﻿
// checkMainFrame()
function checkMainFrame(blnIsLoggedOn)
{
	if (blnIsLoggedOn == null)		return;
	if (top.blnIsLoggedOn == null)	return;

	// check against "main" page (if values do not match, then refresh the page)
	if (blnIsLoggedOn != top.blnIsLoggedOn)
		top.location = top.location.href;
}


// refreshFooter()
function refreshFooter(strLightboxId)
{
	if (strLightboxId == 'Y')	strLightboxId = null;

	if (!strLightboxId)
	{
		// get the select list with the lightbox id
		var listLightboxes = window.document.getElementById('listLightboxes');

		// get the selected lightbox id
		if (listLightboxes)
			strLightboxId = listLightboxes.options[listLightboxes.selectedIndex].value;
	}

	// refresh the footer
	if (strLightboxId)
		self.location = self.location.pathname + '?id=' + strLightboxId;
	else
		self.location = self.location.pathname;
}


// ExpandLightbox()
function ExpandLightbox()
{
	if (top.blnIsLoggedOn)
	{
		var fraRetna = top.document.getElementById('Retna');
		if (!fraRetna)	return;

		var fraFooter = top.frames.footer;
		if (!fraFooter)	return;

		fraRetna.rows = '*,240';
		fraFooter.location = 'footerLoggedOn_Expanded.aspx';
	}
	else
	{
		var fraMain = top.frames.main;
		if (!fraMain)	return;

		fraMain.showPopup('accessible');
	}	
}

// MinimizeLightbox()
function MinimizeLightbox()
{
	var fraRetna = top.document.getElementById('Retna');
	if (!fraRetna)	return;

	var fraFooter = top.frames.footer;
	if (!fraFooter)	return;

	fraRetna.rows = '*,128';
	fraFooter.location = (top.blnIsLoggedOn) ? 'footerLoggedOn.aspx'
											 : 'footerLoggedOff.aspx';
}

// ManageLightboxes()
function ManageLightboxes()
{
	var fraMain = top.frames.main;
	if (!fraMain)	return;

	fraMain.location = 'lightbox.aspx';
}


// CheckLightboxMessage()
function CheckLightboxMessage()
{
	var hiddenMessage = document.getElementById('hiddenMessage');
	if (!hiddenMessage)		return;

	var strMessage = hiddenMessage.value;
	if (strMessage == '')	return;

	var fraMain = top.frames.main;
	if (!fraMain)			return;

	var divMessage = fraMain.document.getElementById('couldNotAddToLightbox_Message');
	if (!divMessage)		return;

	// set message text
	divMessage.innerHTML = strMessage;
			
	// show popup
	fraMain.showPopup('couldNotAddToLightbox');
}


// showPopup()
function showPopup(strWindowId)
{
	// show the popup (in the main frame)
	var fraMain = top.main;
	if (fraMain)
		top.main.showPopup(strWindowId);
}
