// JavaScript Document
//listar
function buscar(campoCodigo, campoTexto,pCodigo,pTexto){
	window.opener.document.getElementById(campoCodigo).value  = pCodigo;
	window.opener.document.getElementById(campoTexto).value   = pTexto;
	window.opener.focus();
	window.close(); 
}
	
function excluir(pTabela, pChave, pTitulo, pTexto, pCodigo){
	
	msg = 'Deseja realmente excluir o(a) '+pTitulo+': ' +  pTexto + ' ?';

	if(confirm(msg)){
		self.location = pTabela + '_Gravar.asp?Acao=4&'+pChave+'='+ pCodigo;
	}
	
}
//pTabela, campoCodigo, campoTexto,pCodigo,pTexto,pAcao

function executaDestino(pTabela, campoCodigo, campoTexto,pCodigo,pTexto,pTitulo,pAcao){
	
	switch(pAcao){
		case 2://alterar
			self.location	=	pTabela+'_Alterar.asp?'+campoCodigo+'='+pCodigo;
			break;    
		case 3://consultar
			self.location	=	pTabela+'_Consultar.asp?'+campoCodigo+'='+pCodigo;
		  	break;
		case 4://excluir
			excluir(pTabela, campoCodigo, pTitulo, pTexto, pCodigo);
		 	break;
		case 5://buscar
		 	buscar(campoCodigo, campoTexto,pCodigo,pTexto);
			break;
		case 6:	
			self.location	=	pTabela+'_Reorganizar.asp?'+campoCodigo+'='+pCodigo;	
			break;
		case 7:
			//self.location	=	pTabela+'_enviar.asp?'+campoCodigo+'='+pCodigo;	
			abreJanela(pTabela+'_enviar.asp?'+campoCodigo+'='+pCodigo,'880','600','yes')
			break;
	}
	
	
}

//listar


//formatações

//IE ou Outros
if (navigator.appName.indexOf('Microsoft') != -1){
	clientNavigator = "IE";
}else{
	clientNavigator = "Other";
}

function formataInteiro(evnt){ 
	if (clientNavigator == "IE"){
		if (evnt.keyCode < 48 || evnt.keyCode > 57){
			return false
		}
	}else{
		if ((evnt.charCode < 48 || evnt.charCode > 57) && evnt.keyCode == 0){
			return false
		}
	}
} 

function FormataCEP(input, evnt){
	if (input.value.length == 5){
		if(clientNavigator == "IE"){
			input.value += "-";
		}else{
			if(evnt.keyCode == 0){
				input.value += "-";
			}
		}
	}
	//Chama a função Bloqueia_Caracteres para só permitir a digitação de números
	return formataInteiro(evnt);
}


//formata telefone com "()" exemplo onkeyup="formataTel(event)"
function formataTel(evt) {
	var obj;
		if (navigator.appName.indexOf("Netscape") != -1) obj = evt.target;
		else obj = evt.srcElement;
		qtd = obj.value.length;
		if (qtd == 2) obj.value = "("+obj.value+")";
		if (qtd == 7) obj.value = obj.value+"-";
		if (qtd == 12 && evt.keyCode == 8) {
		character = tiraChar(obj.value, "-");
			obj.value = character.substring(0,7)+"-"+character.substring(7,12);
		}
		if (qtd == 13) {
		character = tiraChar(obj.value, "-");
		obj.value = character.substring(0,8)+"-"+character.substring(8,12);
	}
}




function formataCPF(input,evnt){
	if (input.value.length == 3 || input.value.length == 7){
				if(clientNavigator == "IE"){
					input.value += ".";
				}else{
					if(evnt.keyCode == 0){
						input.value += ".";
					}
				}
	}else if(input.value.length == 11){
				if(clientNavigator == "IE"){
					input.value += "-";
				}else{
					if(evnt.keyCode == 0){
						input.value += "-";
					}
				}
	}
	
	return formataInteiro(evnt);
}


function formataCNPJ(input){
	if (input.value.lenght > 18){
		return false;	
	}
	if ((event.keyCode<48)||(event.keyCode>57)){
		event.returnValue = false;
	}
    else {
    	if((input.value.length==2) || (input.value.length==6)) {
			input.value=input.value + "." ;
		} else {
			if(input.value.length==10) {
				input.value=input.value + "/" ;
			} else {
				if (input.value.length==15) {
					input.value=input.value + "-" ;					
				}
			}
		}
	} 
}

