/* http://github.com/enure/Hide-All-Except-One */
  $.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };
(function($){
  $.hideAllExcept = function(tabs,boxes){
    function init() {
      // make it bookmarkable/refreshable. but, no history.
      var hash = window.location.hash;
      (!hash) ? hideShow('#' + $(boxes+':first').attr('id')) : hideShow(window.location.hash);

      // add click handler.
      $(tabs).click(function(e) {
        e.preventDefault();
        var href = $(this).attr('href');
        // add back the hash which is prevented by e.preventDefault()
        window.location.hash = href;
        hideShow(href);
      });
    }
    function hideShow(el) {
      $(boxes).slideUp();
      $(el).slideDown();

      $(tabs).removeClass('active');
      $('a[href="' + el + '"]').addClass('active');
    }
    init();
  };
})(jQuery);
