﻿function validate()
{
	var frm=document.frm;
	if(frm.txtFname.value=='')
	{
		alert("Enter the FirstName");
		frm.txtFname.focus();
		return false;
	}
	if(frm.txtLname.value=='')
	{
		alert("Enter the LastName");
		frm.txtLname.focus();
		return false;
	}
		if(frm.txtEmail.value=='')
	{
		alert("Enter the E-Mail ID");
		frm.txtEmail.focus();
		return false;
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.txtEmail.value))){
		alert("Enter the valid email id");
		frm.txtEmail.focus();
		return false
		}
		if(frm.txtUrl.value=='')
	{
		alert("Enter the URL");
		frm.txtUrl.focus();
		return false;
	}			
	if(frm.txtOrganization.value=='')
	{
		alert("Enter the Organization");
		frm.txtOrganization.focus();
		return false;
	}			
	if(frm.txtTitle.value=='')
	{
		alert("Enter the Title");
		frm.txtTitle.focus();
		return false;
	}	
	if(frm.txtStreet.value=='')
	{
		alert("Enter the Street Address");
		frm.txtStreet.focus();
		return false;
	}	
	if(frm.txtCity.value=='')
	{
		alert("Enter the City");
		frm.txtCity.focus();
		return false;
	}	
	if(frm.txtState.value=='')
	{
		alert("Enter the State");
		frm.txtState.focus();
		return false;
	}	
	if(frm.txtZip.value=='')
	{
		alert("Enter the Zip/Pin Code");
		frm.txtZip.focus();
		return false;
	}
	
	 if(isNaN(frm.txtZip.value)) 
	{
		alert("Please Enter a Number Only.");
		frm.txtZip.focus();
		return false;
    }	
	if(frm.txtCountry.value=='')
	{
		alert("Enter the Country");
		frm.txtCountry.focus();
		return false;
	}	
	
		if(frm.txtPhone.value=='')
	{
		alert("Enter the Telephone Number");
		frm.txtPhone.focus();
		return false;
	}
	
	 if (!(frm.txtPhone.value.search(/^[0-9][0-9][0-9]\-[0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]$/) != -1))
	 {
		 alert("Phone Number Format is 123-123-1234");
		 frm.txtPhone.focus();
		 return false;
	}	
	
		if(frm.txtFax.value=='')
	{
		alert("Enter the Fax");
		frm.txtFax.focus();
		return false;
	}
	
	 if(isNaN(frm.txtFax.value)) 
	{
		alert("Please Enter a Number Only.");
		frm.txtFax.focus();
		return false;
    }
	if(frm.txtLocate.value=='')
	{
		alert("Enter how did you locate us? ");
		frm.txtLocate.focus();
		return false;
	}	
	
		if(frm.txtComment.value=='')
	{
	alert("Enter your Comments");
	frm.txtComment.focus();
	return false;
	}
	
	return true;
	
}