$jq(document).ready(function() {
  var setClose = null, idle = false;
  var closingTime = 1000;
  var animSpeed = 300;
  var $jqpanels = $jq('div.panel_container');
  $jq('div.panel_body').hide();
  
  var closeAll = function() {
    setClose = setTimeout(function() {
          idle = true;
          goDown($jq('div.panel_container').filter(".showing"));
        },closingTime);
  };
  var resetClose = function() {
    clearTimeout(setClose);
    closeAll();
  };
  
  closeAll();
  function goUp($jqel) {
    var isHidden = $jqel.find('div.panel_body:hidden').length > 0;
    $jqel.not(".showing")
         .addClass("showing")
         .find("div.panel_body")
         .queue("fx", [])
         .stop()
         .animate({height: (isHidden ? 'show' : '100px')}, animSpeed, function () {
              $jq(this).height("").prev().addClass('visible');
            });
  }
  function goDown($jqel) {
    $jqel.filter(".showing")
         .removeClass("showing")
         .find("div.panel_body")
         .queue("fx", [])
         .stop()
         .animate({height:'hide'}, animSpeed, function () {
              $jq(this).height("").prev().removeClass('visible');
            });
  }
  function slideTabs() {
    var overTab = this;
    $jq("div.panel_container").each(function () {
          if (overTab == this) {
            resetClose();
            goUp($jq(overTab));
          } else {
            goDown($jq(this));
          }
        });
  }
  $jq('div.panel_container').mouseover(slideTabs);

  $jq('html, body').mousemove(function() {
        if (idle) idle = false;
      });  

});
