var plNN = document.layers ? true : false; // NN or IE
var plIE = plNN ? false : true;
var psDL = plNN ? "layer" : "div";
var iM = false;
var q = "'";

 // window.onresize  = location.reload;

function w(sPar){document.write(sPar)}
function W(sPar){document.writeln(sPar)}

function LayBeg(nLeft, nTop, nWidth, sID)//`
{
var sL, sS, sE;

    if (plIE) {
        sL = "<div bgcolor=red style='position:absolute";
        sS = ";";
        sE = "'";
    } else {
        sL = "<layer ";
        sS = " ";
        sE = "";
    }

    if (sID != null)
    {
        sE +=  " id='" + sID + "'";
        sE += " onmouseover='event.cancelBubble=false'";
        sE += " onmouseout='alert(event.srcElement.id);if(event.srcElement.id.length>0)this.style.visibility=hidden'";
    }

    if (nLeft  != null) sL = sL + sS + "left=" + nLeft;
    if (nTop   != null) sL = sL + sS + "top=" + nTop;
    if (nWidth != null) sL = sL + sS + "width=" + nWidth;

    sE += ">";
    sL = sL + sE;

    w(sL);
}

function LayEnd()//`
{
var sL;

    if (plIE) sL = "</div>";
    else      sL = "</layer>";

    w(sL);
}

function Img(sSrc, sName, sA, sAlt, sW, sH)//`
{
var s = '';
    if (sA != null)
    {
        s += '<A href="'+sA+'"';
        if (sName != null)
        {   s += ' onmouseover="document.images.' + sName + '.src=' + q + sSrc.replace(".gif","_on.gif") + q+'"'
            s += ' onmouseout="document.images.' + sName + '.src=' + q + sSrc + q + '"'
        }
        s += '>';
    }
    s += '<img src="' + sSrc + '" border=0';

    if (sName != null) s += ' name="' + sName + '"';

    if (sAlt != null) s += "alt='" + sAlt + "'";

    if (sW != null) s += "width='" + sW + "'";

    if (sH != null) s += "height='" + sH + "'";

    s += '>';

    if (sA != null) s += '</A>';

    w(s);
}

function Parus(sM, xBegin, yBegin)//`вывод паруса над элементом меню
{
var screen_width = document.body.clientWidth;//document.images.screen_width.offsetLeft;
var tables_width = 750;//document.images.tables_width.offsetLeft;
var nShift, xBegin, x, y;

    if (plIE && xBegin != null && yBegin != null)
    {
        nShift = Math.max((screen_width - tables_width) / 2,0);

        x = nShift + xBegin;
        y = yBegin;

        LayBeg(x,y);
        Img("img/parus.gif",null,null,"parus",24,26);
        LayEnd();

    }
}

function LP(sN,nW,nH)//`
{
    open("LP.asp?src="+sN
        ,"LP","resizable=YES,menubar=NO,location=NO,toolbar=NO,status=NO,scrollbars=AUTO,width="+nW+",height="+nH+",center")
}
