$(function () {
  $('.navcat').each(function(it) {
    if (this.src.indexOf('-on') == -1) {
      this.current = false;
    } else {
      this.current = true;
    }
  });
});

function showNavCat(ncid,ncname,ncimage) {
  MM_swapImageCat(ncname,'','templates/default/images/nav_'+ncimage+'-on.gif',1);
  if (ncid != 0 && ncname != "" && ncimage!="") {
    $('.navcat').each(function(it) {
      if (this.id != ncname) {
        var imgStart = this.src.indexOf('_');
        var imgEnd = 0;
        if (this.src.indexOf("-on") != -1) {
          imgEnd = this.src.indexOf("-on");
        } else {
          imgEnd = this.src.indexOf(".gif");
        }
        var tempImgName = this.src.substring(imgStart+1,imgEnd);
        this.current = false;
      } else {
        this.current = true;
      }
    });
    $('.subNav').each(function(it) {
      if (this.id != 'subNav'+ncname) {
        this.style.display = "none";
      } else {
        this.style.display = "block";
      }
    });
  }
}

function hideNavCats() {
  $('.subNav').each(function(it) {
    this.style.display = "none";
  });
}
