




function formvalidation(theForm)
{
	  if (theForm.Contact.value == "")
	  {
		alert("Please enter your contact name");
		theForm.Contact.focus();
		return (false);
	  }
	  
	  if (theForm.Name_of_Firm.value == "")
	  {
		alert("Please enter the name of firm");
		theForm.Name_of_Firm.focus();
		return (false);
	  }

	if (theForm.Address.value == "")
	  {
		alert("Please enter your Address");
		theForm.Address.focus();
		return (false);
	  }   

	  if (theForm.City.value == "")
	  {
		alert("Please enter your city");
		theForm.City.focus();
		return (false);
	  }
	  
	  
	   if (theForm.State.value=="")
		{
			alert("Please enter State");
        theForm.State.focus();
			return (false);
		}
		
		if (theForm.Postal_Code.value=="")
		{
			alert("Please enter Postal Code");
        theForm.Postal_Code.focus();
			return (false);
		}
		if (theForm.Phone1.value=="")
		{
			alert("Please enter phone number ");
        theForm.Phone1.focus();
			return (false);
		}
		if(theForm.Phone1.value != "" ) {
			if(isnumeric(theForm.Phone1.value)) {
				alert("Please enter numeric characters in number of phone field");
				theForm.Phone1.focus();
				return (false);
			}
		}
		if (theForm.Phone2.value=="")
		{
			alert("Please enter phone number ");
        theForm.Phone2.focus();
			return (false);
		}
		if(theForm.Phone2.value != "" ) {
			if(isnumeric(theForm.Phone2.value)) {
				alert("Please enter numeric characters in number of phone field");
				theForm.Phone2.focus();
				return (false);
			}
		}
		if (theForm.Phone3.value=="")
		{
			alert("Please enter phone number ");
        theForm.Phone3.focus();
			return (false);
		}
		if(theForm.Phone3.value != "" ) {
			if(isnumeric(theForm.Phone3.value)) {
				alert("Please enter numeric characters in number of phone field");
				theForm.Phone3.focus();
				return (false);
			}
		}
		
		if (theForm.Fax1.value=="")
		{
			alert("Please enter fax number");
        	theForm.Fax1.focus();
			return (false);
		}
		if(theForm.Fax1.value != "" ) {
			if(isnumeric(theForm.Fax1.value)) {
				alert("Please enter numeric characters in number of fax field");
				theForm.Fax1.focus();
				return (false);
			}
		}
		if (theForm.Fax2.value=="")
		{
			alert("Please enter fax number");
        theForm.Fax2.focus();
			return (false);
		}
		if(theForm.Fax2.value != "" ) {
			if(isnumeric(theForm.Fax2.value)) {
				alert("Please enter numeric characters in number of fax field");
				theForm.Fax2.focus();
				return (false);
			}
		}
		if (theForm.Fax3.value=="")
		{
			alert("Please enter fax number");
        theForm.Fax3.focus();
			return (false);
		}
		if(theForm.Fax3.value != "" ) {
			if(isnumeric(theForm.Fax3.value)) {
				alert("Please enter numeric characters in number of fax field");
				theForm.Fax3.focus();
				return (false);
			}
		}
		
		if(emailCheck(theForm.email.value)== false)
		{
			
        	theForm.email.focus();
			return (false);
		}
		
		if (theForm.Tax_ID_Number.value=="")
		{
			alert("Please enter tax id number");
        theForm.Tax_ID_Number.focus();
			return (false);
		}
		if (theForm.Years_in_business.value=="")
		{
			alert("Please enter years in business");
        theForm.Years_in_business.focus();
			return (false);
		}
		
		if(isnumeric(theForm.Years_in_business.value)) {
				alert("Please enter numeric characters in years in business field");
				theForm.Years_in_business.focus();
				return (false);
		}
		
		if (theForm.Number_of_principles.value=="")
		{
			alert("Please enter number of principles");
        theForm.Number_of_principles.focus();
			return (false);
		}
		if(theForm.Number_of_principles.value != "" ) {
			if(isnumeric(theForm.Number_of_principles.value)) {
				alert("Please enter numeric characters in number of principles field");
				theForm.Number_of_principles.focus();
				return (false);
			}
		}
		if (theForm.name_of_principle1.value=="")
		{
			alert("Please enter at least on name of principle");
        theForm.name_of_principle1.focus();
			return (false);
		}
		if (theForm.title_of_principle1.value=="")
		{
			alert("Please enter at least on title of principle");
        theForm.title_of_principle1.focus();
			return (false);
		}
		if (theForm.percent_Ownership_of_principle1.value=="")
		{
			alert("Please enter at least one of  percent ownership of principle field");
        theForm.percent_Ownership_of_principle1.focus();
			return (false);
		}
		if (theForm.percent_Ownership_of_principle1.value > 100 || theForm.percent_Ownership_of_principle1.value < 0)
		{
			alert("Please enter value between 0 and 100 in Ownership 1");
        theForm.percent_Ownership_of_principle1.focus();
			return (false);
		}
		if (theForm.percent_Ownership_of_principle2.value!="" && (theForm.percent_Ownership_of_principle2.value > 100 || theForm.percent_Ownership_of_principle2.value < 0))
		{
			alert("Please enter value between 0 and 100 in Ownership 2");
        theForm.percent_Ownership_of_principle2.focus();
			return (false);
		}
		if (theForm.percent_Ownership_of_principle3.value!="" && (theForm.percent_Ownership_of_principle3.value > 100 || theForm.percent_Ownership_of_principle3.value < 0))
		{
			alert("Please enter value between 0 and 100 in Ownership 3");
        theForm.percent_Ownership_of_principle3.focus();
			return (false);
		}
		
		if(theForm.percent_Ownership_of_principle1.value != "" ) {
			if(isnumeric(theForm.percent_Ownership_of_principle1.value)) {
				alert("Please enter numeric characters in number of principles field");
				theForm.percent_Ownership_of_principle1.focus();
				return (false);
			}
		}
		if (theForm.number_of_other_staff.value=="")
		{
			alert("Please enter other staff field");
        theForm.number_of_other_staff.focus();
			return (false);
		}
		if(theForm.number_of_other_staff.value != "" ) {
			if(isnumeric(theForm.number_of_other_staff.value)) {
				alert("Please enter numeric characters in number of other staff field");
				theForm.number_of_other_staff.focus();
				return (false);
			}
		}
		if (!(theForm.state_disipline[0].checked || theForm.state_disipline[1].checked))
	  {
		alert("Please select state disipline field.");
		theForm.state_disipline[0].focus();
		return (false);
	  }
	  if (theForm.state_disipline[0].checked && theForm.state_disipline_explain.value=="")
	  {
		alert("Please enter state disipline explain field.");
		theForm.state_disipline_explain.focus();
		return (false);
	  }
	  
	  if (!(theForm.company_cancel_contract[0].checked || theForm.company_cancel_contract[1].checked))
	  {
		alert("Please select  agency contract canceled field.");
		theForm.company_cancel_contract[0].focus();
		return (false);
	  }
	   if (theForm.company_cancel_contract[0].checked && theForm.company_cancel_contract_explain.value=="")
	  {
		alert("Please enter company cancel contract explain field.");
		theForm.company_cancel_contract_explain.focus();
		return (false);
	  }
		
		if (theForm.licensed_in_states.value=="")
		{
			alert("Please enter all states in which the firm is licensed");
        	theForm.licensed_in_states.focus();
			return (false);
		}
		 if (!(theForm.retail_or_wholesale[0].checked || theForm.retail_or_wholesale[1].checked))
	  {
		alert("Please select retail or whole sale.");
		theForm.retail_or_wholesale[0].focus();
		return (false);
	  }
		if (theForm.total_agency_volume.value=="")
		{
			alert("Please enter total agency volume");
        theForm.total_agency_volume.focus();
			return (false);
		}
		if(theForm.total_agency_volume.value != "" ) {
			if(isnumeric(theForm.total_agency_volume.value)) {
				alert("Please enter numeric characters in number of total agency volume field");
				theForm.total_agency_volume.focus();
				return (false);
			}
		}
		if (theForm.personal_lines1.value=="")
		{
			alert("Please enter at least one of personal lines field");
        theForm.personal_lines1.focus();
			return (false);
		}
		if(theForm.personal_lines1.value != "" ) {
			if(isnumeric(theForm.personal_lines1.value)) {
				alert("Please enter numeric characters in number of personal lines field");
				theForm.personal_lines1.focus();
				return (false);
			}
		}
		
		if (theForm.commercial_lines1.value=="")
		{
			alert("Please enter at least one of commercial lines field");
        theForm.commercial_lines1.focus();
			return (false);
		}
		if(theForm.commercial_lines1.value != "" ) {
			if(isnumeric(theForm.commercial_lines1.value)) {
				alert("Please enter numeric characters in number of commercial lines field");
				theForm.commercial_lines1.focus();
				return (false);
			}
		}
		
		
		
		if (theForm.top_3_company1.value=="")
		{
			alert("Please enter at least one of the top 3 company field");
        	theForm.top_3_company1.focus();
			return (false);
		}
		if (theForm.top_3_company1_value.value=="")
		{
			alert("Please enter at least one of the top 3 company value field");
        	theForm.top_3_company1_value.focus();
			return (false);
		}
		if(theForm.top_3_company1_value.value != "" ) {
			if(isnumeric(theForm.top_3_company1_value.value)) {
				alert("Please enter numeric characters in number of the top 3 company value field");
				theForm.top_3_company1_value.focus();
				return (false);
			}
		}
		if (theForm.Property.value=="")
		{
			alert("Please enter Property  field");
        theForm.Property.focus();
			return (false);
		}
		if(theForm.Property.value != "" ) {
			if(isnumeric(theForm.Property.value)) {
				alert("Please enter numeric characters in number of Property field");
				theForm.Property.focus();
				return (false);
			}
		}
		if (theForm.General_Liability.value=="")
		{
			alert("Please enter General Liability  field");
        theForm.General_Liability.focus();
			return (false);
		}
		if(theForm.General_Liability.value != "" ) {
			if(isnumeric(theForm.General_Liability.value)) {
				alert("Please enter numeric characters in number of General Liability field");
				theForm.General_Liability.focus();
				return (false);
			}
		}
		
		if (theForm.Crime.value=="")
		{
			alert("Please enter Crime  field");
        theForm.Crime.focus();
			return (false);
		}
		if(theForm.Crime.value != "" ) {
			if(isnumeric(theForm.Crime.value)) {
				alert("Please enter numeric characters in number of Crime field");
				theForm.Crime.focus();
				return (false);
			}
		}
		if (theForm.Automobile.value=="")
		{
			alert("Please enter Automobile  field");
        theForm.Automobile.focus();
			return (false);
		}
		if(theForm.Automobile.value != "" ) {
			if(isnumeric(theForm.Automobile.value)) {
				alert("Please enter numeric characters in number of Automobile field");
				theForm.Automobile.focus();
				return (false);
			}
		}
		if (theForm.Professional_Liability.value=="")
		{
			alert("Please enter Professional Liability  field");
        theForm.Professional_Liability.focus();
			return (false);
		}
		if(theForm.Professional_Liability.value != "" ) {
			if(isnumeric(theForm.Professional_Liability.value)) {
				alert("Please enter numeric characters in number of Professional Liability field");
				theForm.Professional_Liability.focus();
				return (false);
			}
		}
		if (theForm.Workers_Compensation.value=="")
		{
			alert("Please enter Workers Compensation  field");
        theForm.Workers_Compensation.focus();
			return (false);
		}
		if(theForm.Workers_Compensation.value != "" ) {
			if(isnumeric(theForm.Workers_Compensation.value)) {
				alert("Please enter numeric characters in number of Workers Compensation field");
				theForm.Workers_Compensation.focus();
				return (false);
			}
		}
		
		if (theForm.Habitational.value=="")
		{
			alert("Please enter Habitational  field");
        theForm.Habitational.focus();
			return (false);
		}
		if(theForm.Habitational.value != "" ) {
			if(isnumeric(theForm.Habitational.value)) {
				alert("Please enter numeric characters in number of Habitational field");
				theForm.Habitational.focus();
				return (false);
			}
		}
		if (theForm.Hospitality.value=="")
		{
			alert("Please enter Hospitality  field");
        theForm.Hospitality.focus();
			return (false);
		}
		if(theForm.Hospitality.value != "" ) {
			if(isnumeric(theForm.Hospitality.value)) {
				alert("Please enter numeric characters in number of Hospitality field");
				theForm.Hospitality.focus();
				return (false);
			}
		}
		
		if (theForm.Contractors.value=="")
		{
			alert("Please enter Contractors  field");
        theForm.Contractors.focus();
			return (false);
		}
		if(theForm.Contractors.value != "" ) {
			if(isnumeric(theForm.Contractors.value)) {
				alert("Please enter numeric characters in number of Contractors field");
				theForm.Contractors.focus();
				return (false);
			}
		}
		
		if (theForm.Health_Care.value=="")
		{
			alert("Please enter Allied Health Care  field");
        theForm.Health_Care.focus();
			return (false);
		}
		if(theForm.Health_Care.value != "" ) {
			if(isnumeric(theForm.Health_Care.value)) {
				alert("Please enter numeric characters in number of Allied Health Care field");
				theForm.Health_Care.focus();
				return (false);
			}
		}
		
		if (theForm.Architects_Engineers.value=="")
		{
			alert("Please enter Architects & Engineers  field");
        theForm.Architects_Engineers.focus();
			return (false);
		}
		if(theForm.Architects_Engineers.value != "" ) {
			if(isnumeric(theForm.Architects_Engineers.value)) {
				alert("Please enter numeric characters in number of Architects & Engineers field");
				theForm.Architects_Engineers.focus();
				return (false);
			}
		}
		
		if (theForm.Miscellaneous.value=="")
		{
			alert("Please enter Miscellaneous E & O  field");
        theForm.Miscellaneous.focus();
			return (false);
		}
		if(theForm.Miscellaneous.value != "" ) {
			if(isnumeric(theForm.Miscellaneous.value)) {
				alert("Please enter numeric characters in number of Miscellaneous E & O field");
				theForm.Miscellaneous.focus();
				return (false);
			}
		}
		
		if (theForm.Manufacturing.value=="")
		{
			alert("Please enter Manufacturing  field");
        theForm.Manufacturing.focus();
			return (false);
		}
		if(theForm.Manufacturing.value != "" ) {
			if(isnumeric(theForm.Manufacturing.value)) {
				alert("Please enter numeric characters in number of Manufacturing field");
				theForm.Manufacturing.focus();
				return (false);
			}
		}
		
		if (theForm.Service.value=="")
		{
			alert("Please enter Service  field");
        theForm.Service.focus();
			return (false);
		}
		if(theForm.Service.value != "" ) {
			if(isnumeric(theForm.Service.value)) {
				alert("Please enter numeric characters in number of Service field");
				theForm.Service.focus();
				return (false);
			}
		}
		
		if (theForm.home_state_license.value=="")
		{
			alert("Please enter Home State License Number field");
        	theForm.home_state_license.focus();
			return (false);
		}
		
		 if (theForm.license_Expiration_month.selectedIndex=="")
		{
			alert("Please select License Expiration month field");
        	theForm.license_Expiration_month.focus();
			return (false);
		}
		if (theForm.license_expiration_year.selectedIndex=="")
		{
			alert("Please select License Expiration year field");
        	theForm.license_expiration_year.focus();
			return (false);
		}
		
		
		
		if (theForm.proposed_annual_volume_commitment.value=="")
		{
			alert("Please enter proposed annual volume commitment field");
        theForm.proposed_annual_volume_commitment.focus();
			return (false);
		}
		if(theForm. proposed_annual_volume_commitment.value != "" ) {
			if(isnumeric(theForm. proposed_annual_volume_commitment.value)) {
				alert("Please enter numeric characters in number of  proposed annual volume commitment field");
				theForm.proposed_annual_volume_commitment.focus();
				return (false);
			}
		}
		
		if (!(theForm.target_account_size[0].checked || theForm.target_account_size[1].checked|| theForm.target_account_size[2].checked))
	  {
		alert("Please select target account size.");
		theForm.target_account_size[0].focus();
		return (false);
	  }
	   if (!(theForm.view_insured_risk[0].checked || theForm.view_insured_risk[1].checked))
	  {
		alert("Please select inspect or view insured risk field.");
		theForm.view_insured_risk[0].focus();
		return (false);
	  }
	   if (!(theForm.agency_has_email[0].checked || theForm.agency_has_email[1].checked))
	  {
		alert("Please select agency has email or not field.");
		theForm.agency_has_email[0].focus();
		return (false);
	  }
	   if (!(theForm.agency_individual_emails[0].checked || theForm.agency_individual_emails[1].checked))
	  {
		alert("Please select agency has  individual email or not field.");
		theForm.agency_individual_emails[0].focus();
		return (false);
	  }
	   if (!(theForm.has_highspeed_internet[0].checked || theForm.has_highspeed_internet[1].checked))
	  {
		alert("Please select agency has highspeed internet or not field.");
		theForm.has_highspeed_internet[0].focus();
		return (false);
	  }
		if (theForm.agency_management_system.value=="")
		{
			alert("Please enter eagency management system field");
        	theForm.agency_management_system.focus();
			return (false);
		}
		if (theForm.name_of_EO_Carrier.value=="")
		{
			alert("Please enter name of EO Carrier");
        theForm.name_of_EO_Carrier.focus();
			return (false);
		}
		if (theForm.EO_limits.value=="")
		{
			alert("Please enter EO limits field");
        	theForm.EO_limits.focus();
			return (false);
		}
		
		 if (theForm.EO_Expiration_month.selectedIndex=="")
		{
			alert("Please select EO Expiration month field");
        	theForm.EO_Expiration_month.focus();
			return (false);
		}
		if (theForm.EO_expiration_year.selectedIndex=="")
		{
			alert("Please select EO Expiration year field");
        	theForm.EO_expiration_year.focus();
			return (false);
		}
		if (theForm.EO_policy_number.value=="")
		{
			alert("Please enter EO policy number field");
        	theForm.EO_policy_number.focus();
			return (false);
		}
		if (theForm.bank_reference.value=="")
		{
			alert("Please enter bank reference field");
        	theForm.bank_reference.focus();
			return (false);
		}
		if (theForm.name_of_bank.value=="")
		{
			alert("Please enter name of bank field");
        	theForm.name_of_bank.focus();
			return (false);
		}
		if (theForm.bank_telephone_1.value=="")
		{
			alert("Please enter bank telephone field");
        	theForm.bank_telephone_1.focus();
			return (false);
		}
		if(theForm.bank_telephone_1.value != "" ) {
			if(isnumeric(theForm.bank_telephone_1.value)) {
				alert("Please enter numeric characters in number of bank telephone field");
				theForm.bank_telephone_1.focus();
				return (false);
			}
		}
		if (theForm.bank_telephone_2.value=="")
		{
			alert("Please enter bank telephone field");
        	theForm.bank_telephone_2.focus();
			return (false);
		}
		if(theForm.bank_telephone_2.value != "" ) {
			if(isnumeric(theForm.bank_telephone_2.value)) {
				alert("Please enter numeric characters in number of bank telephone field");
				theForm.bank_telephone_2.focus();
				return (false);
			}
		}

		if (theForm.bank_telephone_3.value=="")
		{
			alert("Please enter bank telephone field");
        	theForm.bank_telephone_3.focus();
			return (false);
		}
		if(theForm.bank_telephone_3.value != "" ) {
			if(isnumeric(theForm.bank_telephone_3.value)) {
				alert("Please enter numeric characters in number of bank telephone field");
				theForm.bank_telephone_3.focus();
				return (false);
			}
		}
		
		if (theForm.trust_account_number.value=="")
		{
			alert("Please enter trust account number  field");
        	theForm.trust_account_number.focus();
			return (false);
		}
		if (theForm.professional_reference_1.value=="")
		{
			alert("Please enter the 1st professional reference field");
        	theForm.professional_reference_1.focus();
			return (false);
		}
		if (theForm.professional_reference_2.value=="")
		{
			alert("Please enter the 2nd professional reference field");
        	theForm.professional_reference_2.focus();
			return (false);
		}
		if (theForm.professional_reference_3.value=="")
		{
			alert("Please enter the 3rd professional reference field");
        	theForm.professional_reference_3.focus();
			return (false);
		}
		
		 if (!(theForm.verification[0].checked || theForm.verification[1].checked))
	  {
		alert("Please select agree or disagree field.");
		theForm.verification[0].focus();
		return (false);
	  }
	  if (theForm.your_name.value=="")
		{
			alert("Please enter your name field");
        	theForm.your_name.focus();
			return (false);
		}
		if (theForm.your_title.value=="")
		{
			alert("Please enter your title field");
        	theForm.your_title.focus();
			return (false);
		}
	
}
function addCommasTotalAgencyVolume()
{
	var nStr
	nStr = document.mainForm.total_agency_volume.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.total_agency_volume.value = x1 + x2;
	return x1 + x2;
} 
function addCommasAnnualVolume()
{
	var nStr
	nStr = document.mainForm.proposed_annual_volume_commitment.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.proposed_annual_volume_commitment.value = x1 + x2;
	return x1 + x2;
}
function addCommasNumberOfPrinciples()
{
	var nStr
	nStr = document.mainForm.Number_of_principles.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.Number_of_principles.value = x1 + x2;
	return x1 + x2;
}
function addCommasOtherStaff()
{
	var nStr
	nStr = document.mainForm.number_of_other_staff.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.number_of_other_staff.value = x1 + x2;
	return x1 + x2;
}
function addCommasCompanyValue1()
{
	var nStr
	nStr = document.mainForm.top_3_company1_value.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.top_3_company1_value.value = x1 + x2;
	return x1 + x2;
}
function addCommasCompanyValue2()
{
	var nStr
	nStr = document.mainForm.top_3_company2_value.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.top_3_company2_value.value = x1 + x2;
	return x1 + x2;
}
function addCommasCompanyValue3()
{
	var nStr
	nStr = document.mainForm.top_3_company3_value.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.top_3_company3_value.value = x1 + x2;
	return x1 + x2;
}
function addCommasLimits()
{
	var nStr
	nStr = document.mainForm.EO_limits.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	document.mainForm.EO_limits.value = x1 + x2;
	return x1 + x2;
}


function isnumeric(val)
{
	f="1234567890. ()-,"
	eno=val;
	for(var i=0;i<eno.length;i++)
	{
		if(f.indexOf(eno.charAt(i))==-1)
		 {
			return true;
		}
	}
	return false;
}

function emailCheck (emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The email address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This email address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

function autoTab(e) {
    if(this.value.length == this.getAttribute("maxlength") && 
        e.KeyCode != 8 && e.keyCode != 16 && e.keyCode != 9) {
            new Field.activate(findNextElement(this.getAttribute("tabindex")));
        }
}

function findNextElement(index) {
    elements = new Form.getElements('Phone1');
    for(i = 0; i < elements.length; i++) {
        element = elements[i];
        if(parseInt(element.getAttribute("tabindex")) == (parseInt(index) + 1)) {
            return element;
        }
    }
    return elements[0];
}






