(function($){

    $.fn.slidingNav = function(options){
        options = $.extend({
            speed: 500,
            reset: 1500,
            easing: 'easeOutExpo'
        }, options);
        
        return this.each(function(){
            var nav = $(this), blob, reset;
            $('<li id="blob"></li>').appendTo(this);
			// csak letrehozzuk, mivel a sammy-s resz majd kezeli az animaciot
			
//            $('<li id="blob"></li>').css({
//                width: currentPageItem.first('img').width() + 6,
//                left: currentPageItem.position().left - 3
//            }).appendTo(this);
            
            blob = $('#blob', nav);
            
            $('li:not(#blob)', nav).hover(function(){
                // mouse over
                clearTimeout(reset);
                blob.animate({
                    left: $(this).position().left - 3,
                    width: $(this).first('img').width() + 6
                }, {
                    duration: options.speed,
                    easing: options.easing,
                    queue: false
                });
            }, function(){
                // mouse out	
				currentPageItem = $('.selected', nav);
                reset = setTimeout(function(){
                    blob.animate({
                        width: currentPageItem.first('img').width() + 6,
                        left: currentPageItem.position().left - 3
                    }, options.speed)
                }, options.reset);
                
            });
        }); // end each
    };
    
})(jQuery);

