
function ChkEmail(str) {
  var pattern = /^[\w-_.]*[\w-_.]@[\w].+[\w]+[\w]$/i;
  return pattern.test(str);
}

window.onload=function(){

var submitform = document.getElementById("submitform");
if (submitform != null) {
			submitform.onclick =function(){
				var MsgError = "";
					document.frmContact.name.value == "" ?	MsgError += "Please add you name. \n" : MsgError += "";
						(!(ChkEmail(document.frmContact.email.value))||(document.frmContact.email.value == "")) ? MsgError += "Please enter a valid email address.\n": MsgError += "";
							document.frmContact.tel.value == "" ?	MsgError += "Please add your telephone number. \n" : MsgError += "";
								document.frmContact.message.value == "" ?	MsgError += "Please add your message. \n" : MsgError += "";

					MsgError !="" ? alert(MsgError) : document.getElementById("frmContact").submit();
			}
	}
}

