function ChangeArrow (td, sl)
{


	if (document.getElementById(td).title == 'Expand')
	{
		document.getElementById(td).src = 'images/arrowu.gif';
		document.getElementById(td).title = 'Collapse';
	} else {
		document.getElementById(td).src = 'images/arrowd.gif';
		document.getElementById(td).title = 'Expand';
	}		


	slidedown(sl);
}


function ChangeMenuClass (td, sw, ex)
{
	var x = 1;
	var parent;

	if (ex == '1') {

		// Clear the color from whatever the parent of the submenu was

		while (x <= 9)
		{
			if (x < 10) {
				parent = "menu0" + x;
			} else {
				parent = "menu" + x;
			}

			document.getElementById(parent).className = "MenuList";
			x++;
		}
	}


	if (sw != '3') 
	{

		if (sw == '1')
		{
			document.getElementById(td).className = "MenuFloat";
		} else {
			document.getElementById(td).className = "MenuList";
		}
	}


}

function ChangeClassEx (td, sw)
{


	if (sw == '1')
	{
		document.getElementById(td).className = "FloatEx";
	} else {
		document.getElementById(td).className = "ListEx";
	}



}

// Menu Bar, no expandable menu's
function ChangeMenuBar (td, sw)
{
	if (sw == '1')
	{
		document.getElementById(td).className = "MenuHover";
	} else {
		document.getElementById(td).className = "MenuBar";
	}
}


function xstooltip_findPosX(obj) 
{
  var curleft = 165;
  if (obj.offsetParent) 
  {
    while (obj.offsetParent) 
        {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}


function xstooltip_findPosY(obj) 
{
    var curtop = 2;
    if (obj.offsetParent) 
    {
        while (obj.offsetParent) 
        {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}

function xstooltip_show(tooltipId, parentId, posX, posY)
{

    var x = 1;

    document.getElementById(parentId).className = "MenuFloat";


    while (x <= 1)
    {
	it = document.getElementById('menu_' + x);
	it.style.visibility = 'hidden';
	x++;
    }


    it = document.getElementById(tooltipId);

   
    if ((it.style.top == '' || it.style.top == 0) 
        && (it.style.left == '' || it.style.left == 0))
    {
        // need to fixate default size (MSIE problem)
        it.style.width = it.offsetWidth + 'px';
        it.style.height = it.offsetHeight + 'px';
        
        img = document.getElementById(parentId); 
    
        // if tooltip is too wide, shift left to be within parent 
        if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
        if (posX < 0 ) posX = -5; 

        
        x = xstooltip_findPosX(img) + posX;
        y = xstooltip_findPosY(img) + posY;
        
        it.style.top = (y - 3) + 'px';
        it.style.left = x + 'px';
    }
    
    it.style.visibility = 'visible'; 

}

function xstooltip_hide()
{

    var x = 1;

    while (x <= 3)
    {
	it = document.getElementById('menu_' + x);
	it.style.visibility = 'hidden';
	x++;
    }

    //ChangeMenuClass('menu01', 0, 1);

    //it = document.getElementById(id); 
    //it.style.visibility = 'hidden'; 
}