function addDropDown() {
  count = 0;
  jQuery("#navigation").children().each(function() {
    count++;
    var child = jQuery(this);
    if(child.children().length > 1) {
      if(child.find('.cat-item').length == 1) { //this dropdown has a single item
        child.find('.children').addClass('single');
        child.addClass((count != 5) ? 'dropdownSingle' : 'dropdownLastSingle');
      } else {                                  //this drop down has multiple items
        child.addClass((count != 5) ? 'dropdown' : 'dropdownLast');
      }
    }
  });
}
  
function sfHover() {
  var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    };
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    };
  }
}

jQuery(document).ready(function() {
  addDropDown();
  sfHover();
});
