function validateAndPost(){
    var str = "";
    if(!isName(document.frmContact.txtName.value)){
       str += "Please supply a Name.\n";
    }
	if(!isEmail(document.frmContact.txtEmail.value)){
       str += "Please supply a correct Email address.\n";
    }
	if(str.length > 0){
	   
		alert(str);
    } 
    else{
	   document.frmContact.submit();
    }
}

function isName(strName){
	if(strName.length < 3){
		return false;
	}
	return true;
}
function isEmail(strEmail){
	if(strEmail.length < 3 || strEmail.length > 255){
		return false;
	}
	if(strEmail.indexOf("@") < 0){
		return false;
	}
	if(strEmail.indexOf(".") < 0){
		return false;
	}
	return true;
}

