I am trying to build contact for my site. For some reason (probabably a bug), I getting the email twice. The first email gets before I hit ok on javascript alert. The second email gets after.

The first email is blank with no subject, unknown sender, and no content.
The second email is fine. The way I wanted.

Please help me to fix this. The following is the script.

Thank you
Kevin

-----------------
<script language="JavaScript">
function isValidEmail(frm,fld,entry) {
var re = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,4}(\.[a-z]{2}){0,2})$/i;
if (!re.test(entry)) {
alert("The email address is not valid.")
if ( document.forms[frm.name] ) { // protect ns4 in case of nesting
setTimeout("setFocus(document.forms['"+frm.name+"'].elements['"+fld.name+"'])",100);
} else {
fld.focus(); fld.select();
}
return false;
} else return true;
}

function formCheck(formobj){
// Enter name of mandatory fields
var fieldRequired = Array("Name", "Email", "Subject", "Message");
// Enter field description to appear in the dialog box
var fieldDescription = Array("Name", "Email", "Subject", "Message");
// dialog message
var alertMsg = "Please complete the following fields:\n";

var l_Msg = alertMsg.length;

for (var i = 0; i < fieldRequired.length; i++){
var obj = formobj.elements[fieldRequired[i]];
if (obj){
switch(obj.type){
case "select-one":
if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "select-multiple":
if (obj.selectedIndex == -1){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
case "text":
case "textarea":
if (obj.value == "" || obj.value == null){
alertMsg += " - " + fieldDescription[i] + "\n";
}
break;
default:
}
if (obj.type == undefined){
var blnchecked = false;
for (var j = 0; j < obj.length; j++){
if (obj[j].checked){
blnchecked = true;
}
}
if (!blnchecked){
alertMsg += " - " + fieldDescription[i] + "\n";
}
}
}
}

if (alertMsg.length == l_Msg){
if ( !isValidEmail(formobj, formobj.Email, formobj.Email.value) ) {
return false;
}
<?php $from=$_POST['Email'];
mail('test@gmail.com', $_POST['Subject'], $_POST['Message'], "From: $from\n"); ?>
return true;
}else{
alert(alertMsg);
return false;
}
}
</script>