function WindowOnload(f) 
{
	var prev=window.onload;
	window.onload=function(){ if(prev)prev(); f(); }
}
  
  // Roll-Over Functions
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_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_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];}
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
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";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function setActiveStyleSheet(title)
{
	deleteCookie("pref_font", "/", "");
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
	{
		if(a.getAttribute("rel").indexOf("alternate") != -1 && a.getAttribute("title"))
		{
			a.disabled = true;
			if(a.getAttribute("title") == title)
			{
				a.disabled = false;
				setCookie("pref_font", a.getAttribute("title"), "", "/", "", "");
			}
		}
	}
}

function setMainPix(val)
{
	var thisPage = new String(document.location);
	var pURL     = new String(document.location);
	var thisAnchor="";

	if( pURL.indexOf('#') > 0 )
	{
		var thisAnchor = pURL.substr(pURL.indexOf('#'),pURL.length);
		var thisPage   = pURL.substr(0,pURL.indexOf('#'));
	}

	if( thisPage.indexOf('?') > 0 )
	{
		var parts      = thisPage.split('?');
		var qString    = parts[1];
		
		var pairs      = qString.split('&');
		for(i=0;i<pairs.length;i++)
		{
			if( pairs[i].indexOf('nav_pref=')==0 )
				pairs.splice(i,1);
		}
		pairs.push('nav_pref='+val);
		document.location=parts[0]+"?"+pairs.join('&')+thisAnchor;
	}
	else
	{
		document.location=thisPage+"?nav_pref="+val+thisAnchor;
	}
}

function setMenuPref( str )
{
	setCookie("pref_menu", str, "", "/", "", "");
}

function setPrefs()
{
	toTop();
	//setActiveStyleSheet(getCookie('pref_font'));
}
function toTop() 
{
	var w = window.location.pathname;
	var home = (w=='/' || w.indexOf('/index.')>-1)? true : false ;
	if(!window.location.hash&&!home){self.scrollTo(0,250);}
}

// Various Pop Up window Functions
function winPop(url)
{
	if( url.indexOf("send_friend.asp")!=-1 )
	{
		var h = 420;
		var w = (navigator.appVersion.indexOf("MSIE") != -1)? 520 : 500 ;
	}
	else
	{
		var h = 450;
		var w = 500;
	}
	self.window.name = "homeWin";
	pWin = window.open(url,'searchWin','width='+w+',height='+h+',scrollbars=yes,resizable=no,top=50,left=50');
	pWin.focus();
}

function winSubscribe(url,valh)
{
	self.window.name = "homeWin";
	pWin = window.open(url,'searchWin','width=516,height='+valh+',scrollbars=yes,resizable=no,top=50,left=50');
	pWin.focus();
}
	
	
function winEmail(url)
{
	self.window.name = "homeWin";	
	eWin = window.open(url,'Email','width=420,height=400,scrollbars=yes,resizable=yes,top=50,left=50');
	eWin.focus();
}

function expWide(url) // Landscape format Experience Pop-up
{
	var scBrs,reSize,width,height;
	width  = 600;
	height = 400;
	scBrs  = "no";
	reSize = "no";
	if( url.indexOf("no3_nc_food")>0 )
	{
		width  = 620;
		height = 390;
		scBrs  = "yes";
		reSize = "yes";
	}
	else if( url.indexOf("no7_nc_motorsports")>0 )
	{
		width  = 640;
		height = 428;
	}
	else if( url.indexOf("firstflight")>0 )
	{
		width  = 606;
		height  = 406;
		scBrs  = "no";
		reSize = "no";
	}
	else if( url.indexOf("no4_nc_fallcolor")>0 )
	{
		width  = 640;
		scBrs  = "yes";
		reSize = "yes";
	}
	else if( url.indexOf("no10_nc_civilwar")>0 )
	{
		width  = 650;
		height = 433;
	}
	else if( url.indexOf("no2_nc_golf")>0 )
	{
		width  = 650;
		height = 433;
	}	
	else if( url.indexOf("no11_wine")>0 )
	{
		width  = 650;
		height = 433;
	}
	self.window.name = "homeWin";
	var pos_x = ((screen.availWidth - width)/2);
	var pos_y = ((screen.availHeight - (height + 50))/2);
	var ewfeatures = "width="+width+",height="+height+",scrollbars="+scBrs+",resizable="+reSize+",top="+pos_y+",left="+pos_x;
	ewWin = window.open(url,'expWide',ewfeatures);
	self.location="/what_to_do_experience.asp"; //experience_nc.asp";
	ewWin.focus();
}

