(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = Array ();
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);

$(function(){
			$("#menu").lavaLamp({ fx: "easeInOutBack", speed: 700 })
		/*
		$('#menu li').hover(function(){
				$('.star').remove();
				var atual = this;
				setTimeout(function(){
					$('.star').remove();
					$(atual).append('<div class="star"></div>')
				},600);
			},function(){
			$('.star').remove();
			});
			*/
	$('#por:not(.marcado)').hover(function(){
		$('#por').stop().animate({backgroundPosition:'-11px -433px'},600);
	},function(){
		$('#por').stop().animate({backgroundPosition:'-11px -413px'},600);
		});
		
	$('#eng:not(.marcado)').hover(function(){
		$('#eng').stop().animate({backgroundPosition:'-45px -433px'},600);
	},function(){
		$('#eng').stop().animate({backgroundPosition:'-45px -413px'},600);
		});	
		
	$('#esp:not(.marcado)').hover(function(){
		$('#esp').stop().animate({backgroundPosition:'-78px -433px'},600);
	},function(){
		$('#esp').stop().animate({backgroundPosition:'-78px -413px'},600);
		});	
		

		
	$('#restrito').hover(function(){
		$('#restrito').stop().animate({backgroundPosition:'-109px -433px'},600);
	},function(){
		$('#restrito').stop().animate({backgroundPosition:'-109px -413px'},600);
		});		
		
	$('#webmail').hover(function(){
		$('#webmail').stop().animate({backgroundPosition:'-142px -433px'},600);
	},function(){
		$('#webmail').stop().animate({backgroundPosition:'-142px -413px'},600);
		});	
	
	$("#menu li").hover(function(){
			$(this).find('ul:first').css({visibility: "visible"});
		},function(){
			$(this).find('ul:first').css({visibility: "hidden"});
	});	
						
});
