/*used for jcms menu*/
function show(id,pid) {
	var aid=new Array();
	aid[2]='national';
	aid[3]='north';
	aid[4]='south';
	aid[5]='midwest';
	aid[6]='west';
	aid[7]='crate';
	aid[8]='history';
	aid[9]='weekly';
	aid[10]='schedule';
	
	

    var d = document.getElementById(id);
    var p = document.getElementById(pid);
    for (var i = 2; i <= 13; i++) {
        if (document.getElementById("smenu" + i)) {
            document.getElementById("smenu" + i).style.display = "none";
             document.getElementById(aid[i]).className='';
        }
    
    if (d) {
        d.style.display = "block";
        d.style.zindex = "2";
        
        p.className='hover';
    }
    }
}

function showSlideA(URL){
day = new Date();
id = day.getTime();
 eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=700');");
}

function showSlide(URL){
day = new Date();
id = day.getTime();
 eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=600');");
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//where assuming that css as set the display
function toggleStyleDisplay(id){
	var obj = document.getElementById(id);
	if(obj.style.display==''||obj.style.display=='none'){
	obj.style.display='block';
	}else{
	obj.style.display='none';
	}
}
function toggleHeight(id,grow){
	var obj = document.getElementById(id);
	if(obj.style.height==''){
	obj.style.height=grow+'px;';
	}else{
	obj.style.height='';
	}
	}
	
function popUp(URL, w, h) {
	var w = w + 40;
	var h = h + 40;
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width="+w+",height="+h+"');");
}


function GetCookie( name ) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while ( i < clen ) {
		var j = i + alen;
		if ( document.cookie.substring(i, j) == arg )
			return getCookieVal(j);
		i = document.cookie.indexOf( " ", i ) + 1;
		if ( i == 0 ) break;
	}
	return null;
}

/* alternate getCookie that's fewer lines of code 
function getCookie(Name){
   var re = new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
   if (document.cookie.match(re)) //if cookie found
       return document.cookie.match(re)[0].split("=")[1] //return its value
   return "";
}*/


function DeleteCookie( name, path, domain ) {
	if ( GetCookie( name ) ) {
		document.cookie = name + "=" +
		( ( path ) ? "; path=" + path : "" ) +
		( ( domain ) ? "; domain=" + domain : "" ) +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function SetCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires ){
		expires = expires * 86400000; // 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" + escape (value) +
		( ( expires ) ? "; expires=" + expires_date.toGMTString() : "" ) +
		( ( path ) ? "; path=" + path : "" ) +
		( ( domain ) ? "; domain=" + domain : "" ) +
		( ( secure ) ? "; secure" : "" );
}

function getCookieVal( offset ) {
	var endstr = document.cookie.indexOf ( ";", offset );
	if ( endstr == -1 )
		endstr = document.cookie.length;
	return unescape( document.cookie.substring( offset, endstr ) );
}

// If session cookies are disabled, it replaces every form with a message to enable cookies and alerts
function checkCookies(){
	SetCookie( "foo", "bar" );
	if ( GetCookie( "foo" ) ) {
		DeleteCookie( "foo" );
		return true;
	}
	else {	// Cookies are disabled
		for(a = 0;a < document.forms.length;a++){
			elem = document.forms[a];
			if(elem){
				elem.style.display = "none";
				elem.parentNode.innerHTML += "<p>Please enable cookies and reload this page</p>";
			}
		}
		alert("Please enable cookies and reload this page");
		return false;
	}
}

function testCookies(){	
	SetCookie( "foo", "bar" );
	if ( GetCookie( "foo" ) ) {
		DeleteCookie( "foo" );
		return true;
	}
	else {	// Cookies are disabled
		return false;
	}
}

function submitCookies(){
	if(testCookies() == false){	// Cookies are disabled
		alert("Please enable cookies and try again");
		return false;
	}
}


// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} 
function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} 
function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} 

function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} 
function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}

var _dom, _ie, _ie4, _moz, _mac, _win, _linux, _opera, _safari;

_win = ( navigator.appVersion.indexOf( 'Win' ) != -1 );
_mac = ( navigator.appVersion.indexOf( 'Mac' ) != -1 );
_linux = ( navigator.userAgent.indexOf( 'Linux' ) != -1 );

if ( !document.layers ){
	_dom = ( document.getElementById );
	_opera = ( navigator.userAgent.indexOf( 'Opera' ) != -1 );
	_konq = ( navigator.userAgent.indexOf( 'Konqueror' ) != -1 );
	_safari = ( navigator.userAgent.indexOf( 'Safari' ) != -1 );
	_moz = ( navigator.userAgent.indexOf( 'Gecko' ) != -1 && !_safari && !_konq);
	_ie = ( document.all && !_opera );
	_ie4 = ( _ie && !_dom );
}

if (_ie)
	document.onselectstart = function(e){return false};	// IE only - no select
if (_ie || _moz)
	document.oncontextmenu = function(e){return false};
/*
function noright(e) {
	if (_moz && e.which==3)
		return false;
	if (_ie && event.button==2)
		return false;
	return true;
} */
