
var ns = document.layers ? true : false;

function newslaypos (plusy, plusx) {
  plusx = 1;
  plusy = 23;
  if (ns) plusy = plusy - 1;
  
  pos = document.images["newspos"];
  if (ns) {
    posx = pos.x;
    posy = pos.y;
  } else {
    posx = getLeft(pos);
    posy = getTop(pos);
  }
  scrollerleft = posx + plusx;
  scrollertop = posy + plusy;
}

// Höhe der Scrollerbox (pixels)
var scrollerheight = 100

// Breite der Scrollerbox (pixels)
var scrollerwidth = 164

// Abstand zum linken Fensterrand (pixels)
var scrollertop = 0;

// Abstand zum oberen Bildschirmrand (pixels)
var scrollerleft = 0;

// Abstand zwischen Boxrahmen und Text (pixels)
var scrollerpadding = 5

// Breite des Box-Rahmens (pixels)
var backgroundborder = 0

// Hintergrundfarbe der Scrollerbox
var scrollerbgcolor="ffffff"

// Wartezeit zwischen den Textblöcken (milliseconds)
var standstillfix = 5000

var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var mozup = (!document.all && document.getElementById) ? 1 : 0;

var cliptop=0
var clipbottom=scrollerheight-2*scrollerpadding
var clipleft=0
var clipright=155

var i_message=0
var mes_joined
var mes_split
var contenttext

var totalheight=scrollerheight * (message.length - 1)
var i_height=0
var step=2
var pause=20

var standstillflex=0

function initiate(){
  contenttext="<table cellpadding=0 cellspacing=0 border=0 width="+(scrollerwidth-2*scrollerpadding)+">"
  contenttext+="<tr valign='top'><td height='"+scrollerheight+"'><br></td></tr>"
  for (i=0;i<=message.length-1;i++) {
    mes_joined=message[i]
    mes_split=mes_joined.split("|")
    contenttext+="<tr valign='top'><td height='"+scrollerheight+"'>"+mes_split[1]+"</td></tr>"
  }
  contenttext+="</table>"
  if (ie4up) {
    scrollertext.innerHTML=contenttext
    document.all.scrollertext.style.posTop=scrollertop
    document.all.scrollertext.style.posLeft=scrollerleft
    document.all.scrollerbg.style.posTop=scrollertop
    document.all.scrollerbg.style.posLeft=scrollerleft
    document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  }
  if (ns4up) {
    document.scrollertext.document.write(contenttext)
    document.scrollertext.document.close()
    document.scrollerbg.document.close()
    document.scrollertext.top=scrollertop
    document.scrollertext.left=scrollerleft
    document.scrollerbg.top=scrollertop-scrollerpadding
    document.scrollerbg.left=scrollerleft-scrollerpadding
    document.scrollertext.clip.left=clipleft
    document.scrollertext.clip.right=clipright
    document.scrollertext.clip.top=cliptop
    document.scrollertext.clip.bottom=clipbottom
  }
  if (mozup) {
    document.getElementById("scrollertext").innerHTML=contenttext
    document.getElementById("scrollertext").style.top=scrollertop
    document.getElementById("scrollertext").style.left=scrollerleft
    document.getElementById("scrollerbg").style.top=scrollertop
    document.getElementById("scrollerbg").style.left=scrollerleft
    document.getElementById("scrollertext").style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  }
  scroll()
}
function scroll(){
  standstillflex=standstillfix
  if (ie4up){
    if (i_height<scrollerheight) {
      i_height+=step
      cliptop+=step
      clipbottom+=step
      document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
      document.all.scrollertext.style.posTop-=step
      var timer=setTimeout("scroll()",pause)
    } else {
      if (document.all.scrollertext.style.posTop<=-(totalheight)) {
        document.all.scrollertext.style.posTop=scrollertop
        cliptop=0
        clipbottom=scrollerheight-2*scrollerpadding
        document.all.scrollertext.style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        standstillflex=0
      }
      i_height=0
      clearTimeout(timer)
      var timer=setTimeout("scroll()",standstillflex)
    }
  }
  if (ns4up){
    if (i_height<scrollerheight) {
      i_height+=step
      cliptop+=step
      clipbottom+=step
      document.scrollertext.clip.left=clipleft
      document.scrollertext.clip.right=clipright
      document.scrollertext.clip.top=cliptop
      document.scrollertext.clip.bottom=clipbottom
      document.scrollertext.top-=step
      var timer=setTimeout("scroll()",pause)
    } else {
      if (document.scrollertext.top<=-(totalheight)) {
        document.scrollertext.top=scrollertop
        cliptop=0
        clipbottom=scrollerheight-2*scrollerpadding
        document.scrollertext.clip.left=clipleft
        document.scrollertext.clip.right=clipright
        document.scrollertext.clip.top=cliptop
        document.scrollertext.clip.bottom=clipbottom
        standstillflex=0
      }
      i_height=0
      clearTimeout(timer)
      var timer=setTimeout("scroll()",standstillflex)
    }
  }
  if (mozup){
    if (i_height<scrollerheight) {
      i_height+=step
      cliptop+=step
      clipbottom+=step
      document.getElementById("scrollertext").style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
      document.getElementById("scrollertext").style.top=parseInt(document.getElementById("scrollertext").style.top, 10)-step
      var timer=setTimeout("scroll()",pause)
    } else {
      if (parseInt(document.getElementById("scrollertext").style.top, 10)<=-(totalheight)) {
        document.getElementById("scrollertext").style.top=scrollertop
        cliptop=0
        clipbottom=scrollerheight-2*scrollerpadding
        document.getElementById("scrollertext").style.clip="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        standstillflex=0
      }
      i_height=0
      clearTimeout(timer)
      var timer=setTimeout("scroll()",standstillflex)
    }
  }
}