//verify function to verify all inputs with a set pattern
function verify(frmElem){
    var regex, pattern, errmsg, fid;
    var result;
    //loop through all form elements
    for(var i = 0;i < frmElem.length;i++){
        //try to grab the pattern
        fid = frmElem.elements[i].id;
        pattern = document.getElementById(fid).getAttribute("testcode");
        errmsg  = document.getElementById(fid).getAttribute("testerror");
        //make sure there was a pattern
        if(!(pattern===null)){
            //create a regexp object with the specified pattern
            regex = new RegExp(pattern,"i");
            //test the value with the supplied pattern
            if(!(regex.test(frmElem.elements[i].value))){
                //oops, incorrect entry, get the error message
                //if there wasn't one, make one up
                if(errmsg===undefined){
                    errmsg = "Please double check the selected entry, it is incorrectly formated."
                }
                //do a std error reaction
                alert(errmsg);
                frmElem.elements[i].focus();
                return false;
            }
        }
    }
    return true;
}