var wnd, id;
function submitMessage (wndName,theForm) {
	var name = theForm.from.value;
	var msg = theForm.body.value;
	var mail = theForm.fromemail.value;

	//this regular expression represents an email address
	var emlExpr = /(\w+)@?(\w+\.)+([A-Za-z]{2,3}$)/;

	if(name==""){
		alert("Please enter your name.");
		theForm.from.focus();
		return false;
	}
				
	if(mail == ""){
		alert("Please enter your Email.");
		theForm.fromemail.focus();
		return false;
	}
	
			
	if(!emlExpr.test(mail)){
		alert("You have entered an invalid email address.\nPlease check again and re-enter your email address.");
		theForm.fromemail.select();
		theForm.fromemail.focus();		
		return false;
	}

	if(msg==""){
		alert("Please enter your message.");
		theForm.body.focus();
		return false;
	}
        wnd = window.open('',wndName,'top=-10,width=1,height=1');
	theForm.submit();
	id=setTimeout('wnd.close()',1000);
	return true;
}
