(function($){ 
     $.fn.extend({  
         accordion: function() {
            return this.each(function() {
				if($(this).data('accordiated'))
					return false;

                $n = 0;
                
				$.each($(this).find('.accContent'), function(){
                    
                    $(this).data('accordiated', true);
                    
                    //console.log($n);
                    if ($n >= 0) {
                        $(this).hide();
                    } else
		    {
			/*$(this).addClass('active');*/	
		    }
                    $n++;
					//$('#QuickStart').show();
				});

				$.each($(this).find('.accElement>h2>a'), function(){
					$(this).click(function(e){
						//activate(e.target);
						activate($(e.target).parent());
						return void(0);
					});
				});
				
				//console.log(location+location.hash);
				
				var active = false;
				/*if(location.hash)
					active = $(this).find('a[href=' + location + ']')[0];*/
			
			   //console.log(location.hash);
	
				if(active){
					//activate(active, 'toggle','parents');
					activate($(active).parent(), 'toggle','parents');
					$(active).parent().show();
				}
				
				function activate(el,effect,parents){
                    //siblings().removeClass('active').children('div, div').slideUp('fast');
					$(el)[(parents || 'parent')]('div').addClass('active');
					$(el).siblings('div, div')[(effect || 'slideToggle')]((!effect)?'slow':null);
                    $.each($(el).parent().siblings().find('.accContent'), 
                        function() {
                            //console.log(this);
                            $(this).slideUp('slow');
                            $(this).parent().removeClass('active');
                        });
				}
				
            });
        } 
    }); 
})(jQuery);

