
// JavaScript Document
//Funções Celular Direto - Coca
var Alvo='divAlvo';
var ImgLoad='../imagens/loader_61.gif';
var chkAlvoCompara;
function trataResposta(Retorno){			
	eLementos(Alvo).innerHTML=Retorno;
	
	
	//Ações do sistema de votação
	if(eLementos('hiVotacao')){
		if(eLementos('hiVotacao').value=='ok'){
			eLementos(Alvo).innerHTML="Votação efetuada com sucesso!";
		}else{
			eLementos(Alvo).innerHTML="Você já votou nesse produto!";
		}		
	}
	//Fim Ações do sistema de votação
	
	//Ações do sistema de votação
	if(eLementos('hiAvaliacao')){
		if(eLementos('hiAvaliacao').value=='erro'){
			eLementos(Alvo).innerHTML="Erro ao processar a sua avaliação!\r\nTente novamente mais tarde!";			
		}else{
			eLementos(Alvo).innerHTML="Avaliação efetuada com sucesso!";			
		}		
	}
	//Fim Ações do sistema de votação
	
	
	//Sistema de comparação de produtos
	if(eLementos('hiComparacao')){
		if(eLementos('hiComparacao').value=='cProdutos'){
			display('box_topo_compara','block');	
			if(eLementos('hiComparacao2')){
				alert(eLementos('hiComparacao2').value);
				eLementos(chkAlvoCompara).checked=false;
			}
		}
		if(eLementos('hiComparacao').value=='sProdutos'){
			display('box_topo_compara','none');
		}
	}else{
		if(eLementos('hiClearCompacao')){
			window.location=window.location;
		}
		if(eLementos('box_topo_compara')){
			display('box_topo_compara','none');
		}
	}
	//Fim Sistema de comparação de produtos
	
	
	//Retorno cep.
	if(eLementos('hiCep')){
		if(eLementos('hiCep').value=='Encontrado'){			
			if(eLementos('hiIndice')){
				vlrIndice=eLementos('hiIndice').value;
				//Alteração endereço de entrega com Indice
				eLementos('txtEndereco'+vlrIndice).value=eLementos('enderecoCep').value;
				eLementos('txtBairro'+vlrIndice).value=eLementos('bairroCep').value;
				eLementos('txtCidade'+vlrIndice).value=eLementos('cidadeCep').value;
				eLementos('txtUf'+vlrIndice).value=eLementos('ufCep').value;
				
				if(eLementos('dv_CadEndereco').style.display=='none' && Alvo=='loadCep-1'){
					eLementos('dv_CadEndereco').style.display='block';
				}
				
			}else{
				//Cadastro de Usuários
				eLementos('txtEndereco').value=eLementos('enderecoCep').value;
				eLementos('txtBairro').value=eLementos('bairroCep').value;
				eLementos('txtCidade').value=eLementos('cidadeCep').value;
				eLementos('txtUf').value=eLementos('ufCep').value;					
			}		
		}else{
			alert("Cep não encontrado.");
				if(eLementos('hiIndice')){
					vlrIndice=eLementos('hiIndice').value;					
					eLementos('txtEndereco'+vlrIndice).value='';
					eLementos('txtBairro'+vlrIndice).value='';
					eLementos('txtCidade'+vlrIndice).value='';
					eLementos('txtUf'+vlrIndice).value='';
					
					if(eLementos('dv_CadEndereco').style.display=='block' && Alvo=='loadCep-1'){
						eLementos('dv_CadEndereco').style.display='none';
					}
					
				}
				if(eLementos('hiIndice2')){
					eLementos('txtEndereco').value='';
					eLementos('txtBairro').value='';
					eLementos('txtCidade').value='';
					eLementos('txtUf').value='';	
				}
				
		}
		eLementos(Alvo).innerHTML='';
	}
	
	//Retorno cep.
	if(eLementos('hiValida')){
		if(eLementos('hiValida').value=='jaCadastrado'){
			//if(eLementos(eLementos('hiCampo').value).value=='txtEmailC'){
				alert('O usuário já esta cadastrado.');
				
				if(eLementos('txtCpf')){
					eLementos('txtCpf').value='';
				}
				if(eLementos('txtCpf2')){
					eLementos('txtCpf2').value='';
				}
				
				
			//}else{
				
			//}
		}
		eLementos(Alvo).innerHTML='';
	}	
	
	
	//Retorno Carrinho
	if(eLementos('hiFlagEmbalar')){
		if(eLementos('hiFlagEmbalar').value=='ok'){
			
		}else{
			eLementos(Alvo).innerHTML="Erro interno!";
		}
	}
	
	
}

