/*
 The next line checks to see if the browser will allow us to control
 the image objects using JavaScript.
 If it does, then we execute the first block of code.  If it does not,
 then we execute the block after "else". Only one block will be
 executed.
*/

if (document.images)
{
   // Create four new empty Image objects
   ImageMenuRot = new Image;
   ImageMenuRotHL = new Image;
   ImageMenuGruen = new Image;
   ImageMenuGruenHL = new Image;
   ImageMenuViolett = new Image;
   ImageMenuViolettHL = new Image;
   ImageMenuOliv = new Image;
   ImageMenuOlivHL = new Image;
   ImageMenuBlau = new Image;
   ImageMenuBlauHL = new Image;

   // These lines will cause the browser to load the images into the cache.
   ImageMenuRot.src = "images/rechteck_rot.gif";
   ImageMenuRotHL.src = "images/rechteck_rot_hl_text.gif";
   ImageMenuGruen.src = "images/rechteck_gruen.gif";
   ImageMenuGruenHL.src = "images/rechteck_gruen_hl_text.gif";
   ImageMenuViolett.src = "images/rechteck_violett.gif";
   ImageMenuViolettHL.src = "images/rechteck_violett_hl_text.gif";
   ImageMenuOliv.src = "images/rechteck_oliv.gif";
   ImageMenuOlivHL.src = "images/rechteck_oliv_hl_text.gif";
   ImageMenuBlau.src = "images/rechteck_blau.gif";
   ImageMenuBlauHL.src = "images/rechteck_blau_hl_text.gif";
}
else
{
   // Create four new empty strings.
   // This will stop the browser from reporting JavaScript errors
   // when these are referred to in the HTML below.
   ImageMenuRot = "";
   ImageMenuRotHL = "";
   ImageMenuGruen = "";
   ImageMenuGruenHL = "";
   ImageMenuViolett = "";
   ImageMenuViolettHL = "";
   ImageMenuOliv = "";
   ImageMenuOlivHL = "";
   ImageMenuBlau = "";
   ImageMenuBlauHL = "";
}


function RotateFunction()
{
   var x = parseInt(document.all.MenuPos[this.menuNr].style.left);
   var y = parseInt(document.all.MenuPos[this.menuNr].style.top);
   var step = 2;

   if(this.status==8)
   {
      x = x - step;
      y = y - step;
      if(x<270)
         this.status = 1;
   }
   if(this.status==7)
   {
      x = x - step;
      if(x<310)
         this.status = 8;
   }
   if(this.status==6)
   {
      x = x - step;
      y = y + step;
      if(y>380)
         this.status = 7;
   }
   if(this.status==5)
   {
      y = y + step;
      if(y>340)
         this.status = 6;
   }
   if(this.status==4)
   {
      x = x + step;
      y = y + step;
      if(x>600)
         this.status = 5;
   }
   if(this.status==3)
   {
      x = x + step;
      if(x>560)
         this.status = 4;
   }
   if(this.status==2)
   {
      y = y - step;
      x = x + step;
      if(y<75)
         this.status = 3;
   }
   if(this.status==1)
   {
      y = y - step;
      if(y<115)
         this.status = 2;
   }

   document.all.MenuPos[this.menuNr].style.left = x;
   document.all.MenuPos[this.menuNr].style.top = y;
}

// rotieren funktioniert leider nur im IE :-(
if(navigator.appName.indexOf("Microsoft")>=0)
{
   var RotateTime = 50;
   
   menuButton1 = new Object();
   menuButton1.rotate = RotateFunction;
   menuButton1.rotateTime = RotateTime;
   menuButton1.menuNr = 0;
   menuButton1.status = 1;
   setInterval("menuButton1.rotate()", menuButton1.rotateTime);
   
   menuButton2 = new Object();
   menuButton2.rotate = RotateFunction;
   menuButton2.rotateTime = RotateTime;
   menuButton2.menuNr = 1;
   menuButton2.status = 1;
   setInterval("menuButton2.rotate()", menuButton2.rotateTime);
   
   menuButton3 = new Object();
   menuButton3.rotate = RotateFunction;
   menuButton3.rotateTime = RotateTime;
   menuButton3.menuNr = 2;
   menuButton3.status = 7;
   setInterval("menuButton3.rotate()", menuButton3.rotateTime);
   
   menuButton4 = new Object();
   menuButton4.rotate = RotateFunction;
   menuButton4.rotateTime = RotateTime;
   menuButton4.menuNr = 3;
   menuButton4.status = 5;
   setInterval("menuButton4.rotate()", menuButton4.rotateTime);
   
   menuButton5 = new Object();
   menuButton5.rotate = RotateFunction;
   menuButton5.rotateTime = RotateTime;
   menuButton5.menuNr = 4;
   menuButton5.status = 5;
   setInterval("menuButton5.rotate()", menuButton5.rotateTime);
}