function DisplaySendToFriendPopup(type, id, url, targetUrl)
{
	if (targetUrl!=undefined)
		document.forms['sendToFriendForm']._target.value = targetUrl;
		
	document.forms['sendToFriendForm'].type.value = type;
	document.forms['sendToFriendForm'].url.value = url;
	document.forms['sendToFriendForm'].id.value = id;
		
	var sendToFriendPopupOverlay = document.getElementById('sendToFriendPopupOverlay');
	var sendToFriendForm = document.getElementById('sendToFriendForm');
	
	var browserWidth = YAHOO.util.Dom.getDocumentWidth();
	var browserHeight = YAHOO.util.Dom.getDocumentHeight();
	var clientWidth = YAHOO.util.Dom.getClientWidth();
	var clientHeight = YAHOO.util.Dom.getClientHeight();
	
	YAHOO.util.Dom.setStyle(sendToFriendPopupOverlay, 'display', 'block');	
	YAHOO.util.Dom.setStyle(sendToFriendPopupOverlay, 'opacity', 0);	
	YAHOO.util.Dom.setStyle(sendToFriendPopupOverlay, 'width', browserWidth+'px');
	YAHOO.util.Dom.setStyle(sendToFriendPopupOverlay, 'height', browserHeight+'px');
		
	var myAnim = new YAHOO.util.Anim(sendToFriendPopupOverlay, { opacity: { to: 0.5 }}, 1,YAHOO.util.Easing.easeOut); 
	myAnim.animate();
	myAnim.onComplete.subscribe(function()										 
		{
			YAHOO.util.Event.addListener(sendToFriendPopupOverlay, "click", HideSendToFriendPopup);

			finalx = Math.round(browserWidth/2-parseInt(YAHOO.util.Dom.getStyle(sendToFriendForm, 'width'))/2);
			finaly = Math.round(clientHeight/2-200/2);
			
			YAHOO.util.Dom.setStyle(sendToFriendForm, 'display', 'block');	
			YAHOO.util.Dom.setStyle(sendToFriendForm, 'opacity', 0);			
			YAHOO.util.Dom.setX(sendToFriendForm, finalx);
			YAHOO.util.Dom.setY(sendToFriendForm, finaly);
			
			var animAttr = new Object(); 
				animAttr['opacity'] = { to: 1.0 };
				animAttr['points'] = { by: [0, -100] };
		
			var myAnimForm = new YAHOO.util.Anim(sendToFriendForm, animAttr, 0.5,YAHOO.util.Easing.easeOut); 
			myAnimForm.animate();
		});
}

function HideSendToFriendPopup()
{
	YAHOO.util.Dom.setStyle('sendToFriendPopupOverlay', 'display', 'none');
	YAHOO.util.Dom.setStyle('sendToFriendForm', 'display', 'none');
}

function SendToFriendForm_Validate(sendToFriendForm)
{
	var error = '';
	
	if (sendToFriendForm.to_email.value=='' || !ValidateEmail(sendToFriendForm.to_email.value))
		error += "- Friend's email address is missing\n";
	
	if (error!='')
	{
		alert("ERROR:\n==========\n"+error);
		return false;
	}
	
	return true;
}

