(function($){ 
     $.fn.extend({  
         accordion: function() {       
            return this.each(function() {
				if($(this).data('accordiated'))
					return false;									
				$.each($(this).find('ul, li>ul'), function(){
					$(this).data('accordiated', true);
					$(this).hide();
				});
				$.each($(this).find('a:not(.foo)'), function(){
					$(this).click(function(e){
						activate(e.target);
						return void(0);
					});
				});
				
				var active = false;
				if(location.hash){
					
					//var AktifGelenParametre = location.hash; //#bolumadi şeklinde queryden gelen parametredir.
					var filename = location.href.replace(/^.*\//, '');  //abc.php#bolumadi  şkelinde veri getiri.
					//var filenameDiyez = location.href.replace(/^.*\#/, ''); //bolumadi şeklinde getirir.

					//active = $(this).find('a[href=' + location.hash + ']')[0];
					active = $(this).find('a[href=' + filename + ']')[0];
					var dosyaYolu = location.pathname;
					/*
					alert (	
						   	"href : " + location.href +  
						  	"\nhost : " + location.host +  
							"\nhostname : " + location.hostname +  
							"\npathname : " + location.pathname);
					*/
					
					//alert ("filename : " + filename + "\nlocation.hash : " + location.hash);
					
					//
					
				} else if($(this).find('li.current')) {
					active = $(this).find('li.current 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, ul').slideUp('fast');
					$(el).siblings('ul, ul')[(effect || 'slideToggle')]((!effect)?'fast':null);
				}
				
            });
        } 
    }); 
})(jQuery);