var Ver4=parseInt(navigator.appVersion.charAt(0))>=4
var IE=navigator.appName.indexOf("Microsoft")!=-1
// var al, a1, a2, a3, a4, a5, imagesrc, ex=-32, ey=-32, x0=-32, y0=-32, x1=-32, y1=-32, x2=-32, y2=-32, x3=-32, y3=-32, x4=-32, y4=-32, x5=-32, y5=-32, x6=-32, y6=-32, x7=-32, y7=-32, x8=-32, y8=-32, x9=-32, y9=-32
var al, a1, a2, a3, a4, a5, imagesrc, ex=450, ey=250, x0=450, y0=250, x1=466, y1=266, x2=466, y2=266, x3=466, y3=266, x4=466, y4=266, x5=466, y5=266, x6=466, y6=266, x7=466, y7=266, x8=466, y8=266, x9=466, y9=266
 
function BewegeBiene()
{ // Neue Position der Spur ist alte Position der Biene
  y9=y8
  x9=x8
  y8=y7
  x8=x7
  y7=y6
  x7=x6
  y6=y5
  x6=x5
  y5=y4
  x5=x4
  y4=y3
  x4=x3
  y3=y2
  x3=x2
  y2=y1
  x2=x1
  y1=y0
  x1=x0

 // Neue Position des Biene berechnen
  if (Math.abs(ex-x0)>=10) { x0+=Math.floor((ex-x0)*0.1) }
  else if (ex!=x0) { x0+=Math.abs(ex-x0)/(ex-x0) }
  if (Math.abs(ey-y0)>=10) { y0+=Math.floor((ey-y0)*0.1) }
  else if (ey!=y0) { y0+=Math.abs(ey-y0)/(ey-y0) }

  // entsprechende Grafik in Bezug zur Maus-Position waehlen
  imagesrc=""
  if ( (ex<x0) && ( (x0-ex) > Math.abs(y0-ey)/2 ) )
  { imagesrc="/biene/biene_l.gif"
    if ( (x0-ex) < Math.abs(y0-ey)*2 )
    { if (ey<y0) imagesrc="/biene/biene_ol.gif"
      if (ey>y0) imagesrc="/biene/biene_ul.gif"
    }
  }
  if ( (ex>x0) && ( (ex-x0) > Math.abs(y0-ey)/2) )
  { imagesrc="/biene/biene_r.gif"
    if ( (ex-x0) < Math.abs(y0-ey)*2 )
    { if (ey<y0) imagesrc="/biene/biene_or.gif"
      if (ey>y0) imagesrc="/biene/biene_ur.gif"
    }
  }
  if (imagesrc=="")
  { if (ey<y0) imagesrc="/biene/biene_o.gif"
    if (ey>y0) imagesrc="/biene/biene_u.gif"
    if ((ex==x0)&&(ey==y0)) imagesrc="/biene/biene_r.gif"
  }

  // Grafik und Position setzen
  if (Ver4)
  { if (!IE)
    { document.BieneLayer.document.images.biene.src=imagesrc }
    else document.all.BieneLayer.document.images.biene.src=imagesrc
  }
  al.left=x0-32
  al.top=y0
  a1.left=x1-22
  a1.top=y1+16
  a2.left=x2-22
  a2.top=y2+16
  a3.left=x3-22
  a3.top=y3+16
  a4.left=x4-22
  a4.top=y4+16
  a5.left=x5-22
  a5.top=y5+16
  a6.left=x6-22
  a6.top=y6+16
  a7.left=x7-22
  a7.top=y7+16
  a8.left=x8-22
  a8.top=y8+16
  a9.left=x9-22
  a9.top=y9+16

  setTimeout("BewegeBiene();",80)
}

function MeinMausEvent(e)
{ // Position des Maus-Cursors ermitteln
  if (Ver4)
  { if (!IE)
    { ex=e.pageX
      ey=e.pageY }
    else
    { ex=event.clientX + document.body.scrollLeft
      ey=event.clientY + document.body.scrollTop }
  }
}

function ScriptSetup()
{ // Alle Biene-Grafiken laden
  isIm = (document.images) ? 1 : 0
  if (isIm)
  { arImLoad = new Array
    ('/biene/biene_r','/biene/biene_u','/biene/biene_o','/biene/biene_l','/biene/biene_r',
     '/biene/biene_ul','/biene/biene_ol','/biene/biene_ur','/biene/biene_or')
    arImList = new Array ()
    for (counter in arImLoad)
    { arImList[counter] = new Image()
      arImList[counter].src = arImLoad[counter] + '.gif'
    }
  }

  // Globale Variablen setzen und Maus-Event initialisieren
  if (Ver4)
  { if (!IE)
    { al=document.BieneLayer
      a1=document.spur1
      a2=document.spur2
      a3=document.spur3
      a4=document.spur4
      a5=document.spur5
      a6=document.spur6
      a7=document.spur7
      a8=document.spur8
      a9=document.spur9
      document.captureEvents(Event.MOUSEMOVE)
    }
    else
    { al=document.all.BieneLayer.style
    a1=document.all.spur1.style
    a2=document.all.spur2.style
    a3=document.all.spur3.style
    a4=document.all.spur4.style
    a5=document.all.spur5.style
    a6=document.all.spur6.style
    a7=document.all.spur7.style
    a8=document.all.spur8.style
    a9=document.all.spur9.style }
    document.onmousemove = MeinMausEvent
    BewegeBiene()
  }
}

function ZeigeBiene()
{ // Setzen der Block-Level Container zur Anzeige der Grafiken
  if(Ver4)
  { s ='<DIV STYLE="visibility:hidden"></DIV>'
    s+='<DIV ID="spur1" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur1i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur2" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur2i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur3" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur3i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur4" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur4i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur5" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur5i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur6" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur6i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur7" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur7i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur8" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur8i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="spur9" STYLE="position:absolute; '
    s+='top:-4; left:-4; width:4; height:4">'
    s+='<IMG NAME="spur9i" SRC="/biene/spur.gif" border=0>'
    s+='</DIV>'
    s+='<DIV ID="BieneLayer" STYLE="position:absolute; '
    s+='top:-32; left:-32; width:32; height:32">'
    s+='<IMG NAME="biene" SRC="/biene/biene_r.gif" border=0>'
    s+='</DIV>'
    document.writeln(s)
  }
}

window.onload = ScriptSetup
ZeigeBiene()
