
function addLoadEvent(func)
{
  var oldonload = window.onload;
  if(typeof window.onload != 'function')
  {
    window.onload = func;
  }
  else
  {
    window.onload = function()
    {
      oldonload();
      func();
    }
  }
}
 var scr = 0;

function getProperty(item,property)
{
  var x = document.defaultView;
  if (x)
  {
    return x.getComputedStyle(item, '').getPropertyValue(property);
  }
}

function getWidth(item)
{
  if(x = item.offsetWidth)
  {
    return x;
  }
  return parseFloat(getProperty(item,"width"));
}
  
   
function updateMarquee()
{
  var datey = new Date();
  var dt1 = datey - lastTime;
  lastTime = datey;
  if(dt1 < 0)
  {
    dt1 = 1000 + dt1;
  }
  var w = scroll1.scrollWidth + 300;
  scr -= dt1/20;
  if(scr <= -w)
  {
    scr += w;
  }
  scroll1.style.left = scr + "px";
  scroll2.style.left = scr + w + "px"
}


function startMarquee()
{
  lastTime = new Date();
  scr = getWidth(document.getElementById("marquee"));
  scroll1 = document.getElementById("scroller");
  scroll2 = scroll1.cloneNode(true);
  document.getElementById("marquee").appendChild(scroll2);
  var mainloop = setInterval("updateMarquee()", 10);
}  

addLoadEvent(startMarquee);  
