<!-- begin common scripts
var isNav, isIE;
if (navigator.appVersion.charAt(0) == "4"){
	if (navigator.appName == "Netscape"){
		isNav = true;
		isIE = false
	}else{
		isNav = false;
		isIE = true;
	}
}

function process_formMail(){
	document.forms[0].action = "/_array_componants/form_send_mail.php";
	document.forms[0].submit()
}

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_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

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_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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function get360(movFile,wd,ht){
	//alert('Width = '+wd+" Height="+ht);
	var winWD = wd;
	var winHt = (ht+16);
	movHt = (ht+15);
	var features = 'scrollbars=no,resizable=no,width='+winWD+',height='+winHt;
	var movArg = "/Templates/GPI_Templates/360.php?movFile="+movFile+"&ht="+movHt+"&wd="+wd;
	MM_openBrWindow(movArg,'',features);
}

function rendersubMenu(WhichSub){
	var menuIndex = WhichSub;
	switch(WhichSub){
		case "1":
			var WhichSub = HM_Array5_1;
			break;
		case "2":
			var WhichSub = HM_Array5_2;
			break;
		case "3":
			var WhichSub = HM_Array5_3;
			break;
		case "4":
			var WhichSub = HM_Array5_4;
			break;
		case "5":
			var WhichSub = HM_Array5_5;
			break;
		case "6":
			var WhichSub = HM_Array5_6;
			break;
		case "7":
			var WhichSub = HM_Array5_7;
			break;
		case "8":
			var WhichSub = HM_Array5_8;
			break;
		case "9":
			var WhichSub = HM_Array5_9;
			break;
		case "10":
			var WhichSub = HM_Array5_10;
			break;
		case "11":
			var WhichSub = HM_Array5_11;
			break;
		case "12":
			var WhichSub = HM_Array5_12;
			break;					
	}					
	//onMouseOver="MM_swapImage('diamond1','','../images/bullet.gif',1)" onMouseOut="MM_swapImgRestore()"
	len = WhichSub.length;
	itemStr = "";
	/*
		itemStr +='<tr>\n'
    itemStr +='<td valign="top" nowrap valign="top" class="sidebarLinks">&nbsp;<img src="/images/blank.gif" width="8" height="10" vspace="2"></td>\n'
    itemStr +='<td valign="top" width="130" class="sidebarLinks"><a href="#" onMouseOver="popUp(\'HM_Menu5\',event)" class="headerMenu">Main Menu...</a></td>\n'		
		itemStr +='</tr>\n'
		itemStr +='<tr>\n'
		itemStr +='<td colspan="2" class="rules-accents"><img src="/images/spacer.gif" height="1" width="1"></td>\n';
		itemStr +='</tr>\n'
		*/
		//itemStr +='<tr>'
    //itemStr +='<td valign="top" nowrap valign="top" class="sidebarLinksHeader">&nbsp;<img src="/images/blank.gif" vspace="2" width="8" height="10">&nbsp;</td>\n'
    //itemStr +='<td valign="top" width="130" class="sidebarLinksHeader">'+HM_Array5[menuIndex][0]+'</td>\n';		
		//itemStr +='</tr>'
		//itemStr +='<tr>'
		//itemStr +='<td colspan="2" class="rules-accents"><img src="../images/spacer.gif" height="1" width="1"></td>\n';
		//itemStr +='</tr>\n'
	
	for( i = 1;i < len; ++i){	
		itemStr +='<tr>\n'
    itemStr +='<td valign="top" nowrap valign="top" class="sidebarLinks"><img src="/images/bullet_off.gif" width="8" height="10" vspace="2" hspace="2" name="diamond'+i+'">&nbsp;</td>\n'
    itemStr +='<td valign="top" width="130" class="sidebarLinks"><a href="'+WhichSub[i][1]+'" class="sidebarLinks" onMouseOver="MM_swapImage(\'diamond'+i+'\',\'\',\'/images/bullet2.gif\',1)" onMouseOut="MM_swapImgRestore()">'+WhichSub[i][0]+'</a>&nbsp;</td>\n'		
		itemStr +='</tr>\n'
		if(i != len-1){
			itemStr +='<tr>\n'
			itemStr +='<td colspan="2" class="rules-accents"><img src="/images/spacer.gif" height="1" width="1"></td>\n';
			itemStr +='</tr>\n'
		}
	}
	document.write(itemStr);
}

function MM_validateForm() { //v4.0

  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);

    if (val) { nm=val.name; if ((val=val.value)!="") {

      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

      } else if (test!='R') {

        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

          min=test.substring(8,p); max=test.substring(p+1);

          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

  } if (errors) alert('The following error(s) occurred:\n'+errors);

  document.MM_returnValue = (errors == '');

}

function emailcheck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}
	
