var oiFrame;
var oContainer;
var bShowing = false;

function loadUrl (sUri)
{
	if (!bShowing)
	{
		oContainer.style.display = "block";
	}
	
	bShowing = true;
	sUri = escape(sUri);
	oiFrame.src = 'iframe.php?page=' + sUri;
}

function closeFrame ()
{
	oiFrame.src = '/a/inc/common/blank_iframe.inc.php';
	oContainer.style.display = "none";
	bShowing = false;
	document.getElementById('flashHome').reactivate();
	return true;
}

function testFrame ()
{
	oiFrame.src = '/a/inc/common/blank_iframe.inc.php';
	oContainer.style.display = "none";
	bShowing = false;
	document.getElementById('flashHome').reactivate();
	return true;
}

// Function To Swap the Background Panel in the Flash from HTML based links
function changeState (flashState, sUri)
{
	flashState = escape(flashState);
	sUri = escape(sUri);
	oContainer.style.display = "none";
	bShowing = false;
	flash = document.getElementById('flashHome');
	document.getElementById('flashHome').changeState(flashState); // Second Parameter Not used currently
	loadUrl(sUri);
	return true;
}

function checkState (flashState)
{
	flashState = escape(flashState);
	document.getElementById('flashHome').checkState(flashState); // Second Parameter Not used currently
	return true;
}

function footerLink (flashState, sUri)
{
	var flash = document.getElementById('flashHome');
	flash.footerLink(flashState); // Second Parameter Not used currently
	return true;
}

function toggleSound ()
{
	document.getElementById('flashHome').changeState('toggleSound');
	return true;
}

function _init ()
{
	oContainer = document.createElement("div");
	oContainer.className = "iframeContainer";
	oiFrame = document.createElement("iframe");
	oiFrame.name =  "overlayIFrame";
	oContainer.appendChild(oiFrame);
	
	if (document.all)
	{
		oiFrame.setAttribute('allowTransparency', true);
		oiFrame.setAttribute('frameBorder', 0);
	}
	
	document.getElementById("flashWrapper").appendChild(oContainer);
}
