function toForm() { document.form.firstname.focus(); // Replace field1 in the script with the field name of which you want to place the focus. } // End --> var isNN = (navigator.appName.indexOf("Netscape")!=-1); function autoTab(input,len, e) { var keyCode = (isNN) ? e.which : e.keyCode; var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; if(input.value.length >= len && !containsElement(filter,keyCode)) { input.value = input.value.slice(0, len); input.form[(getIndex(input)+1) % input.form.length].focus(); } function containsElement(arr, ele) { var found = false, index = 0; while(!found && index < arr.length) if(arr[index] == ele) found = true; else index++; return found; } function getIndex(input) { var index = -1, i = 0, found = false; while (i < input.form.length && index == -1) if (input.form[i] == input)index = i; else i++; return index; } return true; } function checkInput(form) { errorText = "The following fields are missing or invalid\n"; submitForm = true; custtest=false; //check input parameters //validate first name if(form.firstname.value=="" || form.firstname.value==" ") { errorText += "- Please enter your first name\n"; submitForm=false; } //validate last name if(form.lastname.value=="" || form.lastname.value==" ") { errorText += "- Please enter your last name\n"; submitForm=false; } //validate address if(form.addone.value=="" || form.addone.value==" ") { errorText += "- Please enter a service address\n"; submitForm=false; } //validate city if(form.city.value=="" || form.city.value==" ") { errorText += "- Please enter your city\n"; submitForm=false; } //validate state if ((( (form.state.value=="") || (form.state.value.length<2))) || (form.state.value.length>0) && ((!isNaN(form.state.value.charAt(0))) || (!isNaN(form.state.value.charAt(1))) || (form.state.value.length < 2))) { errorText+= "- Please enter a valid state\n"; submitForm = false; } //validate zipcode if( (form.zipcode.value=="") || (isNaN(form.zipcode.value)) || form.zipcode.value.length<5) { errorText += "- Please enter a valid zip code\n"; submitForm=false; } //validate zip code extension if (form.plusfour.value.length>0) { if (isNaN(form.plusfour.value) || (form.plusfour.value.length<4)) { errorText+= "- Please enter a valid zip code extension\n"; submitForm=false; } } //validate daytime phone number if ( ((form.dayareacode.value.length>0) && (isNaN(form.dayareacode.value) || (form.dayareacode.value.length<3))) || ((form.daycitycode.value.length>0) && (isNaN(form.daycitycode.value) || (form.daycitycode.value.length<3))) || ((form.dayextension.value.length>0) && (isNaN(form.dayextension.value) || (form.dayextension.value.length<4))) || ((form.dayextn.value.length>0) && isNaN(form.dayextn.value)) ) { errorText+= "- Please enter a valid daytime phone number\n"; submitForm=false; } //validate fax phone number if ( ((form.faxareacode.value.length>0) && (isNaN(form.faxareacode.value) || (form.faxareacode.value.length<3))) || ((form.faxcitycode.value.length>0) && (isNaN(form.faxcitycode.value) || (form.faxcitycode.value.length<3))) || ((form.faxextension.value.length>0) && (isNaN(form.faxextension.value) || (form.faxextension.value.length<4))) ) { errorText+= "- Please enter a valid fax phone number\n"; submitForm=false; } //check email field for value if(form.email.value.length==0) { errorText += "- Please enter a valid e-mail address\n"; submitForm = false; } else if(form.email.value.indexOf("@")==-1) { errorText += "- Please enter a valid e-mail address\n"; submitForm = false; } else if(form.email.value.indexOf(".", form.email.value.indexOf("@"))==-1) { errorText += "- Please enter a valid e-mail address\n"; submitForm = false; } //is customer selected for(i=0;i