
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_email_validity() { // f is the form (passed using the this keyword)

  if(check_email_contents('email-address')){
    if(check_email_contents('verification-address')){

      if(!($F('email-address') == $F('verification-address'))){

      alert("Email addresses do not match");

      $('email-address').focus();

      } else {
       if ($F('email-address')){
      //submitEmail();
      //joinPopUp();
      }
     }
    
    }
  }

}

function check_email_contents(field_name) { // f is the form (passed using the this keyword)


if($F(field_name)){

f = $(field_name);


// check the first email address ( the exclamation means "not" )
if(!check_email(f.value)){
alert("Invalid email detected.");
f.focus(); 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.style.background = "yellow";
}
// make sure the form is not submitted
return false;
}

}


return true;

}

