<script language="JavaScript">
function validateForm(form){
	// Check to see if company Name is Blank - alert user if blank and focus
	if (form.Company.value==""){
		alert("Please enter your company name")
		form.Company.focus()
	return false;
	}

		// Check to see if Last Name is Blank - alert user if blank and focus
	if (form.FirstName.value==""){
		alert("Please enter your first name")
		form.FirstName.focus()
	return false;
	}
	
	
	// Check to see if Last Name is Blank - alert user if blank and focus
	if (form.LastName.value==""){
		alert("Please enter your last name")
		form.LastName.focus()
	return false;
	}
	
		// Check to see if phone is Blank - alert user if blank and focus
	if (form.Phone.value==""){
		alert("Please enter your phone number")
		form.Phone.focus()
	return false;
	}
	//Check to see if email is vaild
	if (!validEmail(form.Email.value)) {
		form.Email.focus()
		form.Email.select()
	return false;
	}
	
	// Check to see if partnumber is Blank - alert user if blank and focus
	if (form.Partnumber.value==""){
		alert("Please enter the partnumber")
		form.Partnumber.focus()
	return false;
	}
	// Check to see if lot number is Blank - alert user if blank and focus
	if (form.Lotnumber.value==""){
		alert("Please enter the lot number")
		form.Lotnumber.focus()
	return false;
	}
	
return true; //end of validateForm()
}

function validEmail(email){
	//Check to see if email is empty
	if (email == ""){							
		alert("Please enter your email address.")
	return false
	}
	
	//does it contain any invalid characters?
	invalidChars = " / : , ; "
	for (i=0; i < invalidChars.length; i++) {
	badChar = invalidChars.charAt(i)
	if (email.indexOf (badChar,0) > -1) {
		alert("The '" + badChar + "'" + " character is not allowed in your email address.")
	return false
	}
	}
	
	// there must be on "@" symbol in address
	atPos = email.indexOf ("@",1)
	if (atPos == -1){
		alert("Missing '@' symbol in your email address.")
	return false
	}
	
	// and only on "@" symbol
	if (email.indexOf("@", atPos+1) != -1){
		alert("Only one '@' symbol is allowed in your email address.")
	return false
	} 
	
	//and at least one"." after the "@"
	periodPos = email.indexOf(".", atPos)
	if (periodPos == -1){
		alert("Your domain address appears to be incomplete. Please check for a missing period.")			
	return false
	}
	
	//must be at least 2 characters after the "."
	if (periodPos+3 > email.length) {
		alert("Your domain address appears to be incomplete. Please make sure the suffix is at least two characters long.")
	return false
	}

return true //end email function
}
</script>