// these are for the guest book
function submitSubscription(){

 	RequiredItems = "";
	errors = "";
	if(!document.forms[0].FIRSTNAME.value){
		errors += "First name is required\n";
	}
	if(!document.forms[0].LASTNAME.value){
		errors += "Last name is required\n";
	}
	if(!document.forms[0].ADDRESS1.value){
		errors += "Address is required\n";
	}
	if(!document.forms[0].CITY.value){
		errors += "City is required\n";
	}
	if(!document.forms[0].POSTALCODE.value){
		errors += "Postal Code is required\n";
	}
	if(!document.forms[0].PASSWORD.value){
		errors += "Password is required\n";
	}
	if(document.forms[0].PASSWORD.value != document.forms[0].PASSWORD2.value){
		errors += "Password Confirm Must Match Password\n";
	}	
	
	if(!emailcheck(document.forms[0].EMAIL.value)){
		errors += "The Email Address appears to be an invalid format";
	}
	//errors =  MM_validateForm('EMAIL','','RisEmail','FIRSTNAME','','R','LASTNAME','','R','POSTALCODE','','R');	
	
	if (errors){
		//alert ("Errors"+ errors);
		RequiredItems += "Please Note\n"+errors;
	}	
	if (RequiredItems != ""){
		alert ( RequiredItems )
		RequiredItems = "";
	}else{
		// Double check recieve email.
		if(document.forms[0].RECIEVE_MAIL_ATTRIB_SELECTED.value == "0"){
			getsemail = confirm("You have elected to receive periodic email from us, Please confirm here\nby clicking OK")
			if(!getsemail){
				document.forms[0].RECIEVE_MAIL_ATTRIB_SELECTED.value = "1";
			}
		}else{
			alert("You haven't elected to Sign Up & Save\nYou must click a Notice Option to Sign Up");
			return;
		}
		document.forms[0].BILL_TO_FNAME.value = document.forms[0].FIRSTNAME.value;
		document.forms[0].BILL_TO_LNAME.value = document.forms[0].LASTNAME.value;
		document.forms[0].BILL_TO_ADDRESS1.value = document.forms[0].ADDRESS1.value;
		document.forms[0].BILL_TO_CITY.value = document.forms[0].CITY.value;
		selectedState_i = document.forms[0].STATE.selectedIndex;
		selectedState = document.forms[0].STATE.options[selectedState_i].value;
		document.forms[0].BILL_TO_STATE.value = selectedState;
		//alert(selectedState);
		document.forms[0].BILL_TO_POSTALCODE.value = document.forms[0].POSTALCODE.value;
		document.forms[0].submit()	
	}
}
function submitRegistration(){

 	RequiredItems = "";
	errors = "";
	if(!document.forms[0].FIRSTNAME.value){
		errors += "First name is required\n";
	}
	if(!document.forms[0].LASTNAME.value){
		errors += "Last name is required\n";
	}
	if(!document.forms[0].ADDRESS1.value){
		errors += "Address is required\n";
	}
	if(!document.forms[0].CITY.value){
		errors += "City is required\n";
	}
	if(!document.forms[0].POSTALCODE.value){
		errors += "Postal Code is required\n";
	}	
	if(!emailcheck(document.forms[0].EMAIL.value)){
		errors += "The Email Address appears to be an invalid format";
	}
	//errors =  MM_validateForm('EMAIL','','RisEmail','FIRSTNAME','','R','LASTNAME','','R','POSTALCODE','','R');	
	
	if (errors){
		//alert ("Errors"+ errors);
		RequiredItems += "Please Note\n"+errors;
	}	
	if (RequiredItems != ""){
		alert ( RequiredItems )
		RequiredItems = "";
	}else{
		// Double check recieve email.
		if(document.forms[0].RECIEVE_MAIL[0].checked){
			getsemail = confirm("You have elected to receive periodic email from us, Please confirm here\nby clicking OK")
			if(!getsemail){
				document.forms[0].RECIEVE_MAIL[1].checked = true
				document.forms[0].RECIEVE_MAIL[0].checked = false
			}
		}
		document.forms[0].BILL_TO_FNAME.value = document.forms[0].FIRSTNAME.value;
		document.forms[0].BILL_TO_LNAME.value = document.forms[0].LASTNAME.value;
		document.forms[0].BILL_TO_ADDRESS1.value = document.forms[0].ADDRESS1.value;
		document.forms[0].BILL_TO_CITY.value = document.forms[0].CITY.value;
		selectedState_i = document.forms[0].STATE.selectedIndex;
		selectedState = document.forms[0].STATE.options[selectedState_i].value;
		document.forms[0].BILL_TO_STATE.value = selectedState;
		//alert(selectedState);
		document.forms[0].BILL_TO_POSTALCODE.value = document.forms[0].POSTALCODE.value;
		document.forms[0].submit()	
	}
}

