// JavaScript Document
<!--
	function checkMail(str){
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(str))
			return true;
		else
			return false;
	}

	function checkPhone(str){
		var ts = str.replace(" ","");
		if(ts.length < 11)
			return false;
		else
			return true;
	}

	function checkCallBackMethod(id){
		
	}
	
	function checkCallBack(t){
		// accepts the form as an arg. Does basic field validation and focuses on first failing field.
		var i=0;
		var msg = "Please make the following change(s):";
		var fcs = "";
		
		if(t["contactName"].value == ""){
			i++;
			msg += "\n"+i+") Please enter a contact name.";
			fcs = t["contactName"];
		}
		
		if(t["contactUsing_email"]){
			if( (t["contactUsing_email"].checked == true) && ( (t["contactEmail"].value == "") || (!checkMail(t["contactEmail"].value)) ) ){
				i++;
				msg += "\n"+i+") Please enter a valid email address.";
				if(fcs == "")
					fcs = t["contactEmail"];
			}
		}
		
		if( ( (t["contactUsing_tel"]) && (t["contactUsing_tel"].checked == true) ) || (!(t["contactUsing_email"])) ){
			if( (t["contactTel"].value == "") || (!checkPhone(t["contactTel"].value)) ){
				i++;
				msg += "\n"+i+") Please enter a valid contact number, including your std code.";
				if(fcs == "")
					fcs = t["contactTel"];
			}
		}

		if(i != 0){
			alert(msg);
			fcs.focus();
			return false;
		}else{
			return true;
		}
	}
//-->