//Função do sistema de votação
function fnAvaliacao(Estrelas,Codigo,Div){
	Alvo=Div;
	dadosAjax('/Ajax/Votacao.asp?Codigo='+Codigo+'&Estrelas='+Estrelas,Alvo,ImgLoad);
	display(Alvo,'block');
	eval('a'+Div+'=setInterval(function(){display("'+ Alvo +'","none");;clearInterval('+'a'+Div +')},4000)');	
}
//Fim Função do sistema de votação


//Função do sistema de comparação de produtos
function fnAddComparaca(Campo,Div){
	chkAlvoCompara=Campo;
	eLementos(Div).style.display='block';
	Alvo=Div;						
	if(eLementos(Campo).checked!=true){
		Acao='del';		
		a=eLementos(Campo).value;		
		if(eLementos('compare'+a)){
			eLementos('compare'+a).checked=0;
		}
	}else{
		Acao='add';
	}						
	dadosAjax('/Ajax/Lista_Comparacao.asp?Codigo='+eLementos(Campo).value+'&Acao='+Acao,Div,ImgLoad);
}

function fnClearComparaca(){
	//eLementos('box_topo_compara').style.display='none';
	dadosAjax('/Ajax/Lista_Comparacao.asp?Acao=Clear','box_topo_compara',ImgLoad);	
}

//Fim Função do sistema de comparação de produtos


//Função para busca o endereço
function fnCep(Id,Div){
	var indice = Div.replace('loadCep','');		
	if(eLementos(Id).value.length>0){
		Alvo=Div;
		dadosAjax('/Ajax/Busca_Endereco.asp?txtCep='+eLementos(Id).value+'&Indice='+indice,Alvo,ImgLoad);		
	}
}

////Função para busca o endereço

//Função para busca o endereço
function fnValida(Id,Div,Acao){
	Alvo=Div;
	if(eLementos(Id).value.length>0){
		if(Acao=='Email'){
			if(valMail('txtEmail')!=false){
				dadosAjax('/Ajax/Validacoes_Cadastro.asp?Valida=Email&txtEmail='+eLementos(Id).value,Alvo,ImgLoad);	
			}			
		}
		if(Acao=='Cpf'){			
			if(eLementos('txtCpf2').value.length>0 && eLementos('txtCpf2').value!='___.___.___-__'){
				dadosAjax('/Ajax/Validacoes_Cadastro.asp?Valida=Cpf&txtCpf='+eLementos(Id).value,Alvo,ImgLoad);
			}			
		}
	}
}


//function UpdateEndEntrega(Codigo,Div){
//	Alvo=Div;
//	dadosAjax('/Ajax/CarregaEndereco.asp',Alvo,ImgLoad);	
//}

////Função para busca o endereço


