(function($) {
    $.fn.GradLavaLamp = function(options) {
        options = $.extend({
            overlap : 0,
            speed : 1200,
            reset : 1500,
            easing : 'easeOutExpo'
        }, options);

         return this.each(function() {
            
            var nav = $(this),
            currentPageItem = $('#selected', nav),
            blob,
            reset;

            $('<li id="nav_hover" class="png_fix"><span class="png_fix"></span></li>').css({
                width : currentPageItem.outerWidth()-11,
                height :currentPageItem.height(),
                left : currentPageItem.position().left,
                top : currentPageItem.position().top - options.overlap / 2
            }).appendTo(this);            
            
            blob = $('#nav_hover', nav);            
   
            $('ul:first > li:not(#nav_hover)').hover(function() {
                // mouse over
                clearTimeout(reset);
                blob.animate(
                    {
                        left : $(this).position().left,
                        width : $(this).width()-11
                    },
                    {
                        duration : options.speed,
                        easing : options.easing,
                        queue : false
                    }
                );
            }, function() {
                // mouse out
                reset = setTimeout(function() {
                    blob.animate({
                        width : currentPageItem.outerWidth()-11,
                        left : currentPageItem.position().left
                    }, options.speed)
                }, options.reset);
            
            });            
            
         });// end each
    };  
})(jQuery);

