// Top Main Nav, Left Side Nav, and Marketplace Nav



// NOTE: Make sure that the menulist here matches the menulist in the DWB component.

// That link and all other following links will be dead otherwise.



//var sectionlist = new Array("Atlantic","CapeMay","Cumberland","Ocean");

var sectionlist = new Array("Local","Nation","World");

var marketlist = new Array("Shop","Cars","Homes","Jobs");

// 'Business' was removed from this list 8/26/05

var menulist = new Array("News","Opinion","Sports","Life","PhotoGallery","Interact","SiteServices","Entertainment","Business");


function showmenu(group) {
	for (sec in menulist) {
		//window.alert("group ="+group+" menulist[sec] ="+menulist[sec]);
		if ((menulist[sec] == group) && document.getElementById(group).style.display=="none") 
		    {
     		document.getElementById(menulist[sec]).style.display="block";
     		//document.getElementById(menulist[sec]+"Arrow").src="/images/siteimages/right_arrow.gif";
		    } 
		else 
		    {
    		document.getElementById(menulist[sec]).style.display="none";
     		//document.getElementById(menulist[sec]+"Arrow").src="/images/siteimages/right_arrow.gif";
    		}
 	}
}
function showtab(section) {

 for (sec in sectionlist) {

  sectab = eval("sectionlist[sec]")+"Tab";

  sectblock = eval("sectionlist[sec]")+"Block";

  sectablink = eval("sectionlist[sec]")+"TabLink";

  //alert("Debug: iteration = "+sectionlist[sec]+"-"+sectab+"-"+sectablink);

  //alert("Debug: current = "+section);

  if (sectionlist[sec] == section) {

   document.getElementById(sectblock).style.display="block";

   document.getElementById(sectab).style.backgroundColor="#FFF";

   document.getElementById(sectablink).style.color="#555449";

  } else {

   document.getElementById(sectblock).style.display="none";

   document.getElementById(sectab).style.backgroundColor="#555449";

   document.getElementById(sectablink).style.color="#FFF";

  }

 }

}



function showtabmkt(section) {

 for (sec in marketlist) {

  sectab = eval("marketlist[sec]")+"Tab";

  sectblock = eval("marketlist[sec]")+"Block";

  sectablink = eval("marketlist[sec]")+"TabLink";

  //alert(marketlist[sec]+"-"+sectab+"-"+sectablink);

  if (marketlist[sec] == section) {

   document.getElementById(sectblock).style.display="block";

   document.getElementById(sectab).style.backgroundColor="#FFF";

   document.getElementById(sectablink).style.color="#1F5C57";

  } else {

   document.getElementById(sectblock).style.display="none";

   document.getElementById(sectab).style.backgroundColor="#1F5C57";

   document.getElementById(sectablink).style.color="#FFF";

  }

 }

}





// Search Box Javascript

function formHandler(form){

var URL = document.form.site.options[document.form.site.selectedIndex].value;

window.location.href = URL;

}



// -- FOLLOWING IS IMPORTED FROM FRESNO BEE --



// GALLERY LAUNCHER 

function goGallery(url)  

{ 

 galleryWindow = window.open(url,'gallerypopup','status=yes,width=600,height=550,scrollbars=auto,resizable=yes'); 

} 



// WEATHER SCRIPTS/FUNCTIONS

var default_zone="ACY";

function setwzone() {	// Does popup window for user to set preferred zone(s)

	getwzone = "http://newslink.nandomedia.com/cgi-bin/weather/findcode.cgi?camefrom=http://"+escape(location.hostname)+escape(location.pathname);

	setme = window.open(getwzone,"setwzone","status=yes,width=350,height=350,scrollbars=yes,resizable=no");

}

// SETS THE PREFERED ZONE FROM QUERY STRING, OR USES DEFAULT

if (document.location.search.substr(1,5)=="wzone") { //reads from url

	var wzone = document.location.search.substr(7);

} else { 

	wzone = default_zone;

}		

var dontdrawzonew="1";   //IMPORTANT: STOPS DEFAULT OUTPUT SO WE YOU CAN CUSTOMIZE

document.write('<scr' + 'ipt language="javascript" type="text/javascript" src="http://newslink.nandomedia.com/weather/data/current/' + wzone + '.js"></scr' + 'ipt>');





// DECLAREING THE VARIABLES TO AVOID ERRORS IN EVENT OF TROUBLE

var mywzonename; var timelocal; var icon; var conditions; var temperature; var wind_chill; var humidity; var wind_from; var wind_speed; var visibility; var pressure; var fivedays; var icondesc;



//Image rollover stuff for topnav bar

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.0

  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 && document.getElementById) x=document.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];}

}



MM_preloadImages('http://www.pressofatlanticcity.com/static/img/nav/news_ov.gif','http://www.pressofatlanticcity.com/static/img/nav/sports_ov.gif','http://www.pressofatlanticcity.com/static/img/nav/home_ov.gif','http://www.pressofatlanticcity.com/static/img/nav/ent_ov.gif','http://www.pressofatlanticcity.com/static/img/nav/class_ov.gif');


function popup(mylink,windowName,width,height,windowFeatures)
{
if (! window.focus)return true;

var test = "'"; 

if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
   
winLeft = (screen.width-width)/2; 
winTop = (screen.height-(height+110))/2; 
window.open(href,windowName,"width=" + width +",height=" + height + ",left=" + winLeft + ",top=" + winTop + test + windowFeatures + test);
return false;
}


// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 320;
defaultHeight = 320;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=150-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

