/* Replacing heading & Navigation with Cufon */
Cufon.replace('.replace-cuf',{hover: true,textShadow: '1px 1px rgba(0, 0, 0, 0.2)'});
Cufon.replace('#top-nav a',{hover: true,textShadow: '1px 1px rgba(0, 0, 0, 0.2)'});	
Cufon.replace('.tabs a',{hover: true});
Cufon.replace('h1');
Cufon.replace('h2');
Cufon.replace('h3');
Cufon.replace('h4');
Cufon.replace('h5');
Cufon.replace('.tab-heading');			
			
		sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);	







/* Banner Slider */
$(document).ready(function() {
						   

							   
							   

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});






function greyPage()
		{
			//create the layer and show it
			$("#grey_layer").animate({
				opacity: 0.25,
				width: '100%',
				height: $(document).height()   
 			 });
			
			}






var videoOpen=0;
 	function openVideo()
	{
	
	if (videoOpen == 0)
		{
			greyPage();
			$("#home_video_layer").fadeIn("slow");
			videoOpen= 1;
		
		}
		else
		{
			greyPage();
			$("#home_video_layer").fadeOut("slow");
			videoOpen= 0;
			$("#grey_layer").animate({
				opacity: 0.25,
				width: '0px',
				height: '0px'   
 			 });
			
		}
		
	}



/*************************  ie 6   *************************************/

// Warning to IE6 users



/*************************** out put IS 6 message  ******************/

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;
}


function removeBrMess()
	{
		
		createCookie('browsermess1','1',1);
		
		$('#IE6_message').fadeOut(500);
		
	}
	
	
	
	$(document).ready(function() {
							   // $('#top-nav').hide();
							 // $('#top-nav li a').fadeIn('fast');//show sufon fonts
	
	var donotshowmessage = readCookie('browsermess1');	
	if (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.indexOf("MSIE 6.")!=-1 && donotshowmessage!=1)
	{
		
		//don't forget to upload the images!!!!
		var url = 'http://' + window.location.hostname + '/';
		
		$('body').append('<div id="IE6_message"><br /><p><strong>Did you know that your version of Internet Explorer is out of date?</strong></p><br /><br /><p>To get the best possible experience using our website we recommend that you upgrade to a newer version or another web browser. </p><p>A list of the most popular web browsers can be found below.<br />Just click on the icons to get to the download page.</p><p><a href="http://www.mozilla.com/firefox/" target="_blank"><img src="'+url+'library/browsers/browser_firefox.gif" alt="Firefos" width="100" height="100" border="0" /></a>&nbsp;&nbsp;&nbsp;<a href="http://www.google.com/chrome" target="_blank"><img src="'+url+'library/browsers/browser_chrome.gif" alt="Google Chrome" width="100" height="100" border="0" /></a>&nbsp;&nbsp;&nbsp;<a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx" target="_blank"><img src="'+url+'library/browsers/browser_ie.gif" alt="Internet Explorer" width="100" height="100" border="0" /></a>&nbsp;&nbsp;&nbsp;<a href="http://www.apple.com/safari/download/" target="_blank"><img src="'+url+'library/browsers/browser_safari.gif" alt="Safari" width="100" height="100" border="0" /></a></p><p><strong>Important:</strong> Some of the functionalities / layout on this website may not render as expected on your current browser.</p><p>&nbsp;</p><p>Upgrading is FREE!<br />Why not select a new browser now.</p><p>&nbsp;</p><p><a href="javascript:removeBrMess();">Dismiss this message</a></p><p>&nbsp;</p></div>') 
		
	}







/**********************************************************************************************/
			
			/*   ATTENTION, FOR THIS SCRIPT TO WORK YOU MUST SET THE HREF WITHIN THE LINK TO A FULL URL    */
			/*   FOR INSTANCE http://mydomain.com/page1.html AS OPPOSED TO  page1.html                     */
		//set the ID of the menu
			
				//current location
			var href = jQuery(location).attr('href');
		
		//REPEAT THE SCRIPT BELOW IF YOU WANT THIS TO WORK ON SEVERAL MENUS
		$('#top-nav li a').each(function(index) {
   				
						if ($(this).attr('href')== href)
						{
									//$(this).addClass('top-nav-on');
									//$(this).parent().addClass('top_nav_li_on');
									$(this).css('color','#fff');
						}//end if
							
	  			});//end loop
		
		
		$('#nav li a').each(function(index) {
   				
						if ($(this).attr('href')== href)
						{
									//$(this).addClass('top-nav-on');
									//$(this).parent().addClass('top_nav_li_on');
									$(this).css('color','#f0a74f');
						}//end if
							
	  			});//end loop
		
		
















		});//end of document.ready

/*******************************************************************************************************/








