// JavaScript Document
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 Validate_reservation()
{
	if (document.Reservation.Title.value=='--')
	{
		alert("Please select your title");
		document.Reservation.Title.focus();
		return false;
	}
	if (document.Reservation.Fname.value==''||document.Reservation.Fname.value==null)
	{
		alert("Please give your first name");
		document.Reservation.Fname.focus();
		return false;
	}
	if (document.Reservation.Lname.value==''||document.Reservation.Lname.value==null)
	{
		alert("Please give you last name");
		document.Reservation.Lname.focus();
		return false;
	}
	if (document.Reservation.Address.value==''||document.Reservation.Address.value==null)
	{
		alert("Please give your address");
		document.Reservation.Address.focus();
		return false;
	}
	if (document.Reservation.Country.value==''||document.Reservation.Country.value==null)
	{
		alert("Please give your nationality");
		document.Reservation.Country.focus();
		return false;
	}
	if (document.Reservation.Telephone.value==''||document.Reservation.Telephone.value==null)
	{
		alert("Please give your telephone number");
		document.Reservation.Telephone.focus();
		return false;
	}
	var emailID=document.Reservation.Email;
	if ((emailID.value=="")||(emailID.value==null))
	 {
		 alert("Please enter your Email ID")
		 emailID.focus();
		 return false;
	 }
	 if (echeck(emailID.value)==false)
	 {
		 emailID.focus();
		 emailID.select();
		 return false;
	 }
	if (document.Reservation.Checkindate.value==''||document.Reservation.Checkindate.value==null)
	{
		alert("Please give check in date");
		document.Reservation.Checkindate.focus();
		return false;
	}
	if (document.Reservation.Checkoutdate.value==''||document.Reservation.Checkoutdate.value==null)
	{
		alert("Please give your check out date");
		document.Reservation.Checkoutdate.focus();
		return false;
	}
	var reserve=confirm("Are you sure to submit this form");
	if(reserve==true)
	{
		return true;
	}
	else
	{
		return false;
	}
}