<!-- begin sitewide scripts

// GENERIC WINDOW OPENER
function openWin(url,name,options)
{
	win = window.open(url,name,options)
	self.name = "main"
	win.focus()
}

// LOTTERY SCRIPTS
function savelot(the_menu) {
	var allmystates=""; var len = the_menu.length;	
	for (itm=0; (itm < the_menu.length); itm++) {
		if (the_menu.options[itm].selected) {
			if (allmystates) {allmystates = allmystates + "|"}
			allmystates = allmystates + the_menu.options[itm].value;
		}
	}
	SaveCookie("mylstates",allmystates,365);
}
function setlotterystates() {		// POPUP window for user to select lot_prefered states
	window.name="orig";
	var availstates="AZ|CA|CO|CT|DC|DE|FL|GA|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MT|NE|NH|NJ|NM|NY|OH|OR|PA|RI|SD|TX|VA|VT|WA|WI|WV";
	var popstring="<HTML><TABLE><TR VALIGN=TOP><TD ALIGN=CENTER>"
	+"<FONT SIZE=+2><B>Choose<BR>your<BR>state<BR>"
	+"<A HREF='javascript:window.opener.savelot(document.pickstate.mylstates);window.opener.location.reload();self.close();'>SAVE</A>"
	+"</TD><TD><FORM name='pickstate'><SELECT NAME='mylstates' MULTIPLE SIZE=7>";
	var avail=availstates.split("|");
	for (state in avail) {popstring = popstring+"<OPTION VALUE='"+avail[state]+"'>"+avail[state];}
	popstring=popstring+"</SELECT></FORM></TD></TR></TABLE></HTML>";
	setme = window.open('',"lotto","status=yes,width=150,height=150,scrollbars=no,resizable=no");
	setme.document.write(popstring);
	setme.document.close();
}
// End -->


// GALLERY LAUNCHER
function goGallery(url)  {
	galleryWindow = window.open(url,'gallerypopup','status=yes,width=600,height=400,scrollbars=auto,resizable=yes');
}

// 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;
}

// Changed 10/7/02 to scrape www from domains -- Norm
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 + "; domain=" + location.hostname.replace(/www\./,"");
	// 10/8/02 Added 2 lines to kill old cookies set as www.nando stead of nando -- Norm
	ex = new Date; ex.setTime(ex.getTime() + (-1*86400000));
	document.cookie = cname + '=' + cvalue + '; expires=' + ex.toGMTString() + cpath;

}

//USER CUSTOMIZATION: SHOW/HIDE STORY SUMMARIES
//Requires generic cookie handler
function SetSummaries() 
{
	if (GetCookie('showsummaries')=='-1') 
	{ SaveCookie('showsummaries',1,365); var s = "show"; } 
	else
	{ SaveCookie('showsummaries',-1,365); var s = "hide"; }
	location.reload();
	var popurl = "http://nandotimes.com/nt/count/summary" + s + ".html";
	setsum = window.open(popurl,"setsum","status=no,width=300,height=100,scrollbars=no");
}
document.write("<style type='text/css'>");
if (GetCookie('showsummaries')=='-1')
{
 document.write(".summary{display:none;}");
 var showstatus = "Show";
}
else 
{ var showstatus = "Hide"; }
document.write("<"+"/style>");

// 10/8/2001 -- Norm 
// Next four lines allow for registration tracking for cookied ad delivery and omniture
if (GetCookie('nandotimes_user_auth')) { targetval="registered" } else { targetval="not" };
if (GetCookie('adtarget') != targetval) { SaveCookie('adtarget',targetval,1,'/') };
if (document.location.pathname.match(/story/)) { plevel="_story_" } else { plevel="_index_"}; 
var prop10='subscriber_'+plevel+GetCookie('adtarget');

// end sitewide scripts -->
