<!--
//A utility function that returns true if a string contains only whitespace characters
function isblank(s) {
	for (var i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '')) return false;
	}
	return true;
}

//Form verification function, invoked from the onsubmit event handler. The handler should return whatever value this function returns.
function AD_verify(formname) {
	var msg;
	var empty_fields = "";
	var errors = "";
	for (var i = 0; i < formname.elements.length; i++) {
		var e = formname.elements[i]; 
		//Check only Text and Textarea elements that have "req_" in their names (ex.: req_your_email ) //
		if ( ((e.type == "text") || (e.type == "textarea") || (e.type == "radio") || (e.type == "checkbox")) && (e.name.search(/req_/i) != -1) ) {
			//First check if the field is empty
			//alert(e.value);////////////////
			if ((e.value == null) || (e.value == "") || isblank(e.value)) {
				var name_edited = e.name.replace(/req_/i, '');
				name_edited = name_edited.replace(/_/g, ' ');
				empty_fields += "\n -- " + name_edited;
				continue;
			}
			//Now check for fields that are supposed to be numeric (ex.: this.zip.min = 0; this.zip.max = 99999; )
			if (e.numeric || (e.min != null) || (e.max != null)) {
				var v = parseFloat(e.value);
				if ( isNaN(v) || ((e.min != null) && (v < e.min)) || ((e.max != null) && (v > e.max)) ) {
					errors += "- The field '" + e.name + "' must be a number";
					if (e.min != null) errors += " that is greater than " + e.min;
					if (e.max != null && e.min != null) errors += " and less then " + e.max;
					else if (e.max != null) errors += " that is less then " + e.max;
					errorst += ".\n";
				}
			}
		}
	}
	//Now, if there's any errors, submit the form....
	if (!empty_fields && !errors) return true;
	//...otherwise, display the message and return false
	msg = "Sorry, the form was not submitted because of the following error(s). Please correct them and re-submit the form.\n";
	if (empty_fields) {
		msg += "- These reguired field(s) are empty: " + empty_fields + "\n";
		if (errors) msg += "\n";
	}
	msg += errors;
	alert(msg);
	return false;
}
//-->