var infoLayer;

function showInfo(link, title, text)
{
    if(typeof(infoLayer)=='object')
        hideInfo();
    
    link.style.cursor = 'default';
    link.style.position = 'relative';
    
    infoLayer = document.createElement('div');
    infoLayer.style.background = '#DBEFC2';
    infoLayer.style.border = '1px solid #6C0';
    infoLayer.style.position = 'absolute';
    infoLayer.style.top = '-9px';
    infoLayer.style.left = '-5px';
    infoLayer.style.zIndex = '100';
    infoLayer.style.padding = '4px';
    infoLayer.style.whiteSpace = 'nowrap';
    
    img = link.getElementsByTagName('img')[0].cloneNode(true);
    img.style.marginRight = '4px';
    img.style.cursor = 'pointer';
    img.onmouseup = hideInfo;
    infoLayer.appendChild(img);    

    span = document.createElement('span');
    span.style.marginRight = '20px';
    span.style.fontWeight = 'bold';
    span.style.fontSize = '12px';
    span.appendChild(document.createTextNode(title));
    infoLayer.appendChild(span);
    
    img = document.createElement('img');
    img.src = '/images/close.gif';
    img.style.position = 'absolute';
    img.style.top = '4px';
    img.style.right = '4px';
    img.style.cursor = 'pointer';
    img.onmouseup = hideInfo;
    infoLayer.appendChild(img);
    
    infoLayer.appendChild(document.createElement('hr'));
    
    textField = document.createElement('span');
    textField.innerHTML = text;
    infoLayer.appendChild(textField);

    link.appendChild(infoLayer);
}

function hideInfo()
{
    if(typeof(infoLayer)=='object')
    {
        infoLayer.parentNode.style.cursor = 'pointer';
        infoLayer.parentNode.style.position = 'static';
        infoLayer.parentNode.removeChild(infoLayer);
        infoLayer = false;
    }
}

function focusMenu(menu)
{
    document.getElementById('pop' + menu).style.display = 'block';
    document.getElementById(menu).style.background = '#FFF';
}

function removeFocusMenu(menu)
{
    document.getElementById('pop' + menu).style.display = '';
    document.getElementById(menu).style.background = '';
}

function removeFocusMenuAll(menu)
{
    if(menu != 'menuSuchen')
    {
        document.getElementById('popmenuSuchen').style.display = '';
        document.getElementById('menuSuchen').style.background = '';
    }
    
    if(menu != 'menuEintragen')
    {
        document.getElementById('popmenuEintragen').style.display = '';
        document.getElementById('menuEintragen').style.background = '';
    }
    
    if(menu != 'menuKlommunity')
    {
        document.getElementById('popmenuKlommunity').style.display = '';
        document.getElementById('menuKlommunity').style.background = '';
    }
}