$(document).ready(function(){
	/* troca o about */
	$("#about_resume .about_inner").css("padding",(104-$("#about_resume .about_inner p").height())/2+"px 0");
	
	$("#about_resume a[rel]").mouseover(function(){ $(this).css("cursor","pointer"); }).click(function(){
		$("#about_resume a[rel]").removeClass("about_act");
		$(this).addClass("about_act");
		var id = $(this).attr("rel");
		if (id == "pt") { var outroid = "en" } else { var outroid = "pt" };
		$("#about_resume div.about_"+outroid+"").fadeOut("slow", function(){
			$("#about_resume div.about_"+id+"").fadeIn("fast").removeClass("h");
			$("#about_resume .about_inner").css("padding",(104-$("#about_resume .about_"+id+" p").height())/2+"px 0");
		});
		
		$(".home_fixed #about_resume h2").css("marginTop","20px");
		
	});
	
	/* navega entre testimonials*/
	$("#execphp-15").ready(function(){
		$(".tst").each(function(i){
			$(this).attr("id",(i+1));
		});									
		$(".tst:not(:eq(0))", this).addClass("h");
		var qtos = $(".tst",this).length;
	
		$(".tst_nav a[rel]").click(function(){ 
			if($(this).attr("class") == "tst_inc") {
				return false;
			} else {
				var index = $(".tst:visible").attr("id");
				
				if($(this).attr("rel") == "prev") {
					$(".tst#"+index).fadeOut(function() { 
						$(".tst#"+(Number(index)-1)).fadeIn().removeClass("h");
						$(this).addClass("h");
						var pad = (181-$(".tst#"+(Number(index)-1)).height())/2;
						desativaLink(Number(index)-1,qtos,pad);
					});
				} else {
					if (index != qtos) {
						$(".tst#"+index).fadeOut(function() { 
							$(".tst#"+(Number(index)+1)).fadeIn().removeClass("h");
							$(this).addClass("h");
							var pad = (181-$(".tst#"+(Number(index)+1)).height())/2;
							desativaLink(Number(index)+1,qtos,pad);
						});
					};
				};
				
			};
		});
		
		function desativaLink(index,qtos,pad) {
			if (index == qtos) {
				$(".tst_nav a[rel='next']").addClass("tst_inc").mouseover(function(){ $(this).css("cursor",""); });
			} else if (index == 1) {
				$(".tst_nav a[rel='prev']").addClass("tst_inc").mouseover(function(){ $(this).css("cursor",""); });
				$(".tst_nav a[rel='next']").mouseover(function(){ $(this).css("cursor","pointer"); });
			} else {
				$(".tst_nav a[rel]").removeClass("tst_inc").mouseover(function(){ $(this).css("cursor","pointer"); });
			};
			$(".tst#"+index).css("padding",pad+"px 0");
		};

		var padIni = (181-$(".tst:visible").height())/2;
		desativaLink(1,qtos, padIni);
	});
});