//--------------------------------------------------------------
// dealerapp.js
// used by dealerapp.php
//--------------------------------------------------------------
	function isNum(passedValue) {
			if (passedValue=="") {
				return false
			}
			
			for (i=0; i<passedValue.length; i++) {
				if (passedValue.charAt(i) < "0") {
					return false
				}
				if (passedValue.charAt(i) > "9") {
					return false
				}
			}
			return true
	}
	
	function validEmail(email) {
		invalidChars = " /:,;"

		if (email == "") {
			return false
		}
		
		for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) > -1) {
				return false
			}
		}
	
		atPos = email.indexOf("@",1)
		
		if (atPos == -1) {
			return false
		}
		
		if (email.indexOf("@",atPos+1) > -1) {
			return false
		}
		
		periodPos = email.indexOf(".",atPos)
		
		if (periodPos == -1) {
			return false
		}
		
		if (periodPos+3 > email.length)	{
			return false
		}
		
		return true
	}
	
function validatePSForm(myForm) 	{
	
		if (myForm.ps_description.value == "") {
			alert("You must enter a product description.")
			myForm.ps_description.focus()
			return false
		}

		if (myForm.ps_applications.value == "") {
			alert("You must enter potential applications.")
			myForm.ps_applications.focus()
			return false
		}

		if (!validEmail(myForm.ps_email.value)) {
			alert("Please enter a valid email address.")
			myForm.ps_email.focus()
			return false
		}

		if (myForm.ps_agree.checked == false) {
			alert("You must read the agreement and check the confirmation checkbox in order to proceed.")
			myForm.ps_agree.focus()
			return false
		}
}


