﻿if (!northlich) {
    var northlich = new Object();
}
if (!northlich.validate) {
    northlich.validate = new Object();
}

if (!northlich.validate.Zip) {
    northlich.validate.Zip = new Object();
}

northlich.validate.Zip.CheckError = function(dspName, tagID, oErrorsTracker) {
    var oTxt = document.getElementById(tagID);
    var zip = oTxt.value;

    if (zip.replace(/ /g, '') == '')
        return;

    var oRe = /\b[0-9]{5}(?:-[0-9]{4})?\b/g;
    var matchA = zip.match(oRe);

    if (matchA == null || matchA[0].length != zip.length) {
        error_msg = "'" + dspName + "' is in valid: " + zip + ". The format should be '12345-1234'";
        oErrorsTracker.appendError(oTxt.id, error_msg);
    }

    
}
