$.fn.extend({
    updateMenu : function(maxSubMenuHeight, liHeight){
        return this.each(function(){

            var projectsHeight = 0;

            $(this).children('li').each(function() {
                projectsHeight += liHeight;
            });

            if(projectsHeight > maxSubMenuHeight)
            {
                $(this).css('overflow', 'hidden');
                $(this).css('height', maxSubMenuHeight + "px");
                $(this).slideToggle('slow',function() {
                    $(this).jScrollPane();
                });
            }
            else
            {

                $(this).slideToggle('slow');
            }

        });
    }
});


(function( $ ){
  $.fn.refreshScroll = function() {

      $(this).jScrollPane({
          'scrollbarWidth':4
      });

  };


  
})( jQuery );

