history.navigationMode = 'compatible'; //fire jQuery ready function on back button
jQuery(function($){

	//DETECT HOMEPAGE
	var isHome = false;
	if($('#sectionid_1').length > 0) 
		isHome = true;
	

	$.getScript("common/js/hoverIntent.js",function(){
		$.getScript("common/js/superfish.js",function(){ 
			$("#topnav ul").superfish({ 
				delay: 200, 
				animation: {height:'show'}, 
				speed: 'fast'
			});	
		});
	});
	
	$.getScript("common/js/jquery.tools.js",function(){
		$.getScript("common/js/jquery.jRotator.js", function(){
			var holder = document.getElementById("rotatingHeader");
			var imgs = holder.getElementsByTagName("img");
			var ul = document.createElement("ul");
				ul.className = "filmstrip";
				ul.innerHTML = "";
			for(var i=1; i<imgs.length +1; i++) {
				
				ul.innerHTML = ul.innerHTML +"<li>"+i+"</li>";
				holder.appendChild(ul);
			}
			$("#rotatingHeader").galleryView({
					panel_width: 620,
					panel_height: 299,
					frame_width: 25,
					frame_height: 25,
					filmstrip_size: 3,
					overlay_height: 70,
					overlay_font_size: "1em",
					transition_speed: 3000,
					transition_interval: 4000,
					overlay_opacity: 0.6,
					overlay_color: "#fff",
					background_color: "transparent",
					overlay_text_color: "white",
					caption_text_color: "white",
					border: "none",
					nav_theme: "",
					easing: "swing",
					filmstrip_position: "top",
					overlay_position: "bottom",
					show_captions: false,
					fade_panels: true,
					pause_on_hover: true
			});
				
		});		
	});
	
	/*
	var holder = document.getElementById("rotatingHeader");
		var imgs = holder.getElementsByTagName("img");
		var ul = document.createElement("ul");
			ul.className = "filmstrip";
			ul.innerHTML = "";
		for(var i=1; i<imgs.length +1; i++) {
			
			ul.innerHTML = ul.innerHTML +"<li>"+i+"</li>";
			holder.appendChild(ul);
		}
		jQuery("#rotatingHeader").galleryView({
			panel_width: 620,
			panel_height: 299,
			frame_width: 25,
			frame_height: 25,
			filmstrip_size: 3,
			overlay_height: 70,
			overlay_font_size: "1em",
			transition_speed: 3000,
			transition_interval: 4000,
			overlay_opacity: 0.6,
			overlay_color: "#fff",
			background_color: "transparent",
			overlay_text_color: "white",
			caption_text_color: "white",
			border: "none",
			nav_theme: "",
			easing: "swing",
			filmstrip_position: "top",
			overlay_position: "bottom",
			show_captions: false,
			fade_panels: true,
			pause_on_hover: true
		});*/

});
	
function formatdateCal(datestr) {
	
        var d = new Date(datestr)
        var month = new Array(12);
        month[0] = "Jan";
        month[1] = "Feb";
        month[2] = "Mar";
        month[3] = "Apr";
        month[4] = "May";
        month[5] = "Jun";
        month[6] = "Jul";
        month[7] = "Aug";
        month[8] = "Sep";
        month[9] = "Oct";
        month[10] = "Nov";
        month[11] = "Dec";
        var itemdate = "<span class=mo>"+month[d.getMonth()] + "</span> <span class=day>" + d.getDate() + "</span>"
        return "<span class=cal>" + itemdate + "</span>"
		
    }	
var textsize = 12;
function changetextsize(up){
	if(up){
		textsize = parseFloat(textsize)+2;
	}else{
		textsize =parseFloat(textsize)-2;
	}
}
function fsize(size,unit,id){
	var vfontsize = document.getElementById(id);
	if(vfontsize){
		vfontsize.style.fontSize = size + unit;
		createCookie("textsizestyle", textsize, 365);
	}
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
/*:::::::::: END FONT SIZE CONTROL :::::::::: */

function iFocus(e) {
    if (e.value == e.defaultValue) {
        e.value = "";
        e.style.color = "#000";
    }
}
function iBlur(e) {
    if (e.value == "") {
        e.value = e.defaultValue;
        e.style.color = "#444";
    }
}


