//Call the hotels - email down
function plzCall (){
	var loc = document.resForm.dest.value;
	alert("We are having technical difficulties, please contact the location directly to book a room at " + loc);
}

// Jacuzzi Carry script
function jacCarry (){
var jacpromo = "<?php echo $promo?>";
if (jacpromo == "Jacuzzi" || jacpromo == "JacuzziSerenity")
	{
		document.resForm.jacuzzi[0].checked = true;
	}
}
function noSmoking (smokeIndex)
{
	var loc = document.resForm.dest.value;
	if (smokeIndex == 0 && (loc == "1-888-877-9444 City Center"))
	{
		returnValue = true;
	}
	else {
		returnValue = false;
		alert("Sorry \n Smoking rooms are not available at that location.");
		document.resForm.smoke[1].checked = true;		
	}
}
function noJacuzzi (jacuzziIndex)
{
	var loc = document.resForm.dest.value;
	if (jacuzziIndex == 0 && (loc == "1-888-877-9444 City Center" || loc == "1-888-883-6742 In Town"|| loc == "1-888-657-4545 Extended Stay" || loc == "1-800-663-7898 Oceanfront Grand Resort" || loc=="1-800-663-5660 Vacation Inn"))
	{
		returnValue = false;
		alert("Sorry \n Jacuzzi is not available at that location.");
		document.resForm.jacuzzi[1].checked = true;
	}
}
		
	
// Credit Card Month setter	
function nowMonth ()
{
	var theForm = document.resForm
	var theMonth = new Date();
	theForm.cardMonth.options[theMonth.getMonth()+1].selected = true;
}


// Rest of form validator
function formValid ()
{	
	var phone = document.resForm.dest.value.substring(0,14);
	var loc = document.resForm.dest.value.substring(15);  
	var theForm = document.resForm;
	var str = theForm.email.value;
	var isEmail = ((str.indexOf("@") != -1) && (str.indexOf(".") != -1));
	
//Weekend overflow script - 05/16-17 2009
if ((theForm.arrMonth.selectedIndex==4 && (theForm.arrDate.selectedIndex==15 || theForm.arrDate.selectedIndex==16)) && (loc=="Downtown" )) // || loc=="City Center" || loc=="On Blanshard" || loc=="On Douglas" || loc=="Central"))
	{
		alert("The Downtown location is full for the dates you have choosen. \n\n Please select another of our great locations.  \n\n Sorry for any inconvenience."); 
		theForm.dest.focus();
		return(false);
	}
	
		if ( !(theForm.arrMonth.selectedIndex == 11) && (theForm.arrMonth.selectedIndex >= theForm.depMonth.selectedIndex && theForm.arrDate.selectedIndex >= theForm.depDate.selectedIndex) )
	{
		alert("Please ensure your arrival and departure information is correct.");
		theForm.arrDate.focus();
		return (false);
		}
	if (theForm.arrTime.value == "")
	{
		alert("Please enter your expected Arrival time.");
		theForm.arrTime.focus();
		return (false);
	}
	if ((theForm.promo.value == "Jacuzzi+20"||theForm.promo.value == "JacuzziSerenity+60") && (theForm.dest.value == "1-888-877-9444 City Center" || theForm.dest.value == "1-888-883-6742 In Town"|| theForm.dest.value == "1-888-657-4545 Express" || theForm.dest.value == "1-800-663-7898 Oceanfront Grand Resort" || theForm.dest.value =="1-800-663-5660 Vacation Inn"))
	{
	alert("Unfortunately that hotel does not have a jacuzzi suite.  \n\rTry another hotel or choose the Standard package.");
	theForm.dest.focus();
	return (false);
	}

	// OGR packages restrictions
	if ((theForm.promo.selectedIndex == 5) && (theForm.dest.selectedIndex != 9))
	{
		alert("This package is only available trough The Oceanfront Grand Resort.  \n\rPerhaps you would like to select another package");
		theForm.promo.focus();
		return(false);
	}
	if (theForm.firstName.value == "")
	{
		alert ("Please enter your First Name.");
		theForm.firstName.focus();
		return (false);
	}
	if (theForm.lastName.value == "")
	{
		alert ("Please enter your Last Name.");
		theForm.lastName.focus();
		return (false);
	}
	if (theForm.address.value == "")
	{
		alert ("please enter your Address.");
		theForm.address.focus();
		return (false);
	}
	if (theForm.city.value == "")
	{
		alert ("Please enter the city of your address.");
		theForm.city.focus();
		return (false);
	}
	if (theForm.state.value == "")
	{
		alert ("Please enter the State or Province where you reside.");
		theForm.state.focus();
		return (false);
	}
	if (theForm.zip.value == "")
	{
		alert ("Please enter your zip or postal code.");
		theForm.zip.focus();
		return (false);
	}
	if (theForm.phone.value == "")
	{
		alert ("Please enter a valid phone number");
		theForm.phone.focus();
		return (false);
	}
	if (theForm.email.value == "")
	{
		alert ("Please enter a valid email address.");
		theForm.email.focus();
		return (false);
	}
	if (isEmail == false) 
	{
	  	alert("" + str + " is an invalid email address!");
  		theForm.email.select();
  		theForm.email.focus();
  		return false;
	}
	if (theForm.numAdults.value == "")
	{
		alert ("please let us know how many adults will be staying.");
		theForm.numAdults.focus();
		return (false);
	}
	if (theForm.numBeds.value == "")
	{
		alert ("Please let us know how many beds you require.");
		theForm.numBeds.focus();
		return (false);
	}
	if (theForm.cardNumber.value =="")
	{
		alert("\n For Non-Guaranteed Reservation (6pm hold) Call the hotel directly. \n\n Traveller's Inn - "+ loc +" : "+ phone +" \n\n\n To guarantee a reservation please enter your credit card number in the \"Number\" field. \n\n");
		return false;
	}
	if (isNaN(theForm.cardNumber.value) ==true)
	{
		alert ("Please enter a valid credit card number. \n No spaces please.")
		theForm.cardNumber.focus();
		return (false);
	 }
	 if (theForm.cardName.value == "")
	 {
	 	alert ("Please enter the name as it appears on the card.");
		theForm.cardName.focus();
		return (false);
	}
	

	return (true);
}
