function getTopMenuCoords(n)
{
    var t = document.getElementById('topMenu'+n);
    if (t) {
        var x = t.offsetLeft;
        var y = t.offsetTop;
        var p = t;
        while (p = p.offsetParent) {
            x += p.offsetLeft;
            y += p.offsetTop;
        }
        return [x, y, t.offsetWidth, t.offsetHeight];
    }
}


function showPopupMenu(n)
{
    var t = document.getElementById('topMenu1');
    if (t) {
    	t.className = 'services_active';
    }
    var m = document.getElementById('popupMenu'+n);
    if (m) {
        var c = getTopMenuCoords(n);
        if (c) {
            m.style.display = 'block';
            m.style.left = c[0]+'px';
            m.style.top = c[1]+c[3]+'px';
            var sh = document.getElementById('popupMenuShadow'+n);
            if (sh) {
                sh.style.display = 'block';
                sh.style.left = c[0]+5+'px';
                sh.style.top = c[1]+c[3]+5+'px';
                sh.style.width = m.offsetWidth+'px';
                sh.style.height = m.offsetHeight+'px';
            }
        }
    }
}


function hidePopupMenu(n)
{
    var t = document.getElementById('topMenu1');
    if (t) {
    	t.className = 'services';
    }
    var m = document.getElementById('popupMenu'+n);
    if (m) {
        m.style.display = 'none';
        var sh = document.getElementById('popupMenuShadow'+n);
        if (sh) {
            sh.style.display = 'none';
        }
    }
}