function submitSurvey(){

 	RequiredItems = "";
	errors = "";
	if(!document.forms[0].FIRSTNAME.value){
		errors += "First name is required\n";
	}
	if(!document.forms[0].LASTNAME.value){
		errors += "Last name is required\n";
	}
	if(!document.forms[0].ADDRESS1.value){
		errors += "Address is required\n";
	}
	if(!document.forms[0].CITY.value){
		errors += "City is required\n";
	}
	if(!document.forms[0].POSTALCODE.value){
		errors += "Postal Code is required\n";
	}	
	if(!emailcheck(document.forms[0].EMAIL.value)){
		errors += "The Email Address appears to be an invalid format\n";
	}
	//errors =  MM_validateForm('EMAIL','','RisEmail','FIRSTNAME','','R','LASTNAME','','R','POSTALCODE','','R');	
	
	if(document.forms[0].SUBSCRIBE_ME.checked){
	alert(document.forms[0].SUBSCRIBE_ME.value);
		if(!document.forms[0].PASSWORD.value){
			errors += "If you've desided to subscribe, you need to enter a Password";
		}
		if(document.forms[0].PASSWORD.value){
			if(document.forms[0].PASSWORD2.value != document.forms[0].PASSWORD.value){
				errors += "The Password Verification field does not match the Password";
				document.forms[0].PASSWORD2.value = "";
			}
		}
	}
	if (errors){
		//alert ("Errors"+ errors);
		RequiredItems += "Please Note\n"+errors;
	}	
	if (RequiredItems != ""){
		alert ( RequiredItems )
		RequiredItems = "";
	}else{
		// Double check recieve email.
		if(document.forms[0].RECIEVE_MAIL[0].checked){
			getsemail = confirm("You have elected to receive periodic email from us, Please confirm here\nby clicking OK")
			if(!getsemail){
				document.forms[0].RECIEVE_MAIL[1].checked = true
				document.forms[0].RECIEVE_MAIL[0].checked = false
			}
		}
		document.forms[0].BILL_TO_FNAME.value = document.forms[0].FIRSTNAME.value;
		document.forms[0].BILL_TO_LNAME.value = document.forms[0].LASTNAME.value;
		document.forms[0].BILL_TO_ADDRESS1.value = document.forms[0].ADDRESS1.value;
		document.forms[0].BILL_TO_CITY.value = document.forms[0].CITY.value;
		selectedState_i = document.forms[0].STATE.selectedIndex;
		selectedState = document.forms[0].STATE.options[selectedState_i].value;
		document.forms[0].BILL_TO_STATE.value = selectedState;
		//alert(selectedState);
		document.forms[0].BILL_TO_POSTALCODE.value = document.forms[0].POSTALCODE.value;
		document.forms[0].submit()	
	}
}

function setClubs(formObj){
	zipVal = formObj.value;
	testStr = zipVal.substr(0,3);
	if(testStr == "286" || testStr == "287" || testStr == "288" || testStr == "289"){
		//alert("Its in the zone we want");
		MM_showHideLayers('bothclubs','','show','justspa','','hide');
	}else{
		//alert("Its outside our geo-region");
		MM_showHideLayers('bothclubs','','hide','justspa','','hide');
	}
}

function setRecieveEmail(){
	document.forms[0].RECIEVE_MAIL[0].checked = true	

}

function setshoppinginfo(){
	var register = MM_findObj('register');	
	if(register.checked){					
		MM_openBrWindow('/guestbook/shopping_info_popup.htm','ShoppingInfo','scrollbars=yes,resizable=yes,width=600,height=290')	
	}
}

function setSpaPrefs(clubObj){
	formObj = MM_findObj('CLUBS_ATTRIB_SELECTED');
	if(clubObj.checked){		
		formObj.value = "0"
		document.forms[0].RECIEVE_MAIL[0].checked = true;	
		MM_openBrWindow('/guestbook/spaclub_popup.htm','SpaClubInfo','scrollbars=yes,resizable=yes,width=610,height=700')
	}else{
		formObj.value = "";
	}
}

function setDiningPrefs(clubObj){
	formObj = MM_findObj('CLUBS_ATTRIB_SELECTED');
	if(clubObj.checked){
		formObj.value = "1";
		document.forms[0].RECIEVE_MAIL[0].checked = true;
		MM_openBrWindow('/guestbook/diningclub_popup.htm','SpaClubInfo','scrollbars=yes,resizable=yes,width=610,height=570')
	}else{
		formObj.value = "";
	}

}

function setSpacerSize(compOffset){
	// this is for NS although you can use it to figure out the size for a dynamically written image in IE
	if(!compOffset){
		compOffset = 310; // set this to whatever..
	}
	var spacer = MM_findObj("spacer");
	if(isIE){
		winHeight = document.body.clientHeight;		
	}else{
		winHeight = window.innerHeight;
	}
	spacerHeight = (winHeight -compOffset) - 6; //the -10 corrects for chrome
	return spacerHeight ;
}

function sizeSpacer(compOffset){
	if(!compOffset){
		compOffset = 310;
	}
	var spacer = MM_findObj("spacer");
	if(isIE){
		winHeight = document.body.clientHeight;
		spacer.height = (winHeight -compOffset) - 8; //the -8 corrects for script chrome caused by the NS method below the image
	//alert(spacer.height)
	}else{
		winHeight = document.innerHeight - 5;
	}
	//alert(winHeight);
}
// end common scripts-->

