//---------------------------------------------------
function fnIntroMenu(id, className){
	var img_menu = document.getElementById(id);
		img_menu.className = className;
}
//---------------------------------------------------
function fnOutMenu(id, className){
	var img_menu = document.getElementById(id);
		img_menu.className = className;
}
//---------------------------------------------------


/*MENU DESCPLEGABLE*/
// JavaScript Document
var hidemenu_onclick="yes";
var ie4=document.all;
var ns6=document.getElementById&&!document.all;
var disappeardelay=100;


function xstooltip_findPosX(obj) 
{
  var curleft = 0;
  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 = 0;
    if (obj.offsetParent)     {
        while (obj.offsetParent) {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}

function subMenu_show(tooltipId, parentId, posX, posY){
    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 = 0; 
        
        x = xstooltip_findPosX(img) + posX;
        y = xstooltip_findPosY(img) + posY;
        
        it.style.top = y + 'px';
        it.style.left = 394 + 'px';
    }
    it.style.visibility = 'visible'; 
}
//----------------------------------------------
function subMenu_hide(id){
    it = document.getElementById(id); 
    it.style.visibility = 'hidden'; 
}
//----------------------------------------------
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
	return true;
	return false;
}

function dynamichide(e, id){
it = document.getElementById(id);

	if (ie4&&!it.contains(e.toElement))
		delayhidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		delayhidemenu()
}

function hidemenu(){
	if (typeof it!="undefined"){
		if (ie4||ns6){
			it.style.visibility="hidden"
		}
	}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
