/*
 * qujOchOE scripts
 * (c) 2002 qujOchOE, sgefant
 */

// browser check
var dom, ie4, ie5, nav4;
dom = document.getElementById?1:0;
ie4 = (document.all && !dom)?1:0;
ie5 = (navigator.appVersion.indexOf("MSIE 5")>-1 && dom)?1:0;
nav4 = (document.layers && !dom)?1:0;
konq = (navigator.appVersion.indexOf("Konqueror")>-1)?1:0;
// scrolling with opera appears to be broken
opera = (navigator.appName.indexOf("Opera")>-1)?1:0;

var initialised = false;
var scrolling = false;
var timer;
content = new Object();
container = new Object();

function init() {
  content   = document.getElementById("bodycopy"");
  container = document.getElementById("bodycopy");
  if (ie5) content.style.position = "absolute"; // bah
  if (konq) content.style.height = "290px"; // double bah
/*
  if (opera) {
    container.style.overflow = "scroll";
  }
*/
  initialised = true;

}

function scrollUp() {
  if (!initialised) init();
  scrolling = true;
  scroll(36);
}

function scrollDown() {
  if (!initialised) init();
  scrolling = true;
  scroll(-36);
}

function stopScroll() {
  clearTimeout(timer);
  scrolling = false;
}

function scroll(amount) {
  var top = 2;
  style = content.style;
  if (style.top) top = parseInt(style.top);
  else top = 2;
  if ((amount < 0 || top < 2) && (amount > 0 || content.offsetHeight+top >= container.offsetHeight-10 || konq)) {
    top+= amount;
    style.top = top+"px";
  } else { stopScroll(); }
  if (scrolling) timer=setTimeout("scroll("+amount+")", 100);
}
