
function echeck(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					
	}

function ValidateForm()
{

	if ((document.booking.firstName.value==null)||(document.booking.firstName.value=="")){
		alert("Please enter your first name")
		document.booking.firstName.focus()
		return false
	}
	if ((document.booking.lastName.value==null)||(document.booking.lastName.value=="")){
		alert("Please enter your last name")
		document.booking.lastName.focus()
		return false
	}
	if ((document.booking.address1.value==null)||(document.booking.address1.value=="")){
		alert("Please enter your address")
		document.booking.address1.focus()
		return false
	}
	if ((document.booking.city.value==null)||(document.booking.city.value=="")){
		alert("Please enter your city")
		document.booking.city.focus()
		return false
	}
	if ((document.booking.prov.value==null)||(document.booking.prov.value=="")){
		alert("Please enter your first name")
		document.booking.prov.focus()
		return false
	}
	if ((document.booking.postalCode.value==null)||(document.booking.postalCode.value=="")){
		alert("Please enter your postal code")
		document.booking.postalCode.focus()
		return false
	}
	if ((document.booking.phone.value==null)||(document.booking.phone.value=="")){
		alert("Please enter your phone number")
		document.booking.phone.focus()
		return false
	}
	
	if ((document.booking.ExpireMonth.value==null)||(document.booking.ExpireMonth.value=="")||(document.booking.ExpireYear.value==null)||(document.booking.ExpireYear.value=="")){
			alert("Please enter the expiry date of your credit card")
			document.booking.ExpireMonth.focus()
			return false
	}
	
	//Email Check
	var emailID=document.booking.txtEmail
		
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

	if ((document.booking.CardName.value==null)||(document.booking.CardName.value=="")){
		alert("Please enter your name as it appears on your credit card")
		document.booking.CardName.focus()
		return false
	}
	if ((document.booking.CardNumber.value==null)||(document.booking.CardNumber.value=="")){
		alert("Please enter your credit card number")
		document.booking.CardNumber.focus()
		return false
	}

	//Dialog Box for Booking Info
	var bookingInfo = "Please confirm the following:\n\n"  
	bookingInfo = bookingInfo + "Room:  Room #" + String(document.booking.RoomNum.value) + "\n"
	bookingInfo = bookingInfo + "Check in:  " + String(document.booking.CheckinMonth.value) + "/"
	bookingInfo = bookingInfo + String(document.booking.CheckinDay.value) + "/"
	bookingInfo = bookingInfo + String(document.booking.CheckinYear.value) + "\n"
	bookingInfo = bookingInfo + "Check out:  " + String(document.booking.CheckoutMonth.value) + "/"
	bookingInfo = bookingInfo + String(document.booking.CheckoutDay.value) + "/"
	bookingInfo = bookingInfo + String(document.booking.CheckoutYear.value) + "\n"
	
	var confirmInfo = confirm(bookingInfo)
	
	if (confirmInfo==false)
	{
		return false
	}
	
	//Dialog Box for Customer Info
	var bookingInfo2 = "Please confirm the following:\n\n"  
	bookingInfo2 = bookingInfo2 + "Name:  " + String(document.booking.firstName.value) + " " + 
	String(document.booking.lastName.value) + "\n"
	bookingInfo2 = bookingInfo2 + "Address:  " + String(document.booking.address1.value)
	if ((document.booking.address2.value!=null) && (document.booking.address2.value!="")) 
	{
		bookingInfo2 = bookingInfo2 + "\n" + "Address 2: " + String(document.booking.address2.value)
	}
	bookingInfo2 = bookingInfo2 + "\nCity:  " + String(document.booking.city.value) + "\n"
	bookingInfo2 = bookingInfo2 + "Province:  " + String(document.booking.prov.value) + "\n"
	bookingInfo2 = bookingInfo2 + "Country:  " + String(document.booking.Country.value) + "\n"
	bookingInfo2 = bookingInfo2 + "Postal Code:  " + String(document.booking.postalCode.value) + "\n"
	bookingInfo2 = bookingInfo2 + "Phone #:  " + String(document.booking.phone.value) + "\n"
	bookingInfo2 = bookingInfo2 + "E-Mail:  " + String(document.booking.txtEmail.value) + "\n"
	
	
	var confirmInfo2 = confirm(bookingInfo2)	
	if (confirmInfo2==false)
	{
		return false
	}
	
	//Dialog Box for Credit card Info
	var bookingInfo3 = "Please confirm the following:\n\n"  
	bookingInfo3 = bookingInfo3 + "Card Type: " + String(document.booking.cardType.value) + "\n"
	bookingInfo3 = bookingInfo3 + "Name on Card:  " + String(document.booking.CardName.value) + "\n"
	bookingInfo3 = bookingInfo3 + "Card Number:  " + String(document.booking.CardNumber.value) + "\n"	
	bookingInfo3 = bookingInfo3 + "Expiry Date:  "
	bookingInfo3 = bookingInfo3 + String(document.booking.ExpireMonth.value) + "/"
	bookingInfo3 = bookingInfo3 + String(document.booking.ExpireYear.value) + "\n"
	
	var confirmInfo3 = confirm(bookingInfo3)

	if (confirmInfo3==false)
	{
		return false
	}
	
	
	
	return true	
}