//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=600').focus;}
	return(0);
	}

//PURPOSE: to make sure users who use the wedding announcement form agree to the disclaimer 
//CREATED BY: Zhen Zhen Deng, 3/2003
   
 function valid_new_user()
     {
        if (document.weddingForm.terms_of_agreement)
        {
            if (!document.weddingForm.terms_of_agreement.checked)
            {
                 alert("You can't submit the form unless you agree to the terms listed on the top of the form.");
                 document.weddingForm.terms_of_agreement.focus();
                 return false;
             }
        }

        return true;
     }
     
//PURPOSE: To use on the directory site for the travel brochure pop up order form
//ADDED BY: Elaine Duignan, 3/9/2004

function Pop(address)
	{
		var card=window.open(address, "card", "toolbar=0,location=0,status=0,menubar=0,scrollbars=YES,resizable=YES,width=500,height=600");
	}

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