function formataData(input, evnt){
	//Ajusta máscara de Data e só permite digitação de números
	if (input.value.length == 2 || input.value.length == 5){
		if(clientNavigator == "IE"){
			input.value += "/";
		}else{
			if(evnt.keyCode == 0){
				input.value += "/";
			}
		}
	}
	
	//Chama a função Bloqueia_Caracteres para só permitir a digitação de números
	return formataInteiro(evnt);
}


function formataHora(input, evnt){
	//Ajusta máscara de Hora e só permite digitação de números
	if (input.value.length == 2){
		if(clientNavigator == "IE"){
			input.value += ":";
		}else{
			if(evnt.keyCode == 0){
				input.value += ":";
			}
		}
	}
	
	//Chama a função Bloqueia_Caracteres para só permitir a digitação de números
	return formataInteiro(evnt);
}


function formataMoeda(pEvent){
	if (navigator.appName.indexOf('Microsoft') != -1){
		if(pEvent.keyCode == 45) return false; //-
		if (pEvent.keyCode < 44 || pEvent.keyCode > 57){
			return false;
		}
	}else{
		if( pEvent.keyCode == 0){
			
			if(pEvent.charCode == 45){return false;}
		
			if ((pEvent.charCode < 44 || pEvent.charCode > 57)){
				return false;
			}
		}
	}
}

//FIM FORMATCOES

//Verifica se a data inicial é maior que a data final  
function ComparaData(DtHrInicio, DtHrTermino){  
	 var AgeDtHrIniciodt   		= document.getElementById(DtHrInicio).value;
     var AgeDtHrTerminodt   	= document.getElementById(DtHrTermino).value;
     var DiaInicial        		= AgeDtHrIniciodt.substring(0,2);
     var DiaFinal        		= AgeDtHrTerminodt.substring(0,2);
     var MesInicial      		= AgeDtHrIniciodt.substring(3,5);
     var MesFinal       	    = AgeDtHrTerminodt.substring(3,5);
     var AnoInicial      		= AgeDtHrIniciodt.substring(6,10);
     var AnoFinal        		= AgeDtHrTerminodt.substring(6,10);  

	if(AnoFinal != ""){
		if(AnoInicial > AnoFinal) {  
			 alert("A data Inicial deve ser menor que a data final.");   
			 document.getElementById(DtHrTermino).focus();
			 return false;  
		}else{  
			if(AnoInicial == AnoFinal){  
				if(MesInicial >  MesFinal){  
					alert("A data inicial deve ser menor que a data final.");  
					document.getElementById(DtHrTermino).focus();  
					return false;  
				}else{  
					if(MesInicial == MesFinal){  
						if(DiaInicial > DiaFinal){  
							alert("A data inicial deve ser menor que a data final.");  
							document.getElementById(DtHrTermino).focus();  
							return false;  
						 }  
					 }  
				 }  
			 }  
		 }  
	}
	 return true;
}


function validaEmail(email, obrigatorio){
	//obrigatorio 1, 0 não obrigadorio
	var email = document.getElementById(email);
	
	if(email.value != "") {
		if((obrigatorio == 1) || (obrigatorio == 0 && email.value != "")){
			if(!email.value.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z0-9._-]+)/gi)){
				alert("Por favor, preencha o campo E-mail corretamente.");
				email.focus();
				return false;
			}
		}
	}
}

function selectAll(pForm,pCheck){ 

	vForm  = document.getElementById(pForm).elements.length;
	
	for(e=0;e<vForm;e++){
		if(document.getElementById(pForm).elements[e].type == 'checkbox'){
				if(document.getElementById(pCheck).checked == true){
					document.getElementById(pForm).elements[e].checked = true;
				}else{
					document.getElementById(pForm).elements[e].checked = false;	
				}
		}
	}
	
} 

function abreJanela(pagina,largura,altura,scrollbar) {
		//pega a resolução do visitante
		w = screen.width;
		h = screen.height;
		//divide a resolução por 2, obtendo o centro do monitor
		meio_w = w/2;
		meio_h = h/2;
		//diminui o valor da metade da resolução pelo tamanho da janela, fazendo com q ela fique centralizada
		altura2  = altura/2;
		largura2 = largura/2;
		meio1 	 = meio_h-altura2;
		meio2 	 = meio_w-largura2;
		//abre a nova janela, já com a sua devida posição
		window.open(pagina,'','height=' + altura + ', width=' + largura + ', top='+meio1+', left='+meio2+', scrollbars='+scrollbar); 
}



