function validate()
//Validation function for Omni Customer Inquiry Form



{
	

// Name ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//  If First Name Required - testing for input
			if(document.form1.realname.value=="")
					{ alert("Please provide us your First & Last Name.");
					document.form1.realname.focus();
					return false; }

//  If Field Populated, subTest for valid characters:  alpha and dashes by matching illegal characters  
			if(!(document.form1.realname.value=="")) 
				{
					
					var illegalChars= /[\@\(\)\<\>\,\;\:\.\\\/\"\[\][0-9}]/;  
				 
					if (document.form1.realname.value.match(illegalChars))
						{ alert("Name field contains illegal characters. \n\n Please use only alpha characters, apostrophe and dashes");      
							document.form1.realname.focus();
							return false; }
				}	
				
// Company Name ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//  If Company Field Populated, subTest for valid characters:  alpha and dashes by matching illegal characters  
			if(!(document.form1.Company.value=="")) 
				{
					
					var illegalChars= /[\@\(\)\<\>\,\;\:\.\\\/\"\[\][0-9}]/;  
				 
					if (document.form1.Company.value.match(illegalChars))
						{ alert("Company Name contains illegal characters. \n\n Please use only alpha characters, apostrophe and dashes");      				document.form1.Company.focus();
							return false; }
				}	
		
		
// Email Address ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			

//  Email Address Required - testing for input
				if(document.form1.email.value=="")
				{ alert("Please provide your Email Address.")
				document.form1.email.focus()
				return false }
				
				// Test for valid format
				var emailFilter=/^.+@.+\..{2,3}$/;
				
				if(!(emailFilter.test(document.form1.email.value)))
						{ alert("Please provide a valid Email Address format.");
						document.form1.email.focus(); 
						return false; }

			
// Address ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//  If Address Field Populated, subTest for valid characters:  alpha and dashes by matching illegal characters  
			if(!(document.form1.Address.value=="")) 
				{
					
					var illegalChars= /[\@\(\)\<\>\,\;\:\.\\\/\"\[\][}]/;  
				 
					if (document.form1.Address.value.match(illegalChars))
					{ alert("Address contains illegal characters. \n\n Please use only alpha characters, apostrophe and dashes");      
						document.form1.Address.focus();
						return false; }
				}	
// Address Continuation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//  If Field Populated, subTest for valid characters:  alpha and dashes by matching illegal characters  
			//if(!(document.form1.Address2.value=="")) 
				//{
					
					//var illegalChars= /[\@\(\)\<\>\,\;\:\.\\\/\"\[\][}]/;  
				 
					//if (document.form1.Address2.value.match(illegalChars))
					//{ alert("Address contains illegal characters. \n\n Please use only alpha characters, apostrophe and dashes");      
						//document.form1.Address2.focus();
						//return false; }
				//}	
				
				
// City ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//  If City Field Populated, subTest for valid characters:  alpha and dashes by matching illegal characters  
			if(!(document.form1.City.value=="")) 
				{
					
					var illegalChars= /[\@\(\)\<\>\,\;\:\.\\\/\"\[\][0-9}]/;  
				 
					if (document.form1.City.value.match(illegalChars))
					{ alert("City contains illegal characters. \n\n Please use only alpha characters, apostrophe and dashes");      
						document.form1.City.focus();
						return false; }
				}	
				
				
// State ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++					

// Zip Code ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++								

//  If Field Populated, subTest for for illegal characters (alpha-numeric valid for international postal codes) & correct length 
			if(!(document.form1.Zip.value==""))
					{
					// Test for correct length of field  
							theField = document.form1.Zip.value;
							theLength = theField.length;
		
							for (i=0; i<= theLength-1; i++);
					
							if(!((theLength == 5) || (theLength ==10)))
									{alert("The Zip Code entered is not a valid length. A minimum of 5 digits are required.");
									document.form1.Zip.focus();
									return false; }
									
						 	var illegalChars= /[\(\)\<\>\,\;\:\.\\\/\"\[\]\@}]/;  
 
							if (document.form1.Zip.value.match(illegalChars))
								{ alert("Zip Code contains illegal characters. \n\n Please use only alpha-numeric characters and dashes");  
									document.form1.Zip.focus();
									return false; }
						}
						

//  Valdiate phone number provided - if required, length, characters

		// Required - check for data
		if(document.form1.phone.value=="")
				{ alert("Please provide your phone number with Area Code. \n\n Please use only digits in this \n\n format 4563218790 and no spaces, ( ) or dashes");
				document.form1.phone.focus();
				return false; }

		// check that phone number contains all digits and is a valid length
			theField = document.form1.phone.value
			theLength = theField.length
			
			for (i=0; i<= theLength-1; i++)
			//{  is this bracket really required?
			
					//if(theField.charAt(i) < "0" || theField.charAt(i) > "9")
						//{alert("Phone must contain only numeric characters and dashes. \n\n Please use only digits in this \n\n format 1234567890 and no spaces, () or dashes");
						//document.form1.phone.focus();
						//return false; }
						
						var illegalChars= /[\<\>\,\;\:\.\\\/\"\[\]\@}[a-z}[A-Z}]/;  
 
							if (document.form1.phone.value.match(illegalChars))
								{ alert("Phone number contains illegal characters. \n\n Please use only numeric characters. Dashes & ( ) are automatically inserted");  
									document.form1.phone.focus();
									return false; }

						
			//}  is this bracket really required?

					if(!(theLength <= 13))
						{alert("The Telephone Number you entered is not a valid length.  Make sure you include both area code and number.");
						document.form1.phone.focus();
						return false; }


//  Valdiate fax number provided - if required, length, characters

		// Required - check for data
		//if(document.form1.fax.value=="")
				//{ alert("Please provide your fax number with Area Code. \n\n Please use only digits in this \n\n format 1234567890 and no spaces, ( ) or dashes");
				//document.form1.fax.focus();
				//return false; }

		// check that fax number contains all digits and is a valid length
			theField = document.form1.fax.value
			theLength = theField.length
			
			for (i=0; i<= theLength-1; i++)
			//{  is this bracket really required?
			
					//if(theField.charAt(i) < "0" || theField.charAt(i) > "9")
						//{alert("Fax number must contain only numeric characters and dashes. \n\n Please use only digits in this \n\n format 1234567890 and no spaces, ( ) or dashes");
						//document.form1.fax.focus();
						//return false; }
			//}  is this bracket really required?
						var illegalChars= /[\<\>\,\;\:\.\\\/\"\[\]\@}[a-z}[A-Z}]/;  
 
							if (document.form1.fax.value.match(illegalChars))
								{ alert("Fax number contains illegal characters. \n\n Please use only numeric characters. Dashes & ( ) are automatically inserted");  
									document.form1.fax.focus();
									return false; }


					if(!(theLength == 14) && !(document.form1.fax.value==""))
						{alert("The Fax Number you entered is not a valid length.  Make sure you include both area code and number.");
						document.form1.fax.focus();
						return false; }



			
			
//**********  If Comment Field Populated, subTest for valid characters:  alpha and dashes by matching illegal characters  
					if(!(document.form1.comments.value=="")) 
						{
							
							var illegalChars= /[\@\<\>\\\/\[\][}]/;  
						 
							if (document.form1.comments.value.match(illegalChars))
							{ alert("Comments Box contains illegal characters. \n\n Please use only alpha characters, apostrophe and dashes. \n\nPlease do not enter any email address in this text box.");      
								document.form1.comments.focus();
								return false; }
						}	
						
						

//Return confirmation to user that data entered correctly and now being submitted for processing
alert("Your form is being submitted and may take a few seconds. \n\n Please do not Click on SUBMIT again. \n\n Click \"OK\" and await your confirmation of successful submission. \n\n Thank you")

}


