﻿<!--  
	function ExcluirConteudo(Url) {
	    //var msg = confirm("Você realmente deseja excluir o conteúdo?");		
	    if(msg)
	        location.href = Url;
	    return false;
	}
	
	function fncCadastrese() {
	    var cpfCad = $("input#cpfCad").val();
		var nomeCad = $("input#nomeCad").val();
		var emailCad = $("input#emailCad").val();
		var sexoCad = $("input[name='sexoCad']:checked").val();
		var enderecoCad = $("input#enderecoCad").val();
		var numeroCad = $("input#numeroCad").val();
		var complementoCad = $("input#complementoCad").val();
		var cepCad = $("input#cepCad").val();
		var cidadeCad = $("#cidadeCad option:selected").val();
		var nascCad = $("input#nascCad").val();
		var dddFoneCad = $("input#dddFoneCad").val();
		if(!dddFoneCad) {dddFoneCad = "0"}
		var foneCad = $("input#foneCad").val();
		var dddFaxCad = $("input#dddFaxCad").val();
		if(!dddFaxCad) {dddFaxCad = "0"}
		var faxCad = $("input#faxCad").val();
		var dddCelCad = $("input#dddCelCad").val();
		if(!dddCelCad) {dddCelCad = "0"}
		var celCad = $("input#celCad").val();
		var receberCad = $("input[name='receberCad']:checked").val();
		if (!receberCad) { receberCad = "false" }
		var senhaCad = $("input#senhaCad").val();
		var senha1Cad = $("input#senha1Cad").val();
			
		if (!cpfCad || !nomeCad || !emailCad || !sexoCad || !nascCad || !enderecoCad || !numeroCad || !cepCad || !cidadeCad || !senhaCad) {
		    $("#preencha").show();
		} else if (!isCPF(cpfCad)) {
		    alert("CPF inválido.");
		    $("input#cpfCad").val("");
		    $("input#cpfCad").focus();
		} else if (senha1Cad != senhaCad) {
		    alert("As senhas digitadas não são iguais");
		    $("input#senha1Cad").val("");
		    $("input#senha1Cad").focus();
		}
		else {
		    $.post(
				'../services/Cadastrar.aspx',
				{
				    Nome: nomeCad,
				    Email: emailCad,
				    Sexo: sexoCad,
				    Endereco: enderecoCad,
				    Numero: numeroCad,
				    Complemento: complementoCad,
				    CEP: cepCad,
				    IdCidade: cidadeCad,
				    DataNascimento: nascCad,
				    DddTelefone: dddFoneCad,
				    Telefone: foneCad,
				    DddFax: dddFaxCad,
				    Fax: faxCad,
				    DddCelular: dddCelCad,
				    Celular: celCad,
				    ReceberInformacoes: receberCad,
				    Senha: senhaCad,
				    Cpf: cpfCad
				},
				function(callback) {
				    if (callback == "C") {
				        $("#cadastro").show();
				    }
				    else {
				        $("#preencha").show();
				    }
				}
			);
		}
	}
	
	function fncObterEstados() {
		$("#cidadeCad").html("<option>Selecione um Estado</option>");
		$.ajax({  
			url: "services/ObterEstados.aspx",  
			dataType: "xml", 
			
			beforeSend: function() {
				$("#ufCad").html("<option>Carregando...</option>");
			},
			 
			success: function(xml) {
				$("#ufCad").html("<option>Selecione</option>");
				$(xml).find("estado").each(function(){
					var idEstado =  $(this).attr("id");  
					var nomeEstado =  $(this).attr("nome");  
		   			$("#ufCad").append("<option value='" + idEstado + "'>" + nomeEstado + "</option>");
				});
			}
	  	});
	}
	
	function fncObterCidadePorIdEstado(id) {
		$.ajax({
			type: "POST",
			url: "services/ObterCidadePorIdEstado.aspx",  
			dataType: "xml", 
			data: {IdEstado:id},
			
			beforeSend: function() {
				$("#cidadeCad").html("<option>Carregando...</option>");
			},
			 
			success: function(xml) {
				$("#cidadeCad").html("");  
				$(xml).find("cidade").each(function(){  
					var idCidade =  $(this).attr("IdCidade");
					var nomeCidade =  $(this).find("nome").text();
		   			$("#cidadeCad").append("<option value='" + idCidade + "'>" + nomeCidade + "</option>");
				});
			}
	  	});
	}
	
	function fncVerificaEmail(email) {
		$.post(
			'services/VerificaEmail.aspx',
			{
				EMAIL: email
			},
			function(callback) { 
				if(callback == "S") {
					alert("Este email já existe.");
					$("input#emailCad").val("");
					$("input#emailCad").focus();
				}
				
			}
		);
	}
	
	function fncVerificaCpf(Cpf) {
	    $.post(
			'services/VerificaCPF.aspx',
			{
			    Cpf: Cpf
			},
			function(callback) {
			    if (callback == "S") {
			        alert("Este CPF já existe.");
			        $("input#cpfCad").val("");
			        $("input#cpfCad").focus();
			    }
	
			}
		);
	}
	
	function fncFaleConosco() {
		var nomeFale = $("input#nomeFale").val();
		var emailFale = $("input#emailFale").val();
		var sexoFale = $("input[name='sexoFale']:checked").val();
		var dddTelefoneFale = $("input#dddTelefoneFale").val();
		var telefoneFale = $("input#telefoneFale").val();
		var assuntoFale = $("#assuntoFale option:selected").val();
		var mensagemFale = $("textarea#mensagemFale").val();
		
		if(!nomeFale || !emailFale || !sexoFale || !dddTelefoneFale || !telefoneFale || !assuntoFale || !mensagemFale) {
			 $("#preencha").show();
		}
		else {
			$.post(
				'services/FaleConosco.aspx',
				{
					Nome: nomeFale,
					Email: emailFale,
					Sexo: sexoFale,
					DddTelefone: dddTelefoneFale,
					Telefone: telefoneFale,
					IdAssunto: assuntoFale,
					Mensagem: mensagemFale
		
				},
				function(callback) { 
					if(callback == "C") {
						$("#obrigado").show();
					}
					else {
						$("#preencha").show();
					}
				}
			);
		}
	}
	
	function fncObterAssuntos() {
		$.ajax({  
			url: "services/ObterAssuntos.aspx",  
			dataType: "xml", 
			
			beforeSend: function() {
				$("#assuntoFale").html("<option>Carregando...</option>");
			},
			 
			success: function(xml) {
				$("#assuntoFale").html("<option>Selecione um Assunto</option>");
				
				$(xml).find("assunto").each(function(){
					var idAssunto =  $(this).attr("id");  
					var nomeAssunto =  $(this).attr("nome");
		   			$("#assuntoFale").append("<option value='" + idAssunto + "'>" + nomeAssunto + "</option>");
				});
			}
	  	});
	}
	
	function fncAvisoChat() {
		var nomeAvise = $("input#nomeAvise").val();
		var emailAvise = $("input#emailAvise").val();
		var receberAvise = $("input[name='receberAvise']:checked").val();
		if(!receberAvise) {receberAvise = "false"}
		
		if(!nomeAvise || !emailAvise || !receberAvise) {
			 $("#preencha2").show();
			 $("#aviseme").hide();
		}
		else {
			$.post(
				'services/AvisoChat.aspx',
				{
					Nome: nomeAvise,
					Email: emailAvise,
					ReceberInformacoes: receberAvise
		
				},
				function(callback) { 
					if(callback == "C") {
						$("#feedback").show();
						fecharAvise();
						fncHidePreencha();
					}
					else {
						$("#preencha2").show();
					}
				}
			);
		}
	}
	
	function isCPF (cpf) {
	    var cpf_limpo = cpf.replace(/\D/g, "");
	    if (cpf_limpo.length != 11)
	        return false;
	
	    var soma = 0;
	    for (var i = 0; i < 9; i++)
	        soma += parseInt(cpf_limpo.charAt(i)) * (10 - i);
	
	    if (soma == 0)
	        return false;
	
	    primeiro_digito = 11 - soma % 11;
	    if (primeiro_digito > 9)
	        primeiro_digito = 0;
	
	    if (cpf_limpo.substr(9, 1) != primeiro_digito)
	        return false;
	
	    var soma = 0;
	    for (var i = 0; i < 10; i++)
	        soma += parseInt(cpf_limpo.charAt(i)) * (11 - i);
	
	    var segundo_digito = 11 - soma % 11;
	
	    if (segundo_digito > 9)
	        segundo_digito = 0;
	    if (cpf_limpo.substr(10, 1) != segundo_digito)
	        return false;
	
	    return true;
	}
	
	
	function openPage(page){
		window.location.href = page;
	}
	
	function abrirAviseme() {
		$("#aviseme").show();
	}
	
	
	function fncHidePreencha() {
		$("#preencha").hide();
	}
	
	function fncHidePreencha2() {
		$("#preencha2").hide();
		$("#aviseme").show();
	}
	
	function fncHideCadastro() {
		$("#cadastro").hide();
		document.location = "Default.shtml";
	}
	
	function fncHideObrigado() {
		$("#obrigado").hide();
		document.location = "Default.shtml";
	}
	
	function fncHideFeedback() {
		$("#feedback").hide();
	}
	
	function fecharAvise() {
		$("#aviseme").hide();
	}
	
	window.onload = function() {
		fncEmbaixadoras("mais");
	}
	
	var e = 0;
	function fncEmbaixadoras(tipo) {
		if(tipo == "mais") {
			if(e >= 12) {
				e = 12;
			} 
			else {
				e++;
				$("#contador").html(e);
			}
		}
		
		if(tipo == "menos") {
			if(e <= 1) {
				e = 1;
			} 
			else {
				e--;
				$("#contador").html(e);
			}
		}
			
		if(e == 1) {
			$("#nomeEmbaixadora").html("Adriana Granato");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/adriana.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Analista financeira - Empresa de Cr&eacute;dito");
			$("#idadeEmbaixadora").html("10/07");
			$("#signoEmbaixadora").html("Signo: C&acirc;ncer");
		}
		
		if(e == 2) {
			$("#nomeEmbaixadora").html("Betty Lago");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/beth.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Atriz");
			$("#idadeEmbaixadora").html("24/06");
			$("#signoEmbaixadora").html("Signo: C&acirc;ncer");
		}
		
		if(e == 3) {
			$("#nomeEmbaixadora").html("Carolina Bermejo");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/carolina.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Assistente Gerente de Alimentos e Bebidas - Hotel");
			$("#idadeEmbaixadora").html("24/04");
			$("#signoEmbaixadora").html("Signo: Touro");
		}
		
		if(e == 4) {
			$("#nomeEmbaixadora").html("Fabiane Loureiro");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/fabiane.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Caixa de Loja");
			$("#idadeEmbaixadora").html("24/10");
			$("#signoEmbaixadora").html("Signo: Escorpi&atilde;o");
		}
		
		if(e == 5) {
			$("#nomeEmbaixadora").html("Fernanda Lousada");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/fernanda.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Analista de RH - Agribusiness");
			$("#idadeEmbaixadora").html("24/04");
			$("#signoEmbaixadora").html("Signo: Touro");
		}
		
		if(e == 6) {
			$("#nomeEmbaixadora").html("Maria Fernanda Oliveira");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/maria_fernanda.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Estudante de Fotografia e Designer");
			$("#idadeEmbaixadora").html("17/05");
			$("#signoEmbaixadora").html("Signo: Touro");
		}
		
		if(e == 7) {
			$("#nomeEmbaixadora").html("Maria Fernanda Carvalhaes");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/maria_fernanda_franciozi.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Assistente Comercial - Com. Exterior");
			$("#idadeEmbaixadora").html("16/02");
			$("#signoEmbaixadora").html("Signo: Aqu&aacute;rio");
		}
		
		if(e == 8) {
			$("#nomeEmbaixadora").html("Priscila Labourdetti");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/priscila.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Professora");
			$("#idadeEmbaixadora").html("02/02");
			$("#signoEmbaixadora").html("Signo: Aqu&aacute;rio");
		}
		
		if(e == 9) {
			$("#nomeEmbaixadora").html("Regiane Alves");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/regiane.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Atriz");
			$("#idadeEmbaixadora").html("28/07");
			$("#signoEmbaixadora").html("Signo: Virgem");
		}
		
		if(e == 10) {
			$("#nomeEmbaixadora").html("Renata Ayres");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/renata.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Vendedora de Loja");
			$("#idadeEmbaixadora").html("12/01");
			$("#signoEmbaixadora").html("Signo: Capric&oacute;rnio");
		}
		
		if(e == 11) {
			$("#nomeEmbaixadora").html("Tammy Barboza");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/tammy.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("Arquiteta");
			$("#idadeEmbaixadora").html("19/05");
			$("#signoEmbaixadora").html("Signo: Touro");
		}
		
		if(e == 12) {
			$("#nomeEmbaixadora").html("Thais Regina Louren&ccedil;o");
			$("#fotoEmbaixadora").html("<img src='images/embaixadoras/thais.jpg' width='56' height='56' alt='' />");
			$("#profissaoEmbaixadora").html("M&eacute;dica");
			$("#idadeEmbaixadora").html("28/12");
			$("#signoEmbaixadora").html("Signo: Capric&oacute;rnio");
		}
	}
	
	// Div Swap
	function divSwap(divOpen, divClose) {
	    document.getElementById(divClose).style.display = "none";
	    document.getElementById(divOpen).style.display = "block";
	}
	
	function divClose(div) {
	   document.getElementById(div).style.display = "none";
	}
	
	function divOpen(div) {
	   document.getElementById(div).style.display = "block";
	}
	
	
	// Login
	function fcnEfetuarLogin() {
	    var Email = $("input#emailLogin").val();
	    var Senha = $("input#senhaLogin").val();
		
		document.getElementById("loginErro").innerHTML = "Aguarde...";
	
	    $.post(
			'../services/EfetuarLogin.aspx',
				{
				    Email: Email,
				    Senha: Senha
				},
				function(callback) {
				    if (callback == "C") {
				        location.href = "EnviarTestemunho.aspx";
				    }
				    else {
				        document.getElementById("loginErro").innerHTML = "Usuario<br />Inexistente."
				    }
				}
			);
	}
	
	// Recuperar Senha
	function fcnRecuperarSenha() {
	    var Email = $("input#emailLembrete").val();
		$("#aguarde").hide();
	    $("#senhaEviado").hide();
	    $("#senhaErro").hide();
		
		
		if(Email == ""){
			document.getElementById("emailLembrete").value = "Preencha o Campo";
		}else{
			var rp = /[a-z\.\_]+@*([a-z\_]+[\.]+[a-z\_]+)+/;
			if(!rp.test(Email)){
				document.getElementById("emailLembrete").value = "Preencha corretamente o e-mail.";
			}else{
				$("#aguarde").show();
				
				$.post(
					'../services/RecuperarSenha.aspx',
					{
					    Email: Email
					},
					function(callback) {
					    $("#senhaCampos").hide();
						$("#aguarde").hide();
						if (callback == "C") {
					        $("#senhaEviado").show();
					    }
					    else {
					        $("#senhaErro").show();
					    }
						
					}
				);
			}
		}
	}
	
	// Enviar Testemunho
	function fcnEnviarTestemunho(form) {
		$("div#mensagemResposta").hide();
		var iframe = document.getElementById("testemunho_action");
		
		form.target = "testemunho_action";
		form.submit();
		return false;
	}
	
	function fcnCallBackTestemunho(resposta) {
	    var msg = "";
	    switch (resposta) {
	        case "JaEnviou":
	            msg = '<strong>Voc&ecirc; j&aacute; enviou um testemunho, &eacute; permitida apenas uma participa&ccedil;&atilde;o por usu&aacute;rio.</strong><br /><br /><a href="javascript:divSwap(\'envie\' , \'msgResposta\');"><img src="_img/btn_voltar.gif" width="44" height="13" alt="Voltar" /></a>';
				$("div#msgResposta").html(msg); $("div#msgResposta").show();$("div#envie").hide();
	            break;
	        case "Ext":
	            msg = "Formato inv&aacute;lido"; $("div#mensagemResposta").html(msg); $("div#mensagemResposta").show();
	            break;
	        case "Maior500K":
	            msg = "Peso m&aacute;ximo permitido excedido (500k)"; $("div#mensagemResposta").html(msg); $("div#mensagemResposta").show();
	            break;
	        case "C":
	            msg = '<strong>Seu depoimento foi enviado com sucesso.</strong><br />Aguarde nosso contato para a pr&oacute;xima fase do Concurso.<br /><br /><a href="default.shtml"><img src="_img/btn_voltar.gif" width="44" height="13" alt="Voltar" /></a>';
				$("div#msgResposta").html(msg); $("div#msgResposta").show();$("div#envie").hide();
	            break;
	        default:
	            msg = '<strong>Falha no envio. Tente novamente mais tarde.</strong><br /><br /><a href="javascript:divSwap(\'envie\' , \'msgResposta\');"><img src="_img/btn_voltar.gif" width="44" height="13" alt="Voltar" /></a>';
				$("div#msgResposta").html(msg); $("div#msgResposta").show();$("div#envie").hide();
	            break;
	    }	
	}
	
	function validaCampos(){
		var blnValida = true;
		
		var nome = document.getElementById("nome");
		var email = document.getElementById("email");
		var depoimento = document.getElementById("Depoimento");
		var file = document.getElementById("file");
		var check = document.getElementById("checkReg");
		
		if(nome.value == ""){
			nome.value = "Preencha o campo.";
			blnValida=false;
		}
		
		var rp = /[a-z\.\_]+@*([a-z\_]+[\.]+[a-z\_]+)+/;
		if(email.value != "" && !rp.test(email.value)){
			email.value = "Preencha corretamente o campo.";
			blnValida=false;
		}
		if(email.value == ""){
			email.value = "Preencha o campo.";
			blnValida=false;
		}
	
		if(depoimento.value == ""){
			depoimento.value = "Preencha o campo.";
			blnValida=false;
		}
		if(file.value == ""){
			alert("Selecione uma foto.");
			blnValida=false;
		}
		if(!check.checked){
			alert("Leia o regulamento.");
			blnValida=false;
		}
		
		if(blnValida){
			fcnEnviarTestemunho(document.frmEnvio);
		}
	}
	
	var intPasso = 1;
	
	function fncMudaPasso(){
		var img = document.getElementById("controle");
		
		document.getElementById("passo" + intPasso).style.display = "none";
		if(intPasso == 1){
			document.getElementById("participe").style.display = "block";
			img.src = "_img/btn_anterior.gif";
			intPasso = 2;
		}else{
			document.getElementById("participe").style.display = "none";
			img.src = "_img/btn_proximo.gif";
			intPasso = 1;
		}
		document.getElementById("passo" + intPasso).style.display = "block";
	}
	
	function loadVideoPlayer(video){
		var so = new SWFObject('/campanha/_swf/video_player.swf?Video=' + video, 'main', '446', '269', '9', '#FFFFFF', 'high');
		so.addParam('wmode', 'transparent');
		so.write('flashBox');
	}
	//
-->