function alertaCampo(pId,pEvento){
	
	document.getElementById(pId).style.background='#FF9B9C';
	

	if(document.getElementById(pId).addEventListener){
		document.getElementById(pId).addEventListener(pEvento, function(){document.getElementById(pId).style.background='#FFFFFF';}, false);			
	}else{
		document.getElementById(pId).attachEvent('on'+pEvento, function (){document.getElementById(pId).style.background='#FFFFFF';});
	}
	
	document.getElementById(pId).focus();
	
}

function acentuacao(pString){
	
	arAcentos = Array("á","é","í","ó","ú","À","È","Ì","Ò","Ù","Á","É","Í","Ó","Ú","Ç","ç","ã","õ","Õ","Ã","ô","Ô","Â","â","î","Î","Û","û","ê","Ê", "ü", "Ü")
	arCodigos = Array("&#225;","&#233;","&#237;","&#243;","&#250;","&#192;","&#200;","&#204;","&#210;","&#217;","&#193;","&#201;","&#205;","&#211;","&#218;","&#199;","&#231;","&#227;","&#245;","&#213;","&#195;", "&#244;", "&#212;","&#194;","&#226;","&#238;","&#206;","&#219;","&#251;","&#234;","&#202;", "&#252;", "&#220;")

	for(s=0;s<arAcentos.length;s++){
		pString.replace(arCodigos[s],arAcentos[s]);
	}

	return pString;
}

var xmlHttp

function getUrl(pUrl){

	xmlHttp	= GetXmlHttpObject()
	
	if (xmlHttp==null){
		alert("Este navegador não suporta HTTP Request.");
		return
	}

	xmlHttp.open("GET",pUrl,false)
	xmlHttp.send(null)
	
	return xmlHttp.responseText;
	
}

/* Instancia */
function GetXmlHttpObject(){

	var objXMLHttp=null

	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest()
	}else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	
	return objXMLHttp
	
}

//PORTAL
function GerarCookie(pNome, pValor, pDias){
    var pData = new Date();
    if(pDias){
		pData.setTime(pData.getTime() + (pDias * 24 * 60 * 60 * 1000));
        var vExpira = "; expires=" + pData.toGMTString();
    } else{
		var vExpira = "";
    }
    document.cookie = pNome + "=" + pValor + vExpira + "; path=/";
}

// Função para ler o cookie.
function LerCookie(pNome){
  
    var strNomeIgual = pNome + "=";
    var arrCookies 	 = document.cookie.split(';');

    for(var i = 0; i < arrCookies.length; i++){
        var pValorCookie = arrCookies[i];
        while(pValorCookie.charAt(0) == ' '){
            pValorCookie = pValorCookie.substring(1, pValorCookie.length);
        }
        if(pValorCookie.indexOf(strNomeIgual) == 0){
            return pValorCookie.substring(strNomeIgual.length, pValorCookie.length);
        }
    }
    return null;
}

// Função para excluir o cookie desejado.
function ExcluirCookie(pNome){
    GerarCookie(pNome, '', -1);
}

function geraFavoritos(pCodigo,pObjeto){
		
		if(LerCookie("coFav") == null){//
				GerarCookie("coFav", pCodigo, 0);
				pObjeto.src = "img/btn_fav_del.gif";
		}else{
			
				arVerifica = LerCookie("coFav").split(",");
				
				var Pos	= null;
				
				for(x=0;x<arVerifica.length;x++){
					if(arVerifica[x] == pCodigo){
						Pos   = x;
					}
				}

				if(Pos != null){
					arVerifica.splice(Pos,1);
					pObjeto.src = "img/btn_fav_add.gif";
				}else{
					arVerifica.push(pCodigo);
					pObjeto.src = "img/btn_fav_del.gif";
				}

				GerarCookie("coFav", arVerifica, 0);
		}

}


