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) {

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

// check the second email address
if(!check_email(f.referto.value)){
alert("Invalid email detected.");
f.referto.focus(); 
if(document.all || document.getElementByID){
f.referto.style.background = "#FF9999";
}
return false;
}

}

/////////////////////////////////////////////
// Written in for newsletter signups
/////////////////////////////////////////////

function check_email_addy(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_email(f) {

// check the first email address ( the exclamation means "not" )
if(!check_email_addy(f.email.value)){
alert("Invalid email detected.");
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 = "#FF9999";
}
// make sure the form is not submitted
return false;
}

}


/////////////////////////////////////////////
// Written in for registration
/////////////////////////////////////////////

function check_email_reg(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_email_reg(f) {

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

}