
tickerTop = 440;
tickerLeft = 10;
tickerWidth = 125;
tickerHeight = 750;
movingSpeed = 5;
stopDelay = 1000;

//---------------------------------------------------------

var isNS = (navigator.appName == "Netscape");
var isIE = (document.all)? true:false
var scrolltimer = null;

//---------------------------------------------------------

function startMoving()
{

 bottomClip = 0;
 topClip = 0;
 countDelay = 0;

 if (isIE)
 {
  theDIV.style.visibility = "hidden";
  theDIV.style.clip = "rect(0,0,0,0)";
  theDIV.style.pixelTop = tickerTop + tickerHeight;
  theDIV.style.pixelLeft = tickerLeft;
  theDIV.style.visibility = "visible";
 }
 
 if (isNS)
 {
  document.theDIV.visibility = "hidden";
  document.theDIV.clip.top = 0;
  document.theDIV.clip.bottom = 0;
  document.theDIV.clip.right = tickerWidth;
  document.theDIV.clip.left = 0;
  document.theDIV.top = tickerTop + tickerHeight;
  document.theDIV.left = tickerLeft;
  document.theDIV.visibility = "visible";
 }
 moveIn();
}

//---------------------------------------------------------

function moveIn()
{
 
 if (isNS)
 {
  if (document.theDIV.top == tickerTop) 
  {
   clearTimeout(scrolltimer);
   delay();
  }
  else
  {
   document.theDIV.clip.bottom += 1;
   document.theDIV.top -= 1;
   scrolltimer = setTimeout("moveIn()", movingSpeed);
  }
 }
  
 if (isIE)
 {
  if (theDIV.style.pixelTop == tickerTop) 
  {
   clearTimeout(scrolltimer);
   delay();
  }
  else
  {
   bottomClip +=1;
   theDIV.style.clip = "rect(0, " + tickerWidth + ", " + bottomClip + ", 0)";
   theDIV.style.pixelTop -= 1;
   scrolltimer = setTimeout("moveIn()", movingSpeed);
  }
 }
}

//---------------------------------------------------------

function moveOut()
{

 if (isNS)
 {
  if (document.theDIV.top == (tickerTop - tickerHeight)) 
  {
   clearTimeout(scrolltimer);
   doNews();
  }
  else
  {
   document.theDIV.clip.top += 1;
   document.theDIV.top -= 1;
   scrolltimer = setTimeout("moveOut()", movingSpeed);
  }
 }
  
 if (isIE)
 {
  if (theDIV.style.pixelTop == (tickerTop - tickerHeight)) 
  {
   clearTimeout(scrolltimer);
   doNews();
  }
  else
  {
   topClip +=1;
   theDIV.style.clip = "rect(" + topClip + ", " + tickerWidth + ", " + bottomClip + ", 0)";
   theDIV.style.pixelTop -= 1;
   scrolltimer = setTimeout("moveOut()", movingSpeed);
  }
 }
}

//---------------------------------------------------------

function delay()
{
 if (countDelay == 1) 
 {
  clearTimeout(scrolltimer);
  moveOut();
 }
 else
 {
  countDelay = 1;
  scrolltimer = setTimeout("delay()", stopDelay);
 }
}

//---------------------------------------------------------

function doNews()
{
 if (newsItem <= news.length-2) 
 {
  clearTimeout(scrolltimer);
  newsItem +=1;
  WriteHTML(news[newsItem]);
  startMoving();
 }
 else
 {
  newsItem = 0;
  scrolltimer = setTimeout("doNews()", 0);
 }
}

//---------------------------------------------------------

function WriteHTML(html)
{
 if (isNS)
 {
  document.theDIV.document.open();
  document.theDIV.document.write(html);
  document.theDIV.document.close();  
 }
 if (isIE) theDIV.innerHTML = html;
}