function carregaFavoritos(){
	if(LerCookie("coFav") != null){
		arVerifica = LerCookie("coFav").split(",");
		for(o=0;o<arVerifica.length;o++){
			if(document.getElementById("btnFav"+arVerifica[o]))
				document.getElementById("btnFav"+arVerifica[o]).src = "img/btn_fav_del.gif";
		}
	}
	//alert(LerCookie("coFav"))
}

function buscaReferencia(pImoCodRef){
	if(pImoCodRef != "") {
		var vRetorno = retornaValor('includes/ajax.asp','ImoCod','Imoveis',' WHERE ImoCodRef like $' +pImoCodRef+ '$');
		if(vRetorno != ""){
			abreJanela('imoveis_detalhes.asp?ImoCod='+vRetorno,'720','550','no');
		}else{
			alert("Nenhum imóvel encontrado com a referência '"+pImoCodRef+"'.");
		}
	}else{
			alert("Por favor, digite a referência do imóvel a ser encontrado.");		
			alertaCampo("txtImoCodRef","keypress");
	}
	
	
}

function validaNews(){
	return validaEmail("NCEmail",1);
}
//fim



function abreOferta(pImoCod){
	abreJanela('imoveis_detalhes.asp?ImoCod='+pImoCod+'','720','550','no');
}

function carregaVideo(pUrl){
	
	strObjeto = ' <object width="340" height="280" style=" border:1px solid #339933; width:340px;"> '
			  + '	<param name="movie" value="'+pUrl+'" /> '
			  + '	<param name="wmode" value="transparent" /> '
			  + '	<embed src="'+pUrl+'" type="application/x-shockwave-flash" wmode="transparent" width="340" height="280"></embed>'
			  + ' </object> '
		
	document.getElementById("tdVideoPrincipal").innerHTML = strObjeto		
	
	scroll(0,200);
	
}


function abas(pIndice){
	if(pIndice == 1){
		document.getElementById("tab-tr-1").style.display = "";
		document.getElementById("tab-tr-2").style.display = "none";
		document.getElementById("tab-tr-3").style.display = "none";
		document.getElementById("tab-img-rodape").src = "img/rod1_dest.jpg";
	}else if(pIndice == 2){
		document.getElementById("tab-tr-1").style.display = "none";
		document.getElementById("tab-tr-2").style.display = "";
		document.getElementById("tab-tr-3").style.display = "none";
		document.getElementById("tab-img-rodape").src = "img/rod2_dest.jpg";
	}else if(pIndice == 3){
		document.getElementById("tab-tr-1").style.display = "none";
		document.getElementById("tab-tr-2").style.display = "none";
		document.getElementById("tab-tr-3").style.display = "";
		document.getElementById("tab-img-rodape").src = "img/rod3_dest.jpg";
	}
}


/*FORMATAÇÃO DE VALORES MONETÁRIOS*/

function formatamoney(c) {   
    var t = this; if(c == undefined) c = 2;         
    var p, d = (t=t.split("."))[1].substr(0, c);   
    for(p = (t=t[0]).length; (p-=3) >= 1;) {   
           t = t.substr(0,p) + "." + t.substr(p);   
    }   
    return t+","+d+Array(c+1-d.length).join(0);   
}   
  
String.prototype.formatCurrency = formatamoney   
  
function demaskvalue(valor, currency){   
   
   /*  
   * Se currency é false, retorna o valor sem apenas com os números. Se é true, os dois últimos caracteres são considerados as   
   * casas decimais  
   */  
   
   var val2 = '';   
   var strCheck = '0123456789';   
   var len = valor.length;   
   
   if (len== 0){   
      return 0.00;   
   }   
  
   if (currency ==true){      
      /* Elimina os zeros à esquerda   
      * a variável  <i> passa a ser a localização do primeiro caractere após os zeros e   
      * val2 contém os caracteres (descontando os zeros à esquerda)  
      */  
         
      for(var i = 0; i < len; i++)   
         if ((valor.charAt(i) != '0') && (valor.charAt(i) != ',')) break;   
         
      for(; i < len; i++){   
         if (strCheck.indexOf(valor.charAt(i))!=-1) val2+= valor.charAt(i);   
      }   
  
      if(val2.length==0) return "0.00";   
      if (val2.length==1)return "0.0" + val2;   
      if (val2.length==2)return "0." + val2;   
         
      var parte1 = val2.substring(0,val2.length-2);   
      var parte2 = val2.substring(val2.length-2);   
      var returnvalue = parte1 + "." + parte2;   
      return returnvalue;   
         
   }   
   else{   
         /* currency é false: retornamos os valores COM os zeros à esquerda,   
         * sem considerar os últimos 2 algarismos como casas decimais   
         */  
         val3 ="";   
         for(var k=0; k < len; k++){   
            if (strCheck.indexOf(valor.charAt(k))!=-1) val3+= valor.charAt(k);   
         }            
   return val3;   
   }   
}   
  
