function open_printrates() { window.open('printrates.php','tarife','scrollbars=yes, status=yes, menubar=yes, toolbar=yes, location=no, resizable=yes, width=700,height=450'); return false; } function isEmail(address) { var isValid = false; // basic checks (relying on lazy evaluation for correct behaviour!) // not empty // at least 7 characters (x@yy.zz) // has @ // has only 1 @ // has at least one . (domain.ext) isValid = (address!=null) && (address.length >= 7) && (address.indexOf('@')!=-1) && (address.indexOf('@') == address.lastIndexOf('@')) && (address.indexOf('.')!=-1) ; if (isValid) { var parts = address.split('@'); var name = parts[0].split('.'); var host = parts[1].split('.'); var regName = new RegExp("^([!#$%&'*+-/0-9=?A-Z^_a-z{}~]+)$"); // at least length 1 var regLabel = new RegExp("^(^[-0-9A-Za-z][-0-9A-Za-z]+)$"); // at least length 2 var regExt = new RegExp("^([A-Za-z]{2,63})$"); // at least length 2 var i; for (i=0; i < name.length; i++) { isValid = isValid && (name[i].search(regName) != -1); } for (i=0; i < host.length-1; i++) { isValid = isValid && (host[i].search(regLabel) != -1) && (host[i].length <= 63); } isValid = isValid && (host[host.length-1].search(regExt) != -1); } return isValid; } function noenter() { return !(window.event && window.event.keyCode == 13); } function checkEmail(thisform) { var emailaddress = thisform.email.value; if (isEmail(emailaddress)) return true; else { alert('Your email address is incorrect.'); return false; } }