function validate_email(theControl){if(theControl.value==""||theControl.value.length<=0){alert("I'm sorry. This email address must be filled in correct to send the form to our server. Please"
+" check the prefix and '@' sign.");theControl.focus()
return false;}
var reEmail=/^.+\@.+\..+$/
var holderValue;var thisValue=theControl.value;if((thisValue.substring(thisValue.length-4,thisValue.length).toLowerCase())=='@aol'||(thisValue.substring(thisValue.length-4,thisValue.length).toLowerCase())=='@msn'||(thisValue.substring(thisValue.length-6,thisValue.length).toLowerCase())=='@yahoo'||(thisValue.substring(thisValue.length-6,thisValue.length).toLowerCase())=='@lycos'||(thisValue.substring(thisValue.length-7,thisValue.length).toLowerCase())=='@excite'||(thisValue.substring(thisValue.length-10,thisValue.length).toLowerCase())=='@altavista'||(thisValue.substring(thisValue.length-11,thisValue.length).toLowerCase())=='@compuserve'||(thisValue.substring(thisValue.length-8,thisValue.length).toLowerCase())=='@prodigy'||(thisValue.substring(thisValue.length-8,thisValue.length).toLowerCase())=='@hotmail'||(thisValue.substring(thisValue.length-9,thisValue.length).toLowerCase())=='@netscape')
{holderValue=thisValue.concat('.com');thisValue=holderValue;theControl.value=thisValue;}
if((thisValue.substring(thisValue.length-5,thisValue.length).toLowerCase())=='@home')
{holderValue=thisValue.concat('.net');thisValue=holderValue;theControl.value=thisValue;}
var flagFirstCheck=(theControl.value.length<6)||(thisValue.indexOf('@')==-1)||(thisValue.indexOf('.')==-1)||(thisValue.indexOf('@',(thisValue.indexOf('@')+1))!=-1)||((thisValue.indexOf('.')+1)==thisValue.length)||((thisValue.indexOf('@')+1)==thisValue.length)
var flagSecondCheck=reEmail.test(thisValue)
if(flagFirstCheck||!flagSecondCheck)
{alert("I'm sorry. This email address seems to be incorrect. Please"
+" check the prefix and '@' sign.");theControl.focus()
return false;}
else{return true;}}
function validate_vin(theControl){if(theControl.value.length!=17)
{alert("I'm sorry. The VIN must be filled in correct to send the form to our server. Please"
+" enter 17 digits.");theControl.focus()
return false;}
else{return true;}}
function ValidateControl(control,prompt){if(control.value==""){alert("The "+prompt+" field is a required field, and it must be filled in before your form can be sent to our server.")
control.focus()
return false}
return true}
function SalesSubmitValidation(form){var count=0;if(!ValidateControl(form.country,'country'))return false
if(!ValidateControl(form.firstname,'First Name'))return false
if(!ValidateControl(form.lastname,'Last Name'))return false
if(!ValidateControl(form.address,'Address'))return false
if(!ValidateControl(form.city,'City'))return false
if(!ValidateControl(form.state,'State'))return false
if(!ValidateControl(form.zipcode,'Zip'))return false
if(!ValidateControl(form.captcha_code,'Security Code'))return false
if(form.AL.checked){count++;form.division.value=form.division.value+","+form.AL.value}
if(form.AV.checked){count++;form.division.value=form.division.value+","+form.AV.value}
if(form.BS.checked){count++;form.division.value=form.division.value+","+form.BS.value}
if(form.BL.checked){count++;form.division.value=form.division.value+","+form.BL.value}
if(form.CG.checked){count++;form.division.value=form.division.value+","+form.CG.value}
if(form.FZ.checked){count++;form.division.value=form.division.value+","+form.FZ.value}
if(form.HC.checked){count++;form.division.value=form.division.value+","+form.HC.value}
if(form.HI.checked){count++;form.division.value=form.division.value+","+form.HI.value}
if(form.HO.checked){count++;form.division.value=form.division.value+","+form.HO.value}
if(form.LA.checked){count++;form.division.value=form.division.value+","+form.LA.value}
if(form.MO.checked){count++;form.division.value=form.division.value+","+form.MO.value}
if(form.HM.checked){count++;form.division.value=form.division.value+","+form.HM.value}
if(form.MR.checked){count++;form.division.value=form.division.value+","+form.MR.value}
if(form.EN.checked){count++;form.division.value=form.division.value+","+form.EN.value}
if(form.OB.checked){count++;form.division.value=form.division.value+","+form.OB.value}
if(form.PM.checked){count++;form.division.value=form.division.value+","+form.PM.value}
if(form.PP.checked){count++;form.division.value=form.division.value+","+form.PP.value}
if(form.RP.checked){count++;form.division.value=form.division.value+","+form.RP.value}
if(form.RE.checked){count++;form.division.value=form.division.value+","+form.RE.value}
if(form.HR.checked){count++;form.division.value=form.division.value+","+form.HR.value}
if(form.SG.checked){count++;form.division.value=form.division.value+","+form.SG.value}
if(form.ST.checked){count++;form.division.value=form.division.value+","+form.ST.value}
if(form.SM.checked){count++;form.division.value=form.division.value+","+form.SM.value}
if(form.SY.checked){count++;form.division.value=form.division.value+","+form.SY.value}
if(form.XL.checked){count++;form.division.value=form.division.value+","+form.XL.value}
if(form.VL.checked){count++;form.division.value=form.division.value+","+form.VL.value}
if(count==0){alert("You must choose at least one brochure to proceed !");return false}
return true}
function SpecialsSubmitValidation(form){if(!ValidateControl(form.firstname,'Your First Name'))return false
if(!ValidateControl(form.lastname,'Your Last Name'))return false
if(!ValidateControl(form.address,'Your Address'))return false
if(!ValidateControl(form.city,'Your City'))return false
if(!ValidateControl(form.state,'Your State'))return false
if(!ValidateControl(form.zip,'Your Zip'))return false
if(!ValidateControl(form.phone,'Your Phone'))return false
return true}
function SalesSubmitValidation2(form){var count=0;if(!ValidateControl(form.country,'Country'))return false
if(!ValidateControl(form.firstname,'First Name'))return false
if(!ValidateControl(form.lastname,'Last Name'))return false
if(!ValidateControl(form.address,'Address'))return false
if(!ValidateControl(form.city,'City'))return false
if(!ValidateControl(form.state,'State'))return false
if(!ValidateControl(form.zipcode,'Zip'))return false
if(!ValidateControl(form.captcha_code,'Security Code'))return false
return true}
function MailSubmitValidation(form){if(!ValidateControl(form.firstname,'First Name'))return false
if(!ValidateControl(form.lastname,'Last Name'))return false
if(!ValidateControl(form.address,'Address'))return false
if(!ValidateControl(form.city,'City'))return false
if(!ValidateControl(form.state,'State'))return false
if(!ValidateControl(form.zipcode,'Zip'))return false
if(!ValidateControl(form.country,'country'))return false
if(form.division.value=="0"||form.division.value==""){alert("You must choose a product to proceed !");form.division.focus();return false}
if(!ValidateControl(form.captcha_code,'Security Code'))return false
return true}
function DownloadSubmitValidation(form){var Yoptin=document.getElementById('y');if(!ValidateControl(form.firstname,'First Name'))return false
if(!ValidateControl(form.lastname,'Last Name'))return false
if(!ValidateControl(form.zipcode,'Zip'))return false
if(form.division.value=="0"||form.division.value==""){alert("You must choose a product to proceed !");form.division.focus();return false}
if(Yoptin.checked&&form.email.value==""){alert("If you wish to Opt In, you must provide an email address");form.division.focus();return false}
if(!ValidateControl(form.captcha_code,'Security Code'))return false
return true}
function DownloadSubmitValidation2(form){if(!ValidateControl(form.realname,'Name'))return false
if(!ValidateControl(form.zipcode,'Zip'))return false
if(form.division.value=="0"||form.division.value==""){alert("You must choose a product to proceed !");form.division.focus();return false}
return true}
function FriendSubmitValidation(form){if(!validate_email(form.friend_email,'Your Friends email'))return false
if(!validate_email(form.your_email,'Your email'))return false
if(!ValidateControl(form.your_realname,'Your Name'))return false
if(!ValidateControl(form.friend_realname,'Friends Name'))return false
return true}
function SpecialsSubmitValidation(form){if(!validate_email(form.email,'Your Email'))return false
if(!ValidateControl(form.firstname,'Your First Name'))return false
if(!ValidateControl(form.lastname,'Your Last Name'))return false
if(!ValidateControl(form.address,'Address'))return false
if(!ValidateControl(form.city,'City'))return false
if(!ValidateControl(form.state,'State'))return false
if(!ValidateControl(form.zip,'Zip'))return false
if(!ValidateControl(form.phone,'Phone'))return false
return true}
function WarrantySubmitValidation(form){if(!validate_email(form.email))return false
if(!ValidateControl(form.realname,'Name'))return false
if(!ValidateControl(form.Address,'Address'))return false
if(!ValidateControl(form.City,'City'))return false
if(!ValidateControl(form.State,'State'))return false
if(!ValidateControl(form.ZipCode,'Zip'))return false
if(!ValidateControl(form.PhoneNumber,'Phone Number'))return false
if(form.division.value=="0"){alert("You must select a division to proceed !");form.division.focus();return false}
if(!ValidateControl(form.SerialNumber,'Serial Number'))return false
if(!validate_vin(form.VINNumber))return false
if(!ValidateControl(form.Comments,'Comments'))return false
return true}
function generalSubmitValidation(form){if(!validate_email(form.email))return false
if(!ValidateControl(form.realname,'Name'))return false
if(!ValidateControl(form.Address,'Address'))return false
if(!ValidateControl(form.City,'City'))return false
if(!ValidateControl(form.State,'State'))return false
if(!ValidateControl(form.ZipCode,'Zip'))return false
if(!ValidateControl(form.PhoneNumber,'Phone Number'))return false
if(!ValidateControl(form.Comments,'Comments'))return false
return true}
function webmasterSubmitValidation(form){if(!validate_email(form.email))return false
if(!ValidateControl(form.realname,'Name'))return false
if(!ValidateControl(form.Comments,'Comments'))return false
return true}
function dealerSubmitValidation(form){if(!ValidateControl(form.DealerNumber,'Dealer Number'))return false
if(!ValidateControl(form.DealerName,'Dealer Name'))return false
if(!ValidateControl(form.Address,'Address'))return false
if(!ValidateControl(form.City,'City'))return false
if(!ValidateControl(form.State,'State'))return false
if(!ValidateControl(form.ZipCode,'Zip'))return false
if(!validate_email(form.Email))return false
if(!ValidateControl(form.PhoneNumber,'Phone Number'))return false
return true}
function validateDealeremail(form){if(!ValidateControl(form.firstname,'First Name'))return false
if(!ValidateControl(form.lastname,'Last Name'))return false
if(!validate_email(form.Email))return false
if(!ValidateControl(form.question,'Question'))return false
return true}
function mediaValidation(form){if(!ValidateControl(form.fullname,'Full Name'))return false
if(!ValidateControl(form.email,'Email'))return false
if(!ValidateControl(form.comments,'Comments'))return false
return true}
function PhoneFormat(evt){IE=document.all;if(IE){var keycode=window.event.keyCode;var shift=window.event.shiftKey;var ctrl=window.event.ctrlKey;var alt=window.event.altKey;var pos=this.value.length+1;var lparen=(shift&&!ctrl&&!alt&&keycode==40);var rparen=(shift&&!ctrl&&!alt&&keycode==41);var space=(!shift&&!ctrl&&!alt&&keycode==32);var dash=(!shift&&!ctrl&&!alt&&keycode==45);var slash=(!shift&&!ctrl&&!alt&&keycode==47);var digit=(!shift&&!ctrl&&!alt&&keycode>=48&&keycode<=57);if(!lparen&&!rparen&&!space&&!dash&&!digit)return false;if(pos==1&&lparen)return true;if(pos==1&&digit){this.value='(';return true;}
if(pos==2&&digit)return true;if(pos==3&&digit)return true;if(pos==4&&digit)return true;if(pos==5&&rparen){this.value+=') ';return false;}
if(pos==5&&dash){this.value+=') ';return false;}
if(pos==5&&slash){this.value+=') ';return false;}
if(pos==5&&space){this.value+=') ';return false;}
if(pos==5&&digit){this.value+=') ';return true;}
if(pos==6&&space)return true;if(pos==6&&digit){this.value+=' ';return true;}
if(pos==7&&digit)return true;if(pos==8&&digit)return true;if(pos==9&&digit)return true;if(pos==10&&dash)return true;if(pos==10&&space){this.value+='-';return false;}
if(pos==10&&digit){this.value+='-';return true;}
if(pos==11&&digit)return true;if(pos==12&&digit)return true;if(pos==13&&digit)return true;if(pos==14&&digit)return true;}else{keycode=evt.which;var bs=String.fromCharCode(evt.which);if(keycode>=48&&keycode<=57)return true;if(keycode==0)return true;if((keycode==32)||(keycode>=40&&keycode<=41)||(keycode>=45&&keycode<=46))return true;if(bs=="\b")return true;if(keycode==13)wr4_hitReturn();return false;}
return false;}
function validateFeedback(form){if(!ValidateControl(form.name,'Full Name'))return false
if(!ValidateControl(form.email,'Email'))return false
if(!ValidateControl(form.comments,'Comments'))return false
return true}
function FSubmitValidation(form){if(form.division.value==""){alert('You MUST select a division');return false}
if((form.zip.value=="")&&(form.city.value==""||form.state.value=="")){alert("You must enter EITHER a zip code or city/state to proceed !");form.zip.focus();return false}
return true}
function check_division(){var i,ok=false;for(i=0;i<document.f.elements.length;i++){if(document.f.elements[i].name=='class_id[]'&&document.f.elements[i].checked){ok=true;break;}}
return ok;}
function PhoneFormat(evt){IE=document.all;if(IE){var keycode=window.event.keyCode;var shift=window.event.shiftKey;var ctrl=window.event.ctrlKey;var alt=window.event.altKey;var pos=this.value.length+1;var lparen=(shift&&!ctrl&&!alt&&keycode==40);var rparen=(shift&&!ctrl&&!alt&&keycode==41);var space=(!shift&&!ctrl&&!alt&&keycode==32);var dash=(!shift&&!ctrl&&!alt&&keycode==45);var slash=(!shift&&!ctrl&&!alt&&keycode==47);var digit=(!shift&&!ctrl&&!alt&&keycode>=48&&keycode<=57);if(!lparen&&!rparen&&!space&&!dash&&!digit)return false;if(pos==1&&lparen)return true;if(pos==1&&digit){this.value='(';return true;}
if(pos==2&&digit)return true;if(pos==3&&digit)return true;if(pos==4&&digit)return true;if(pos==5&&rparen){this.value+=') ';return false;}
if(pos==5&&dash){this.value+=') ';return false;}
if(pos==5&&slash){this.value+=') ';return false;}
if(pos==5&&space){this.value+=') ';return false;}
if(pos==5&&digit){this.value+=') ';return true;}
if(pos==6&&space)return true;if(pos==6&&digit){this.value+=' ';return true;}
if(pos==7&&digit)return true;if(pos==8&&digit)return true;if(pos==9&&digit)return true;if(pos==10&&dash)return true;if(pos==10&&space){this.value+='-';return false;}
if(pos==10&&digit){this.value+='-';return true;}
if(pos==11&&digit)return true;if(pos==12&&digit)return true;if(pos==13&&digit)return true;if(pos==14&&digit)return true;}else{keycode=evt.which;var bs=String.fromCharCode(evt.which);if(keycode>=48&&keycode<=57)return true;if(keycode==0)return true;if((keycode==32)||(keycode>=40&&keycode<=41)||(keycode>=45&&keycode<=46))return true;if(bs=="\b")return true;if(keycode==13)wr4_hitReturn();return false;}
return false;}
