// script for e-mailing story added by Ben Winton
function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
//end script for e-mailing story bw


//PURPOSE: for select form elements to work without a go button; selected URL appears in main window
//ADDED BY: Shawna Schnorr
function goTo(form)
	{
	var index = form.urlSelect.selectedIndex;
	var jump = form.urlSelect.options[index].value;
	document.location.href = jump;
	}
//PURPOSE: for select form elements to work without a go button; selected URL appears in popup window. (used for ViewPrintAds)
//ADDED BY: Shawna Schnorr
function goToPopup(form)
	{
	var index = form.urlSelect.selectedIndex;
	var jump = form.urlSelect.options[index].value;
	//document.location.href = jump;
        if (jump.indexOf("http://") == 0)  
		{window.open(jump,'ad_window','toolbar=no,location=yes,status=no,menubar=no,scrollbars=yes,resizable=yes,height=500,width=765').focus;}
	return(0);
	}


// PURPOSE: user registration
//ADDED BY: Shawna Schnorr (from threshhold component, which we no longer need to use)
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;i
 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 false;
}
function SaveCookie(cname,cvalue,cdays,cpath) {
 ex = new Date; ex.setTime(ex.getTime() + (cdays*86400000));
 if (cpath == null) { cpath = "/" }
 else { cpath = "; path=" + cpath }
 sitedom=location.hostname.replace(/24hour\./,"").replace(/www\./,"");
 document.cookie=cname + '=' + cvalue + '; expires=' + ex.toGMTString() + cpath + "; domain="+sitedom;
}
