  var valid = new Object();

    valid.zipCode = /^\d{5}(-\d{4})?$/;
    valid.Time = /^([1-9]|1[0-2]):[0-5]\d$/;
    valid.emailAddress = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/;
    valid.phoneNumber = /^^(\(?[0-9]{3}[\)-\.]?\ ?)?[0-9]{3}[-\.]?[0-9]{4}$/;
    valid.Date = /^\d{1,2}\/\d{1,2}\/\d{2,4}$/;
    valid.State = /^(AK|AL|AR|AZ|CA|CO|CT|DC|DE|FL|GA|HI|IA|ID|IL|IN|KS|KY|LA|MA|MD|ME|MI|MN|MO|MS|MT|NB|NC|ND|NH|NJ|NM|NV|NY|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VA|VT|WA|WI|WV|WY)$/i;
    valid.NotEmpty = /^[\w\W]+$/;
    valid.PUAccount = /\d{3}-\d{6}-\d{7}/;
       
    function validateForm(theForm) {

        document.getElementById('referer').value = document.getElementById('ctl00_var_form_referer').value
        
        var elArr = theForm.elements; 

        for(var i = 0; i < elArr.length; i++) {

           with(elArr[i]) { 
           
             var v = elArr[i].getAttribute('validator'); 

             if(!v) continue; 

              var thePat = valid[v]; 

              var gotIt = thePat.exec(value); 

             if(! gotIt){
                alert("Invalid or missing information for " + name + ". Please correct.");                  
                elArr[i].select();
                elArr[i].focus(); 
                return false; } } }
    
        // Custom Script for Graffiti Form
        if (theForm.getAttribute('recipient').value == "c_graffiti") {
        
            if (theForm.getAttribute('radio1').checked) {
                theForm.getAttribute('recipient').value = "pwclrks@vbgov.com,vbpd@vbgov.com"; }
            if (theForm.getAttribute('radio2').checked) {
                theForm.getAttribute('recipient').value = "pio@vbgov.com,vbpd@vbgov.com"; }
            if (theForm.getAttribute('radio3').checked) {
                theForm.getAttribute('recipient').value = "housenp@VBgov.com,vbpd@vbgov.com"; } }
         
         return true; }