/*(function(d){d.fn.extend({accordion:function(){return this.each(function(){var $ul=$(this);if($ul.data('accordiated'))return false;$.each($ul.find('ul, li>div'),function(){$(this).data('accordiated',true);$(this).hide()});$.each($ul.find('a'),function(){$(this).hover(function(e){activate(this);return void(0)})});var c=(location.hash)?$ul.find('a[href='+location.hash+']')[0]:'';if(c){activate(c,'toggle');$(c).parents().show()}function activate(a,b){$(a).parent('li').toggleClass('active').siblings().removeClass('active').children('ul, div').slideUp('fast');$(a).siblings('ul, div')[(b||'slideToggle')]((!b)?'fast':null)}})}})})(jQuery);*/

(function($){ 
     $.fn.extend({  
         accordion: function() {       
            return this.each(function() {
				if($(this).data('accordiated'))
					return false;									
				$.each($(this).find('ul, li>div'), function(){
					$(this).data('accordiated', true);
					$(this).hide();
				});
				$.each($(this).find('a:not(.foo)'), function(){
					$(this).hover(function(e){
						activate(e.target);
						return void(0);
					});
				});
				
				var active = false;
				if(location.hash)
					active = $(this).find('a[href=' + location.hash + ']')[0];
				else if($(this).find('li.current_page_item'))
					active = $(this).find('li.current_page_item a')[0]; 
				
				if(active){
					activate(active, 'toggle','parents');
					$(active).parents().show();
				}
				
				function activate(el,effect,parents){
					$(el)[(parents || 'parent')]('li').toggleClass('active').siblings().removeClass('active').children('ul, div').slideUp('fast');
					$(el).siblings('ul, div')[(effect || 'slideToggle')]((!effect)?'fast':null);
				}
				
            });
        } 
    }); 
})(jQuery);
