jQuery(document).ready(function() {
	/* ABRE E FECHA */
	$(function() {
        $('.abre-fecha + div').hide();
        $('.abre-fecha').click(function(){
			$(this).toggleClass("fecha");
			$(this).next().slideToggle(600);
		});
    });
	
	/* LIMPA FORM */
	$("input").each(function(){
	  $(this).val($(this).attr("alt"));
	});
	$("input").focus(function() {

	  if($(this).val()==$(this).attr("alt")) {
		$(this).val("");
	  }
	});
	$("input").blur(function() {
	  if($(this).val()=="") {
		$(this).val($(this).attr("alt"));
	  }
	});
	
	/* Abrir links com o rel="external" em outra janela com tageamento no Analytics */
	$("a[rel~=external]").attr("target","_blank");	
	//$("a[rel~=external]").click(function(){
		//pageTracker._trackPageview("/link-externo/" + $(this).attr("href").replace("http://",""));
	//});	
});

$(function() {
	var offset = $("#box-flutuante").offset();
	var topPadding = 280;
	$(window).scroll(function() {
		if ($(window).scrollTop() > offset.top) {
			$("#box-flutuante").stop().animate({
				marginTop: $(window).scrollTop() - offset.top + topPadding
			});
		} else {
			$("#box-flutuante").stop().animate({
				marginTop: 0
			});
		};
	});
	
	
});
