(function($) {

    $.fn.Nav = function(options) {

        options = $.extend({
            overlap : 20,
            speed : 500,
            reset : 750,
            easing : 'easeOutExpo'
        }, options);

        return this.each(function() {

            var nav = $(this),
            //currentPageItem = $('#active_menu-nav', nav),
            currentPageItem = $('.active_menu-nav', nav),
            blob,
            reset;
            $('<li id="blob"></li>').css({
                width : currentPageItem.outerWidth(),
                height : currentPageItem.outerHeight() + options.overlap,
                left : currentPageItem.position().left,
                top : currentPageItem.position().top - options.overlap / 2,
                backgroundColor : options.color
            }).appendTo(this);

            blob = $('#blob', nav);

            $('li:not(#blob)', nav).hover(
                function() {
                    // mouse over (handler IN)
                    clearTimeout(reset);
//                    console.log('before animate');
                    blob.animate({
                        left : $(this).position().left,
                        width : $(this).width()
                    },
                    {
                        duration : options.speed,
                        easing : options.easing,
                        queue : false
                    });
//                    console.log('after animate');
                },
                function() {
                    // mouse out (handler OUT)
//                    console.log('before reset');
                    reset = setTimeout(function() {
                        blob.animate({
                            width : currentPageItem.outerWidth(),
                            left : currentPageItem.position().left
                        }, options.speed)
                    }, options.reset);
//                    console.log('after reset');

                });

        }); // end each

    };

})(jQuery);
