// Управление комментариями к объектам, выводящиеся в виде слоев.
// (c) Zhukov Alexey, 2003
// Last Revision: 23.04.03

var NS4 = (document.layers) ? 1 : 0;
var AltIdShow = 0;

function AltCreate(id, content) {
        document.writeln(
                (NS4
                        ? '<layer id=Alt'+id+' onMouseOver="AltShow(false, '+id+');" onMouseOut="AltHide('+id+');" visibility=hide left=0 top=0>'
                        : '<div id=Alt'+id+' onMouseOver="AltShow(false, '+id+');" onMouseOut="AltHide('+id+');" style="visibility:hidden; position:absolute; left:-2000; top:-2000;">')
                + content
                + (NS4 ? '</layer>' : '</div>')
        );
}

function AltShow(event, id) {
        if (AltIdShow && id!=AltIdShow) { AltHide(AltIdShow); AltIdShow = id; }
        if (NS4) document.layers['Alt'+id].visibility = "visible";
        else {
                document.getElementById('Alt'+id).style.visibility = "visible";
                if (event != false) {
                        var coord_x = event.clientX+document.body.scrollLeft;
                        var coord_y = event.clientY+document.body.scrollTop;
						var tblHeight=document.getElementById('Alt'+id).offsetHeight;
                        document.getElementById('Alt'+id).style.top = coord_y-tblHeight;
                        document.getElementById('Alt'+id).style.left = coord_x+10;
                        document.getElementById('Alt'+id).style.zindex = 0;
                }
        }
}

function AltHide(id, HideNow) {
//      if (!HideNow) { window.setTimeout("AltHide("+id+", 1)", 0); return; }
        if (NS4) document.layers['Alt'+id].visibility = "hide";
        else document.getElementById('Alt'+id).style.visibility = "hidden";
}
