/*
Validation functions for TellAFriend.asp
Kevin Clarke Marketlink corp. DEC 2004
*/

var notvalidcolor = '#FFFFEC';
var validcolor = 'transparent';	
	

function isValidEmailTAF(elemEmail) {

	var emailstring = document.getElementById(elemEmail).value;
	return (emailstring.indexOf(".") > 0) && (emailstring.indexOf("@") > 0);
}

function showValidationMsg(elemID){
	document.getElementById(elemID).style.background=notvalidcolor;
	document.getElementById('val'+elemID).style.display='block';
}

function hideValidationMsg(elemID){
	document.getElementById(elemID).style.background=validcolor;
	document.getElementById('val'+elemID).style.display='none';
}

function Validate(){
	var blnReturn = true;
	
	if (!isValidEmailTAF('txtYourEmail')){
		blnReturn = false;
		showValidationMsg('youremail');
	}
	else{
		hideValidationMsg('youremail')
	}
	
	//-----------------------------------//

	if (!isValidEmailTAF('txtFriendEmail')){
		blnReturn = false;
		showValidationMsg('friendemail');
	}
	else{
		hideValidationMsg('friendemail')
	}
	
	
	return blnReturn;
	
	
}

function SendMessage(){
	
	if(Validate()){
		document.getElementById('frmTellAFriend').submit();
	}
	
}

function openTellAFriend(){
	window.open ('/public/content/eat_well_live_well/english/HealthyWayChallenge/TellAFriend.asp','TAF','status=no,toolbar=no,address=no,scrollbars=yes,width=680,height=485')
}