function expTall(url) // Portrait format Experience Pop-up
{
	self.window.name = "homeWin";
	var pos_x = ((screen.availWidth - 300)/2);
	var pos_y = ((screen.availHeight - 450)/2);
	var etfeatures = "width=300,height=400,scrollbars=no,resizable=no,top="+pos_y+",left="+pos_x;
	etWin = window.open(url,'expTall',etfeatures);
	self.location="/experience_nc.asp";
	etWin.focus();
}
	
function open_popup(url,w,h)
{
	w = new Number(w);
	h = new Number(h);
	var pos_x = ((screen.availWidth - w)/2);
	var pos_y = ((screen.availHeight - (h + 50))/2);
	var ewfeatures = "width="+w+",height="+h+",scrollbars=no,resizable=yes,top="+pos_y+",left="+pos_x;
	win = window.open(url,'ncWin',ewfeatures);
	win.focus();
}

 // Pop-up for press image library
function imgView(url)
{
	var iWin = window.open(url,'imgView','width=500,height=430,scrollbars=yes,resizable=no,top=10,left=10');
	iWin.focus();
}

function viewAds(theUrl)
{
	var re_size = (navigator.appVersion.indexOf("MSIE") != -1) ? "no" : "yes";
	var scroll = (navigator.appVersion.indexOf("MSIE") != -1) ? "auto" : "yes";
	var pos_x = ((screen.availWidth - 600)/2);
	var pos_y = ((screen.availHeight - 480)/2);
	var adfeatures = "width=600,height=480,scrollbars="+scroll+",resizable="+re_size+",top="+pos_y+",left="+pos_x;
	var adWin = window.open(theUrl,'NCAds',adfeatures);
	adWin.focus();
}

function viewSched(sUrl)
{
	var pos_x = ((screen.availWidth - 600)/2);
	var pos_y = ((screen.availHeight - 450)/2);
	var sfeatures = "width=680,height=400,scrollbars=yes,resizable=yes,top="+pos_y+",left="+pos_x;
	var sWin = window.open(sUrl,'Schedule',sfeatures);
	sWin.focus();
}

//Pop-up for industry advertising page

function viewAds(theUrl)
{
	var re_size = (navigator.appVersion.indexOf("MSIE") != -1) ? "no" : "yes";
	var scroll = (navigator.appVersion.indexOf("MSIE") != -1) ? "auto" : "yes";
	var pos_x = ((screen.availWidth - 600)/2);
	var pos_y = ((screen.availHeight - 550)/2);
	var adfeatures = "width=600,height=550,scrollbars="+scroll+",resizable="+re_size+",top="+pos_y+",left="+pos_x;
	var adWin = window.open(theUrl,'NCAds',adfeatures);
	adWin.focus();
}

function alerts(URL) { 
	var re_size = "yes"; //(navigator.appVersion.indexOf("MSIE") != -1) ? "no" : "yes";
	var pos_x = ((screen.availWidth - 510)/2);
	var pos_y = ((screen.availHeight - 510)/2);
	var features = "width=510,height=510,scrollbars=yes,resizable=no,top="+pos_y+",left="+pos_x;
	window.open(URL,"survey",features); 
}

function unset_index( obj ) {
	obj.options[obj.selectedIndex] = null;
}

function detectFlash()
{
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : false;
	if ( plugin!=null && plugin!=false ) 
	{
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i=0; i < words.length; ++i)
		{
			if (isNaN(parseInt(words[i])))
			continue;
			MM_PluginVersion = words[i]; 
		}
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.appVersion.indexOf("Win") != -1)) 
	{			
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('Dim topVer,i,x \n');
		document.write('topVer = year(date())-1990 \n');
		document.write('on error resume next \n');
		document.write('x = null \n');
		document.write('For i = topVer To 1 Step -1 \n');
		document.write('	Set x = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n');
		document.write('	MM_FlashControlInstalled = IsObject(x) \n');
		document.write('	If MM_FlashControlInstalled Then \n');
		document.write('		MM_PluginVersion = CInt(i) \n');
		document.write('		Exit For \n');
		document.write('	End If \n');
		document.write('Next \n');
		document.write('</SCR' + 'IPT\> \n');	
	}
	else
		MM_PluginVersion = 0;
		
	return new Number(MM_PluginVersion);
}

// set flash cookie
if(getCookie("flash")==null)
	setCookie("flash", detectFlash(), "", "", "", "");
	
// set menu cookie
if(getCookie("pref_menu")==null)
	setCookie("pref_menu", "YES", "", "", "", "");
	
function chkit(obj)
{
	if ( obj.keywords.value=="" || obj.keywords.value=="search" )
	{
		alert("please enter a search phrase!");
		return false;
	}
	return true;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	// eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	
	var newwindow = window.open(selObj.options[selObj.selectedIndex].value,targ);
	
	
	if (restore) selObj.selectedIndex=0;
}