Shadowbox.loadSkin('classic', '/local/scripts/shadowbox/skin');
Shadowbox.loadLanguage('en', '/local/scripts/shadowbox/lang');
Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], '/local/scripts/shadowbox/player');

$(document).ready(function(){
				
	$("#tabs").tabs();
	
	// Start all of the form type DIVs in the hidden state
	$("div.form_type_holder").toggleClass("invisible");
	
	// Show / Hide Application forms panel	
	$("application_forms_link").click(function() {
		$("#application_forms_holder").toggleClass("invisible");
	});			
	
	// When the user interacts with any of the links to expand a DIV change the + to a - and allow this behaviour to be toggled.
	function toggleSymbol(em) {
		if($(em).html() == ' + ')
		{
			$(em).html(" - ");
			$(em).parent().parent().next().toggleClass("invisible");
		}
		else
		{
			$(em).html(" + ");
			$(em).parent().parent().next().toggleClass("invisible");
		}
	};
	
	// Fire the toggleSymbol function when the link text is clicked.	
	$(".toggleSymbol").click(function() {
		toggleSymbol(this);
	});
	
	// Hide the tool tip
	$("#postgrad_form_dialog").toggleClass("invisible");
	$("#scholarship_base_tooltip").toggleClass("invisible");
	$("#scholarship_ug_tooltip").toggleClass("invisible");
	$("#scholarship_pg_tooltip").toggleClass("invisible");			
	
	// JQuery TOOLS / Tooltip for PG application form
	$("#download_pg_form").tooltip({
		tip: '#postgrad_form_dialog',
		position: ['top','center'],
		opacity: 1,
		delay: 60,
		slideOffset:-5				
	});
	
	// JQuery TOOLS / Tooltip for PG application form
	/*
	$("#scholarship_base_info").tooltip({
		tip: '#scholarship_base_tooltip',
		position: ['center','right'],
		opacity: 1,
		delay: 120,
		slideOffset:-5
	});
	*/
	
	// JQuery TOOLS / Tooltip for scholarship ug/pg explanation
	
	$("#ug_tooltip").tooltip({
		tip: '#scholarship_ug_tooltip',
		position: ['top','center'],
		opacity: 1,
		delay: 300,
		slideOffset:10				
	});
	$("#intug_tooltip").tooltip({
		tip: '#scholarship_ug_tooltip',
		position: ['top','center'],
		opacity: 1,
		delay: 300,
		slideOffset:10				
	});
	$("#pg_tooltip").tooltip({
		tip: '#scholarship_pg_tooltip',
		position: ['top','center'],
		opacity: 1,
		delay: 300,
		slideOffset:10				
	});
	$("#intpg_tooltip").tooltip({
		tip: '#scholarship_pg_tooltip',
		position: ['top','center'],
		opacity: 1,
		delay: 300,
		slideOffset:10				
	});
	
	// When the "Find a course" option is clicked, focus on the input box
	$("#findACourse").click(function(){
		$("#cFinderSearchAdvan").focus();
	});
	
	// When the "Find a career" option is clicked, focus on the checkbox
	$("#findACareer").click(function(){
		$("#labelInterestsA").focus();
	});
	
	// When the "Find a scholarship" option is clicked, focus on the input box
	$("#findAScholarship").click(function(){
		$("#ugscholar").focus();
	});
	
	
	Shadowbox.init();

});