		//
		// FIELD TYPE VALIDATION
		//
		
		var failedFields = '';
		
		function addFailure(name) {
			if ( failedFields != '' ) failedFields = failedFields + ', ';
			failedFields = failedFields + name;
		}
		function isEmail(name) {
			val = document.getElementById(name).value;
			reg = /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
			OK = reg.test(val);
			if ( !OK ) { addFailure(name); }
			return OK;
		}
		
		function isPhone(name) {
			val = document.getElementById(name).value;
			reg = /^[\(]*[0-9]{3}[\) -]*[0-9]{3}[ -]*[0-9]{4}$/;
			OK = reg.test(val);
			if ( !OK ) { addFailure(name); }
			return OK;
		}
		
		function isZip(name) {
			val = document.getElementById(name).value;
			reg = /^(\d{5}-[0-9]{4}|\d{5})$/;
			OK = reg.test(val);
			if ( !OK ) { addFailure(name); }
			return OK;
		}
		
		function isSSN(name) {
			val = document.getElementById(name).value;
			reg = /^([0-9]{3})[ -]*([0-9]{2})[ -]*([0-9]{4})$/;
			OK = reg.test(val);
			if ( !OK ) { addFailure(name); }
			return OK;
		}
		
		function isDate(name) {
			val = document.getElementById(name).value;
			reg = /^([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{2,4})$|^([0-9]{2,4})[/-]([0-9]{1,2})[/-]([0-9]{1,2})$/;
			OK = reg.test(val);
			if ( !OK ) { addFailure(name); }
			return OK;
		}
		
		//for input fields and select option fields
		function isNotEmpty(name) {
			val = document.getElementById(name).value;
			if ( val != '' ) return true;
			addFailure(name);
			return false;
		}
		
		//for radio buttons and check boxes
		function radioOK() {
            // example: radioOK('Q8', 'Q8_1', 'Q8_2', 'Q8_3');
            var ok = false;
            var a = radioOK.arguments;
            for(i=1; i<a.length; i++) {
                if ( !ok ) {
                    ok = document.getElementById(a[i]).checked;
                }
            }
            if ( !ok ) {
                addFailure(a[0]);
            }
            return ok;
        }

