//-----------------------------------------------------------------------//
function validZip(sZip)                                                  //
//-----------------------------------------------------------------------//
//          function name: validZip()                                    //
//             created by: Dustin Brown                                  //
//             created on: 2/20/2001                                     //
//                purpose: determine if 'sZip' is a valid zip code. the  //
//                         valid formats are '99999', '99999-9999', and  //
//                         '999999999'.                                  //
//             parameters: 'sZip' - the zip code to be evaluated.        //
//                returns: true if 'sZip' is a valid zip code.           //
// include files required: stripChars.js                                 //
//-----------------------------------------------------------------------//
{
    //check to see if '-' delimiter is in 'sZip'
    if(sZip!=stripChars(sZip)){
        //'-' must be at position 5
        if(sZip.charAt(5)!="-")return false;
        sZip=stripChars(sZip);
        //'sZip' minus any non-numeric characters must contain 9 digits
        return (sZip.length==9);
    }

    //'sZip' must either be 5 or 9 characters long
    return ((sZip.length==5)||(sZip.length==9));
}
//End function validZip()------------------------------------------------//