function scrollObject(main, height, width, deccel, begin, speed, pause, classname)
{
   this.main       = main;
   this.one        = main + "Block1";
   this.two        = main + "Block2";
   this.block      = new Array();
   this.blockup    = 1;
   this.height     = height;
   this.width      = width;
   this.bkgcol     = "";
   this.deccel     = Math.max(deccel, 1);
   this.begin      = Math.max(Math.min(begin, this.height), 1);
   this.speed      = speed;
   this.pause      = pause;
   this.classname  = classname;
   this.slide      = this.height / this.begin;
   this.div        = 0;
   this.table      = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td class=\"" + this.classname + "\" style=\"width:" + this.width + "px;height:" + this.height + "px;\">";
   this.scroll     = scroll;
   this.scrollLoop = scrollLoop;
   this.opacityOne = 0;
   this.opacityTwo = 0;
}

function scroll(objTitle)
{
   if (this.block.length == 1) {
	   this.block[1] = "";
   }
   if (!document.getElementById) return false;
   document.getElementById(this.main).innerHTML = "<div id=\"" + this.one + "\"></div><div id=\"" + this.two + "\"></div>";
   document.getElementById(this.two).style.filter = "alpha(opacity=0)";
   this.opacityOne = 100;
   this.opacityTwo = 0;
   var divList = [document.getElementById(this.main), document.getElementById(this.one), document.getElementById(this.two)];
   for (var i = 0; i <= 2; i++)
   {
      if (i > 0)
      {
         divList[i].style.position = "absolute";
         divList[i].style.left = "0px";
         (i == 1) ? divList[i].style.top = "0px" : divList[i].style.top = this.height + "px";
         divList[i].innerHTML = this.table + this.block[i - 1] + "</td></tr></table>";
      }
	  else
      {
         divList[i].style.position = "relative";
         divList[i].style.background = this.bkgcol;
      }
      divList[i].style.width = this.width + "px";
      divList[i].style.height = this.height + "px";
      divList[i].style.overflow = "hidden";
   }
   setTimeout(objTitle + ".scrollLoop('" + objTitle + "');", this.pause);
}

function scrollLoop(objTitle)
{
   var divList = [document.getElementById(this.main), document.getElementById(this.one), document.getElementById(this.two)];
   for (var j = 1; j <= 2; j++) divList[j].style.top = (parseInt(divList[j].style.top) - this.slide) + "px";
   //this.slide = Math.max(parseInt(this.slide / this.deccel), 1);
   this.slide = Math.max(this.deccel, 1);
   this.opacityOne -= this.slide * 2;
   if (this.opacityOne < 0) opacityOne = 0;
   this.opacityTwo += this.slide;
   if (this.opacityTwo > 100) opacityTwo = 100;
   if (Math.min(parseInt(divList[1].style.top), parseInt(divList[2].style.top)) <= -this.height)
   {
      this.slide = this.height / this.begin;
      if (++this.blockup >= this.block.length) this.blockup = 0;
      (parseInt(divList[1].style.top) <= -this.height) ? this.div = 1 : this.div = 0;
      divList[2 - this.div].style.top = this.height + "px";
      divList[2 - this.div].innerHTML = this.table + this.block[this.blockup] + "</td></tr></table>";
      divList[1 + this.div].style.top = "0px";
	  this.opacityOne = 100;
	  this.opacityTwo = 0;
      setTimeout(objTitle + ".scrollLoop('" + objTitle + "');", this.pause);
  }
  else
  {
	  if (parseInt(divList[1].style.top) < parseInt(divList[2].style.top))
      {
		 document.getElementById(this.one).style.filter = "alpha(opacity=" + this.opacityOne + ")";
	   	 document.getElementById(this.two).style.filter = "alpha(opacity=" + this.opacityTwo + ")";   
      }
      else
      {
	   	 document.getElementById(this.two).style.filter = "alpha(opacity=" + this.opacityOne + ")";
	   	 document.getElementById(this.one).style.filter = "alpha(opacity=" + this.opacityTwo + ")";
      }
	setTimeout(objTitle + ".scrollLoop('" + objTitle + "');", this.speed);
  }
  return;
}
