<!-- HIDE SCRIPT
//NAVIGATION 
function adorder(url) {
	if (url == '')
		url = 'http://tacomanewstribune.adperfect.com/';

	var adWindow;
	if (adWindow = window.open(url,'weboe', 'width=1024,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes')) {
		adWindow.focus();
	} else {
		alert('You must allow popups from this site in order to place an ad.');
	}
	return false;
}

// 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();
}

// PHOTO GALLERY POPUP2 (preset window options)
function photoGallery2(url) {
	galleryWindow = window.open(url,'gallerypopup','status=yes,width=800,height=550,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=1,location=1,statusbar=1,menubar=0,resizable=1,width=600,height=300');");
}

// VIDEO 2 GALLERY POPUP -- FOR LONGER DESCRIPTIONS (preset window options)
function video2Gallery(url) {
	videoWindow = window.open(url,'videopopup2','status=yes,width=485,height=550,scrollbars=auto,resizable=yes');
	videoWindow.focus();
}

// FLASHVIDEO GALLERY POPUP (preset window options)
function flashvideo(url) {
	videoWindow = window.open(url,'flashvideo','status=yes,width=400,height=480,scrollbars=auto,resizable=yes');
	videoWindow.focus();
}


// AUDIO POPUP (preset window options)
function audioGallery(url) {
	videoWindow = window.open(url,'videopopup','status=yes,width=435,height=200,scrollbars=auto,resizable=yes');
	videoWindow.focus();
}

// AUDIO2 POPUP - boxier longer descriptions (preset window options)
function audio2Gallery(url) {
	//videoWindow = window.open(url,'videopopup','status=yes,width=410,height=360,scrollbars=auto,resizable=yes');
	videoWindow = window.open(url,'videopopup','status=yes,width=410,height=460,scrollbars=auto,resizable=yes');
	videoWindow.focus();
}

// SLIDESHOW POPUP - (preset window options)
function slideshowGallery(url) {
	slideshowWindow = window.open(url,'slideshowpopup','status=yes,width=800,height=630,scrollbars=auto,resizable=yes');
	slideshowWindow.focus();
}

// 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,'/')
    }
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=660,left = 340,top = 212');");
}

function wallpaperWindow(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=660,height=620,left = 340,top = 212');");
}

function tntLongDate() {
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var today = new Date();
	var wday   = days[today.getDay()];
	var lmonth = months[today.getMonth()];
	var date = today.getDate();
	var fyear = today.getFullYear();
	
	return (wday +", " + lmonth + " " + date + ", " + fyear);
}

// END HIDING -->


// IMAGE ROLLOVER

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.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];}
}
