﻿
function dropTabs(excludeTab) {
  var id = "";
  if (excludeTab) {
    id = excludeTab.id;
  }
  jQuery("#portalNavigation li:lt(3)").each(function(index, elem) {
    if (elem.id != id) {
      var bottom = -18;
      jQuery(".popupButtons", elem).stop().animate({ "bottom": bottom }, { queue: false, duration: 150 });
      jQuery(elem).stop().animate({ top: 0 }, { queue: false, duration: 75 });
    }
  });
}

jQuery("document").ready(function() {

  var timerID;
  var active

  function highlightTab(tab) {

    jQuery("#portalNavigation li").css("z-index", "0");

    jQuery(tab).css("z-index", "100").stop().each(function(index, elem) {
      var jElem = jQuery(elem);
      if (jElem.css("top") != "-14px") {
        jElem.animate({ top: -14 }, { queue: false, duration: 250 });
        jQuery(".popupButtons", tab).stop().animate({ bottom: -14 }, { queue: false, duration: 125 });
      }
    });
  }

  jQuery("#portalNavigation li").mouseenter(function(e) {

    clearTimeout(timerID);
    if (jQuery(e.target).is("img.MainNavButton")) {

      jQuery("#portalNavigation li:lt(3)").stop();
      jQuery("#portalNavigation li:lt(3) .popupButtons").stop();

      if (this.className != "nopopup") {
        highlightTab(this);
      }
      dropTabs(this);
    }
  }).mouseleave(function() {
    timerID = setTimeout("dropTabs();", 3000);
  });
});


