function ShowFlyOut(RootElement, FlyOutElement, Direction){

	var oRootElement = document.getElementById(RootElement);
	var oFlyOutElement = document.getElementById(FlyOutElement);
	var posLeft = GetCoordinateLeft(oRootElement)
	var posTop = GetCoordinateTop(oRootElement)

	switch(Direction){
		case "Bottom": posTop += oRootElement.offsetHeight; break;
		case "Right": posLeft += oRootElement.offsetWidth; break;
		//case "Top": posTop -= oRootElement.offsetHeight; break;
		//case "Left":
		default: posTop += oRootElement.offsetHeight; break; //identical to Bottom
	}

	arAttributes = new Array("","","",""); //arAttributes: offsetLeft, offsetTop, width, height
	for (var i=3; i<arguments.length; i++) {
		arAttributes[i-3] = arguments[i]
	}

	if (arAttributes[0].length!=0) posLeft = posLeft + (arAttributes[0]*1);

	if (arAttributes[1].length!=0) posTop = posTop - 1 + (arAttributes[1]*1);
	else posTop += -1;

	if (arAttributes[2].length!=0) oFlyOutElement.style.width = arAttributes[2];
	if (arAttributes[3].length!=0) oFlyOutElement.style.height = arAttributes[3];

	oFlyOutElement.style.left = posLeft +"px";
	oFlyOutElement.style.top = posTop +"px";
	oFlyOutElement.style.visibility = "visible";
	oFlyOutElement.style.display = "block";
	oFlyOutElement.style.zIndex = oRootElement.style.zIndex + 100;
}

function HideFlyOut(FlyOutElement){
	// This function can be used to hide any HTML element. FlyOutElemnet: ID of the HTML element you want to hide.
	var oFlyOutElement = document.getElementById(FlyOutElement);
	//oFlyOutElement.style.display = "none"; Keep this commented out. For some reason it causes some wierdness in Mozilla 1.3.
	oFlyOutElement.style.visibility = "hidden";
	oFlyOutElement.style.zIndex = -1;
}

function GetCoordinateLeft(eElement){
	//Returns the left coordinate of any HTML element
	var nLeftPos = eElement.offsetLeft;
	var eParElement = eElement.offsetParent;
	while (eParElement != null){
		nLeftPos += eParElement.offsetLeft;
		eParElement = eParElement.offsetParent;
	}
	return nLeftPos;
}

function GetCoordinateTop(eElement){
    //Returns the top coordinate of any HTML element
	var nTopPos = eElement.offsetTop;            
    var eParElement = eElement.offsetParent;     
    while (eParElement != null){
        nTopPos += eParElement.offsetTop;
        eParElement = eParElement.offsetParent;
    }
    return nTopPos;
}

function s_SwitchStyle(Element){
	//This function can be used to alter the presentation of a specified HTML element.
	var oElement = document.getElementById(Element);
	arAttributes = new Array("","","",""); //arAttributes: className, backgroundColor, color, border
	for (var i=1; i<arguments.length; i++) {
		arAttributes[i-1] = arguments[i]
	}
	if (arAttributes[0].length!=0) oElement.className = arAttributes[0];
	if (arAttributes[1].length!=0) oElement.style.backgroundColor = arAttributes[1];
	if (arAttributes[2].length!=0) oElement.style.color = arAttributes[2];	
	if (arAttributes[3].length!=0) oElement.style.border = arAttributes[3];	
}
