function shareLinkTAfocus(taObj){
     var taValue=Trim(taObj.value);
	  if(taValue.match("comments")){
		 taObj.value="";
	  }
}


function validateSubmitTAF(form)
{
	var formName= form.name;
	var formDiv=document.getElementById("EmailWebFormPageField_div");
	var thankyouDiv=document.getElementById("EmailThankYouMessageField_div");
	var errorDiv=document.getElementById("EmailErrorMessageField_div");
	var excepDiv=document.getElementById("EmailExceptionMessageField_div");
	var regexp = /^([A-Za-z\s0-9-\'()]*)$/;	   
	var emailErrorCount=0;

	if (Trim(document.emailFormPage.emailtoemailAddress.value) == "") 
	{
		document.getElementById('emailtoemailAddressError').style.display='inline';
		emailErrorCount++;
	} 
	else
	{
		if(!isValidEmail(document.emailFormPage.emailtoemailAddress))
		{
		document.getElementById('emailtoemailAddressError').style.display='inline';
		emailErrorCount++;
		} 
		else 
		{	
		document.getElementById('emailtoemailAddressError').style.display='none';
		}
	}
	//alert("ValidateSubmit method3")	;

	if(Trim(document.emailFormPage.emailname.value)=="")
	{		
	document.getElementById('emailnameError').style.display='inline';		
	emailErrorCount++;
	}
	else 
	{
		if(!regexp.test(Trim(document.emailFormPage.emailname.value)))
		{
			document.getElementById('emailnameError').style.display='inline';
			emailErrorCount++;
		}
		else 
		{	
			document.getElementById('emailnameError').style.display='none';
		}		
	}

	if (Trim(document.emailFormPage.emailfromAddress.value) == "") 
	{
		document.getElementById('emailfromAddressError').style.display='inline';
		emailErrorCount++;
	} 
	else
	{
		if(!isValidEmail(document.emailFormPage.emailfromAddress))
		{
			document.getElementById('emailfromAddressError').style.display='inline';
			emailErrorCount++;
		} 
		else 
		{	
			document.getElementById('emailfromAddressError').style.display='none';
		}
	}
	/*
	if(Trim(document.emailFormPage.emailmessage.value)=="")
	{
	document.getElementById('emailmessageError').style.display='inline';
	emailErrorCount++;	
	}
	else
	{
	document.getElementById('emailmessageError').style.display='none';
	}
	*/

	if(emailErrorCount>0)
	{
	return false;
	}
	else
	{
	//From and To email restriction 
	if(document.getElementById('FromToTAFValues')!=null)
	{
		var fromToEmailvalue=Trim(document.getElementById('FromToTAFValues').value);
		document.getElementById('fromEmailRestriction').value="NO";
		document.getElementById('toEmailRestriction').value="NO";	

		if(fromToEmailvalue.indexOf("-")>0)
		{
			document.getElementById('fromEmailRestriction').value="YES";
			document.getElementById('toEmailRestriction').value="YES";
		}
		else if(fromToEmailvalue.match("noRestriction"))
		{
			document.getElementById('fromEmailRestriction').value="NO";
			document.getElementById('toEmailRestriction').value="NO";
		}
		else if(fromToEmailvalue.match("fromEmailRestriction")) 	
		{
			document.getElementById('fromEmailRestriction').value="YES";
			document.getElementById('toEmailRestriction').value="NO";			   
		}
		else if(fromToEmailvalue.match("toEmailRestriction"))
		{
			document.getElementById('fromEmailRestriction').value="NO";
			document.getElementById('toEmailRestriction').value="YES";								 
		}	 
	}
	//page title
	if(document.getElementById('pageTitleTAF')!=null)
	{
		var tafPageTitle=Trim(document.getElementById('pageTitleTAF').value);
		if(tafPageTitle!=null && tafPageTitle!="")
		{
			document.getElementById('emailpageTitle').value=tafPageTitle;
		}
	}

	//visitor Id
	var emailvisitorID ;
	var Cookieresults = document.cookie.match ( '(^|;) ?' + "WT_FPC" + '=([^;]*)(;|$)' );

	if(Cookieresults!=null)
	{
		//alert(Cookieresults.length);
		var visitorfullID = unescape(Cookieresults[2]);
		var visitorpartID = visitorfullID.split(":");
		emailvisitorID = visitorpartID[0].split("=");
	}
	if(typeof emailvisitorID=="undefined") 
	{
		document.getElementById('emailvisitorID').value="";
	} 
	else 
	{
		document.getElementById('emailvisitorID').value=emailvisitorID[1];
	}

	//contentGroup 
	if(contentGroup!="")
	{
		document.getElementById('varContentGrp').value=contentGroup;
	}
	else
	{
		document.getElementById('varContentGrp').value=audience;
	}
	TellAFriendFormSubmit(formName,formDiv,'EmailThankYouMessageField_div','EmailErrorMessageField_div','EmailExceptionMessageField_div');

	return false;
	}
}

function onLoadWebformMethod()
{
var divObjs=document.getElementsByTagName('DIV');
	for(var i=0;i<divObjs.length;i++)
	{
		if(divObjs[i].className=="toShowOnLoad")
		{
			divObjs[i].className="toHideOnLoad";
		}
		else if(divObjs[i].className=="toHideOnLoad")
		{
			divObjs[i].className="toShowOnLoad";
		}
	}
}