function reais(obj,event){   
	var whichCode = (window.Event) ? event.which : event.keyCode;   
	/*  
	Executa a formatação após o backspace nos navegadores !document.all  
	*/  
	if (whichCode == 8 && !documentall) {      
	/*  
	Previne a ação padrão nos navegadores  
	*/  
	   if (event.preventDefault){ //standart browsers   
			 event.preventDefault();   
		  }else{ // internet explorer   
			 event.returnValue = false;   
	   }   
	   var valor = obj.value;   
	   var x = valor.substring(0,valor.length-1);   
	   obj.value= demaskvalue(x,true).formatCurrency();   
	   return false;   
	}   
	/*  
	Executa o Formata Reais e faz o format currency novamente após o backspace  
	*/  
	FormataReais(obj,'.',',',event);   
} // end reais   
  
  
function backspace(obj,event){   
	/*  
	Essa função basicamente altera o  backspace nos input com máscara reais para os navegadores IE e opera.  
	O IE não detecta o keycode 8 no evento keypress, por isso, tratamos no keydown.  
	Como o opera suporta o infame document.all, tratamos dele na mesma parte do código.  
	*/  
	  
	var whichCode = (window.Event) ? event.which : event.keyCode;   
	if (whichCode == 8 && documentall) {      
	   var valor = obj.value;   
	   var x = valor.substring(0,valor.length-1);   
	   var y = demaskvalue(x,true).formatCurrency();   
	  
	   obj.value =""; //necessário para o opera   
	   obj.value += y;   
		  
	   if (event.preventDefault){ //standart browsers   
			 event.preventDefault();   
		  }else{ // internet explorer   
			 event.returnValue = false;   
	   }   
	   return false;   
	  
	   }// end if         
}// end backspace   
  
function FormataReais(fld, milSep, decSep, e) {   
	var sep = 0;   
	var key = '';   
	var i = j = 0;   
	var len = len2 = 0;   
	var strCheck = '0123456789';   
	var aux = aux2 = '';   
	var whichCode = (window.Event) ? e.which : e.keyCode;   
	  
	//if (whichCode == 8 ) return true; //backspace - estamos tratando disso em outra função no keydown   
	if (whichCode == 0 ) return true;   
	if (whichCode == 9 ) return true; //tecla tab   
	if (whichCode == 13) return true; //tecla enter   
	if (whichCode == 16) return true; //shift internet explorer   
	if (whichCode == 17) return true; //control no internet explorer   
	if (whichCode == 27 ) return true; //tecla esc   
	if (whichCode == 34 ) return true; //tecla end   
	if (whichCode == 35 ) return true;//tecla end   
	if (whichCode == 36 ) return true; //tecla home   
	  
	/*  
	O trecho abaixo previne a ação padrão nos navegadores. Não estamos inserindo o caractere normalmente, mas via script  
	*/  
	  
	if (e.preventDefault){ //standart browsers   
		  e.preventDefault()   
	   }else{ // internet explorer   
		  e.returnValue = false  
	}   
	  
	var key = String.fromCharCode(whichCode);  // Valor para o código da Chave   
	if (strCheck.indexOf(key) == -1) return false;  // Chave inválida   
	  
	/*  
	Concatenamos ao value o keycode de key, se esse for um número  
	*/  
	fld.value += key;   
	  
	var len = fld.value.length;   
	var bodeaux = demaskvalue(fld.value,true).formatCurrency();   
	fld.value=bodeaux;   
	  
	/*  
	Essa parte da função tão somente move o cursor para o final no opera. Atualmente não existe como movê-lo no konqueror.  
	*/  
	  if (fld.createTextRange) {   
		var range = fld.createTextRange();   
		range.collapse(false);   
		range.select();   
	  }   
	  else if (fld.setSelectionRange) {   
		fld.focus();   
		var length = fld.value.length;   
		fld.setSelectionRange(length, length);   
	  }   
	  return false;   
		  
}  
/*FORMATAÇÃO DE VALORES MONETÁRIOS*/


