/**
 * CoachWeb, VolunteerWeb & SkillsWeb
 * 
 * Presents the JavaScript framework for the CoachWeb application
 * 
 * @author Ollie Maitland
 * @copyright Byng Systems LLP
 */
var CoachingApp = new Class(
{
	
	Implements : [ByngApp],
	
	/**
	 * Holds meta data on this application
	 * 
	 */
	meta	: {
		'name'	    : 'SkillsWeb',
		'version'   : '0.2',
		'author'    : 'ollie@byng-systems.com',
		'copyright' : 'Byng Systems Limited',
		'date'  	: '2007-04-07'
	},
	
	icons : {
		'loader' : '/html/admin/images/indicators/loading.gif'
	},
	
 	/**
 	 * Gateway base
 	 * 
 	 * @type String
 	 */
 	gatewayBase : "/ajax/cnw/applicants/",
 	
 	/**
 	 * Holds the URL for the loading icon
 	 * 
 	 * @type String
 	 */
 	loadingIcon : '/html/images/nav/loading.gif',

	/**
	 * Set the loader in use
	 * 
	 * @param String loader
	 */
	setLoader : function ( loader )
	{
		this.loader = loader;
		return this;
	},

	/**
	 * Toggle the menu display
	 * 
	 * @param String category
	 */
	display : function (category) 
	{
		var whichcategory = $(category);
		if (whichcategory.className=="show") {
			whichcategory.className="hide";
		} else {
			whichcategory.className="show";
		}
	}
		
});


// Set the CoachingApp
Byng.setApp( new CoachingApp );

//Set the input handles
Byng.setInput( Byng.init('byng.input') );

//load the Byng user interface object
Byng.setUi ( Byng.init('byng.ui', UI_FLAG_AJAX) );

window.addEvent('domready', function() {
	Byng.app.fireEvent('load');
	
	var referForm = $('form-refer-a-friend');

	if (referForm)
	{
		  var referFriend= new Fx.Slide(referForm).hide();
		  $$('.referToggler').addEvent('click', function(event){			
			event.stop();	
			 $$('.referToggler').toggleClass('referOn');
			referFriend.toggle();
		  });
	}

	var frontFlash = $('front_flash');
	
	if (frontFlash)
	{
		swfobject.embedSWF("/skin/flash/coach.swf","flashlogo", "151", "121", "8.0.0", false, false, {xi:"true", wmode:"transparent"});
		swfobject.embedSWF("/skin/flash/education.swf","flashlogo2", "151", "121", "8.0.0", false, false, {xi:"true", wmode:"transparent"});
	}
	
	var tipLoader = $$('span.help');

	if (!tipLoader == null){
		enableTooltips('leftcontent');
	}

    if (Byng.contextAsJson) {
        var context = JSON.decode(Byng.contextAsJson);
        Byng.app.setRequestContext(context);
    }
	
	var popupVideo = $('popThis');
	
	if (popupVideo)
	{
		$$('.popup-show a').cerabox({
			group: false,
			displayTitle: false,
			fullSize: false,
			fixedPosition:false,
			width: 480,
			height: 390
		});		
		popupVideo.fireEvent('click');
	}

	var scrollableDiv = $('scrollable-pane');

	if (scrollableDiv)
	{
		var myScrollables = new Scrollable(scrollableDiv);
	}


});

var ByngUI = Byng.ui;
