objects = new Array();
/* Settings Start */
var velocity = 50;
/* Settings Ende*/



objects[0] = new Array();
objects[0]["id"] = "box1";
objects[1] = new Array();
objects[1]["id"] = "box2";
objects[2] = new Array();
objects[2]["id"] = "box3";
objects[3] = new Array();
objects[3]["id"] = "box4";
objects[4] = new Array();
objects[4]["id"] = "box5";
objects[5] = new Array();
objects[5]["id"] = "box6";
objects[6] = new Array();
objects[6]["id"] = "box7";
objects[7] = new Array();
objects[7]["id"] = "box8";
objects[8] = new Array();
objects[8]["id"] = "box9";
objects[9] = new Array();
objects[9]["id"] = "box10";
objects[10] = new Array();
objects[10]["id"] = "box11";
objects[11] = new Array();
objects[11]["id"] = "box12";
objects[12] = new Array();
objects[12]["id"] = "box13";
objects[13] = new Array();
objects[13]["id"] = "box14";
objects[14] = new Array();
objects[14]["id"] = "box15";
objects[15] = new Array();
objects[15]["id"] = "box16";
objects[16] = new Array();
objects[16]["id"] = "box17";
objects[17] = new Array();
objects[17]["id"] = "box18";
objects[18] = new Array();
objects[18]["id"] = "box19";
objects[19] = new Array();
objects[19]["id"] = "box20";
objects[20] = new Array();
objects[20]["id"] = "box21";
objects[21] = new Array();
objects[21]["id"] = "box22";
objects[22] = new Array();
objects[22]["id"] = "box23";
objects[23] = new Array();
objects[23]["id"] = "box24";
objects[24] = new Array();
objects[24]["id"] = "box25";
objects[25] = new Array();
objects[25]["id"] = "box26";
objects[26] = new Array();
objects[26]["id"] = "box27";
objects[27] = new Array();
objects[27]["id"] = "box28";
objects[28] = new Array();
objects[28]["id"] = "box29";
objects[29] = new Array();
objects[29]["id"] = "box30";
objects[30] = new Array();
objects[30]["id"] = "box31";
objects[31] = new Array();
objects[31]["id"] = "box32";

var timeout_show;
var timeout_hide;

for(var i=0;i <objects.length;i++)  {
  var MyId = document.getElementById(objects[i]["id"])
  if(MyId != null)  {
    objects[i]["visible"] = 0;
    objects[i]["aimheight"] = document.getElementById(objects[i]["id"]).offsetHeight;
    document.getElementById(objects[i]["id"]).style.display = "none";
    document.getElementById(objects[i]["id"]).style.height = "0px";
    document.getElementById(objects[i]["id"]).style.overflow = "hidden";
  }
}

ar_show = new Array();
ar_hide = new Array();

function trigger_box(id)  {
  for(var i=0; i<objects.length;i++)  {
    if(objects[i]["id"] == id)  {
      var aimheight = objects[i]["aimheight"];
      var visible = objects[i]["visible"];
      var inaction = objects[i]["inact"];
      var a = i;
    }
  }

  if(inaction == undefined)  {
    objects[a]["inact"] = "auf";
    var b = ar_show.length;
    ar_show[b] = new Array();
    ar_show[b]["height"] = "0";
    ar_show[b]["aimheight"] = aimheight;
    ar_show[b]["id"] = id;
    document.getElementById(objects[a]["id"]).style.display = "block";
    show_box();
  }
  if(inaction != "auf" && inaction != "zu")  {
    if(visible == 1)  {
      objects[a]["inact"] = "zu";
      var b = ar_hide.length;
      ar_hide[b] = new Array();
      ar_hide[b]["height"] = aimheight;
      ar_hide[b]["id"] = id;

      hide_box();
    } else  {
      objects[a]["inact"] = "auf";
      var b = ar_show.length;
      ar_show[b] = new Array();
      ar_show[b]["height"] = "0";
      ar_show[b]["aimheight"] = aimheight;
      ar_show[b]["id"] = id;
      document.getElementById(objects[a]["id"]).style.display = "block";
      show_box();
    }
  }
  if(inaction == "zu")  {
    objects[a]["inact"] = "auf";
    var b = ar_show.length;
    ar_show[b] = new Array();
    ar_show[b]["height"] = "0";
    ar_show[b]["aimheight"] = aimheight;
    ar_show[b]["id"] = id;
    for(var x=0;x<=ar_hide.length;x++)  {
      if(ar_hide[x]["id"] == id)  {
        ar_show[b]["height"] = ar_hide[x]["height"];
        ar_hide.splice(x,1);
      }
    }
    document.getElementById(objects[a]["id"]).style.display = "block";
    show_box();
  }
  if(inaction == "auf")  {
    objects[a]["inact"] = "zu";
    var b = ar_hide.length;
    ar_hide[b] = new Array();
    ar_hide[b]["height"] = aimheight;
    ar_hide[b]["id"] = id;
    for(var x=0;x<=ar_show.length;x++)  {
      if(ar_show[x]["id"] == id)  {;
        ar_hide[b]["height"] = ar_show[x]["height"];
        ar_show.splice(x,1);
      }
    }
    hide_box();
  }
}

function show_box()  {
  for(var i = 0; i<=ar_show.length;i++)  {
    
    if(ar_show[i]["height"] < ar_show[i]["aimheight"])  {
      ar_show[i]["height"] = parseInt(ar_show[i]["height"]) + parseInt(velocity);
      if(ar_show[i]["height"] > ar_show[i]["aimheight"])  ar_show[i]["height"] = ar_show[i]["aimheight"];
      document.getElementById(ar_show[i]["id"]).style.height = ar_show[i]["height"] + "px";
    }
    else  {
      for(var x = 0;x <= objects.length;x++)  {
        if(objects[x]["id"] == ar_show[i]["id"])  {
          objects[x]["inact"] = "";
          objects[x]["visible"] = 1;
          ar_show.splice(i,1);
        }
      }
    }
    clearTimeout(timeout_show);
    timeout_show = setTimeout("show_box()", 10);
  }
}

function hide_box()  {
  del = new Array();
  var count=0;
  for(var i = 0; i<=ar_hide.length;i++)  {
    ar_hide[i]["height"] = parseInt(ar_hide[i]["height"]) - parseInt(velocity);
    if(ar_hide[i]["height"] >= 0)  {
      document.getElementById(ar_hide[i]["id"]).style.height = ar_hide[i]["height"] + "px";
      if(ar_hide[i]["height"] <= velocity)  document.getElementById(ar_hide[i]["id"]).style.display = "none";
    }
    else  {
      for(var x = 0;x <= objects.length;x++)  {
        if(objects[x]["id"] == ar_hide[i]["id"])  {
          objects[x]["inact"] = "";
          objects[x]["visible"] = 0;
          del[count] = i;
          count++;
          ar_hide.splice(i,1);
        }
      }
    }
    clearTimeout(timeout_hide);
    timeout_hide = setTimeout("hide_box()", 10);
  }
  for(var z = 1; z <= del.length;z++)  {

  }
}

