jQuery(document).ready(function() {
  var setClose = null, idle = false;
  var closingTime = 4000;
  var animSpeed = 600;
  var $panels = jQuery('div.slayer');
  jQuery('div.slayer-body').hide();
  
  var closeAll = function() {
    //setClose = setTimeout(function() {
    //      idle = true;
    //      goDown(jQuery('div.slayer').filter(".showing"));
    //    },closingTime);
  };
  var resetClose = function() {
    clearTimeout(setClose);
    closeAll();
  };
  
  closeAll();
  function goUp($el) {
    var isHidden = $el.find('div.slayer-body:hidden').length > 0;
    $el.not(".showing")
         .addClass("showing")
         .find("div.slayer-body")
         .queue("fx", [])
         .stop()
         .animate({height: (isHidden ? 'show' : '150px')}, animSpeed, function () {
              jQuery(this).height("").prev().addClass('visible');
            });
  }
  function goDown($el) {
    $el.filter(".showing")
         .removeClass("showing")
         .find("div.slayer-body")
         .queue("fx", [])
         .stop()
         .animate({height:'hide'}, animSpeed, function () {
              jQuery(this).height("").prev().removeClass('visible');
            });
  }
  function slideTabs(e) {
    var overTab = this;
    jQuery("div.slayer").each(function () {
          if (overTab == this) {
            if (jQuery(overTab).hasClass("showing")) {
                if (jQuery(e.target).attr("href") == undefined) {   
					
                        goDown(jQuery(this));
                }
            } else {
                resetClose();
                goUp(jQuery(overTab));
            }
          } else {
            goDown(jQuery(this));
          }
        });
  }
  jQuery('div.slayer').click(slideTabs);

  jQuery('html, body').mousemove(function() {
        if (idle) idle = false;
      });  

});


