// JavaScript Document

$(document).ready(function(){

	globalScripts.init();			
	
});


globalScripts = {

	init: function() {	
	
		//menu hover


		$.fn.superfish.defaults = { 
			hoverClass:    'sfHover',          // the class applied to hovered list items 
			pathClass:     'overideThisToUse', // the class you have applied to list items that lead to the current page 
			pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
			delay:         800,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
			animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery’s .animate() method 
			speed:         'normal',           // speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
			autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
			dropShadows:   false,               // completely disable drop shadows by setting this to false 
			disableHI:     false,              // set to true to disable hoverIntent detection 
			onInit:        function(){},       // callback function fires once Superfish is initialised – 'this' is the containing ul 
			onBeforeShow:  function(){},       // callback function fires just before reveal animation begins – 'this' is the ul about to open 
			onShow:        function(){},       // callback function fires once reveal animation completed – 'this' is the opened ul 
			onHide:        function(){}        // callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
		};

		$('#menu-sidenav').superfish(); 

		//original menu
		/* 
		$("#menu-sidenav li").hover(
			function(){
				$(this).find("ul:first").show();
			},
			function(){
				$(this).find("ul").hide();

			}		
		);
		*/		
		
		//tabbedContent

		//loads the current tab
		var currentTab = $("#currentTab").html();
		activateTab(currentTab);
		
		/*
		$("#tabNav a").click(function(){
			var tabId = $(this).attr("id").slice(3);
			activateTab(tabId);
			return false;
		});
		*/


		//blind
		$(".blind > a").toggle(
		function(){
			$(this).parent().find("div").fadeIn();							 
		},
		function(){
			$(this).parent().find("div").fadeOut();			
		});


		//text size
		$("#textSize a").click(function(){
			
			var fontSize;
			
			if ( $(this).attr("id") == "textSizeS") {
				fontSize = "11px";
			}
			else if ( $(this).attr("id") == "textSizeM") {
				fontSize = "12px";
			}
			else if ( $(this).attr("id") == "textSizeL") {
				fontSize = "13px";
			}			
			

			$("#topLeftContent p").css("font-size",fontSize);	
			$("#tabbedContent p").css("font-size","13px");
			$(".playCredits").css("font-size","8px");
			//$("#pageUtils p").css("font-size","9px");	
			$("#textSize a").css("font-weight","normal");
			$(this).css("font-weight","bold");
		});	
		
		
		//timeline
		$("#tsLink").click(function(){
				window.open("/wp-content/themes/shawfest/modules/timeline/index.shtml", "timelessShaw","width=755,height=520,top=100,left=300,menubar=0,resizable=0,location=0,scrollbars=0,status=0");			
		});
		
		
	}
	//e:init
}
//e:globalScripts

function activateTab(tabId) {
	$("#tabbedContent div.tabbedContentUnit").hide();
	$("#tabbedContent div#tc"+tabId).show();
	$("#tabNav a").parent().removeClass("active");
	$("#tab"+tabId).parent().addClass("active");
	return false;			
}
