function formValidator()
{
	if (isEmpty(document.getElementById('name'),"Please enter your name...")) return false;
    if (!emailValidator(document.getElementById('email'),"Please enter the correct e-mail address..."))	 return false;
	if (isEmpty(document.getElementById('subject'),"Please enter your subject..."))		return false;	
	if (isEmpty(document.getElementById('message'),"Please enter message..."))		return false;	
	if (isEmpty(document.getElementById('security_code'),"Please enter security code..."))		return false;	

	return true;
}
function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return true;
	}
	return false;
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,6}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
