function validate()
{
    var problem;
    problem = false;
    document.form_one.zip.value = trim(document.form_one.zip.value);
    if (document.form_one.zip) {
        if (!validate_zip(document.form_one.zip.value)) {
            //msg = ("valid Zip Code ") + msg;
            problem = true;
            document.form_one.zip.focus();
            if (document.images["img_zip"]) document.images["img_zip"].src = "/icons/exclamation.gif";
        }
    }
    
    if (problem) {
        //alert(msg);
    } else {
        document.form_one.submit();
    }
}

<!-- Begin
function validate_zip(field) {
    var valid = "0123456789-";
    var hyphencount = 0;
    
    if (field.length!=5 && field.length!=10) {
    //alert("Please enter your 5 digit or 5 digit+4 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;
}
//  End -->

function trim(s) 
{
  // Remove leading spaces and carriage returns
  
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns

  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}
