function validAll(){
	document.frm.reset();
	validField(document.frm.name, "reqName", "Contact Name");
	validField(document.frm.contact, "reqContact", "Contact Number");
	validField(document.frm.email, "reqEmail", "Email Address");
	validField(document.frm.vcode, "reqCode", "Verification Code");
}


function checkAll(){

	var eMsg="";
	var isOK=true;
	if(document.frm.name.value==""){
		eMsg += "Contact Name is required<br>";
	}
	if(document.frm.contact.value==""){
		eMsg += "Contact Number is required<br>";
	}
	if(document.frm.email.value==""){
		eMsg += "Email Address is required<br>";
	} else {
		var testresults;
		var str=document.frm.email.value;
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if (filter.test(str)){
		}else{
			eMsg += "Please input a valid email address!<br>";
		}
	}

	if(document.frm.remarks.value==""){
		eMsg += "Remarks is required<br>";
	}

	if(document.frm.vcode.value==""){
		eMsg += "Verification Code is required<br>";
	} else {
		if(document.frm.gencode.value != document.frm.vcode.value){
			eMsg += "Verification Code is NOT MATCH<br>";
		}
	}

	if(eMsg !=""){
		eMsg = "The following field information is required:<br>" + eMsg;
		//goto top
		isOK = false;


if(document.getElementById('abox')!=null){
document.getElementById('ibox').removeChild(document.getElementById('abox'));	
}

var newdiv = document.createElement('div');
  var divIdName = 'abox';
  newdiv.setAttribute('id','abox');
  newdiv.setAttribute('name','abox');	
  newdiv.setAttribute('class','alert');	
  newdiv.setAttribute('className','alert');	
  newdiv.innerHTML = eMsg;
document.getElementById('ibox').appendChild(newdiv);
document.location.href="#top";
	} else {
	isOK=true;
document.getElementById('ibox').removeChild(document.getElementById('abox'));

	}
	return isOK;

}

function validField(f, msg, n){

	if(f.value==""){
		f.className="man";
		document.getElementById(msg).innerHTML = n + " is required";
	}else{
		f.className="normal";
		document.getElementById(msg).innerHTML = n + " is filled";
	}

}
