var widthHorizontal = 0, heightHorizontal = 0, HorizontalReady = 0;
var widthVertical = 0, heightVertical = 0, VerticalReady = 0;
var widthBox = 0, heightBox= 0;
var started = 0; firstBar = 0; secondBar = 0; Box = 0;
var geschwindigkeit = 1, selected;
var heightTextBox = 0, heightText = 0;

var bewegen = new Object;
bewegen['link1'];

var textArray = new Array();
textArray[1] = 'News';
textArray[2] = 'Mitglieder';
textArray[3] = 'Auftritte';
textArray[4] = 'Booking';
textArray[5] = 'Photos';
textArray[6] = 'Merchandise';
textArray[7] = 'Kontakt';

/*function testing (modus)
{
if (bewegen)
   {clearTimeout(bewegen);}

if (modus == 'an')
{
 if (started == 0)
    { 
      document.getElementById('test_h').style.visibility = 'visible';
      started = 1;
    }  
 if (started == 1 && HorizontalReady == 0 && VerticalReady == 0 && BoxShow == 0 && widthHorizontal < 100)
 {
  widthHorizontal = widthHorizontal + 1;
  document.getElementById('test_h').style.width = widthHorizontal+"px";
  bewegen = setTimeout("testing(\'"+modus+"\')", 20);
  if (widthHorizontal == 100)
  {HorizontalReady = 1;document.getElementById('test_v').style.visibility = 'visible';}
 }
 if (started == 1 && HorizontalReady == 1 && VerticalReady == 0 && BoxShow == 0 && heightVertical < 100)
 {
  heightVertical = heightVertical + 1;
  document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
  document.getElementById('test_v').style.height = heightVertical+"px";
  bewegen = setTimeout("testing(\'"+modus+"\')", 20);
  if (heightVertical == 100)
  {VerticalReady = 1; document.getElementById('test_box').style.visibility = 'visible';}
 }
 if (started == 1 && HorizontalReady == 1 && VerticalReady == 1 && BoxShow == 0 && widthBox < 80)
 {
  widthBox = widthBox + 1;
  heightBox = widthBox;
//  document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
  document.getElementById('test_box').style.width = widthBox+"px";
  document.getElementById('test_box').style.height = widthBox+"px";
  bewegen = setTimeout("testing(\'"+modus+"\')", 20);
  if (widthBox == 80)
     BoxShow = 1;
 }
 if (started == 1 && HorizontalReady == 1 && VerticalReady == 1 && BoxShow == 1)
 {
  clearTimeout(bewegen);
 }
}
if (modus == 'aus')
   {
    if (started == 1 && HorizontalReady == 1 && VerticalReady == 1 && BoxShow == 1 && widthBox > 0)
    {
     widthBox = widthBox - 1;
     heightBox = widthBox;
     document.getElementById('test_box').style.width = widthBox+"px";
     document.getElementById('test_box').style.height = widthBox+"px";
     bewegen = setTimeout("testing(\'"+modus+"\')", 20);
     if (widthBox == 0)
         {
          BoxShow = 0; document.getElementById('test_box').style.visibility = 'hidden';
         }
    }
    if (started == 1 && HorizontalReady == 1 && VerticalReady == 1 && BoxShow == 0 && heightVertical > 0)
    {
     heightVertical = heightVertical - 1;
     document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
     document.getElementById('test_v').style.height = heightVertical+"px";
     bewegen = setTimeout("testing(\'"+modus+"\')", 20);
     if (heightVertical == 0)
       {VerticalReady = 0; document.getElementById('test_v').style.visibility = 'hidden';}
    }
    if (started == 1 && HorizontalReady == 1 && VerticalReady == 0 && BoxShow == 0 && widthHorizontal > 0)
    {  
       widthHorizontal = widthHorizontal - 1;
       document.getElementById('test_h').style.width = widthHorizontal+"px";
       bewegen = setTimeout("testing(\'"+modus+"\')", 20);
       if (widthHorizontal == 0)
          {HorizontalReady = 0;document.getElementById('test_v').style.visibility = 'hidden';}
    }
    if (started == 1 && HorizontalReady == 0 && VerticalReady == 0 && BoxShow == 0)
    {
       document.getElementById('test_h').style.visibility = 'hidden';
       started = 0;
    }
    if (HorizontalReady == 0 && VerticalReady == 0 && BoxShow == 0)
    {
     clearTimeout(bewegen);
    }
   } 
} */

function textBuild(text)
{
var tmp = '';
  for (var i = 0; i < text.length; i++)
      {
       tmp += text.substr(i,1) + "<br>";
      } 
   document.getElementById('linkText').innerHTML  = tmp;
}

function linkswitch (which,mode)
{
 var tmp = 'figur'+which;
 if (mode == 'hide')
    {               
      document.getElementById('linkText').innerHTML = '';
      if (selected)
         {
          if (document.getElementById(tmp).id != selected.id)
             {
              document.getElementById(tmp).style.display = 'none';

             }
          }
       else   
          {
            document.getElementById(tmp).style.display = 'none';
          }
          
    }
 if (mode == 'show')
    {
          document.getElementById(tmp).style.display = 'inline';
          textBuild(textArray[which]);
    }
}

