		<!--Validate Form-->		
		function validateFormOnSubmit(theForm) 
		{
		 		// validation fails if the input is blank 
		 		if(theForm.fname.value == '') 
		 		{ 
		 			alert("Error: Input is empty!"); 
		 			theForm.fname.focus(); 
		 			theForm.fname.style.background = '#f9ebc8';
		 			
		 			return false;
		 			
		 		} 
		 		
		 		if(theForm.lname.value == '') 
		 		{ 
		 			alert("Error: Input is empty!"); 
		 			theForm.lname.focus();  
		 			theForm.lname.style.background = '#f9ebc8';
		 			return false;  
		 		}
		 		
		 		// regular expression to match alphanumeric characters and spaces 
		 		var re = /^[\w ]+$/; // validation fails if the input doesn't match the regular expression 
		 		
		 		if(!re.test(theForm.fname.value)) 
		 		{ 
		 			alert("Error: Input contains invalid characters!"); 
		 			theForm.fname.focus();
		 			theForm.fname.style.background = '#f9ebc8';
		 			return false;  
		 		} 
		 		
		 		if(!re.test(theForm.lname.value)) 
		 		{ 
		 			alert("Error: Lname Input contains invalid characters!"); 
		 			theForm.lname.focus();
		 			theForm.lname.style.background = '#f9ebc8'; 
		 			return false;  
		 		} 
		 		
		 		//Validate Email
		 		function trim(s)
				{
				  return s.replace(/^\s+|\s+$/, '');
				}

		 		
				var error="";
				var emailStr = theForm.email.value;
				
				
				var tfld = trim(emailStr);                        
				
				// value of field with whitespace trimmed off
				var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
				var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
			   
				if (emailStr == "") {
					theForm.email.style.background = '#f9ebc8';
					error = "You didn't enter an email address.\n";
					alert(error);
					return false;
				} 
					else if (!emailFilter.test(tfld))
				{   
					//test email for illegal characters
					theForm.email.style.background = '#f9ebc8';
					error = "Please enter a valid email address.\n";
					alert(error);
					return false;
				} 
					else if (emailStr.match(illegalChars)) 
				{
					theForm.email.style.background = '#f9ebc8';
					error = "The email address contains illegal characters.\n";
					alert(error);
					return false;
				}
			 		
		 		// validation was successful
		 		return true; 
		}
		
		
	
