//Бегущий баннер
var divId = 'div_banner';
var tableId = 'table_banner'
var bWidth = 800;
var bHeight = 35;
var shift = 1;
var leftPos;

function start()
{
    setInterval("roll()", 30);
    vAlignment();
    document.getElementById(divId).style.visibility = 'visible';
}

function vAlignment()
{
    document.getElementById(divId).style.left = 4;
    if (document.all)
        document.getElementById(divId).style.top = (document.body.scrollTop + document.body.clientHeight - bHeight);
    else
        document.getElementById(divId).style.top = (document.body.clientHeight - bHeight);
    document.getElementById(divId).style.width = document.body.clientWidth;
}

function roll()
{
    if (document.all || document.getElementById)
    {
        leftPos = parseInt(document.getElementById(tableId).style.left);
        document.getElementById(tableId).style.left = leftPos - shift;
        if (Math.abs(leftPos) >= bWidth)
        {
            document.getElementById(tableId).style.left = (-shift);
        }
    }
}

function showBanner(bBody)
{
    var position;
 if (window.attachEvent)
   {
      window.attachEvent("onscroll", vAlignment);
       window.attachEvent("onresize", vAlignment);
       position = "absolute";
   }
   else
    {
      window.addEventListener("resize", vAlignment, 1);
      position = "fixed";
   }

   document.write('<div id="' + divId + '" onMouseout="shift=1" onMouseover="shift=0" style="visibility:hidden;overflow:hidden;position:' + position + ';left:0px;width:' + document.body.clientWidth + 'px;height:' + bHeight + 'px;z-index:100;">');
   document.write('<table cellspacing=0 cellpadding=0 id="' + tableId + '" style="position:absolute;left:0;top:0;width:' + (bWidth * 4) + 'px"><tr><td>' + bBody + '</td></table></div>');

    setTimeout("start()", 1000);
}