/*Validação do ANUNCIE*/

function validaCPFAnunciante(){
	if(document.getElementById('AnuCPF').value == ''){
		alert('Por favor, preencha o campo C.P.F. ');
		alertaCampo('AnuCPF','keypress');
		return false;
	}
}


function validaCadastroAnunciante(){

	if(document.getElementById('AnuNome').value == ''){
		alert('Por favor, preencha o campo Nome. ');
		alertaCampo('AnuNome','keypress');
		return false;
	}

	if(document.getElementById('AnuEmail1').value == ''){
		alert('Por favor, preencha o campo E-mail 1 \n ele é ultilizado para enviarmos sua senha quando você solicitar. ');
		alertaCampo('AnuEmail1','keypress');
		return false;
	}
	
	
	if(document.getElementById('EstCodForm').selectedIndex == 0){
		alert('Por favor, selecione um Estado. ');
		alertaCampo('EstCodForm','mouseover');
		return false;
	}

	if(document.getElementById('CidCodForm').selectedIndex == 0){
		alert('Por favor, selecione uma Cidade. ');
		alertaCampo('CidCodForm','mouseover');
		return false;
	}

	if(document.getElementById('BaiCodForm').selectedIndex == 0){
		alert('Por favor, selecione um Bairro. ');
		alertaCampo('BaiCodForm','mouseover');
		return false;
	}

	if(document.getElementById('AnuEndereco').value == ''){
		alert('Por favor, preencha o campo Endereço. ');
		alertaCampo('AnuEndereco','keypress');
		return false;
	}

	if(document.getElementById('AnuEnderecoNumero').value == ''){
		alert('Por favor, preencha o campo Número. ');
		alertaCampo('AnuEnderecoNumero','keypress');
		return false;
	}
	
	if(document.getElementById('AnuUsuario').value == ''){
		alert('Por favor, preencha o campo Usuário. ');
		alertaCampo('AnuUsuario','keypress');
		return false;
	}


	if(document.getElementById('AnuSenha').value == ''){
		alert('Por favor, preencha o campo Senha. ');
		alertaCampo('AnuSenha','keypress');
		return false;
	}
	
	if(confirm(" Por favor, confira todos os campos digitados . \n Você confirma todas informações digitadas no formulário ?")){
		return true;
	}else{
		return false;
	}
	
	
	return true;
}


function validaCadastroImovel(){
	
	if(document.getElementById('IFCodForm').selectedIndex == 0){
		alert('Por favor, selecione a  Finalidade do Imóvel. ');
		alertaCampo('IFCodForm','mouseover');
		return false;
	}
	
	
	if(document.getElementById('ITCodForm').selectedIndex == 0){
		alert('Por favor, selecione um  Tipo de Imóvel. ');
		alertaCampo('ITCodForm','mouseover');
		return false;
	}
	
	
	if(document.getElementById('EstCodForm').selectedIndex == 0){
		alert('Por favor, selecione um  Estado. ');
		alertaCampo('EstCodForm','mouseover');
		return false;
	}


	if(document.getElementById('CidCodForm').selectedIndex == 0){
		alert('Por favor, selecione um  Cidade. ');
		alertaCampo('CidCodForm','mouseover');
		return false;
	}

	if(confirm(" Por favor, confira todos os campos digitados . \n Você confirma todas informações digitadas no formulário ?")){
		return true;
	}else{
		return false;
	}
	
	return true;			

}	

function verificaUsuario(pObjeto){
	var vRetorno = retornaValor('includes/ajax.asp','AnuUsuario','Anunciantes',' WHERE AnuUsuario like $' +pObjeto.value+ '$');

	if(vRetorno != ""){
		alert("O usuário "+pObjeto.value+" já existe no sistema, por favor digite outro.");
		pObjeto.value = "";
		alertaCampo(pObjeto.id,"keypress");
	}
}

function showHidde(pId){
	
	var obj = document.getElementById(pId);

	if(obj){
		obj.style.display = (obj.style.display == "") ? obj.style.display = "none" : obj.style.display = "";
	}
}