// Page Load: Display Send Email Form if there is error messages
var SendEmailFormErrorMsgSummary = document.getElementById("SendEmailFormErrorMsgSummary");
var hidSubmitEmailForm = document.getElementById("44_objSendEmailToFriend_hidSubmitEmailForm");

HideSendEmailForm();

//Display Send Email Form on reload;
if (!checkIt('compatible')) {
	if (Trim(SendEmailFormErrorMsgSummary.innerHTML) != "" && hidSubmitEmailForm.value == "SubmitEmailForm")
	{
		ShowSendEmailForm();
	}
} else
{
	if (Trim(SendEmailFormErrorMsgSummary.innerHTML).length > 94 && hidSubmitEmailForm.value == "SubmitEmailForm") {
		ShowSendEmailForm();
	}
}
/**************************************************************************/
// Show/Hide Email Form
function ShowSendEmailForm() {
	var SendEmailForm = document.getElementById("SendEmailForm");
	var SendEmailFormErrorMsgs = document.getElementById("SendEmailFormErrorMsgs");
	var PageContentCell = document.getElementById("PageContentCell");

	HideSendEmailForm();

	SendEmailForm.style.display = "block";

	if (PageContentCell && SendEmailForm.offsetWidth > 0 && SendEmailForm.offsetWidth > 0) {

		//Brower Check
		if (!checkIt('compatible'))
		{
			SendEmailForm.style.left = (document.body.offsetWidth - SendEmailForm.offsetWidth) / 2;
			SendEmailForm.style.top = (document.body.clientHeight - SendEmailForm.offsetHeight) / 2;
		} else {
			SendEmailForm.style.left = (PageContentCell.offsetWidth - SendEmailForm.offsetWidth) / 2;
			SendEmailForm.style.top = (document.body.offsetHeight - SendEmailForm.offsetHeight) / 2  + PageContentCell.scrollTop - 100;
		}
	} else {
		window.setTimeout("ShowSendEmailForm()", 250);
	}

	hidSubmitEmailForm.value = "SubmitEmailForm";
}

// Hide Send Email Form
function HideSendEmailForm() {
	var SendEmailForm = document.getElementById("SendEmailForm");
	SendEmailForm.style.display = "none";
}

// Close Send Email Form
function CloseSendEmailForm() {
	hidSubmitEmailForm.value = "";
	HideSendEmailForm();
}

function HideSendEmailFormThankYou()
{
	var SendEmailFormThankYou = document.getElementById("SendEmailFormThankYou");
	SendEmailFormThankYou.style.display = "block";

	scrollTo(0,0);

	//Brower Check
	if (!checkIt('compatible'))
	{
		//Display on user click
		SendEmailFormThankYou.style.left = (document.body.offsetWidth - SendEmailFormThankYou.offsetWidth) / 2;
		SendEmailFormThankYou.style.top = (document.body.clientHeight - SendEmailFormThankYou.offsetHeight) / 2;
	} else {
		//Display on user click
		SendEmailFormThankYou.style.left = (PageContentCell.offsetWidth - SendEmailFormThankYou.offsetWidth) / 2;
		SendEmailFormThankYou.style.top = (document.body.clientHeight - SendEmailFormThankYou.offsetHeight) / 2  + document.body.scrollTop - 100;
	}

	setTimeout("CloseSendEmailFormThankYou()", 5000);
}

function CloseSendEmailFormThankYou()
{
	var SendEmailFormThankYou = document.getElementById("SendEmailFormThankYou");
	SendEmailFormThankYou.style.display = "none";	
}