var speed=90  // speed of scroller
var step=1     // smoothness of movement
var y, scroll, hb, hs, h

function testForObject(Id, Tag)
{
  var o = document.getElementById(Id);
  if (o)
  {
    if (Tag)
    {
      if (o.tagName.toLowerCase() == Tag.toLowerCase())
      {
        return o;
      }
    }
    else
    {
      return o;
    }
  }
  return null;
}


function initScroller(){
  var boardtest = testForObject("board","");
  if (document.getElementById && document.createElement && document.body.appendChild) {    
  if (boardtest)
    {
	   	hb=document.getElementById('board').offsetHeight
		hc=0
		hs=hb-6-hc
		document.getElementById('scrollcontent').style.height=hs+'px'
		tp=hs-(hs/3)
		document.getElementById('news').style.top=tp+'px'
		y=tp
		scroll=setTimeout('startScroller()',speed)
    }
  }
}

function startScroller(){
  h=document.getElementById('news').offsetHeight
  y-=step
  if (y<-h) {y=hs}
  document.getElementById('news').style.top=y+'px'
  scroll=setTimeout('startScroller()',speed)
}

function pauseScroller(){ speed = 1000; }
function restartScroller(){ speed = 90; }

function showAll(){
  if (document.getElementById) {
    stopScroller()
    document.getElementById('news').style.position='relative'
    document.getElementById('board').style.height='auto'
    document.getElementById('scrollcontent').style.height='auto'
    document.getElementById('news').style.top='0px'
  }
}

function hideAll(){
  if (document.getElementById) {
    document.getElementById('news').style.position='absolute'
    document.getElementById('board').style.height=hb+'px'
    initScroller()
  }
}

function scrollUp(){
  if (document.getElementById) {
    y-=step*20
    if (y<-h) {y=hs}
    document.getElementById('news').style.top=y+'px'
  }
}

function scrollDown(){
  if (document.getElementById) {
    y+=step*50
    if (y>h) {y=h}
    document.getElementById('news').style.top=y+'px'
  }
}