<!--
	function prepFormFields() {
		var htmlElements = Array('select', 'input', 'textarea');
		var htmlTempArray;
		for (var i = 0; i < htmlElements.length; i++) {
			htmlTempArray = document.getElementsByTagName(htmlElements[i]);
			for (var j = 0; j < htmlTempArray.length; j++) {
				//if (this.getAttribute("hilight")) {
				//	htmlTempArray[j].onmouseover = htmlTempArray[j].onfocus = function() {this.className = this.getAttribute("hilight");}
				//} else { 
					htmlTempArray[j].onmouseover = htmlTempArray[j].onfocus = function() {this.className = "selected";}
				//}
				htmlTempArray[j].onmouseout = htmlTempArray[j].onblur = function() {this.className = "";}
			} // for
		} // for
	}

	function isNotEmpty(elem) {
		var str = elem.value;
		if(str == null || str.length == 0)
			return false;
		else
			return true;
	}
 
	// THIS FUNCTION PERFORMS VALIDATION BASED ON A SET OF CUSTOM HTML ATTRIBUTES
	function validate(form) {
		var attrVal, attrReg, attrEq, attrFail, strTemp;

		for (var i = 0; i < form.length; i++) {
			attrVal = form[i].getAttribute("validate");

			switch (attrVal) {
				case 'required' :
					if (!isNotEmpty(form[i])) {
						attrFail = form[i].getAttribute("failure");

						if (attrFail)
							alert(attrFail);
						else     
							alert('You must complete all required form fields.');
						
						form[i].focus();
						return false;
					} // if
					break;

				case 'regex' :
					attrReg = form[i].getAttribute("regex");
					if (attrReg != null && attrReg.length != 0) {
						var regex = new RegExp(attrReg);
						strTemp = form[i].value;
						if (!strTemp.match(regex)) {
							attrFail = form[i].getAttribute("failure");

							if (attrFail)
								alert(attrFail);
							else
								alert('Invalid data format at field "' + form[i].name + '".');
							form[i].focus();
							return false;
						} // if
					} // if
					break;
					
				case 'email' :
					var regex = new RegExp(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);
					strTemp = form[i].value;
					if (!strTemp.match(regex)) {
						attrFail = form[i].getAttribute("failure");

						if (attrFail)
							alert(attrFail);
						else
							alert('Invalid data format at field "' + form[i].name + '".');
						form[i].focus();
						return false;
					} // if
					break;
					
				case 'equals' :
					attrEq = form[i].getAttribute("equals");
					var objEq = document.getElementById(attrEq);
					if (objEq) {
						if (form[i].value != objEq.value) {
							attrFail = form[i].getAttribute("failure");

							if (attrFail)
								alert(attrFail);
							else
								alert('Form fields do not match');

							form[i].focus();
							return false;
						} // if
					} // if
					break;
			} // switch

		} // for

		return true;
	}
//-->
