// Email Validation. Written by PerlScriptsJavaScripts.com

function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++){
if(ok.indexOf(e.charAt(i))<0){ 
return (false);
}	
} 

if (document.images) {
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (!e.match(re) && e.match(re_two)) {
return (-1);		
} 

}

}



function check_form(f) { // f is the form (passed using the this keyword)

f.saveemail.value = f.email.value;

// check the first email address ( the exclamation means "not" )
if(!check_email(f.email.value)){
alert("Please check your email address for errors or spaces and reenter");
f.email.focus(); 
// if the browser is Netscape 6 or IE
// if(document.all || document.getElementByID){
// change the color of text field
// f.email.style.background = "yellow";
// }
// make sure the form is not submitted
return false;
}
alert("Your email address is registered to receive\nnotification when the interviews become available");

}





function check_form_onexit() { // f is the form (passed using the this keyword)

// check the first email address ( the exclamation means "not" )

// alert(document.form1.email.value);
// alert(document.form1.saveemail.value);

if (document.form1.email.value != document.form1.saveemail.value) {

if(document.form1.email.value != '') {
   if (!check_email(document.form1.email.value)) {
   alert("Please check your email address for errors or spaces and reenter");
   document.form1.email.focus(); 
   return false;
   } else {
alert("Your email address is registered to receive\nnotification when the webcast becomes available");
   document.form1.submit();
   return true;
   }
}

}

}

