﻿function btnShare()
{
	OpenWizardPopUp();
}

function OpenWizardPopUp()
{
	OpenIFramePopUp('PopUpWizard', "/Wizard.aspx");
}

function OpenRegisterPopUp()
{
	OpenIFramePopUp('RegisterPopUp', "/Register.aspx");
}

function OpenIFramePopUp(id,src)
{
	var PopUpWizard = document.getElementById(id);
	var PopUpWizardFrame = document.getElementById(id + "Frame");
	var GrayOutBox = document.getElementById("GrayOutBox");

	var myWidth = 0, myHeight = 0;
	var topOffset, leftOffset;
	if (typeof (window.innerWidth) == 'number')
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		topOffset = window.pageYOffset;
		leftOffset = document.body.scrollLeft;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		topOffset = document.documentElement.scrollTop;
		leftOffset = document.documentElement.scrollLeft;
	}

	PopUpWizardFrame.src = src;
	//PopUpWizard.style.marginTop = ((myHeight / 2) - 160) + "px";
	PopUpWizard.style.marginLeft = ((myWidth / 2) - 386) + "px";
	PopUpWizard.style.display = "block";
	GrayOutBox.style.marginLeft = ((myWidth / 2) - 490) + "px";
	GrayOutBox.style.display = "block";
}
  
function ClosePopUp(id)
{
	var PopUpWizard = document.getElementById(id);
	var GrayOutBox = document.getElementById("GrayOutBox");

	PopUpWizard.style.display = "none";
	GrayOutBox.style.display = "none";
}

function CloseParentWizardPopUp()
{
	window.parent.CloseWizardPopUp();
}

function OpenParentYouTubePopUp()
{
	window.parent.OpenYouTubePopUp();
}

function OpenYouTubePopUp()
{
	var YouTubeWindow = document.getElementById("YouTubeWindow");

	var myWidth = 0, myHeight = 0;
	var topOffset, leftOffset;
	if (typeof (window.innerWidth) == 'number')
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		topOffset = window.pageYOffset;
		leftOffset = document.body.scrollLeft;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		topOffset = document.documentElement.scrollTop;
		leftOffset = document.documentElement.scrollLeft;
	}

	//ReleaseStatementWindow.style.marginTop = ((myHeight / 2) - 136) + "px";
	YouTubeWindow.style.marginLeft = ((myWidth / 2) - 386) + "px";
	YouTubeWindow.style.display = "block";
}

function CloseYouTubePopUp()
{
	var YouTubeWindow = document.getElementById("YouTubeWindow");

	YouTubeWindow.style.display = "none";
}

function CallParentOpenStatement()
{
	parent.OpenReleaseStatementPopUp();
}

function OpenReleaseStatementPopUp()
{
	var ReleaseStatementWindow = document.getElementById("ReleaseStatementWindow");

	var myWidth = 0, myHeight = 0;
	var topOffset, leftOffset;
	if (typeof (window.innerWidth) == 'number')
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		topOffset = window.pageYOffset;
		leftOffset = document.body.scrollLeft;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		topOffset = document.documentElement.scrollTop;
		leftOffset = document.documentElement.scrollLeft;
	}

	//ReleaseStatementWindow.style.marginTop = ((myHeight / 2) - 136) + "px";
	ReleaseStatementWindow.style.marginLeft = ((myWidth / 2) - 386) + "px";
	ReleaseStatementWindow.style.display = "block";
}

function CloseReleaseStatementPopUp()
{
	var ReleaseStatementWindow = document.getElementById("ReleaseStatementWindow");

	ReleaseStatementWindow.style.display = "none";
}

function CheckPosition()
{
	var myWidth = 0, myHeight = 0;
	var topOffset, leftOffset;
	if (typeof (window.innerWidth) == 'number')
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		topOffset = window.pageYOffset;
		leftOffset = document.body.scrollLeft;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		topOffset = document.documentElement.scrollTop;
		leftOffset = document.documentElement.scrollLeft;
	}

	var PopUpWizard = document.getElementById("PopUpWizard");
	var GrayOutBox = document.getElementById("GrayOutBox");
	if (PopUpWizard)
	{
		if (PopUpWizard.style.display == "block")
		{
			//PopUpWizard.style.marginTop = ((myHeight / 2) - 136) + "px";
			PopUpWizard.style.marginLeft = ((myWidth / 2) - 386) + "px";
			GrayOutBox.style.marginLeft = ((myWidth / 2) - 490) + "px";
		}
	}

	var ReleaseStatementWindow = document.getElementById("ReleaseStatementWindow");
	if (ReleaseStatementWindow)
	{
		if (ReleaseStatementWindow.style.display == "block")
		{
			//ReleaseStatementWindow.style.marginTop = ((myHeight / 2) - 136) + "px";
			ReleaseStatementWindow.style.marginLeft = ((myWidth / 2) - 386) + "px";
		}
	}
}

function CheckRegisterForm(id)
{
	var genericError = document.getElementById(id);
	Page_ClientValidate();
	
	if (Page_IsValid)
	{
		genericError.style.display = "none";
		var v = window.open("/Includes/Assets/RSLT-A-0495_Clinical_Application_Note_Chronic_Disease_Overview.pdf", "assetWindow");
		
		return true;
	}
	else
	{
		genericError.style.display = "inline";
		return false;
	}
}