(function($){
    $.extendable = function(el, options){

        var base = this;
        base.$el = $(el);
        base.el = el;
        
        base.$el.data("extendable", base);
        
        base.init = function(){
			base.options = $.extend({},$.extendable.defaultOptions, options);
			
			base.extendable();
        };
        
        base.extendable = function() {
    
        	$("li",base.el).not("li.current-page").css({backgroundPosition: '-102px 2px', textIndent : 0});
        	
        	$("li",base.el).not("li.current-page").children("ul").hide();
        	$("li.current-page", base.el).parents("ul").show();
        	
			$("li", base.el).hover(
			function(){
				
				if(!$(this).hasClass("current-page"))
					$(this).stop().animate({backgroundPosition: '-80px 2px', textIndent : 22},base.options.animateSpeed);
					
			},
			function(){
				
				if(!$(this).hasClass("current-page"))
					$(this).stop().animate({backgroundPosition: '-102px 2px', textIndent : 0},base.options.animateSpeed);
					
			});
			
			$("a",base.el).click(function(){
				Page.go(this);
				return false;
			});
			
        };
       
        base.init();
    };
    
    $.extendable.defaultOptions = {
    	animateSpeed : 250
    };
    
    $.fn.extendable = function(options){
        return this.each(function(){
            (new $.extendable(this, options));
        });
    };
    
})(jQuery);
