<!--

// Yes, the following code is crumsy, it's patchy and wierd. 
// That's because we're supporting Netscape Agravator 4.0 and
// it *needs* wierd patchy disgusting ugly code to run.

	window.onresize = resizeCheck;

	var g_bDHTML, g_bIE, g_bMozy, g_bNets, g_bIEMac;

	if(document.all)
	{
		g_bDHTML = g_bIE = true;
		g_bMozy = g_bNets = false;
		g_bIEMac = (navigator.appVersion.indexOf("Mac")>-1)
	}
	else if(document.getElementById)
	{
		g_bDHTML = g_bMozy = true;
		g_bIEMac = g_bNets = g_bIE = false;
	}
	if(document.layers) {
		g_bDHTML = g_bNets = true;
		g_bIE = g_bIEMac = g_bMozy = false;
	}
	
	function dump_IE(text)
	{
		window.status = text;
	}

	if(!window.dump)
		window.dump = dump_IE;

function resizeCheck() {

	if(!g_bIE)
	{
		// alert(navigator.appVersion.substring(3,4));
		if(navigator.appVersion.substring(0,1) == 4 && navigator.appVersion.substring(3,4) < 4)
			location.href = location.href; 
	}

}

function cancelEventBubble(evt)
{
	if(window.event)
		window.event.cancelBubble = true;
	
	return false;
}

function cancelEventAll(evt)
{

	if(window.event)
	{	
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
	
	return false;
}



///////////////////////////////////////////////////////////////////////////////
// Panel Code

var aPanels = new Array(3);
var nCurPanel = -1;
var bPanelsInited = false;
var nDelayedPanel = -1;
var bPanelsLoaded = false;

showPanel(0);

function showPanel(nPanel) {

	if(!isPanelsReady()){
		nDelayedPanel = nPanel;
		return;
	}

	if(nCurPanel > -1){
		aPanels[nCurPanel].left = -200;
		aPanels[nCurPanel].zIndex = 2;
	}

	aPanels[nPanel].left = 5;
	aPanels[nPanel].zIndex = 4;
	nCurPanel = nPanel;
}

function initPanels() {

	bPanelsLoaded = true;

	if(bPanelsInited)
		return;

	if(g_bIE){
		aPanels[0] = panel_one.style;
		aPanels[1] = panel_two.style;
		aPanels[2] = panel_three.style;
	}
	else if(g_bMozy)
	{
		aPanels[0] = document.getElementById("panel_one").style;
		aPanels[1] = document.getElementById("panel_two").style;
		aPanels[2] = document.getElementById("panel_three").style;
	}
	else if(g_bNets){
		aPanels[0] = document.panel_one;
		aPanels[1] = document.panel_two;
		aPanels[2] = document.panel_three;
	}
}

function showDelayedPanel() {

	if(nDelayedPanel > -1)
		showPanel(nDelayedPanel);

	nDelayedPanel = -1

}

function isPanelsReady(){
	return bPanelsLoaded;
}






////////////////////////////////////////////////////////////////////////////////
//  Popper Code

var bPoppersLoaded = false;
var nPoppersDisplayed = 0;

function initPoppers() {
	bPoppersLoaded = true;
	
	if(document.body)
		document.body.onmouseup = cancelAllPoppers;
	else
		document.onmouseup = cancelAllPoppers;
}

function isPoppersReady(){
	
	// For Netscape we need the abstraction layer to be loaded
	if(g_bIE || g_bMozy)
		return bPoppersLoaded;
	else
		return bPoppersLoaded && (document.readyState == "complete");
}

function animPopper(popperName, nIncrement) 
{
	// Get the poppout
	var popper;
	if(!document.getElementById)
		popper = document.all[popperName];
	else
		popper = document.getElementById(popperName);

	var bContinue = false;

	// Direction to animate
	if(popper._dir) 
	{
		popper._pos += nIncrement;
		bContinue = (popper._pos < popper.offsetHeight)
	}
	else 
	{
		popper._pos -= nIncrement;
		bContinue = (popper._pos > 0);
	}
	
	// Do the actual jazz
	popper.style.clip = "rect(0 " + popper.offsetWidth + " " + popper._pos + " 0)";

	// Are we done?
	if (bContinue)
		setTimeout("animPopper('" + popperName + "'," + nIncrement + ")", 20);
		
}

function displayPopper(popperName) {

	dump("display\n");
	// Try again in 1 second
	if(!isPoppersReady()){
		setTimeout("displayPopper('" + popperName + "');", 1000);
		return;
	}

	var popper;
	if(!document.getElementById)
		popper = document.all[popperName];
	else
		popper = document.getElementById(popperName);

	// Already animating
	if (popper._dir) 
		return;
		
	// Set dir to null before cancelling so we don't get canceled
	popper._dir = null;
	cancelAllPoppers();

	if (g_bIEMac || g_bMozy) 
	{
		popper.style.visibility = "visible";
		popper._dir = true;
		nPoppersDisplayed++;
		return;
	}

	// Only init if not moving yet
	if(popper._dir == null)
	{ 
		popper.style.clip = "rect(0 " + popper.offsetWidth + " 0 0)";	
		popper._pos = 0;
	}

	popper.style.visibility = "visible";
	popper._dir = true;
	popper.onmouseup = cancelEventBubble;
	nPoppersDisplayed++;
	
	animPopper(popperName, Math.ceil(popper.offsetHeight / 5));
}

function hidePopper(popperName) {

	dump("hide\n");
	if (!isPoppersReady()) 
		return;

	var popper;
	if(!document.getElementById)
		popper = document.all[popperName];
	else
		popper = document.getElementById(popperName);

	if ((popper._dir == null) || (!popper._dir)) 
		return;

	popper._dir = false;
	nPoppersDisplayed--;

	if (g_bIEMac || g_bMozy) 
		popper.style.visibility = "hidden";
	else
		animPopper(popperName, Math.ceil(popper.offsetHeight / 5));
}	

function cancelAllPoppers() 
{
	dump("cancel all\n");
	if(!isPoppersReady()) 
		return;
		
	if(nPoppersDisplayed <= 0)
		return;

	// Cycle through collections and see if any poppers are out
	// This is inefficient but leave it for now.
	var elements;
	if(g_bIE)
		var elements = document.all.tags("table");
	else if(g_bMozy)
		var elements = document.getElementsByTagName("table");
	else if(g_bNets)
		var elements = document.layers;
		
	for(nCnt = 0; nCnt < elements.length; nCnt++)
	{ 
		if(document.all != null)
		{
			dump(document.all[elements[nCnt].id]._dir);
			if(document.all[elements[nCnt].id]._dir != null)
				hidePopper(elements[nCnt].id);
		}
		else
			elements[nCnt]._dir != null;
	}

}	

//: -->