// JavaScript Document

function validateEMail( eMail ) {
 		var re = /^((([a-zA-Z0-9_\%\+\.\-])+|(\"[^\"\\]+\"))\@((\[(([0-1]?[0-9]{1,2}\.)|(2[0-4][0-9]\.)|(25[0-5]\.)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))\])|((([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,4}))))$/;
		return  re.test(eMail);
	}

function validateTellAFriend ( sForm) {
		var frm=document.forms[sForm];
		var ele=frm.elements;

		if ( ( frm.RecipientName.value == '' ) || ( frm.RecipientName.value == 'Friend\'s name' )) {
			frm.RecipientName.focus();
			alert( "Please enter your friend\'s name!");
			return false;
		}

		if ( ( frm.RecipientEmail.value == '' ) || ( frm.RecipientEmail.value == 'Friend\'s e-mail address' ) ) {
			frm.RecipientEmail.focus();
			alert( "Please enter your friends e-mail address!");
			return false;
		}

		if ( !validateEMail( frm.RecipientEmail.value) ) {
			frm.RecipientEmail.focus();
			alert( "Invalid e-mail address format!");
			return false;
		}

		if ( ( frm.SenderName.value == '' ) || ( frm.SenderName.value == 'Your name' ) ) {
			frm.SenderName.focus();
			alert( "Please enter your name!");
			return false;
		}

		if ( ( frm.SenderEmail.value == '' ) || ( frm.SenderEmail.value == 'Your e-mail address' )) {
			frm.SenderEmail.focus();
			alert( "Please enter your e-mail address!");
			return false;
		}

		if ( !validateEMail( frm.SenderEmail.value) ) {
			frm.SenderEmail.focus();
			alert( "Invalid e-mail address format!");
			return false;
		}

		return true;
	}

function validateSubscribe ( sForm ) {
	if ( !validateEMail( document.forms[sForm].SenderEmailMailIt.value) ) {
		document.forms[sForm].SenderEmailMailIt.focus();
		alert( "Invalid e-mail address format!");
		return false;
	}
	return true;
}
