var activeCategory = null;
var activeSubCategory = null;
var visibleSC = null;
function hoverCategory(cid) {
  if (activeCategory == cid) {
    return;
  }
  if (activeCategory != null) {
    var activeE = $('cw_' + activeCategory);
    var activeLinkE = $('c_link_' + activeCategory);
    activeE.className = 'LeftNavWrapper';
    var dropDown = $('subcategories_' + activeCategory);
    if (dropDown != null && dropDown.style.display != 'none') {
      dropDown.style.display = 'none';
    }
  }
  activeCategory = cid;
  var listE = $('cw_' + cid);
  var linkE = $('c_link_' + cid);
  var dropDown = $('subcategories_' + cid);
  if (visibleSC != null) {
    visibleSC.style.display = 'none';
    if (activeSubCategory != null) {
      var activeE = $('scw_' + activeSubCategory);
      var activeLinkE = $('sc_link_' + activeSubCategory);
      activeE.className = 'LeftNavWrapper';
      activeLinkE.className = 'SubCategoryLink';
      activeSubCategory = null;
    }
  }
  if (dropDown != null) {
    visibleSC = dropDown;
    var pos = Position.positionedOffset(listE);
    dropDown.style.left = (pos[0] + 149) + 'px';
    dropDown.style.top = (pos[1]) + 'px';
    dropDown.style.display = 'block';
  }
  listE.className = 'CategoryLinkHover';
}
function deactivateCategory(cid) {
  activeCategory = null;
  setTimeout(function () {
    if (activeCategory != cid) {
      var listE = $('cw_' + cid);
      var linkE = $('c_link_' + cid);
      listE.className = 'LeftNavWrapper';
      var dropDown = $('subcategories_' + cid);
      if (dropDown != null && dropDown.style.display != 'none') {
        dropDown.style.display = 'none';
      }
    }
  }, 50);
}
function deactivateSubCategory(cid, scid) {
  deactivateCategory(cid);
  activeSubCategory = null;
  setTimeout(function () {
    if (activeSubCategory != scid) {
      var listE = $('scw_' + scid);
      var linkE = $('sc_link_' + scid);
      listE.className = 'LeftNavWrapper';
    }
  }, 50);
}
function hoverSubCategory(cid, scid) {
  if (activeCategory != cid) {
    hoverCategory(cid);
  }
  if (activeSubCategory != null) {
    var activeE = $('scw_' + activeSubCategory);
    var activeLinkE = $('sc_link_' + activeSubCategory);
    activeE.className = '';
  }
  activeSubCategory = scid;
  var listE = $('scw_' + scid);
  var linkE = $('sc_link_' + scid);
  listE.className = 'SubNavLinkHover';
}
