///////////////////////////////////////////////////////////////////////
/////////////// Background Images /////////////////////////////////////
// Background images are stored in /designimages/backgrounds.
// Each background uses a number as it's name.
// Backgrounds must be consecutive numbers so that it is not possible to choose a number
// who's background doesn't exist, reeeesulting in no page background.

var min = 1;
var max = 2;   // set this to number of backgrounds







//     **********do not alter anything below this line.**********     //
if (document.cookie){

	var backgroundName = document.cookie.split(";");
	
		for (var i = 0; i < backgroundName.length; i++) {
			var cookieCrumbs = backgroundName[i].split("=");
			var cookieName = cookieCrumbs[0];
			var cookieValue = cookieCrumbs[1];
			
			cookieValue="1";
				$(document).ready(function(){
					//document.body.style.backgroundImage = 'url(/images03/backgrounds/' + cookieValue + '.jpg)';
				});
		};

} else {

	var pageBackground = min + Math.floor(Math.random() * (max - min + 1));
	
	document.cookie = "background=" + pageBackground;
	pageBackground="1";

	$(document).ready(function(){
		//document.body.style.backgroundImage = 'url(/images03/backgrounds/' + pageBackground + '.jpg)';
	});

}


///////////////////////////////////////////////////////////////////////
////////  BEGIN Tert. Nav Contact Box  ////////////////////////////////

$(document).ready(function(){

	$("#tNavCont").mouseover(
		function () {
			$("#contactBoxWrapper").show(0);
		}
	);
	
	
	$("#tNavCont").mouseout(
		function () {
			$("#contactBoxWrapper").hide(0);
		}
	);
	
	

});
///////////////////////////////////////////////////////////////////////
//////////  END Tert. Nav Contact Box  ////////////////////////////////




///////////////////////////////////////////////////////////////////////
////////  BEGIN Accordion  ////////////////////////////////////////////
$(document).ready(function(){
	$("#accordionWrapper").accordion();
});
///////////////////////////////////////////////////////////////////////
//////////  END Accordion  ////////////////////////////////////////////








/*
 * jQuery Timer Plugin
 * http://www.evanbot.com/article/jquery-timer-plugin/23
 *
 * @version      1.0
 * @copyright    2009 Evan Byrne (http://www.evanbot.com)
 *
 * Licensed for use by Callidus, for callidussoftware.com.
 *
 */ 

jQuery.timer = function(time,func,callback){
	var a = {timer:setTimeout(func,time),callback:null}
	if(typeof(callback) == 'function'){a.callback = callback;}
	return a;
};

jQuery.clearTimer = function(a){
	clearTimeout(a.timer);
	if(typeof(a.callback) == 'function'){a.callback();};
	return this;
};
//     End Timer Plugin



///////////////////////////////////////////////////////////////////////
/////////////// Main Navigation Switcher //////////////////////////////
// navigation switcher (requires jquery)
	$(document).ready(function(){
	
		// This will hold our timer
		var myTimer1 = {};
		var myTimer2 = {};
		var myTimer3 = {};
		var myTimer4 = {};
	

		$("#pNavSolu").mouseover(
		
			function () {

				$.clearTimer(myTimer1);
				// Delay 500 second
				myTimer1 = $.timer(350,function(){
					document.getElementById('pNavSolutions').style.backgroundImage = "url(/images03/nav_on_tab.png)";
					document.getElementById('pNavSolutions').style.backgroundPosition = "0px 0px";
					$("#pNavSolutionsPanel").slideDown(350);
					
				});
				// end delay
			}
		);

		$("#pNavSolu").mouseout(
		
			function () {
			
				$.clearTimer(myTimer1);
				
				// Delay .35 second
				myTimer1 = $.timer(350,function(){
				
					document.getElementById('pNavSolutions').style.backgroundImage = "";
					document.getElementById('pNavSolutions').style.backgroundPosition = "13px 14px";
					document.getElementById('pNavSolu').style.backgroundColor='transparent';
					$("#pNavSolutionsPanel").hide(0);
				});
				// end delay
			}
		);
		
		
		
		
		
		
		
		$("#pNavServ").mouseover(
		
			function () {

				$.clearTimer(myTimer2);
				// Delay 500 second
				myTimer2 = $.timer(350,function(){
					document.getElementById('pNavServices').style.backgroundImage = "url(/images03/nav_on_tab.png)";
					document.getElementById('pNavServices').style.backgroundPosition = "0px 0px";
					$("#pNavServicesPanel").slideDown(350);
				});
				// end delay
			}
		);

		$("#pNavServ").mouseout(
		
			function () {
			
				$.clearTimer(myTimer2);
				
				// Delay .35 second
				myTimer2 = $.timer(350,function(){
					document.getElementById('pNavServices').style.backgroundImage = "";
					document.getElementById('pNavServices').style.backgroundPosition = "13px 14px";
					document.getElementById('pNavServ').style.backgroundColor='transparent';
					$("#pNavServicesPanel").hide(0);
				});
				// end delay
			}
		);




		$("#pNavCust").mouseover(
		
			function () {

				$.clearTimer(myTimer3);
				// Delay 500 second
				myTimer3 = $.timer(350,function(){
					document.getElementById('pNavCustomers').style.backgroundImage = "url(/images03/nav_on_tab.png)";
					document.getElementById('pNavCustomers').style.backgroundPosition = "0px 0px";
					$("#pNavCustomersPanel").slideDown(350);
				});
				// end delay
			}
		);

		$("#pNavCust").mouseout(
		
			function () {
			
				$.clearTimer(myTimer3);
				
				// Delay .35 second
				myTimer3 = $.timer(350,function(){
					document.getElementById('pNavCustomers').style.backgroundImage = "";
					document.getElementById('pNavCustomers').style.backgroundPosition = "13px 14px";
					document.getElementById('pNavCust').style.backgroundColor='transparent';
					$("#pNavCustomersPanel").hide(0);
				});
				// end delay
			}
		);
		
		
		
		
		
		$("#pNavPart").mouseover(
		
			function () {

				$.clearTimer(myTimer4);
				// Delay 500 second
				myTimer4 = $.timer(350,function(){
					document.getElementById('pNavPartners').style.backgroundImage = "url(/images03/nav_on_tab.png)";
					document.getElementById('pNavPartners').style.backgroundPosition = "0px 0px";
					$("#pNavPartnersPanel").slideDown(350);
				});
				// end delay
			}
		);

		$("#pNavPart").mouseout(
		
			function () {
			
				$.clearTimer(myTimer4);
				
				// Delay .35 second
				myTimer4 = $.timer(350,function(){
					document.getElementById('pNavPartners').style.backgroundImage = "";
					document.getElementById('pNavPartners').style.backgroundPosition = "13px 14px";
					document.getElementById('pNavPart').style.backgroundColor='transparent';
					$("#pNavPartnersPanel").hide(0);
				});
				// end delay
			}
		);

	});

