//
function animateDiv(oDiv, bOn, nScrollAmount, nScrollDelay )
{
  bOn = (bOn == null ? true : bOn);
  nScrollAmount = (nScrollAmount == null ? oDiv.scrollAmount  : nScrollAmount);
  nScrollAmount = (nScrollAmount == null ? 01 : nScrollAmount);

  nScrollDelay  = (nScrollDelay  == null ? oDiv.scrollDelay : nScrollDelay);
  nScrollDelay  = (nScrollDelay  == null ? 50 : nScrollDelay);

  oDiv.scrollAmount = nScrollAmount;
  oDiv.scrollDelay = nScrollDelay ;

  if (oDiv.initialInner == null)
  {
    oDiv.direction = 'bottom-top';
    if (Math.round(Math.random() * 2) == 0)
      oDiv.direction = 'top-bottom';

    oDiv.innerHTML = oDiv.innerHTML;
    oDiv.initialInner = oDiv.innerHTML;
    var nTmp = '' + oDiv.scrollHeight;   // Workaround : force recompute scroll values
    oDiv.initialScrollHeight = oDiv.scrollHeight;
    oDiv.innerHTML += oDiv.initialInner;
    if (oDiv.direction == 'bottom-top')
      oDiv.scrollTop = 0;
    else if (oDiv.direction == 'top-bottom')
      oDiv.scrollTop = oDiv.initialScrollHeight - oDiv.clientHeight;
    oDiv.style.visibility = 'visible';
  }

  if (bOn)
  {
    if (oDiv.direction == 'bottom-top')
    {
      oDiv.animateCallback = function()
      {
        this.scrollTop += this.scrollAmount;
        var nTmp =  '' + this.scrollTop; // Workaround : force recompute scroll values
        if (this.scrollTop >= (this.scrollHeight - this.initialScrollHeight))
          this.scrollTop = 0;
      }
    }
    else if (oDiv.direction == 'top-bottom')
    {
      oDiv.animateCallback = function()
      {
        this.scrollTop -= this.scrollAmount;
        var nTmp =  '' + this.scrollTop; // Workaround : force recompute scroll values
        if (this.scrollTop < (this.initialScrollHeight - this.clientHeight))
          this.scrollTop = this.scrollHeight;
      }
    }
    oDiv.timer = window.setInterval('document.getElementById("' + oDiv.id + '").animateCallback()', oDiv.scrollDelay, 'javascript');
  }
  else
  {
    window.clearInterval(oDiv.timer);
  }
}
function xalert(sStr)
{
  divMaster.innerHTML += '<br/>' + sStr;

}
