function continuous_scroller(content, divId, height, delay, innerdivclass){
  this.content=content; 				//message array content
  this.tickerid=divId; 					//ID of ticker div to display information
  this.delay=delay; 					//Delay between msg change, in miliseconds.
  this.mouseoverBol=0; 					//Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
  this.nexttickerid="next"+divId; 			//2nd ticker id for tailing mode
  this.displayheight=height;
  var tickerdiv_content='';
  var nexttickerdiv_content='';
  var i=0;
  for (i=0; i<content.length; i++)
  {
    tickerdiv_content = tickerdiv_content + '<div id="'+ this.tickerid + i +'" class="' + innerdivclass + '">' + content[i] + '</div>' ;
    nexttickerdiv_content = nexttickerdiv_content + '<div id="'+ this.nexttickerid + i +'" class="' + innerdivclass + '">' + content[i] + '</div>' ;
  }
  var tickerdiv_construct = '<div id="'+ this.tickerid +'">'+ tickerdiv_content +'</div>';
  var nexttickerdiv_construct = '<div id="'+ this.nexttickerid +'">'+ nexttickerdiv_content +'</div>';
  var html_string=tickerdiv_construct+nexttickerdiv_construct;
  document.write(html_string);
  var scrollerinstance=this;
  if (window.addEventListener) 				//run onload in DOM2 browsers
  window.addEventListener("load", function(){scrollerinstance.initialize();}, false)
  else if (window.attachEvent) 				//run onload in IE5.5+
  window.attachEvent("onload", function(){scrollerinstance.initialize();})
  else if (document.getElementById) 			//if legacy DOM browsers, just start scroller after 0.5 sec
  setTimeout(function(){scrollerinstance.initialize();}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

continuous_scroller.prototype.initialize=function(){
  var scrollerinstance=this;

  for(i=0;i<this.content.length;i++)
  {
    objd=eval(this.tickerid+i);
    objd2=eval(this.nexttickerid+i);
    if((parseInt(objd.offsetHeight)<=0)||(parseInt(objd2.offsetHeight)<=0))
    {
      setTimeout(function(){scrollerinstance.initialize()},1000);
      return;
    }
  }
  this.marking=8;
  
  this.contentmark=new Array();
  for(i=0;i<this.content.length;i++)
  {
    objd=eval(this.tickerid+i);
    this.contentmark[this.marking]=3;
    this.marking = this.marking+objd.offsetHeight;
  }
  this.tickerdiv=document.getElementById(this.tickerid);
  this.nexttickerdiv=document.getElementById(this.nexttickerid);

  this.visibledivtop=0;
  this.nexttickerdiv.style.top=this.displayheight+'px';
  //this.getinline(this.tickerdiv, this.nexttickerdiv);
  document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1;}
  document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0;}
  document.getElementById(this.nexttickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1;}
  document.getElementById(this.nexttickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0;}

  if (window.attachEvent) //Clean up loose references in IE
     window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null;scrollerinstance.nexttickerdiv.onmouseover=scrollerinstance.nexttickerdiv.onmouseout=null;})
  setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

continuous_scroller.prototype.animateup=function(){
  var scrollerinstance=this;
  var nexttickpos=0;

  if (this.mouseoverBol==0)
  {
    this.visibledivtop--;
    if (this.visibledivtop < (this.marking * -1))
    {
      this.visibledivtop=0 ;
      this.nexttickerdiv.style.top=this.displayheight + 'px';
    }
    this.tickerdiv.style.top = this.visibledivtop + 'px';
    if ((this.visibledivtop+this.marking)<this.displayheight)
    { 
      nexttickpos = this.visibledivtop + this.marking;
      this.nexttickerdiv.style.top = nexttickpos + 'px';
    }
  }
  if(this.contentmark[(this.visibledivtop*(-1))+8]==3)
  { 
    setTimeout(function(){scrollerinstance.animateup()},2000+35);   
  }   
  else    
  {        
    setTimeout(function(){scrollerinstance.animateup()},35);    
  }
}

/*
continuous_scroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px";
top2=div1.style.top + div1.offsetHeight;
div2.style.top=top2+"px"; 
}
*/

