function checkEmailForm(id){ var emailInput = document.getElementById(id); if (!emailInput) return false; if (!checkEmailText(emailInput.value)){ alert ('Invalid email format.'); return false; } emailInput.focus(); } function checkEmailText(email){ if (!email) return false; var emailpattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ return emailpattern.test(email); } function openLabel(filename, autoclose, width, height){ window.open(filename, 'compWindow', 'width=' + width + ',height=' + height + 'resizable=no, menubar=no'); }