// Inicializa...
$(function() {
	if($("#abas").length > 0){
		//inicializa abas
		$(".aba").each(function(){
			nome = $(this).attr("id")
			nome = nome.substr(3,nome.length);
			$(this).css("background-color","#FDEFEF");
			$(this).css("color","#9F9E9E");
			$(this).css("text-decoration","none");			
			$("#li"+nome).css("display","none");
		});
	
		desligaLigaAbas("abaDadosCompl");
	
		$("#abaDadosCompl").click(function(){
			desligaLigaAbas($(this).attr("id"));
			return false;
		});
		$("#abaFisico").click(function(){
			desligaLigaAbas($(this).attr("id"));
			return false;
		});
		$("#abaFavoritos").click(function(){
			desligaLigaAbas($(this).attr("id"));
			return false;
		});
		$("#abaOqueAcho").click(function(){
			desligaLigaAbas($(this).attr("id"));
			return false;
		});
		$("#abaMaisFotos").click(function(){
			desligaLigaAbas($(this).attr("id"));
			return false;
		});
	}
})

//Fun&ccedil;&otilde;es
function aumentaDiminuiPost(id){
	//Retrai o post
	$("#post-"+id+" .conteudoPost").slideUp('slow');
	//Modifica imagem do bot&atilde;o
	$("#"+id).css("background-image", "imagens/btMais.jpg");
	//alert($("#"+id).css("background-image"))
}

function camposErrados(campos,valores){
	vetCampos = campos.split(",");
	for(i=0;i<vetCampos.length;i++){
		$("#"+vetCampos[i]).css("border","1px solid red");
		//alert($("#"+vetCampos[i]).attr("name") + "-" + vetCampos[i])
	}
	
	
	if (vetCampos.length > 1){
		$("#msgErro").html("Os campos assinalados em vermelho est&atilde;o incorretos.");
	}
	//Preenche os campos com os dados digitados

	vetValores = valores.split(",");
	$("#strEmail").val(vetValores[0]);
	$("#strUsuario").val(vetValores[1]);
	$("#cboSexo").val(vetValores[2]);	
	$("#strDtNascimento").val(vetValores[4]);
	$("#diaNascimento").val(vetValores[5]);
	$("#mesNascimento").val(vetValores[6]);
	$("#anoNascimento").val(vetValores[7]);
	$("#strEstadoRegiao").val(vetValores[8]);
	$("#strPais").val(vetValores[9]);
	$("#strEmailConfirma").val(vetValores[10]);
	$("#cboSexoBusca").val(vetValores[11]);
	$("#strPlano").val(vetValores[12]);
}

function desligaLigaAbas(ativa){
	$(".aba").each(function(){
		if($(this).attr("id") != ativa){
			
			nome = $(this).attr("id")
			nome = nome.substr(3,nome.length);
			$(this).css("background-color","#FDEFEF");
			$(this).css("color","#9F9E9E");
			$(this).css("text-decoration","none");			
			$("#li"+nome).css("display","none");
			
		}else{
			
			nome = $(this).attr("id")
			nome = nome.substr(3,nome.length);
			$(this).css("background-color","#FFFFFF");
			$(this).css("color","#FE8282");
			$(this).css("text-decoration","none");
			$("#li"+nome).css("display","block");
		}
	});
}