
	function validateForm(){
		try{
		var df = document.forms[0];
		df.selAction.value="submit";
			
		if(df.companyName.value=="" || df.companyName.value.length<=0){
			alert("Please enter the 'Full Legal Name of the Company'");
			df.companyName.focus();
			return false;
		}
		if(df.companyAddress.value=="" || df.companyAddress.value.length<=0){
			alert("Please enter the 'Company Address'");
			df.companyAddress.focus();
			return false;
		}
		
		if(df.companyCity.value=="" || df.companyCity.value.length<=0){
			alert("Please enter the 'City'");
			df.companyCity.focus();
			return false;
		}
		
		
		if(df.cState.value =="" && df.cProvince.value==""){
			alert('Please select a State or a Province');
			df.cState.focus();
			return false;
			/*if(df.companyState.value=="" || df.companyState.value.length<=0){
				alert("Please enter the 'State/Province'");
				df.companyState.focus();
				return false;
			}*/
		}
		
		if(df.cState.value.length > 0 && df.cProvince.value.length > 0){
			alert('Please select either a State or Province (do not select both)');
			df.cState.focus();
			return false;
		}
		if(df.cState.value.length > 0){
			df.companyState.value = df.cState.value;
			//alert('state: ' + df.companyState.value);
		}
		if(df.cProvince.value.length > 0){
			df.companyState.value = df.cProvince.value;
			//alert('state: ' + df.companyState.value);
		}
		
		if(df.companyCountry.value==""){
			alert("Please select the 'Country'");
			df.companyCountry.focus();
			return false;
		}
		/*
		if(df.companyCountry.value=="" || df.companyCountry.value.length<=0){
			alert("Please enter the 'Country'");
			df.companyCountry.focus();
			return false;
		}
		*/
		if(df.companyZip.value=="" || df.companyZip.value.length<=0){
			alert("Please enter the 'Zip/Postal Code'");
			df.companyZip.focus();
			return false;
		}
		if(df.contactName.value=="" || df.contactName.value.length<=0){
			alert("Please enter the 'Contact Person'");
			df.contactName.focus();
			return false;
		}
		if(df.contactTitle.value=="" || df.contactTitle.value.length<=0){
			alert("Please enter the 'Title'");
			df.contactTitle.focus();
			return false;
		}
		if(df.contactPhone.value=="" || df.contactPhone.value.length<=0){
			alert("Please enter the 'Telephone Number'");
			df.contactPhone.focus();
			return false;
		}
		if(df.contactEmail.value=="" || df.contactEmail.value.length<=0){
			alert("Please enter the 'Email Address'");
			df.contactEmail.focus();
			return false;
		}else{
			//var isVEmail = isEmail(df.vendorEmailAddr.value);
			if(!isEmail(df.contactEmail.value)){
				alert("Please enter a Valid 'Email Address'");
				df.contactEmail.focus();
				return false;
			}
		}
		
		
		// make sure a single State or Province selected (not both)
		if(df.pState.value.length > 0 && df.pProvince.value.length > 0){
			alert('Please select either a State or Province for the Parent Company (do not select both)');
			df.pState.focus();
			return false;
		}
		if(df.pState.value.length > 0){
			df.parentState.value = df.pState.value;
			//alert('state: ' + df.parentState.value);
		}
		if(df.pProvince.value.length > 0){
			df.parentState.value = df.pProvince.value;
			//alert('state: ' + df.parentState.value);
		}
		
		
		if(
			(df.primNAICS.value=="" || df.primNAICS.value.length<=0) && 
			(df.primSIC.value=="" || df.primSIC.value.length<=0)
		   )
		{
			alert("Please enter either the 'Primary NAICS Code' or the 'Primary SIC Code'");
			df.primNAICS.focus();
			return false;
		}
		
		/*
		if(df.fedTaxID.value=="" || df.fedTaxID.value.length<=0){
			alert("Please enter the 'Federal Tax ID Number/Social Security Number'");
			df.TaxID.focus();
			return false;
		}
		*/
		
		if(df.dunsNum.value=="" || df.dunsNum.value.length<=0){
			alert("Please enter the 'DUNS Number'");
			df.dunsNum.focus();
			return false;
		}
		
		var compCatChk = 0;
		for(var x=0; x < df.compCat.length; x++){
			if(df.compCat[x].checked){
				compCatChk++;
			}
		}
		if(compCatChk<=0){
			alert("Please select all that apply for 'Company Category'");
			df.compCat[0].focus();	
			return false;
		}	

		var busTypeChk = 0;
		for(var x=0; x < df.busType.length; x++){
			if(df.busType[x].checked){
				busTypeChk++;
				//alert(df.busType[x].value);
				if(df.busType[x].value=="Other" && (df.busTypeOther.value.length<=0 || df.busTypeOther.value=="")){
					alert("Please specify the 'Other' Business Type");
					df.busTypeOther.focus();
					return false;
				}
			}
		}
		if(busTypeChk<=0){
			alert("Please select all that apply for 'Business Type'");
			df.busType[0].focus();	
			return false;
		}

		var compProfileChk = 0;
		for(var x=0; x < df.compProfile.length; x++){
			if(df.compProfile[x].checked){
				compProfileChk++;
				//alert(df.busType[x].value);
				if(df.compProfile[x].value=="Other" && (df.compProfileOther.value.length<=0 || df.compProfileOther.value=="")){
					alert("Please specify the 'Other' Company Profile");
					df.compProfileOther.focus();
					return false;
				}
			}
		}
		if(compProfileChk<=0){
			alert("Please select all that apply for 'Company Profile'");
			df.compProfile[0].focus();	
			return false;
		}
		
		/*
		for(var x=0; x < df.sbdType.length; x++){
			if(df.sbdType[x].checked){
				if(df.sbdType[x].value=="Other" && (df.sbdTypeOther.value.length<=0 || df.sbdTypeOther.value=="")){
					alert("Please specify the 'Other' Business Type");
					df.sbdTypeOther.focus();	
					return false;
				}
			}
		}
		
		for(var x=0; x < df.busProg.length; x++){
			if(df.busProg[x].checked){
				if(df.busProg[x].value=="Other" && (df.busProgOther.value.length<=0 || df.busProgOther.value=="")){
					alert("Please specify the 'Other' Business Program");
					df.busProgOther.focus();	
					return false;
				}
			}
		}
		*/

		/* check here for certifications */
		// certification 1
		if(df.certAgency1.value!="" || df.certAgency1.value.length>0){
			if(df.certNumber1.value=="" || df.certNumber1.value.length<=0){
				alert('Please enter the Certification Number for this Agency.');
				df.certNumber1.focus();
				return false;
			}
			if(df.certExpDate1.value=="" || df.certExpDate1.value.length<=0){
				alert('Please enter the Expiration Date for this Certification.');
				df.certExpDate1.focus();
				return false;
			}else if(!Date.isValid(df.certExpDate1.value,'M/d/y')){
				alert('Please enter a Valid "Expiration Date" for this Certification');
		        	df.certExpDate1.focus();
		        	return false;	
			}
		}
		
		// certification 2
		if(df.certAgency2.value!="" || df.certAgency2.value.length>0){
			if(df.certNumber2.value=="" || df.certNumber2.value.length<=0){
				alert('Please enter the Certification Number for this Agency.');
				df.certNumber2.focus();
				return false;
			}
			if(df.certExpDate2.value=="" || df.certExpDate2.value.length<=0){
				alert('Please enter the Expiration Date for this Certification.');
				df.certExpDate2.focus();
				return false;
			}else if(!Date.isValid(df.certExpDate2.value,'M/d/y')){
			    	alert('Please enter a Valid "Expiration Date" for this Certification');
		        	df.certExpDate2.focus();
		        	return false;	
			}
		}
		
		// certification 3
		if(df.certAgency3.value!="" || df.certAgency3.value.length>0){
			if(df.certNumber3.value=="" || df.certNumber3.value.length<=0){
				alert('Please enter the Certification Number for this Agency.');
				df.certNumber3.focus();
				return false;
			}
			if(df.certExpDate3.value=="" || df.certExpDate3.value.length<=0){
				alert('Please enter the Expiration Date for this Certification.');
				df.certExpDate3.focus();
				return false;
			}else if(!Date.isValid(df.certExpDate3.value,'M/d/y')){
			    	alert('Please enter a Valid "Expiration Date" for this Certification');
		        	df.certExpDate3.focus();
		        	return false;	
			}
		}
		
		// certification 4
		if(df.certAgency4.value!="" || df.certAgency4.value.length>0){
			if(df.certNumber4.value=="" || df.certNumber4.value.length<=0){
				alert('Please enter the Certification Number for this Agency.');
				df.certNumber4.focus();
				return false;
			}
			if(df.certExpDate4.value=="" || df.certExpDate4.value.length<=0){
				alert('Please enter the Expiration Date for this Certification.');
				df.certExpDate4.focus();
				return false;
			}else if(!Date.isValid(df.certExpDate4.value,'M/d/y')){
			    	alert('Please enter a Valid "Expiration Date" for this Certification');
		        	df.certExpDate4.focus();
		        	return false;	
			}
		}
		
		// certification 5
		if(df.certAgency5.value!="" || df.certAgency5.value.length>0){
			if(df.certNumber5.value=="" || df.certNumber5.value.length<=0){
				alert('Please enter the Certification Number for this Agency.');
				df.certNumber5.focus();
				return false;
			}
			if(df.certExpDate5.value=="" || df.certExpDate5.value.length<=0){
				alert('Please enter the Expiration Date for this Certification.');
				df.certExpDate5.focus();
				return false;
			}else if(!Date.isValid(df.certExpDate5.value,'M/d/y')){
			    	alert('Please enter a Valid "Expiration Date" for this Certification');
		        	df.certExpDate5.focus();
		        	return false;	
			}
		}


		for(var x=0; x < df.servArea.length; x++){
			if(df.servArea[x].checked){
				if((df.servArea[x].value=="Local" || df.servArea[x].value=="Regional") && (df.servAreaOther.value.length<=0 || df.servAreaOther.value=="")){
					alert("Please specify the Local or Regional 'Service Area'");
					df.servAreaOther.focus();	
					return false;
				}
			}
		}
		
		return true;
		}catch(E){
			alert("error " + E.description );
		}
	}

	function isEmail(str) {
		// are regular expressions supported?
		var supported = 0;
		if (window.RegExp) {
			var tempStr = "a";
			var tempReg = new RegExp(tempStr);
			if (tempReg.test(tempStr)) supported = 1;
		}
							  
		if (!supported) 
			return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		
		return (!r1.test(str) && r2.test(str));
	}

