///////////////////////////// Email Validation Scripts //////////////////////////////
//Change the Enter Key from submitting the form to just tabbing between fields
function handleEnter (field, event) {
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if (keyCode == 13) {
var i;
for (i = 0; i < field.form.elements.length; i++)
if (field == field.form.elements[i])
break;
i = (i + 1) % field.form.elements.length;
field.form.elements[i].focus();
return false;
}
else
return true;
}
//Check if the required filed(s) are empty
function isEmpty( str ){
strRE = new RegExp( );
strRE.compile( '^[\s ]*$', 'gi' );
return strRE.test( str.value );
}
//Email address validity check
function notValidEmail( str ){
mailRE = new RegExp( );
mailRE.compile( '^[\._a-z0-9-]+@[\.a-z0-9-]+[\.]{1}[a-z]{2,4}$', 'gi' );
return !(mailRE.test( str.value ));
}
//Visual cues for users on error fields - highlight/field focus
function highlight(field) {
var bgcolor = '483D8B';
var txcolor = 'FFFFFF';
if ( bgcolor != '') {
field.style.backgroundColor='483D8B';
}
if ( txcolor != '') {
field.style.color='FFFFFF';
}
field.focus();
}
function highlight2 (field) {
var bgcolor = '483D8B';
var txcolor = 'FFFFFF';
if ( bgcolor != '') {
field.style.backgroundColor='CFCFCF';
}
if ( txcolor != '') {
field.style.color='0E0B48';
}
}
//Check email fields for the required field(s) only - for Logged in users
function recommendvalidate(){
if (isEmpty (document.recommend.recommend_to_email0)) {
highlight (document.forms.recommend.recommend_to_email0);
alert('You need to enter at least 1 email address to send to...');
return false;
} else if (notValidEmail (document.recommend.recommend_to_email0)) {
highlight (document.forms.recommend.recommend_to_email0);
alert('Please make sure all your Friends emails are valid (ie. friend@home.com)...' + '
' + ' *** You are only allowed to enter ONE email address per field *** ');
return false;
} else {
return true;
}
}
//Check email fields for the required field(s) only - for Public Users (not Logged in)
function recommendvalidateall(){
if (isEmpty (document.recommend.recommend_from_email)) {
highlight (document.forms.recommend.recommend_from_email);
alert('You need to enter your email address...');
return false;
} else if (isEmpty (document.recommend.recommend_to_email0)) {
highlight2 (document.forms.recommend.recommend_from_email);
highlight (document.forms.recommend.recommend_to_email0);
alert('You need to enter at least 1 email address to send to...');
return false;
} else if (notValidEmail (document.recommend.recommend_from_email)) {
highlight2 (document.forms.recommend.recommend_to_email0);
highlight (document.forms.recommend.recommend_from_email);
alert('Please make sure your email address is valid (ie. friend@home.com)...' + '
' + ' *** You are only allowed to enter ONE email address per field *** ');
return false;
} else if (notValidEmail (document.recommend.recommend_to_email0)) {
highlight2 (document.forms.recommend.recommend_from_email);
highlight (document.forms.recommend.recommend_to_email0);
alert('Please make sure all your Friends emails are valid (ie. friend@home.com)...' + '
' + ' *** You are only allowed to enter ONE email address per field *** ');
return false;
} else {
return true;
}
}
//-->
Recommend Our Site to Your Friends!
The name and email address that you enter in the fields below will appear in the emails you send to your friends.
- You must enter your email address
- You must enter at least 1 of your Friend's email address
- You must also enter the correct security code shown.
Fields marked with ** must be completed correctly in order to send the site recommendation.
Thanks for recommending us!