function GerarSWF($Swf,$Largura,$Altura,$Id,$PathXML1){
	document.writeln('<object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ $Largura +'" height="'+ $Altura +'" id="'+ $Id +'" name="'+ $Id +'">');
	document.writeln('	<param name="movie" value="' + $Swf + '"/>');
	document.writeln('	<param name="FlashVars" value="PathXML1='+ $PathXML1 +'"/>');
	document.writeln('	<param name="menu" value="false" />');
	document.writeln('	<param name="quality" value="high" />');
	document.writeln('	<param name="scale" value="noscale" />');	
	document.writeln('	<param name="wmode" value="transparent" />');
	document.writeln('	<embed id="globalnav-embed" src="' + $Swf + '" FlashVars="PathXML1='+ $PathXML1 +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" menu="false" quality="high" scale="noscale" id="home" width="'+ $Largura +'" height="'+ $Altura +'"></embed>');
	document.writeln('</object>');
	//alert($Swf)	
}

function fnLoad(){		
	//Eventos de load do sistema de comparação de produtos.
	if(eLementos('box_topo_compara') && eLementos('hiComparacao') ){			
		Div='box_topo_compara';
		Alvo=Div;
		dadosAjax('/Ajax/Lista_Comparacao.asp?Codigo=null'+'&Acao=load',Div,ImgLoad);
	}
	
	//AlternarAbas('aba_caracteristica','cont_caracteristica');
	//troca_imagem('span_caracteristica','aba_caracteristica_on.jpg','aba_caracteristica_off.jpg');		
}



function valLogin(Form){	
	if(Form=='paginaPessoal'){				
		if(document.frmLogin2.Acao[0].checked){			
			if(valMail('txtEmail')==false) return false;
			if(valCampo('txtCep',9,'o cep!')==false) return false;
		}else{
			if(valMail('txtEmail')==false) return false;
			if(valCampo('txtSenha',3,'a senha!')==false) return false;
		}
		
	}	
	return true;
}

function verificaUf(){
	if(eLementos('ufLocalizacao').value!=''){ 
		return true; 
	}else{ 
		alert('Escolha o Estado onde o produto será utilizado.');
		eLementos('ufLocalizacao').focus();
		return false;
	}
}


function valCadastro(Acao){	
	if(valCampo('txtNome',6,'o nome!')==false) return false;
	if(valCpfCNPJ('txtCpf2')==false) return false;		
	if(valCampo('txtNascimento',10,'a data de nascimento!')==false) return false;	
	
	if(valCampo('txtCep',8,'o cep!')==false) return false;
	if(valCampo('txtEndereco',6,'o endereço!')==false) return false;
	if(valCampo('txtNumero',1,'o número!')==false) return false;
	if(valCampo('txtBairro',3,'o bairro!')==false) return false;
	if(valCampo('txtCidade',3,'a cidade!')==false) return false;
	if(valCampo('txtUf',2,'o estado!')==false) return false;
	if(valCampo('txtTelefone',13,'o telefone!')==false) return false;
	if(valMail('txtEmail')==false) return false;
	if(Acao=='Cadastro'){
		if(valSenha('txtSenha',4,1)==false) return false;
	}else{
		if(valSenha('txtSenha',4,2)==false) return false;
	}	
	return true;
}

function valContato(){	
	if(valCampo('txtNome',6,'o nome!')==false) return false;
	if(valMail('txtEmailC')==false) return false;
	if(valSelect('selAssunto','','o assunto!')==false) return false;
	if(valCampo('txtMsg',6,'a mensagem!')==false) return false;	
	return true;
}
function valBusca(){	
	if(valCampo('txtBusca',2,'a busca!')==false) return false;	
	return true;
}


function valAjuda(){	
	if(eLementos('selTema').value=='all' && eLementos('txtTexto').value==''){
		alert("Digite uma palavra para pesquisa ou selecione um tema!");
		return false;
	}
	return true;
}

function trim(str) {
		return str.replace(/^\s+|\s+$/g,"");
}

function valComente(){	
	var verifica = trim(document.getElementById("txtNome").value);

	if (!isNaN(verifica))
	{
		alert("Favor digitar o nome!");
		document.getElementById("txtNome").focus();
		return false;
    }
	
	if (verifica.length < 3) {
		alert("Favor digitar o nome!");
		document.getElementById("txtNome").focus();
		return false;
	}
	
	if(verifica=="")
	{
			alert("Favor digitar o nome!");
			document.getElementById("txtNome").focus();
			return false;
	}
	
	if(valMail('txtEmailC')==false) return false;
	if(valCampo('txtComentario',1,'o comentário!')==false) return false;
	return true;
}


function valNewsletter(){	
	if(valCampo('txtNome',6,'o nome!')==false) return false;
	if(valMail('txtEmailC')==false) return false;
	return true;
}

function valCurriculo(){	
	if(valCampo('txtNome',6,'o nome!')==false) return false;
	if(valCampo('txtDia',2,'o dia da data de nascimento!')==false) return false;
	if(valCampo('txtMes',2,'o mês da data de nascimento!')==false) return false;
	if(valCampo('txtAno',4,'o ano da data de nascimento!')==false) return false;
	if(valCampo('txtEndereco',3,'o endereço!')==false) return false;
	if(valCampo('txtBairro',3,'o bairro!')==false) return false;
	if(valCampo('txtCidade',3,'a cidade!')==false) return false;
	if(valSelect('txtEstado','','o estado!')==false) return false;
	if(valCampo('txtCep',9,'o cep !')==false) return false;
	if(valCampo('txtCelular',13,'o celular!')==false) return false;
	if(valMail('txtEmail')==false) return false;
	if(valSelect('txtCargo','','o cargo desejado!')==false) return false;
	if(valCampo('txtSalario',3,'o salário!')==false) return false;
	
	return true;
}

function valRecomende(){	
	if(valCampo('txtNome',2,'o nome!')==false) return false;
	if(valMail('txtEmail')==false) return false;
	if(valCampo('txtAmigo',2,'o nome do seu amigo!')==false) return false;
	if(valMail('txtEmail2')==false) return false;
	if(valCampo('txtMsg',6,'a mensagem!')==false) return false;	
	return true;
}


function valAddProduto(){	
	if(eLementos('Area2').value=='celulares-de-operadoras' || eLementos('Area2').value=='chips' || eLementos('Area2').value=='banda-larga'){
		if(valSelect('selDDD','','o DDD!')==false) return false;
	}	
	return true;
}

///Controle da descrição dos produtos
function fnDescricao(alvo){
	if(alvo=="link1"){
		display('caracteristicas','block');
		display('especificacoes','none');
		display('itens','none');
		display('descricao','none');
		Css('link1','S1');
		Css('link2','A2');
		Css('link3','A3');
		Css('link4','A4');
	}
	if(alvo=="link2"){
		display('caracteristicas','none');
		display('especificacoes','block');
		display('itens','none');
		display('descricao','none');
		Css('link1','A1');
		Css('link2','S2');
		Css('link3','A3');
		Css('link4','A4');
	}
	if(alvo=="link3"){
		display('caracteristicas','none');
		display('especificacoes','none');
		display('itens','block');
		display('descricao','none');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','S3');
		Css('link4','A4');
	}
	if(alvo=="link4"){
		display('caracteristicas','none');
		display('especificacoes','none');
		display('itens','none');
		display('descricao','block');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','A3');
		Css('link4','S4');
	}
}

///Controle da descrição dos produtos
function fnDescricaoKit(alvo){
		if(eLementos('descricaoProd1').style.display=='block'){
			indice=1;
		}else{
			indice=2;
		}
	
	if(alvo=="link1"){
		display('caracteristicas'+indice,'block');
		display('especificacoes'+indice,'none');
		display('itens'+indice,'none');
		display('descricao'+indice,'none');
		Css('link1','S1');
		Css('link2','A2');
		Css('link3','A3');
		Css('link4','A4');
	}
	if(alvo=="link2"){
		display('caracteristicas'+indice,'none');
		display('especificacoes'+indice,'block');
		display('itens'+indice,'none');
		display('descricao'+indice,'none');
		Css('link1','A1');
		Css('link2','S2');
		Css('link3','A3');
		Css('link4','A4');
	}
	if(alvo=="link3"){
		display('caracteristicas'+indice,'none');
		display('especificacoes'+indice,'none');
		display('itens'+indice,'block');
		display('descricao'+indice,'none');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','S3');
		Css('link4','A4');
	}
	if(alvo=="link4"){
		display('caracteristicas'+indice,'none');
		display('especificacoes'+indice,'none');
		display('itens'+indice,'none');
		display('descricao'+indice,'block');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','A3');
		Css('link4','S4');
	}
}



///Controle da descrição dos produtos - Modem
function fnDescricaoModem(alvo){	
	if(alvo=="link1"){
		display('plano_servico','block');	
		display('caracteristicas','none');
		display('especificacoes','none');
		display('descricao','none');
		Css('link1','S1');
		Css('link2','A2');
		Css('link3','A3');
		Css('link4','A4');
	}
	if(alvo=="link2"){
		display('plano_servico','none');	
		display('caracteristicas','block');
		display('especificacoes','none');
		display('descricao','none');
		Css('link1','A1');
		Css('link2','S2');
		Css('link3','A3');
		Css('link4','A4');
	}
	if(alvo=="link3"){
		display('plano_servico','none');
		display('caracteristicas','none');
		display('especificacoes','block');
		display('descricao','none');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','S3');
		Css('link4','A4');
	}
	if(alvo=="link4"){
		display('plano_servico','none');	
		display('caracteristicas','none');
		display('especificacoes','none');		
		display('descricao','block');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','A3');
		Css('link4','S4');
	}
}

function fnProdutosKit(Alvo){
	if(Alvo=='Prod1'){
		display('descricaoProd2','none');
		display('descricaoProd1','block');
		
		Css('thumbsP1','imagem_promocao');
		Css('chamadaP1','desc_promocao');
		Css('btDetalhesProd1','detalhes_kit');
		
		Css('thumbsP2','imagem_promocao_b');
		Css('chamadaP2','desc_promocao_b');
		Css('btDetalhesProd2','detalhes_kit_b');		
		
	}else{
		display('descricaoProd2','block');
		display('descricaoProd1','none');
		
		Css('thumbsP2','imagem_promocao');
		Css('chamadaP2','desc_promocao');
		Css('btDetalhesProd2','detalhes_kit');
		
		Css('thumbsP1','imagem_promocao_b');
		Css('chamadaP1','desc_promocao_b');
		Css('btDetalhesProd1','detalhes_kit_b');
	}
	fnDescricaoKit('link1');
}


///Controle da descrição dos planos
function fnDescricaoPlanos(alvo){	
	if(alvo=="link1"){
		display('plano_ideal','block');
		display('saiba_mais','none');
		display('cobertura','none');
		Css('link1','S1');
		Css('link2','A2');
		Css('link3','A3');
	}
	if(alvo=="link2"){
		display('plano_ideal','none');
		display('saiba_mais','block');
		display('cobertura','none');
		Css('link1','A1');
		Css('link2','S2');
		Css('link3','A3');
	}
	if(alvo=="link3"){
		display('plano_ideal','none');
		display('saiba_mais','none');
		display('cobertura','block');
		Css('link1','A1');
		Css('link2','A2');
		Css('link3','S4');
	}	
}



function txtBoxFormat(objForm, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
var ObjMascara = document.getElementById(objForm);


if(navigator.appName!="Netscape") { 
	nTecla = evtKeyPress.keyCode;
}else{ 
	nTecla = evtKeyPress.which;
}



sValue = ObjMascara.value;
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( " ", "" );
fldLen = sValue.length;
mskLen = sMask.length;


i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;
	while (i <= mskLen) {
		bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
		
		if (bolMask) {
			sCod += sMask.charAt(i);
			mskLen++;
		}else{
			sCod += sValue.charAt(nCount);
			nCount++;
		}
		
		i++;
}

ObjMascara.value = sCod;
	if (nTecla != 8) {
		if (sMask.charAt(i-1) == "9") {
			return ((nTecla > 47) && (nTecla < 58)); 
		}else{
			return true;
		}
	}else{
		return true;
	}
}// JavaScript Document




function valUpdate(Alvo){	

	if(Alvo=="alteraEmail"){
		if(valCampo('txtEmailOld',5,'o e-mail atual!')==false) return false;
		if(valMail('txtEmailOld')==false) return false;				
		if(valCampo('txtEmail',5,'o novo e-mail!')==false) return false;
		if(valMail('txtEmail')==false) return false;			
		if(valCampo('txtEmail2',5,'a cofirmação do novo e-mail!')==false) return false;
		if(valMail('txtEmail2')==false) return false;			
		if(eLementos('txtEmail').value!=eLementos('txtEmail2').value){
			alert('O e-mail de confirmação deve ser igual ao novo e-mail');
			return false;
		}
		if(valCampo('txtSenha',3,'a sua senha!')==false) return false;
	}
	
	if(Alvo=="alteraSenha"){		
		if(valCampo('txtSenhaOld',3,'a sua senha!')==false) return false;
		if(valSenha('txtSenha',4,1)==false) return false;
	}
	
	
	if(Alvo=="alteraDados"){
		if(valCampo('txtNome',6,'o nome!')==false) return false;
		if(valCpfCNPJ('txtCpf2')==false) return false;		
		if(valCampo('txtNascimento',10,'a data de nascimento!')==false) return false;
		if(valCampo('txtTelefone',13,'o telefone!')==false) return false;

		if(valCampo('txtEndereco',5,'o endereço!')==false) return false;
		if(valCampo('txtNumero',1,'o número!')==false) return false;
		if(valCampo('txtCep',9,'o cep!')==false) return false;
		if(valCampo('txtBairro',3,'o bairro!')==false) return false;
		if(valCampo('txtCidade',3,'a cidade!')==false) return false;
		if(valCampo('txtUf',2,'o estado!')==false) return false;
		if(valCampo('txtPais',2,'o pais!')==false) return false;		
	}
	
	if(Alvo=="alteraDadosComplementares"){
		if(valSelect('txtEstadoCivil','','o estado civil!')==false) return false;		
		if(valCampo('txtRg',6,'o rg!')==false) return false;		
		if(valCampo('txtOrgaoExpeditor',2,'o orgão expeditor!')==false) return false;
		if(valCampo('txtDataExpedicao',10,'a data de expedição!')==false) return false;		
		if(valCampo('txtDataExpedicao',10,'a data de expedição!')==false) return false;
		if(valCampo('txtLocalExpedicao',3,'o local de expedição!')==false) return false;
		if(valCampo('txtNomeMae',3,'o nome da mãe!')==false) return false;
		if(valCampo('txtNomePai',3,'o nome do pai!')==false) return false;
		if(valCampo('txtNacionalidade',3,'a nacionalidade!')==false) return false;
		if(valCampo('txtEscolaridade',3,'a escolaridade!')==false) return false;
		if(valCampo('txtProfissao',3,'a profissão!')==false) return false;
	}
	
	if(Alvo=="cadastrarDadosComplementares"){
		if(eLementos('txtRg')){
			if(valSelect('txtEstadoCivil','','o estado civil!')==false) return false;		
			if(valCampo('txtRg',6,'o rg!')==false) return false;		
			if(valCampo('txtOrgaoExpeditor',2,'o orgão expeditor!')==false) return false;
			if(valCampo('txtDataExpedicao',10,'a data de expedição!')==false) return false;		
			if(valCampo('txtDataExpedicao',10,'a data de expedição!')==false) return false;
			if(valCampo('txtLocalExpedicao',3,'o local de expedição!')==false) return false;
			if(valCampo('txtNomeMae',3,'o nome da mãe!')==false) return false;
			if(valCampo('txtNomePai',3,'o nome do pai!')==false) return false;
			if(valCampo('txtNacionalidade',3,'a nacionalidade!')==false) return false;
		}
	
		if (eLementos('chkAceite').checked==false){
			alert('Para continuar é necessário aceitar o processo de compra.');
			return false;
		}
		
	}
	
	if(Alvo=="pedNumero"){		
		if(valCampo('txtCod_Pedido',1,'número do pedido!')==false) return false;
	}
	
	if(Alvo=="pedData"){			
		if(valCampo('txtDataI',10,'a data inicial!')==false) return false;		
		if(valCampo('txtDataF',10,'a data final!')==false) return false;
	}

	
	/*

	if(valCampo('txtNome',6,'o nome!')==false) return false;
	if(valCpfCNPJ('txtCpf2')==false) return false;		
	if(valCampo('txtNascimento',10,'a data de nascimento!')==false) return false;	
	
	if(valCampo('txtCep',8,'o cep!')==false) return false;
	if(valCampo('txtEndereco',6,'o endereço!')==false) return false;
	if(valCampo('txtNumero',1,'o número!')==false) return false;
	if(valCampo('txtBairro',3,'o bairro!')==false) return false;
	if(valCampo('txtCidade',3,'a cidade!')==false) return false;
	if(valCampo('txtUf',2,'o estado!')==false) return false;
	if(valCampo('txtTelefone',13,'o telefone!')==false) return false;
	if(valMail('txtEmail')==false) return false;
	
	if(Acao=='Cadastro'){
		if(valSenha('txtSenha',4,1)==false) return false;
	}else{
		if(valSenha('txtSenha',4,2)==false) return false;
	}*/	
	
	return true;
}


function valUpdateEndEntrega(Alvo,Id){
	if(Alvo=="alteraEndEntrega" || Alvo=="cadEnderecoEntrega"){
		if(valCampo('txtCep'+Id,9,'o cep!')==false) return false;
		if(valCampo('txtNome'+Id,5,'o nome!')==false) return false;
		if(valCampo('txtEndereco'+Id,5,'o endereço!')==false) return false;
		if(valCampo('txtNumero'+Id,1,'o número!')==false) return false;				
		if(valCampo('txtBairro'+Id,2,'o bairro!')==false) return false;
		if(valCampo('txtCidade'+Id,2,'a cidade!')==false) return false;		
		if(valCampo('txtUf'+Id,2,'o estado!')==false) return false;		
		if(valCampo('txtPais'+Id,2,'o pais!')==false) return false;
	}
	return true;
}




//controla o status da DIV alterar endereço na pagina endereço de entrega
function ShowHiddenEndereco(Div){	
	Alvo = "dv_endereco_static_nome_"+Div;
	displayElementos(Alvo);
	Alvo = "dv_endereco_static_"+Div;
	displayElementos(Alvo);		
	
	Alvo = "dv_formulario_"+Div;
	displayElementos(Alvo);
}	

function ShowHiddenEnd_Detalhes(Div){	
	Alvo = "dv_endereco_static_"+Div;
	displayElementos(Alvo);
}	


//alert de excusão na pagina endereço de entrega
function EnderecoEntregaExclui(Codigo){
	var form = 'frmExcluir_'+Codigo;
	if (confirm("Deseja realmente excluir este endereço?")){
		eLementos(form).submit();
	}else{
		//return (false);
	}
}


//alert de alterar endereço principal na pagina endereço de entrega
function EnderecoEntregaPricipal(Codigo){
	var form = 'frmTornarPricipal_'+Codigo;
	if (confirm("Deseja realmente tornar principal este endereço?")){
		eLementos(form).submit();
	}else{
		//return (false);
	}
}


//controla o status da DIV cadastro na pagina endereço de entrega
function display2(Div,Acao){	
	if(eLementos(Div).style.display=='none'){
		eLementos(Div).style.display='block';
	}else{
		if(Acao=='Fechar'){
			eLementos(Div).style.display='none';
		}
	}
}	



//controla o status da DIV detalhes do pedido
function ShowHiddenDetalhesPed(Div){	
	
	Alvo = "dv_detalhes_"+Div;
	Alvo_Img = "img_botao_"+Div;
	
	displayElementos(Alvo);	
	
	if(eLementos(Alvo_Img).nome==0){
		eLementos(Alvo_Img).src='../imagens/ver_mais_detalhes.jpg';
		eLementos(Alvo_Img).nome=1;
	}else{
		eLementos(Alvo_Img).src='../imagens/ocultar_detalhes.jpg';
		eLementos(Alvo_Img).nome=0;
	}

}
///Rotinas do Carrinho de Compras
function fnFlagEmbalar(Chk,cCarrinho){
	Alvo='alvoAjax';
	if(eLementos(Chk).checked==true){
		Flag_Embalar=1;
	}else{
		Flag_Embalar=0;
	}	
	dadosAjax('/Compras/Ajax/Embalar.asp?Flag_Embalar=' + Flag_Embalar+'&cCarrinho='+cCarrinho,'alvoAjax',ImgLoad);
}

//alert de recusao do contrato de banga larga
function cancelaContrato(){
	if (confirm("Ao recusar o processo, automaticamente sua compra \n\rserá cancelar, deseja realmente confirmar esta solicitação?")){
		tb_remove();
		//window.parent.tb_remove();		
	}
}

function bloqueioUf(){
	tb_remove();	
}

function alteraImagemKit(Img,Alvo){		
		eLementos(Alvo).innerHTML="<img src='/upload/celularDiretoVarejo/"+ Img +"' width='60' height='60' border='0' />";	
}

function alteraBtPessoal(Img,Img2,Botao,Detalhes,Codigo){	
	eLementos(Botao).innerHTML="<img src='"+ Img +"' border='0' id='img"+ Botao +"' style='cursor:pointer;'/>";	
	if(eLementos('img'+ Botao)){
		eLementos('img'+ Botao).onclick=function(){
			fnCarregaPedido(Img2,Img,Botao,Detalhes,Codigo);
		}
	}
}

function fnCarregaPedido(Img,Img2,Botao,Detalhes,Codigo){
		Alvo=Detalhes;
		displayElementos(Detalhes);	
		//Manipulando botão
		alteraBtPessoal(Img,Img2,Botao,Detalhes,Codigo);		
		if(eLementos(Alvo).style.display=='block'){
			//Manipula AJAX
		 	dadosAjax('/Pessoal/Ajax/detalhesPedido.asp?Codigo='+Codigo,Detalhes,ImgLoad);
		}
}

function esqueceuSenha(){
	if(valMail('txtEmail')==false) return false;		
	return true;
}
