// PURE CSS DROPDOWN NAV SCRIPT FOR IE //
/*
navHover = function() {
	var lis = document.getElementById("navigation").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);
*/

// ROTATING MASTHEAD IMAGE SCRIPT //
topImages=["masthead1","masthead2","masthead3","masthead4"];


// GENERIC COOKIE SCRIPT (Next 3 functions)
function getCookieVal(offset) {
 var endstr=document.cookie.indexOf(";",offset);
 if (endstr==-1)
 endstr=document.cookie.length;
 return unescape(document.cookie.substring(offset,endstr));
}
function GetCookie(cname) {
 var arg=cname+"="; 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;
}
function SaveCookie(cname,cvalue,cdays,cpath) {
 ex=new Date; ex.setTime(ex.getTime()+(cdays*86400000));
 if (cpath == null) { cpath = "" } else { cpath= "; path="+cpath }
 document.cookie=cname+'='+cvalue+'; expires='+ex.toGMTString()+cpath;
}

function getImage() {
	seen=Number(GetCookie("seenImages")); 
	if (!seen || (seen>=topImages.length) ) { seen=0 }
	document.write("<img src='http://static.mcclatchyinteractive.com/static/images/"+topImages[seen]+".jpg' width='720' height='87' border='0'>");
	SaveCookie("seenImages",seen+1,365);
}
