function echeck(value) {
	    //alert("in function");
    	var re = new RegExp(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i);
    	if (re.test(value)) {
       		return true;
    	} 
    	else {
    		return false;
    	} 
	}
	
String.prototype.trim = function()
{
  return this.replace(/^\s+/,'').replace(/\s+$/,'');
}


function validate(form){

	var show =true;
	
	if((document.form1.pname.value == "Name") || (document.form1.pname.value == "")){
	document.getElementById('showerror1').style.display = ""; 
	show =false;
	}else{
	document.getElementById('showerror1').style.display = "none"; 
	}
	

	if((document.form1.email.value == "Email") || (document.form1.email.value == "") ){
	document.getElementById('showerror2').style.display = ""; 
	show =false;
	}else{
	
			document.getElementById('showerror2').style.display = "none"; 	
			if(echeck(document.form1.email.value.trim())==false){
				document.getElementById('showerror4').style.display = ""; 
				show = false;
			}else{
				document.getElementById('showerror4').style.display = "none"; 
			}	
	
		
	}
	
	if((document.form1.phone.value == "phone") || (document.form1.phone.value == "")){
	document.getElementById('showerror6').style.display = ""; 
	show =false;
	}else{
	document.getElementById('showerror6').style.display = "none"; 
	}

	if((document.form1.nationality.value == "Nationality") || (document.form1.nationality.value == "") ){
	document.getElementById('showerror3').style.display = ""; 
	show =false;
	}else{
	document.getElementById('showerror3').style.display = "none"; 
	}
	
	if((document.form1.date1.value == "date") || (document.form1.date1.value == "") ){
	document.getElementById('showerror5').style.display = ""; 
	show =false;
	}else{
	document.getElementById('showerror5').style.display = "none"; 
	}

	if((document.form1.guest.value == "guest") || (document.form1.guest.value == "")){
	document.getElementById('showerror8').style.display = ""; 
	show =false;
	}else{
	document.getElementById('showerror8').style.display = "none"; 
	}
	
	if((document.form1.ftdetail.value == "guest") || (document.form1.ftdetail.value == "")){
	document.getElementById('showerror7').style.display = ""; 
	show =false;
	}else{
	document.getElementById('showerror7').style.display = "none"; 
	}
			
		if(show == false){
		return false;
		}else{
		getLocation(document.form1.pname.value,document.form1.email.value,document.form1.phone.value,document.form1.nationality.value,document.form1.date1.value,document.form1.guest.value,document.form1.ftdetail.value,document.form1.aspick.value,document.form1.room.value,document.form1.message.value,'');
		}

}
