function checkEmail(emailString) { atPos = emailString.indexOf("@"); dotPos = emailString.lastIndexOf("."); emailLength = emailString.length; if (emailString == "") { return false; } if (atPos == -1 || dotPos == -1) { return false; } if (atPos > dotPos) { return false; } if (dotPos - atPos == 1) { return false; } if (atPos == 0) { return false; } if (dotPos == emailLength-1) { return false; } } function checkForm() { with(window.document.contactForm) { var inputs = new Array(); inputs[0] = name; inputs[1] = email; inputs[2] = comment; var email_valid = 0; if(comment.value=="") { document.getElementById('contactCommentHint').style.visibility = "visible"; } else { document.getElementById('contactCommentHint').style.visibility = "hidden"; } if(checkEmail(email.value)== false) { document.getElementById('contactEmailHint').style.visibility = "visible"; email.focus(); email_valid = 0; } else { document.getElementById('contactEmailHint').style.visibility = "hidden"; email_valid = 1; } if(name.value=="") { document.getElementById('contactNameHint').style.visibility = "visible"; name.focus(); } else { document.getElementById('contactNameHint').style.visibility = "hidden"; } if(name.value=="" || email.value=="" || comment.value=="" || email_valid==0) { return false; } } }