/*
 * Animação para o portal Ascenty
 */
(function($) {
$.fn.lavaLamp = function(o) {
    
	//Adiciona as classes no menu do topo
	$('div.boxTop ul li').addClass(function() {
	return 'item-' + $(this).index();
	});
    
	//Função de animação do menu
	o = $.extend({ fx: "linear", speed: 500, click: function(){} }, o || {});
	return this.each(function() {
        var me = $(this), noop = function(){},
            $back = $('<div class="back"></div>').appendTo(me),
			$li = $("li", this), 
			curr = $("li.current", this)[0] || $($li[0]).addClass("current")[0];


        $li.not(".back").hover(function() {
            move(this);
        }, noop);
		
        
		$(this).hover(noop, function() {
            move(curr);
        }, noop);

        function move(el) {
            $back.each(function() {
                $.dequeue(this, "fx"); }
            ).animate({
                width: el.offsetWidth,
                left: el.offsetLeft
            }, o.speed, o.fx);
        };

    });
};
})(jQuery);