function enlarge (select,first)
{
  var tmp = 'figur'+select;
  if (first == 1)
     {
      if (selected)
         {
            selected.style.display = 'none';  
            selected.style.zIndex = 2;
         }
      selected = document.getElementById(tmp);
      selected.style.display = 'inline';  
      selected.style.zIndex = 3;
     }
  if (heightTextBox == 0)
     {
      document.getElementById('textFrame').style.borderStyle = "solid";
      document.getElementById('textFrame').style.borderColor = "#FFFFFF";
      document.getElementById('textFrame').style.borderWidth = "1px";    
     }      
  if (heightTextBox < "300")
     {
      heightTextBox = heightTextBox + 30;
      heightText = heightText + 26;
      document.getElementById('textFrame').style.height = heightTextBox + "px";
      document.getElementById('text').style.height = heightText + "px";
  
      setTimeout('enlarge()',5);
     }

 //document.getElementById('text').style.width = 400+"px";
}


function testing (modus,link)
{
if (bewegen)
   {clearTimeout(bewegen[link]);}
   if (modus == 'an')
       {
          if (started == 0)
             {
              document.getElementById('test_h').style.visibility = 'visible';
              started = 1;
             }
          if (started == 1) 
             {
              if (firstBar == 0)
                 {
                  widthHorizontal = widthHorizontal + 1;
                  document.getElementById('test_h').style.width = widthHorizontal+"px";
                  if (widthHorizontal == 100)
                     {firstBar = 1;document.getElementById('test_v').style.visibility = 'visible';} 
                  bewegen[link] = setTimeout("testing(\'"+modus+"\',\'"+link+"\')", geschwindigkeit);
                 }
              if (firstBar == 1 && secondBar == 0) 
                 {
                  heightVertical = heightVertical + 1;
                  document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
                  document.getElementById('test_v').style.height = heightVertical+"px";
                  if (heightVertical == 100)
                     {secondBar = 1; document.getElementById('test_box').style.visibility = 'visible';}
                  bewegen[link] = setTimeout("testing(\'"+modus+"\',\'"+link+"\')", geschwindigkeit);
                 }  
               if (firstBar == 1 && secondBar == 1 && Box == 0)
                 {
                  widthBox = widthBox + 1;
                  heightBox = widthBox;
                  //  document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
                  document.getElementById('test_box').style.width = widthBox+"px";
                  document.getElementById('test_box').style.height = widthBox+"px";
                  if (widthBox == 80)
                     Box = 1;
                  bewegen[link] = setTimeout("testing(\'"+modus+"\',\'"+link+"\')", geschwindigkeit);
                 }   
             }     
       }
   else
       {
          if (started == 1) 
             { 
               if (started == 1 && firstBar == 0)
                  {
                   widthHorizontal = widthHorizontal - 1;
                   document.getElementById('test_h').style.width = widthHorizontal+"px";
                   if (widthHorizontal == 0)
                      {started = 0;document.getElementById('test_h').style.visibility = 'hidden';} 
                   bewegen[link] = setTimeout("testing(\'"+modus+"\',\'"+link+"\')", geschwindigkeit);
                  }
              if (firstBar == 1 && secondBar == 0)
                 {
                   heightVertical = heightVertical - 1;
                   document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
                   document.getElementById('test_v').style.height = heightVertical+"px";
                   if (heightVertical == 0)
                      {firstBar = 0; document.getElementById('test_v').style.visibility = 'hidden';}
                   bewegen[link] = setTimeout("testing(\'"+modus+"\',\'"+link+"\')", geschwindigkeit);
                   }
              if (firstBar == 1 && secondBar == 1)
                 {
                   widthBox = widthBox - 1;
                   heightBox = widthBox;
                   //  document.getElementById('test_v').style.top = "-"+heightVertical+"px" 
                   document.getElementById('test_box').style.width = widthBox+"px";
                   document.getElementById('test_box').style.height = widthBox+"px";
                   if (widthBox == 0)
                      {secondBar = 0; Box = 0; document.getElementById('test_box').style.visibility = 'hidden';}
                   bewegen[link] = setTimeout("testing(\'"+modus+"\',\'"+link+"\')", geschwindigkeit);
                 } 
             }   
       }
}

function toggle_image(which){
var anfang, ende, txt, more = "";
         if (which.src.lastIndexOf("_bw.gif") == -1){
            ende = which.src.lastIndexOf(".gif");
            more = "_bw";
         }  
         else {
            ende = which.src.lastIndexOf("_bw.gif");  
         }  
            anfang = which.src.lastIndexOf("/") + 1
            
            txt = which.src.substring(anfang, ende);
            which.src = "./images/"+txt+more+".gif";
}
