    // Validator Object
    var valid = new Object();

    // REGEX Elements

        // matches zip codes
        valid.zipCode = /\d{5}(-\d{4})?/;

        // matches $17.23 or $14,281,545.45 or ...
        valid.Currency = /\$\d{1,3}(,\d{3})*\.\d{2}/;

        // matches 5:04 or 12:34 but not 75:83
        valid.Time = /^([1-9]|1[0-2]):[0-5]\d$/;

        //matches email
        valid.emailAddress = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;

        // matches phone ###-###-####
        valid.phoneNumber = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;

        // International Phone Number
        valid.phoneNumberInternational = /^\d(\d|-){7,20}/;

        // IP Address
        valid.ipAddress = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;

        // Date xx/xx/xxxx
        valid.Date = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;

        // State Abbreviation
        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;

        // Social Security Number
        valid.SSN = /^\d{3}\-?\d{2}\-?\d{4}$/;
        
        //numeric data
        valid.numeric = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
        
        //strings
        valid.string = /[\w]/;
        
        //password length doesn't matter, but the password must contain at least 1 number, at least 1 lower case letter, and at least 1 upper case letter. 
        valid.password = /^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$/;

        
        

    
    function validateForm(theForm) {

        var elArr = theForm.elements; 
		

        for(var i = 0; i < elArr.length; i++) {
			
				
           with(elArr[i]) { 

              /**
			  * fix for firefox & opera browsers to access the validator attribute. needs work
			  * old method (ie only): var v = elArr[i].validator; 
			  */
			  var v = elArr[i].getAttribute("validator");
			
              if(!v) continue; 

              var thePat = valid[v]; 
              var gotIt = thePat.exec(value); 

              if(! gotIt){
              	 displayName = breakUnderscores(elArr[i].name);
              	 //switch statement allows us to tailor the information being displayed to the user.
              	 switch (v) {
              	 	case 'password':
              	 		alert("Please make sure your passowrd meets the following criteria:\n\n- Must be atleast 8 characters in length.\n- Must contain at least 1 number.\n- Must contain at least one uppercase and one lowercase letter.\n- Can NOT contain 3 or more occurrences of the same character.");
              	 		break;
              	 	default:
              	 		alert("Please enter required field - " + displayName );
              	 		break;
              	 }
                                   
                 elArr[i].select();
                 elArr[i].focus(); 
                 return false;
              }
           }
        }

        return true;
    }
    
    function breakUnderscores(name) {
    	name = name.replace(/_/g," ");
    	
    	return name;
    }