function inValidCharSet(str,charset)
{
	// Note: doesn't use regular expressions to avoid early Mac browser bugs
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			return false
			break
		}
	return true
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789.");
}
 
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(){
 	var surname=document.booking.surname
	var fname=document.booking.fname
	var address=document.booking.address
	var city=document.booking.city
	var country=document.booking.country	
	var mobile=document.booking.mobile
	var nopeople=document.booking.nopeople
	var tour=document.booking.tour
	var accom=document.booking.accom
	var arrival=document.booking.arrival
	
	if ((surname.value==null)||(surname.value=="")){
		alert("Please Enter your Sir Name")
		surname.focus()
		return false
	}
	if ((fname.value==null)||(fname.value=="")){
		alert("Please Enter your First Name")
		fname.focus()
		return false
	}
	if ((address.value==null)||(address.value=="")){
		alert("Please Enter your Address")
		address.focus()
		return false
	}
	if ((city.value==null)||(city.value=="")){
		alert("Please Enter your City")
		city.focus()
		return false
	}
	if ((country.value==null)||(country.value=="")||(country.value=="Select Country")){
		alert("Please Enter your Country")
		country.focus()
		return false
	}
	if ((mobile.value==null)||(mobile.value=="")){
		alert("Please Enter your Mobile Number")
		mobile.focus()
		return false
	}
	
	if ((nopeople.value==null)||(nopeople.value=="")){
		alert("Please Enter Number of People")
		nopeople.focus()
		return false
	}
	if(!(allDigits(nopeople.value))){
		alert("Invalid Input Type! Please enter Number of People")
		nopeople.focus()
		nopeople.value = "";
		return false
	}
	
	if ((tour.value==null)||(tour.value=="")||(tour.value=="Select Tour")){
		alert("Please Select Tour Type")
		tour.focus()
		return false
	}		
	
	if ((accom.value==null)||(accom.value=="")||(accom.value=="Select Type")){
		alert("Please Select Accomodation Type")
		accom.focus()
		return false
	}
	
	if ((arrival.value==null)||(arrival.value=="")){
		alert("Please Enter Arrival Date")
		arrival.focus()
		return false
	}
	
	return true
 }