///////////////////////////////////////////////////////////////////////
////////  BEGIN Tert. Nav Global Box  ////////////////////////////////

$(document).ready(function(){

	$("#tNavGlob").mouseover(
		function () {
			$("#globalBoxWrapper").show(0);
		}
	);
	
	
	$("#tNavGlob").mouseout(
		function () {
			$("#globalBoxWrapper").hide(0);
		}
	);
	
	

});
///////////////////////////////////////////////////////////////////////
//////////  END Tert. Nav Global Box  ////////////////////////////////




///////////////////////////////////////////////////////////////////////
////////  BEGIN Tert. Nav Related Box  ////////////////////////////////

$(document).ready(function(){

	$("#tNavRela").mouseover(
		function () {
			$("#relatedBoxWrapper").show(0);
		}
	);
	
	
	$("#tNavRela").mouseout(
		function () {
			$("#relatedBoxWrapper").hide(0);
		}
	);
	
	

});
///////////////////////////////////////////////////////////////////////
//////////  END Tert. Nav Related Box  ////////////////////////////////




///////////////////////////////////////////////////////////////////////
////////  BEGIN Tert. Nav About Box  //////////////////////////////////

$(document).ready(function(){

	$("#tNavAbou").mouseover(
		function () {
			$("#aboutBoxWrapper").show(0);
		}
	);
	
	
	$("#tNavAbou").mouseout(
		function () {
			$("#aboutBoxWrapper").hide(0);
		}
	);
	
	

});
///////////////////////////////////////////////////////////////////////
//////////  END Tert. Nav About Box  //////////////////////////////////

///////////////////////////////////////////////////////////////////////
////////  BEGIN Tert. Nav Resources Box  //////////////////////////////////

$(document).ready(function(){

	$("#tNavReso").mouseover(
		function () {
			$("#resourcesBoxWrapper").show(0);
		}
	);
	
	
	$("#tNavReso").mouseout(
		function () {
			$("#resourcesBoxWrapper").hide(0);
		}
	);
	
	

});
///////////////////////////////////////////////////////////////////////
//////////  END Tert. Nav About Box  //////////////////////////////////



// Detect Browser
$(document).ready(function(){var a=navigator.userAgent.toLowerCase();$.browser.chrome=/chrome/.test(navigator.userAgent.toLowerCase());if($.browser.msie){$('body').addClass('browserIE');$('body').addClass('browserIE'+$.browser.version.substring(0,1))}if($.browser.chrome){$('body').addClass('browserChrome');a=a.substring(a.indexOf('chrome/')+7);a=a.substring(0,1);$('body').addClass('browserChrome'+a);$.browser.safari=false}if($.browser.safari){$('body').addClass('browserSafari');a=a.substring(a.indexOf('version/')+8);a=a.substring(0,1);$('body').addClass('browserSafari'+a)}if($.browser.mozilla){if(navigator.userAgent.toLowerCase().indexOf('firefox')!=-1){$('body').addClass('browserFirefox');a=a.substring(a.indexOf('firefox/')+8);a=a.substring(0,1);$('body').addClass('browserFirefox'+a)}else{$('body').addClass('browserMozilla')}}if($.browser.opera){$('body').addClass('browserOpera')}});