// JavaScript Document

function show(layerName, startingPoint) 
{
	positionLayer(layerName, startingPoint, 0, -340);
	document.getElementById(layerName).style.display = "block";
		
}

function hide(layerName) 
{
	document.getElementById(layerName).style.display = "none";	
}

/*
positionLayer() moves a layer to any specified point on the screen based on the location of any image.
The layer position can be adjusted up adn down or side to side with top and left.
currentMenu, and startingPoint are the id attributes of a the laeyr being moved and the image used a reference point.
*/
function positionLayer(currentMenu, startingPoint, top, left)
{
	menuLocator = document.images[startingPoint];
	menuStartleft = getRealLeft(menuLocator);
	menuStartTop = getRealTop(menuLocator);
	
	if (navigator.userAgent.indexOf("Firefox")!=-1){
		top = top - 1;
	}
	
	document.getElementById(currentMenu).style.top = (menuStartTop + top) + "px";
	document.getElementById(currentMenu).style.left = (menuStartleft + left) + "px";
}

//This Function gets a starting left point from which we set the hidden menus
function getRealLeft(el) 
{
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) 
	{
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}




//This Function gets a starting top point from which we set the hidden menus
function getRealTop(el) 
{
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) 
	{
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

function toggleFreeList(tog)
{

	if (document.getElementById(tog).style.display == "block") {
		document.getElementById(tog).style.display = "none";
	}
	else {
		document.getElementById(tog).style.display = "block";
	}
}