/*
Cross browser marquee script- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com

Modified to work with the W3C DOM by Doron Rosenberg

*/

var timeout=45;

var marqueewidth=278
//Specify the marquee's height (in pixels, pertains only to NS)
var marqueeheight=18
//Specify the marquee's scroll speed (larger is faster)
var speed=1
//Specify the marquee contents
var marqueecontents='W3C DOM rocks! -- w3.org ';

if (document.all)
  document.write('<marquee scrollAmount='+speed+' style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>')

function regenerate(){
  window.location.reload()
}

function regenerate2(){
  if(document.all) return;

  if (document.layers){
    setTimeout("window.onresize=regenerate",450)  
  }
  intializemarquee()
}

function intializemarquee(){

  if(document.layers){
     document.cmarquee01.document.cmarquee02.document.write(marqueecontents)
     document.cmarquee01.document.cmarquee02.document.close()
     thelength=document.cmarquee01.document.cmarquee02.document.width
  } else {
    document.getElementById('cmarquee02').innerHTML='<div id="cmarqueecontent" style="position:absolute; left:0; top:0;"><nobr>'+marqueecontents+'</nobr><\/div>';
    thelength=document.getElementById('cmarqueecontent').offsetWidth;	
    document.getElementById('cmarqueecontent').style.left=marqueewidth;	
  }	
  scrollit()  
}

function scrollit(){

  if(document.layers){
    if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
      document.cmarquee01.document.cmarquee02.left-=speed
      setTimeout("scrollit()",100)
    }
    else{
      document.cmarquee01.document.cmarquee02.left=marqueewidth
      scrollit()
    }
  } else if (document.getElementById){
    if(document.getElementById('cmarqueecontent').offsetLeft >= thelength*(-1)*2){
      document.getElementById('cmarqueecontent').style.left = document.getElementById('cmarqueecontent').offsetLeft - speed;
      setTimeout("scrollit()",timeout)
    } else {
      document.getElementById('cmarqueecontent').style.left=marqueewidth
      setTimeout("scrollit()",timeout)  
    }
  }
}

window.onload=regenerate2			

if(document.getElementById)
  document.write('<div id="cmarquee02" style="position:relative; left:0; top:0; height: '+marqueeheight+'px; width:'+marqueewidth+'px;clip: rect(0px,'+marqueewidth+'px, '+marqueeheight+'px, 0px); overflow:hidden;"></div>');
else if (document.layers) 
  document.write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="cmarquee01"><layer name="cmarquee02"></layer></ilayer>');
