function validateContact(myForm){
	if(checkEmpty(myForm.txtComment,'Comment',true)) return false;	
	if(checkEmpty(myForm.txtCategory,'Category',true)) return false;	
	if(checkEmpty(myForm.txtName,'Name',true)) return false;
	if(checkEmpty(myForm.txtCompany,'Company',true)) return false;
	if(checkEmpty(myForm.txtAddress,'Address',true)) return false;
	if(checkEmpty(myForm.txtTelephone,'Telephone',true)) return false;
	if(checkEmpty(myForm.txtFAX,'Fax',true)) return false;
	if(checkEmpty(myForm.txtEmail,'Email',true)) return false;
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.txtEmail.value))
		return true;
	else
	{
		alert("Invalid Email Address...");
		myForm.txtEmail.select();
		myForm.txtEmail.focus();
		return false;
	}
}
function checkEmpty(control, msgText, showMsg) {
//returns true if control fails to validate.
	var strTmp = control.value;
	if(strTmp.indexOf("\t") > -1) {
		alert('Invalid character {Tab} found in \'' + msgText + '\'.');
		control.focus();
		control.select();
		return true;
	}
	do {
		strTmp = strTmp.replace('\r\n', '');
	} while (strTmp.indexOf('\r\n') > -1);
	do {
		strTmp = strTmp.replace('  ', ' ');
	} while (strTmp.indexOf('  ') >= 0);
	
	if(strTmp.replace(' ','')  == '') {
		if (showMsg==true) {
			alert('The \'' + msgText + '\' should not be empty.');
		}
		control.focus();
		return true;
	}
	return false;
}
