<!-- HIDE SCRIPT
// 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 = "/" };
	cpath = "; path=" + cpath;
	if (cdays == null) { cdays = "" } else { cdays = "; expires=" + ex.toGMTString() }
	document.cookie = cname + '=' + cvalue + cdays + cpath + ";domain=" + location.host.replace(/.*\.(.*\.com)/,"$1") + ";";
}

function readCookie(name) {
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0) { 
		offset = document.cookie.indexOf(search);
		if (offset != -1) { 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}

function parseCookie(cookie, key) {
	var valArray = cookie.split("|");
	for (i = 0; i < valArray.length; i++) {
		if (valArray[i].match(key)) {var value = valArray[i].split("="); return value[1];}
	}
	return null;
}

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

// PHOTO GALLERY POPUP (preset window options)
function photoGallery(url) {
	galleryWindow = window.open(url,'gallerypopup','status=yes,width=660,height=600,scrollbars=auto,resizable=yes');
	galleryWindow.focus();
}

// 24 HOUR PHOTO GALLERY POPUP (preset window options)
function goGallery(url) {
        var hackedUrl = "/24hour" + url;
	galleryWindow = window.open(hackedUrl,'gallerypopup','status=yes,width=660,height=600,scrollbars=auto,resizable=yes');
	galleryWindow.focus();
}

// VIDEO GALLERY POPUP (preset window options)
function videoGallery(url) {
	videoWindow = window.open(url,'videopopup','status=yes,width=485,height=400,scrollbars=auto,resizable=yes');
	videoWindow.focus();
}

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


// RYAN MOORE POPUP (preset window options)
function specialGallery(url) {
	galleryWindow = window.open(url,'gallerypopup','status=yes,width=640,height=500');
	galleryWindow.focus();
}

// FIX MAIL LINKS (part of obscuring e-mail addresses, puts address back together)
function fixMail(to,domain,tld) {
	if (tld == undefined) {tld = "com";}
	if (domain == undefined) {domain = "mail.tribnet";}
	document.location="ma"+"ilto:"+to+"\@"+domain+"\."+tld;
} 

// PULLDOWN MENU SCRIPT
function formHandler(pulldownform){
var URL = document.pulldownform.site.options[document.pulldownform.site.selectedIndex].value;
window.location.href = URL;
}
function formHandler2(pulldownform2){
var URL = document.pulldownform2.site2.options[document.pulldownform2.site2.selectedIndex].value;
window.location.href = URL;
}

// UPDATE COOKIES
var insitecookie="tacoma_user_auth";
var threshold=0;
var daystokeep=1;

if (GetCookie(insitecookie) && !GetCookie(insitecookie).match("threshold")) {
    if (!GetCookie('seentoday')) {
         document.write('<img width="1" height="1" border="0" ');
		 document.write("src='http://www.thenewstribune.com/static/secure/log.gif?pg="+escape(document.location)+"'>");
         SaveCookie('seentoday',1,.9,'/')
    }
}
// END HIDING -->


