
if (document.getElementById("miniform1_mf_Btn")) {
document.getElementById("miniform1_mf_Btn").onclick = validateMiniForm;
}
/* Validate MiniForm - Name / Phone No
-------------------------------------*/
function validateMiniForm() {
	var f = document.forms[0];
	var isValid = true;
	var errors = "Please amend the following errors:     \n";
	if ( (Trim(f.miniform1_mf_name.value).length == 0) || (f.miniform1_mf_name.value == "Name...") ) {
		errors += "Please enter your name.\n";
		isValid = false;
	}
	if ( (Trim(f.miniform1_mf_phone.value).length == 0) || (f.miniform1_mf_phone.value == "Phone No...") ) {
		errors += "Please enter your Contact Phone Number.\n";
		isValid = false;
	} else {
		if (!checkForNumericChars("miniform1_mf_phone")) {
			errors += "Please enter a valid Contact Phone Number.\n";
			isValid = false;
		}
	}
	if (!isValid) {
		alert(errors);
		return false;
	} else {
		return true;
	}
}


var numericChars = "1234567890() ";

/* Check Numeric field for illegal characters
----------------------------------------*/
function checkForNumericChars(elname) {
	var allowed = true;
	var val = document.getElementById(elname).value.toLowerCase();
	if (val.length != 0) {
		for (x=0; x < val.length; x++) {
			if (numericChars.indexOf(  val.charAt(x)) == -1) {
				allowed = false;
			}
		}
	}
	return allowed;
}
