var Ver4=parseInt(navigator.appVersion.charAt(0))>=4
var IE=navigator.appName.indexOf("Microsoft")!=-1
var al, imagesrc, ex=-32, ey=-32, x0=-32, y0=-32
  
function BewegeFlugzeug()
{ // Neue Position des Flugzeuges 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) }

  imagesrc=""
  if ( (ex<x0) && ( (x0-ex) > Math.abs(y0-ey)/2 ) )
  { imagesrc="flieger_l.gif"
    if ( (x0-ex) < Math.abs(y0-ey)*2 )
    { if (ey<y0) imagesrc="flieger_lo.gif"
      if (ey>y0) imagesrc="flieger_lu.gif"
    }
  }
  if ( (ex>x0) && ( (ex-x0) > Math.abs(y0-ey)/2) )
  { imagesrc="flieger_r.gif"
    if ( (ex-x0) < Math.abs(y0-ey)*2 )
    { if (ey<y0) imagesrc="flieger_ro.gif"
      if (ey>y0) imagesrc="flieger_ru.gif"
    }
  }
  if (imagesrc=="")
  { if (ey<y0) imagesrc="flieger_o.gif"
    if (ey>y0) imagesrc="flieger_u.gif"
    if ((ex==x0)&&(ey==y0)) imagesrc="flieger.gif"
  }

  if (Ver4)
  { if (!IE)
    { document.FlugzeugLayer.document.images.flugzeug.src=imagesrc }
    else document.all.FlugzeugLayer.document.images.flugzeug.src=imagesrc
  }
  al.left=x0-32
  al.top=y0

  setTimeout("BewegeFlugzeug();",100)
}

function MeinMausEvent(e)
{
  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()
{
  isIm = (document.images) ? 1 : 0
  if (isIm)
  { arImLoad = new Array
    ('flieger','flieger_u','flieger_o','flieger_l','flieger_r',
     'flieger_lu','flieger_lo','flieger_ru','flieger_ro')
    arImList = new Array ()
    for (counter in arImLoad)
    { arImList[counter] = new Image()
      arImList[counter].src = arImLoad[counter] + '.gif'
    }
  }

  if (Ver4)
  { if (!IE)
    { al=document.FlugzeugLayer
      document.captureEvents(Event.MOUSEMOVE)
    }
    else
    { al=document.all.FlugzeugLayer.style }
    document.onmousemove = MeinMausEvent
    BewegeFlugzeug()
  }
}

function ZeigeFlugzeug()
{
  if(Ver4)
  { s ='<DIV STYLE="visibility:hidden"></DIV>'
    s+='<DIV ID="FlugzeugLayer" STYLE="position:absolute; '
    s+='top:-32; left:-32; width:32; height:32">'
    s+='<IMG NAME="flugzeug" SRC="flieger.gif" border=0>'
    s+='</A></DIV>'
    document.writeln(s)
  }
}

window.onload = ScriptSetup
ZeigeFlugzeug()

