// JavaScript Document
/*====================================================================================================*/
function checkMobile(numObj,numberType)
{
	if( ( numObj.value == "" ) || ( !numObj.value.match(/^[0-9]{3}-[0-9]{3}-[0-9]{4}$/i)) )
	{
		alert("Please enter a valid " + numberType + " Number.\nAcceptable format: xxx-xxx-xxxx")
		return false;
	}
	return true;
}
/*====================================================================================================*/
function IsNumeric(strString,addchar)   
   {
   var strValidChars = addchar+"0123456789";
   var strChar;
   var blnResult = true;
   if (strString.length == 0) return false;
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
/////////////////////////////////////////
function haveNum(str)   
   {
    for(i=0;i<str.length;i++)
	{
		if(str.charAt(i) >= '0' && str.charAt(i) <= '9') 
		   return false;
	}
	return true;
   }
/////////////////////////////////////////
function isAlpha(str)   
   {
    for(i=0;i<str.length;i++)
	{
		if(!( (str.charAt(i) >= 'a' && str.charAt(i) <= 'z') || (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z')  || str.charAt(i) == ' '))
		   return false;
	}
	return true;
   }
/////////////////////////////////////////

function capitalize(str)
{
	return str.charAt(0).toUpperCase()+str.substr(1).toLowerCase();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*===================================================================*/
function setFocus(field)
{
	field.focus();
	return false;
}
function check_contact()
{
	x = document.forms[0];
	re1 = /^[^0-9]\w+$/;

	if(x.fname.value =="" || !isAlpha(x.fname.value)) 
	{
	   alert("Please type a valid First Name!");
	   setFocus(x.fname);
	}
	else if(x.lname.value =="" || !isAlpha(x.lname.value)) 
	{
	   alert("Please type a valid Last Name!");
	   setFocus(x.lname);
	}
	else if(!x.email.value.match(/^([A-Z0-9_][A-Z0-9._%-]*@[A-Z0-9_][A-Z0-9._%-]*\.[A-Z]{2,4})$/i))
	{
		alert("Please type a valid Email.");
	    setFocus(x.email);
	}
	else if(x.subject.value =="") 
	{
	   alert("Please select a Subject for your contact request.");
	   setFocus(x.subject);
	}
	else if(x.message.value =="") 
	{
	   alert("Please Type your message in the Message area.");
	   setFocus(x.message);
	}
	else
	{
		x.fname.value = capitalize(x.fname.value);
		x.lname.value = capitalize(x.lname.value);		
		x.email.value = x.email.value.toLowerCase();
		x.message1.value = nl2br(x.message.value);
		x.submit();
	}		
}
function check_reservation()
{
	x = document.forms[0];
	re1 = /^[^0-9]\w+$/;
	if(x.ppackage.value =="") 
	{
	   alert("Please select a Party Package for your reservation!");
	   setFocus(x.ppackage);
	}
	else if(x.pfname.value =="" || !isAlpha(x.pfname.value)) 
	{
	   alert("Please type a valid First Name of the Party Person!");
	   setFocus(x.pfname);
	}
	else if(x.plname.value =="" || !isAlpha(x.plname.value)) 
	{
	   alert("Please type a valid Last Name of the Party Person!");
	   setFocus(x.plname);
	}
	else if(x.page.value =="" || !x.page.value.match(/^[0-9]{1,3}$/i))
	{
	   alert("Please type a valid Age of the Party Person!");
	   setFocus(x.page);	
	}
	else if(x.pname.value =="") 
	{
	   alert("Please type a valid Party Name!");
	   setFocus(x.pname);
	}
	else if(x.pnpeople.value =="" || !x.pnpeople.value.match(/^[0-9]{1,4}$/i))
	{
	   alert("Please type a valid Number of People!");
	   setFocus(x.pnpeople);
	}
	else if(x.pdate.value =="") 
	{
	   alert("Please type a valid Party Date!");
	   setFocus(x.pdate);
	}
	else if(x.ptime.value =="") 
	{
	   alert("Please type a valid Party Time!");
	   setFocus(x.ptime);
	}
	else if(x.cfname.value =="" || !isAlpha(x.cfname.value)) 
	{
	   alert("Please type a valid First Name of the Contact Person!");
	   setFocus(x.cfname);
	}
	else if(x.clname.value =="" || !isAlpha(x.clname.value)) 
	{
	   alert("Please type a valid Last Name of the Contact Person!");
	   setFocus(x.clname);
	}
	else if(!x.cemail.value.match(/^([A-Z0-9_][A-Z0-9._%-]*@[A-Z0-9_][A-Z0-9._%-]*\.[A-Z]{2,4})$/i))
	{
		alert("Please type a valid Email of the Contact Person.");
	    setFocus(x.cemail);
	}
	else if(x.czip.value !="" && !x.czip.value.match(/^[0-9]{5}$/i))
	{
		alert("Please enter a valid Zip.\nExactly 5 digits zipcodes are allowed.")
	    setFocus(x.czip);
	}
	else if(!checkMobile(x.cphone,'Phone'))
	{
	    setFocus(x.cphone);
	}
	else if(!checkMobile(x.cephone,'Evening Phone'))
	{
	    setFocus(x.cephone);
	}
	else if(!checkMobile(x.ccphone,'Cell Phone'))
	{
	    setFocus(x.ccphone);
	}
	else if(x.cfax.value != "" && !checkMobile(x.cfax,'Fax'))
	{
	    setFocus(x.cfax);
	}
	else
	{
		x.pfname.value = capitalize(x.pfname.value);
		x.plname.value = capitalize(x.plname.value);		
		x.cfname.value = capitalize(x.cfname.value);
		x.clname.value = capitalize(x.clname.value);		
		x.cemail.value = x.cemail.value.toLowerCase();
		x.comments1.value = nl2br(x.comments.value);
		x.submit();
	}		
}
function check_seasonpass2008()
{
	x = document.forms[0];
	re1 = /^[^0-9]\w+$/;
	if(x.pfname.value =="" || !isAlpha(x.pfname.value)) 
	{
	   alert("Please type a valid First Name of the Pass Person!");
	   setFocus(x.pfname);
	}
	else if(x.plname.value =="" || !isAlpha(x.plname.value)) 
	{
	   alert("Please type a valid Last Name of the Pass Person!");
	   setFocus(x.plname);
	}
	else if(x.page.value =="" || !x.page.value.match(/^[0-9]{1,3}$/i))
	{
	   alert("Please type a valid Age of the Pass Person!");
	   setFocus(x.page);	
	}
	else if(!x.pemail.value.match(/^([A-Z0-9_][A-Z0-9._%-]*@[A-Z0-9_][A-Z0-9._%-]*\.[A-Z]{2,4})$/i))
	{
		alert("Please type a valid Email of the Pass Person.");
	    setFocus(x.pemail);
	}
	else if(!checkMobile(x.pphone,'Pass Person Phone'))
	{
	    setFocus(x.pphone);
	}
	else if(x.pmaddress.value =="") 
	{
	   alert("Please type a valid Mailing Address of the Pass Person!");
	   setFocus(x.pmaddress);
	}
	else if(x.pcell.value != "" && !checkMobile(x.pcell,'Pass Person Cell Phone'))
	{
	    setFocus(x.pcell);
	}
	else if(x.pcity.value =="" || !isAlpha(x.pcity.value)) 
	{
	   alert("Please type a valid City of the Pass Person!");
	   setFocus(x.pcity);
	}
	else if(x.pstate.value =="" || !isAlpha(x.pstate.value)) 
	{
	   alert("Please type a valid State of the Pass Person!");
	   setFocus(x.pstate);
	}
	else if(!x.pzip.value.match(/^[0-9]{5}$/i))
	{
		alert("Please enter a valid Zip of Pass Person!\nExactly 5 digits zipcodes are allowed.")
	    setFocus(x.pzip);
	}
	else if(x.cfname.value =="" || !isAlpha(x.cfname.value)) 
	{
	   alert("Please type a valid First Name of the Contact Person!");
	   setFocus(x.cfname);
	}
	else if(x.clname.value =="" || !isAlpha(x.clname.value)) 
	{
	   alert("Please type a valid Last Name of the Contact Person!");
	   setFocus(x.clname);
	}
	else if(!x.cemail.value.match(/^([A-Z0-9_][A-Z0-9._%-]*@[A-Z0-9_][A-Z0-9._%-]*\.[A-Z]{2,4})$/i))
	{
		alert("Please type a valid Email of the Contact Person.");
	    setFocus(x.cemail);
	}
	else if(x.ccity.value !="" && !isAlpha(x.ccity.value)) 
	{
	   alert("Please type a valid City of the Contact Person!");
	   setFocus(x.ccity);
	}
	else if(x.cstate.value !="" && !isAlpha(x.cstate.value)) 
	{
	   alert("Please type a valid State of the Contact Person!");
	   setFocus(x.cstate);
	}
	else if(x.czip.value != "" && !x.czip.value.match(/^[0-9]{5}$/i))
	{
		alert("Please enter a valid Zip of Contact Person!\nExactly 5 digits zipcodes are allowed.")
	    setFocus(x.czip);
	}
	else if(!checkMobile(x.cphone,'Contact Person Phone'))
	{
	    setFocus(x.cphone);
	}
	else if(x.cephone.value != "" && !checkMobile(x.cephone,'Contact Person Evening Phone'))
	{
	    setFocus(x.cephone);
	}
	else if(x.cfax.value != "" && !checkMobile(x.cfax,'Contact Person Fax'))
	{
	    setFocus(x.cfax);
	}
	else if(x.comments.value == "")
	{
	    alert("Please enter your Special Comments for the Season Pass!")
		setFocus(x.comments);
	}
	else
	{
		x.pfname.value = capitalize(x.pfname.value);
		x.plname.value = capitalize(x.plname.value);		
		x.cfname.value = capitalize(x.cfname.value);
		x.clname.value = capitalize(x.clname.value);		
		x.pemail.value = x.pemail.value.toLowerCase();
		x.cemail.value = x.cemail.value.toLowerCase();
		x.comments1.value = nl2br(x.comments.value);
		x.submit();
	}		
}
/*==================================================*/
function nl2br(string)
{
checkval = DelHTML(string);
checkval = checkval.replace(/\r\n/g,"<br>"); 
checkval = checkval.replace(/\r/g,"<br>"); 
checkval = checkval.replace(/\n/g,"<br>"); 
return checkval;
}
/*==================================================*/
function DelHTML(HTMLWord)
{
a = HTMLWord.indexOf("<");
b = HTMLWord.indexOf(">");

HTMLlen = HTMLWord.length;

c = HTMLWord.substring(0, a);

if(b == -1)
b = a;

d = HTMLWord.substring((b + 1), HTMLlen);

Word = c + d;

tmp = Word.indexOf("<");

if(tmp != -1)
Word = DelHTML(Word);

return Word;
}
/*==================================================*/