var lb_divId = 'div_banner';
var lb_tableId = 'table_banner'
var lb_Width = 798;
var lb_Height = 60;

var shift = 1;
var leftPos;

function start()
{
	setInterval("roll()", 10);
	vAlignment();
	document.getElementById(lb_divId).style.visibility = 'visible';
}

function returnHeight()
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' )
  {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

/*
function vAlignment()
{
	myH = returnHeight();
	if (browser.isOpera)
	{
		document.getElementById(lb_divId).style.top = (document.documentElement.scrollTop + window.innerHeight -  lb_Height);
	}
	else if(browser.isMozilla)
	{
		document.getElementById(lb_divId).style.top = (document.documentElement.scrollTop + myH - lb_Height);
	}
	else
	{
		document.getElementById(lb_divId).style.top = (document.documentElement.scrollTop + myH - lb_Height);
	}
		
    document.getElementById(lb_divId).style.width = document.body.clientWidth;
}
*/


function vAlignment()
{
	document.getElementById(lb_divId).style.left = 0;
	if (document.all)
	{
		document.getElementById(lb_divId).style.top = (document.body.scrollTop + document.body.clientHeight - lb_Height);
	}
	else
	{
		document.getElementById(lb_divId).style.top = (document.body.clientHeight - lb_Height);
	}
	document.getElementById(lb_divId).style.width = document.body.clientWidth;
}

/*
function roll()
{
	banners_count = 4;
    if (document.all || document.getElementById)
    {
        leftPos = parseInt(document.getElementById(lb_tableId).style.left);
        document.getElementById(lb_tableId).style.left = leftPos - shift;
        if (Math.abs(leftPos) >= ((lb_Width * banners_count) - screen.width))
        {
            document.getElementById(lb_tableId).style.left = (-shift);
        }
    }
}*/

function roll()
{
    if (document.all || document.getElementById)
    {
        leftPos = parseInt(document.getElementById(lb_tableId).style.left);
		//alert('aa:'+leftPos);
        document.getElementById(lb_tableId).style.left = leftPos - shift;
        if (Math.abs(leftPos) >= lb_Width)
        {
            document.getElementById(lb_tableId).style.left = (-shift);
        }
    }
}

/*
function showBanner(bBody)
{
	var position;
	if (window.attachEvent)
	{
		window.attachEvent("onresize", vAlignment);
		window.attachEvent("onscroll", vAlignment);
		
		//window.attachEvent("onresize", vAlignment);
		//window.attachEvent("onresize", someA);
		position = "absolute";
	}
	else
	{
		window.addEventListener("resize", vAlignment, 1);
		position = "fixed";
	}
	
	document.write('<div id="' + lb_divId + '" onMouseout="shift=1" onMouseover="shift=0" style="border: 0px;visibility:hidden;overflow:hidden;position:' + position + ';left:0px;width:' + document.body.clientWidth + 'px;height:' + lb_Height + 'px;z-index:100;">');
	document.write('<table class="tblBnrrr" cellspacing=0 cellpadding=0 id="' + lb_tableId + '" style="border: 0px;position:absolute;left:0;top:0;width:' + (lb_Width * 4) + 'px"><tr><td>' + bBody + '</td></table></div>');
	setTimeout("start()", 1000);
}
*/

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="' + lb_divId + '" onMouseout="shift=1" onMouseover="shift=0" style="visibility:hidden;overflow:hidden;position:' + position + ';left:0px;width:' + document.body.clientWidth + 'px;height:' + lb_Height + 'px;z-index:100;">');
    document.write('<table cellspacing=0 cellpadding=0 id="' + lb_tableId + '" style="position:absolute;left:0;top:0;width:' + (lb_Width * 4) + 'px"><tr><td>' + bBody + '</td></table></div>');

    setTimeout("start()", 1000);
}
