
function ValidateForm()
	
	{



if (document.form2.confirmby(0).checked==false && document.form2.confirmby(1).checked==false)
	{
	alert("Please tell us your confirmation type")
	return false;
	}

if (document.form2.txtFirst.value < 1)
	{
		alert("Please fill in your First Name");
		return false;
	}
else if (!(isNaN(document.form2.txtFirst.value)))
	{
		alert("Sorry First Name cannot be a Number");
		return false;
		
	}

if (document.form2.txtLast.value < 1)
	{
		alert("Please fill in your Last Name");
		return false;
	}
else if (!(isNaN(document.form2.txtLast.value)))
	{
		alert("Sorry Last Name cannot be a Number");
		return false;
		
	}

if (document.form2.txtAddress.value < 1)
	{
		alert("Please fill in your Address");
		return false;
	}

if (document.form2.txtCity.value < 1)
	{
		alert("Please fill in your City ");
		return false;
	}

if (document.form2.txtState.value < 1)
	{
		alert("Please fill in your State");
		return false;
	}

if (document.form2.txtCountry.value ==0)
	{
		alert("Please select your Country")
		return false;
	}


var emailID=document.form2.txteAddress
	
if (document.form2.txteAddress.value < 1)
	{
		alert("Please Enter your Email ID")
		return false;
	}


if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false;
		}

if (document.form2.Ccode.value < 1)
	{
		alert("Country Code cannot be Empty");
		return false;
	}

else if (isNaN(document.form2.Ccode.value))
	{
		alert("Country Code Must be a Number");
		return false;
	}

if (isNaN(document.form2.Acode.value))
	{
		alert("Area Code Must be a Number");
		return false;
	}

if (document.form2.fone.value < 1)
	{
		alert("Please type your Phone Number");
		return false;
	}

else if (isNaN(document.form2.fone.value))
	{
		alert("sorry Phone number must be a number");
		return false;
	}

if (document.form2.txtIn.value==0)
	{
		alert("Please select Check-in Date");
		return false;	
	}
	
if (document.form2.txtDropoffDate.value==0)
	{
		alert("Please select Check-Out Date");
		return false;	
	}

}

   

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("Please Enter a Correct Email Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please Enter a Correct Email Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please Enter a Correct Email Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please Enter a Correct Email Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please Enter a Correct Email Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please Enter a Correct Email Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please Enter a Correct Email Address")
		    return false
		 }

 		 return true					
	}
