$(document).ready(function(){
	jQuery('#FormNewsletterIndexForm').ajaxForm({
		cache: false, 
		dataType: "json",
		success: function(data, statusText, xhr, jqForm){
			if(data.valid){
				//Exibe mensagem de sucesso
				alert(data.msg);
				$('#FormNewsletterNome').val('');
				$('#FormNewsletterEmail').val('');
			}else{
				alert(data.msg);
			}
		}
	});
	
	 $("#1, #2, #3").lavaLamp({
        fx: "backout", 
        speed: 700,
        click: function(event, menuItem) {
            //return false;
        }
    });
	
	boxFade();
	
	function boxFade(){
	  $(".box_fade").fadeIn(2000);
	  
	  $(".box_fade").hover(
	    function(){
	      $(".box_fade").not(this)
	      	.fadeTo(500,0.33);
	      	$(this).find('.box-destaques-img-b a')
	      		.addClass('hover')
	      ;
	      if($(this).attr("url"))
	        $(this).css("cursor","pointer");
	    },
	    function(){
	      $(".box_fade")
	      	.fadeTo(1,1);
	      	$(this).find('.box-destaques-img-b a')
				.removeClass('hover')
	    }
	  );
	}
	$("a[rel^='prettyPhoto']").prettyPhoto({gallery_markup:''});
	
});

$(window).load(function() {
    $('#slider').nivoSlider({
    directionNav:false,
    effect:'fade',
	pauseTime:7000,
    pauseOnHover: false,
    animSpeed: 500
    });
});

function changeVideo(id){
	//menu
	$('div.port-mais-videos a.hide').removeClass('hide');
	$('div.port-mais-videos a#'+id).addClass('hide');
	//video
	$("div.port-video div:visible").addClass('hide');
	$("div.port-video div#"+id).removeClass('hide');
}
