 function form_validate()
 {
	
	 
	firstname=document.contactinfo.first_name.value; 
	lastname=document.contactinfo.last_name.value; 
	companyname=document.contactinfo.company.value; 
	add=document.contactinfo.address.value; 
	apt=document.contactinfo.aptname.value; 
	cityname=document.contactinfo.city.value;
	code=document.contactinfo.postalcode.value;
	email=document.contactinfo.email_id.value;
	
	
	if(firstname=="")
	{
		alert("Please Enter Firstname");
		document.contactinfo.first_name.focus();
		return false;
	}
	 if(lastname=="")
	{
		alert("Please Enter Lastname");
		document.contactinfo.last_name.focus();
		return false;
	}
	 if(email=="")
	{
		alert("Please Enter Email Address");
		document.contactinfo.email_id.focus();
		return false;
	}
	if(email!="")
	{
		check=emailcheck(email);
		 if(!check)
		 {
			 alert("please enter Valid Emailid");
			 document.contactinfo.email_id.focus();
			return false;
			 
			 
		 }
			 
		
		
		
	}
	

	
	
	
	
	if(companyname=="")
	{
		alert("Please Enter Companyname");
		document.contactinfo.company.focus();
		return false;
	}
	
	
	if(add=="")
	{
		alert("Please Enter Address");
		document.contactinfo.address.focus();
		return false;
	}
	 if(apt=="")
	{
		alert("Please Enter Apartment");
		document.contactinfo.aptname.focus();
		return false;
	}
	 if(cityname=="")
	{
		alert("Please Enter City");
		document.contactinfo.city.focus();
		return false;
	}
	  if(code=="")
	{
		alert("Please Enter Postalcode");
		document.contactinfo.postalcode.focus();
		return false;
	}
	 
	 return true;
	

	 

	
	 
	 
 }
 
 
 function form_validate2()
 {
	 date1=document.cateringinfo.date.value;
	day1= document.cateringinfo.day.value;
	 deltime=document.cateringinfo.deliverytime.value;
	delto=document.cateringinfo.deliveryto.value;
	 no=document.cateringinfo.noofpeople.value;
	 budget_catering=document.cateringinfo.budget.value;
	 type=document.cateringinfo.typeofevent.value;
	 
	   if(date1=="")
	{
		alert("Please Enter Date of Event");
		document.cateringinfo.date.focus();
		return false;
	}
	   if(day1=="")
	{
		alert("Please Enter Day of Event");
		document.cateringinfo.day.focus();
		return false;
	}
		   if(deltime=="")
	{
		alert("Please Enter Delivery time");
		document.cateringinfo.deliverytime.focus();
		return false;
	}
		   if(delto=="")
	{
		alert("Please Enter Delivery To");
		document.cateringinfo.deliveryto.focus();
		return false;
	}
		   if(no=="")
	{
		alert("Please Enter No of People Atttending");
		document.cateringinfo.noofpeople.focus();
		return false;
	}
		   if(budget_catering=="")
	{
		alert("Please Enter Budget of the Event");
		document.cateringinfo.budget.focus();
		return false;
	}
	   if(type=="")
	{
		alert("Please Enter type of the Event");
		document.cateringinfo.typeofevent.focus();
		return false;
	}
	return true;
 }
 
 
 //UserRegistration Form Validation Come here
 function reg_form_validate()
{

	
user_email=document.regform1.email.value;
user_password=document.regform1.password.value;
user_vpassword=document.regform1.vpassword.value;
user_firstname=document.regform1.first_name.value;
user_lastname=document.regform1.last_name.value;

//terms=document.regform.terms

if(user_email=="")
{
	alert("Please enter Email ");
	document.regform1.email.focus();
	return false;
	
}
check=emailcheck(user_email);
if(!check)
{
	alert("Please enter Valid email_id");
	document.regform1.email.focus();
	document.regform1.email.select();
	return false;
}

	
if(user_firstname=="")
{
alert("Please enter Firstname");
document.regform1.first_name.focus();
return false;
}

if(user_lastname=="")
{
alert("Please enter Lastname");
document.regform1.last_name.focus();
return false;
}

	
if(user_password=='')
{
	alert("Please enter password ");
	document.regform1.password.focus();
	return false;
}	
if(user_password.length<6)
{
	alert("Password should have minumum 6 charaters");
	document.regform1.password.focus();
	document.regform1.password.select();
	return false;
}

if(user_vpassword=='')
{
	alert("Please enter password ");
	document.regform1.vpassword.focus();
	return false;
}	
if(user_password != user_vpassword)
{
	alert("Passwords Should be Matched");
	document.regform1.vpassword.focus();
	document.regform1.vpassword.select();
	return false;
}
return true;
	

}

function emailcheck(str) {
	
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
return false
}
if (str.indexOf(at,(lat+1))!=-1){
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return false
}
if (str.indexOf(dot,(lat+2))==-1){
return false
}
if (str.indexOf(" ")!=-1){
return false
}
return true

  }
 
 
 
 function reg_form_validate2()
{
	

	street=document.regform2.street.value;
	aptno=document.regform2.apt_no.value;
	aptname=document.regform2.apt_name.value;
	//city=document.regform2.city.value;
	city=document.regform2.city.options[document.regform2.city.selectedIndex].value;
	neighbourhood=document.regform2.neigbourhood.value;
	//zip=document.regform2.zip.value;
	phone=document.regform2.ph1.value;
	information=document.regform2.other_info.value;
	abtus=document.regform2.hear_about_us.value;
	

	if(street=="")
	{
		alert("Please enter Street Address");
		document.regform2.street.focus();
		return false;
	}
	
	if(aptno=="")
	{
		alert("Please enter apartment number");
		document.regform2.apt_no.focus();
		return false;
	}
	if(aptname=="")
	{
		alert("Please enter apartment name");
		document.regform2.apt_name.focus();
		return false;
	}
	if(neighbourhood=="")
	{
		alert("Please enter Neigbourhood");
		document.regform2.neigbourhood.focus();
		return false;
	}
	if(city=="")
	{
		alert("Please enter City");
		document.regform2.city.focus();
		return false;
	}
	if(phone=="")
	{
		alert("Please Enter Phonenumber");
		document.regform2.ph1.focus();
		return false;
	}
	if(information=="")
	{
		alert("Please Enter Deliver Information");
		document.regform2.other_info.focus();
		return false;
	}
	if(abtus=="")
	{
		alert("Please Enter How did you hear about us");
		 document.regform2.hear_about_us.focus();
	   return false;
	}
	
	
	if(phone=="")
	{
		alert("Please enter phonenumber");
		document.regform2.ph1.focus();
		return false;
	}
   return true;
  
}


	
