function SetCookie() { with(document.CarSelector) { document.cookie = "ZipCookie=" + zipCode.value;} } function GetCookie(strValue) { var strSearch = strValue + "=" var strResponse = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(strSearch) if (offset != -1) { offset += strSearch.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; strResponse = unescape(document.cookie.substring(offset, end)) } } return strResponse;} function RestoreZipText(strInitialValue) { if (document.CarSelector.zipCode.value == "") { document.CarSelector.zipCode.value = (baseZip == "") ? strInitialValue : baseZip;} } function ClrZipTxt(strInitialValue) { if (document.CarSelector.zipCode.value == strInitialValue) { document.CarSelector.zipCode.value = "";} } function validateZIP(field) { var valid = "0123456789-"; var hyphencount = 0; if (field.length!=5) { alert("Please enter your 5 digit zip code."); return false; } for (var i=0; i < field.length; i++) { temp = "" + field.substring(i, i+1); if (temp == "-") hyphencount++; if (valid.indexOf(temp) == "-1") { alert("Invalid characters in your zip code. Please try again."); return false; } if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) { alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'. Please try again."); return false; } } return true; } function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }