// calculate script
function countit(what){
formcontent=what.form.description.value
what.form.displaycount.value=formcontent.length
}
//-->

// Start Form Check
	function validEmail(inEmail) {
		invalidChars = "/:,;"
		if (inEmail == "") {
			return false; }
		for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i)
		if (inEmail.indexOf(badChar,0) > -1) {
				return false; }
			}
			atPos = inEmail.indexOf("@",1)
		if (atPos == -1) {
				return false; }
		if (inEmail.indexOf("@",atPos+1) > -1) {
				return false; }
			periodPos = inEmail.indexOf(".",atPos)
		if (periodPos == -1) {
				return false; }
		if (periodPos+3 > inEmail.length) {
				return false; }
		else {
				return true; }
	}
	
function validForm(contact) {
		// check bio length
		var maxlength=600
			if (contact.description.value.length>maxlength){
			alert("Your Description is Longer Then 600 Characters. Please Go Back and Edite Your Description.")
			return false; }

			if (contact.first_name.value == "") {
			alert("Please Enter Your First Name")
			contact.first_name.focus()
			return false; }
			
			if (contact.last_name.value == "") {
			alert("Please Enter Your Last Name.")
			contact.last_name.focus()
			return false; }
			
			if (contact.address.value == "") {
			alert("Please Enter Address.")
			contact.address.focus()
			return false; }
			
			if (contact.city.value == "") {
			alert("What City Do You Live In?")
			contact.city.focus()
			return false; }
			
			stateChoice = contact.state.selectedIndex
			if (contact.state.options[stateChoice].value == "") {
			alert("You Must Select a State")
			return false; }
					
			if (contact.zip.value == "") {
			alert("We'll Need Your Zip Code")
			contact.zip.focus()
			return false; }
			
			if (contact.state.value == "") {
			alert("You Must Select a State")
			return false; }

			if (contact.home_phone_areacode.value == "") {
			alert("Enter Your Area Code")
			contact.home_phone_areacode.focus()
			return false; }
			
			if (contact.home_phone_prefix.value == "") {
			alert("What Are theNnext 3 Numbers?")
			contact.home_phone_prefix.focus()
			return false; }
			
			if (contact.home_phone_sufix.value == "") {
			alert("Please Enter the Last 4 Numbers")
			contact.home_phone_sufix.focus()
			return false; }
			
			if (contact.email.value == "") {
			alert("You Must Enter an Email Address")
			contact.email.focus()
			return false; }
			
			if (!validEmail(contact.email.value)) {
			alert("You Must Enter a Valid Email Address")
			contact.email.focus()
			return false; }
			
			if (contact.found_us.value == "") {
			alert("Please Let Us Know How You Found Our Site")
			contact.found_us.focus()
			return false; }
			
			categoryChoice = contact.category.selectedIndex
			if (contact.category.options[categoryChoice].value == "") {
			alert("Select A Category")
			return false; }

			if (contact.make.value == "") {
			alert("Please Enter a Make")
			contact.make.focus()
			return false; }
			
			if (contact.model.value == "") {
			alert("Please Enter a Model")
			contact.model.focus()
			return false; }

			if (contact.year.value == "") {
			alert("Please Enter a Year")
			contact.year.focus()
			return false; }
			
			if (contact.description.value == "") {
			alert("Please Enter a Description 500 Characters or Less")
			contact.description.focus()
			return false; }
			
			if (contact.upload_file.value == "") {
			alert("Please Attach at Least One File")
			contact.upload_file.focus()
			return false; }
			}	
//-->

//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}
