/*  ================================
     Sitewide JavaScript
    ================================ */

	// Detected and set from HTML
	var isIE6;
	isIE6 = false;

/*  ================================
     Template 1 JavaScript
    ================================ */

	function template1Loaded()
	{
		// Per template on load
		init();
	}
	
	function init(){
		$("#topnav > li").mouseenter(function () {navOn(this);});
		$("#topnav > li").mouseleave(function () {navOff(this);});
		$("#topnav > li").last().addClass('last');
		//$(".dropdown2").siblings("li > a").last().addClass('last');
		
		
	}
	
	$(document).ready(function(){
			init();   
	});
	
	function navOn(temp) {	
		//safe function to show an element with a specified id
		var x=temp.getElementsByTagName('ul');
		if(x[0]){x[0].style.display = 'block';}
		
		//offsets the dropdown so it appears in the middle of the main nav selection, no matter the width
		// 204 represents the total width of the dropdown
		var offset = $(temp).width();
		offset = (offset - 204) / 2;
		$(x[0]).css("left", offset + "px");
		
		var y=temp.getElementsByTagName('a');
		y[0].style.background = 'url(/images/bg_navRO.jpg) repeat-x';
	}
	
	//displays the first ul in the container when called in rollover script init()
	function navOff(temp) {
		//safe function to hide an element with a specified id
		var x=temp.getElementsByTagName('ul');
		if(x[0]){x[0].style.display = 'none';}
		
		var y=temp.getElementsByTagName('a');
		y[0].style.background = "";
	}
