function validate(){
	if(validationCheck())
		document.makereservation.submit();
}

function validationCheck(){
	var name=document.makereservation.name;
	var telephone=document.makereservation.telephone;
	var email=document.makereservation.email;
	var guest=document.makereservation.guest;
	var reservation=document.makereservation.reservation;
	var time=document.makereservation.time;
	var rqrt=document.makereservation.rqrt;
	if(name.value==""){
		alert("Please enter your name");
		name.select();
		return false;
	}else if(telephone.value==""){
		alert("Please enter your telephone no.");
		telephone.select();
		return false;
	}else if(!numericValidation(telephone.value)){
		alert("Please enter a valid telephone no.");
		telephone.select();
		return false;
	}else if(email.value!="" && !emailValidation(email.value)){
			alert("Please enter a valid email id");
			email.select();
			return false;
	}else if(guest.value=="0"){
		alert("Please choose total no of guest");
		guest.select();
		return false;
	}else if(reservation.value==""){
		alert("Please select date of reservation");
		reservation.select();
		return false;
	}else if(time.value=="0"){
		alert("Please choose time");
		time.select();
		return false;
	}else return true
}

function emailValidation(email){
	var regexp=/^[a-zA-Z][A-Za-z0-9|_]*((\.)[a-zA-Z0-9|_]+)*@([0-9]*[a-zA-Z][0-9]*)+((\.)([0-9]*[a-zA-Z][0-9]*)+)+$/;
	if(email.search(regexp)==-1){
		return false;
	}else{ 
		return true;
	}
}

function numericValidation(numToCheck){
	var strValidChar="[0-9]";
	var strChar;
	for(i=0;i<numToCheck.length;i++){
		if((numToCheck.charAt(i)).search(strValidChar)==-1){
			return false;
		}
	}
	return true;
}

