var hscrollspeed=2
var vscrollspeed=1
var scrollupdate=40

function scrollbox_h() {
  var posn = parseInt(scroller1.style.left)
  if (posn > (contentwidth*-1)) {
    scroller1.style.left=posn-hscrollspeed
  }
  else {
    scroller1.style.left=parseInt(scroller2.style.left) + contentwidth
  }
  posn = parseInt(scroller2.style.left)
  if (posn > (contentwidth*-1)) {
    scroller2.style.left=posn-hscrollspeed
  }
  else {
    scroller2.style.left=parseInt(scroller1.style.left) + contentwidth
  }
}

function scrollbox_v() {
  var posn = parseInt(scroller1.style.top)
  if (posn > (contentheight*-1)) {
    scroller1.style.top=posn-vscrollspeed
  }
  else {
    scroller1.style.top=parseInt(scroller2.style.top) + contentheight
  }
  var posn = parseInt(scroller2.style.top)
  if (posn > (contentheight*-1)) {
    scroller2.style.top=posn-vscrollspeed
  }
  else {
    scroller2.style.top=parseInt(scroller1.style.top) + contentheight
  }
}

function scroller_init(dir){
  scrollercontent=document.getElementById("scrollcontent")
  scroller1=document.getElementById("scrollcontent1")
  scroller2=document.getElementById("scrollcontent2")
  if (dir=='h') {
    contentwidth=parseInt(scrollercontent.offsetWidth)
    scrollerwidth=parseInt(document.getElementById("scrollcontainer").offsetWidth)
	scroller1.innerHTML = scrollercontent.innerHTML
	scroller2.innerHTML = scrollercontent.innerHTML
    scroller1.style.width=contentwidth
    scroller2.style.width=contentwidth
    scroller1.style.left=scrollerwidth
    scroller2.style.left=scrollerwidth + contentwidth
  }
  if (dir=='v') {
    scrollerheight=parseInt(document.getElementById("scrollcontainer").offsetHeight)
    scroller1.style.top=scrollerheight
    contentheight=parseInt(scroller1.offsetHeight)
    scroller2.style.top=scrollerheight + contentheight
  }
  setInterval("scrollbox_"+dir+"()",scrollupdate)
}
