// JavaScript Document
function TelaManut(pCod,pAcao) {
   var nWind,nUrlUnid; 
   if (pAcao == "A") {
       nUrlUnid = '/adm/imvant/imvupd.asp?stk=mnt&imvcod='+pCod;
   }
   if (pAcao == 'E') 
   {
       nUrlUnid = '/adm/imvant/imvdlt.asp?imvcod='+pCod;
   }
   nWind = window.open(nUrlUnid,'_self','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
   nWind.location.href = nUrlUnid;
   nWind.focus();
}
function TelaBoleto() {
   var nWind,nUrlUnid; 
   nUrlUnid = '/adm/fin/boleto-itau.asp';
   nWind = window.open(nUrlUnid,'_detalhe','toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes');
   nWind.location.href = nUrlUnid;
   nWind.focus();
 }
function verifica_campos_anuncio() {
with (document.forms[0]){
 if (codigo_tipo.value == '') {
 	window.alert('Selecione o tipo do imóvel.');
	codigo_tipo.focus();
	return false;
}

if (endereco.value == '') {
 	window.alert('Informe o endereço do imóvel. Sugestão: Ótima localização.');
 	endereco.value = 'Ótima localização.';
	endereco.focus();
	return false;
}

if (Bairro.value == '') {
 	window.alert('Informe o bairro.');
	Bairro.focus();
	return false;
}
 if (Cidade.value == '') {
 	window.alert('Informe a cidade.');
	Cidade.focus();
	return false;
}
 if (codigo_estado.value == '') {
 	window.alert('Selecione o estado.');
	codigo_estado.focus();
	return false;
}
 if (Anuncio.value == '') {
 	window.alert('Preencha o texto do anuncio a ser publicado.');
	Anuncio.focus();
	return false;
}
 if ((valor_venda.value == '') && (valor_aluguel.value == '')){
 	window.alert('Informe o "Valor de Venda" e/ou o "Valor de Aluguel" do imóvel.');
	valor_venda.focus();
	return false;
}
   return true;
}}

function verifica_campos_anunciante() {
with (document.Endereco){
/* if (nome.value == '') {
 	window.alert('O campo "Nome / Razão Social" deve ser informado.');
	nome.focus();
	return false;
 }
 */
 if (tip_ant.value == '') {
 	window.alert('Informe o tipo de anunciante.');
	tip_ant.focus();
	return false;
 }
 /*
 if (login.value == '') {
 	window.alert('Informe o CPF ou CNPJ.');
	nome.focus();
	return false;
 }
 */
 if (fone.value == '') {
 	window.alert('Informe o DDD e número de telefone.');
	fone.focus();
	return false;
 }
 if (ddd.value == '') {
 	window.alert('Informe o DDD.');
	ddd.focus();
	return false;
 }
 if (mail.value == '') {
 	window.alert('Informe o e-mail.');
	mail.focus();
	return false;
 }
 if (codpln.value == '') {
 	window.alert('Selecione um plano.');
	codpln.focus();
	return false;
 }
 // if (login.value != '') {
 	
 	if ((senha.value == '') && (senha1.value == '')) {
       window.alert('Informe uma senha.');
  	   senha.focus();
	   return false;
	}   
 	if (senha.value != senha1.value) {
       window.alert('O campo "Senha" e "Confirme a Senha" estão diferentes.');
  	   senha.focus();
	   return false;
	}   
 //}
 return true;
}}
function verifica_campos_mail_anunciante() {
with (document.mensagem_anunciante){
 if (nome.value == '') {
 	window.alert('O campo "Nome" deve ser informado.');
	nome.focus();
	return false;
 }
 if (mail.value == '') {
 	window.alert('Informe seu e-mail.');
	mail.focus();
	return false;
 }
 if (mensagem.value == '') {
 	window.alert('Escreva uma mensagem.');
	mensagem.focus();
	return false;
 }
 return true;
}}
function enbl_url() {

 //var _area1=document.getElementById('area1');
 //var _area2=document.getElementById('area2');
 //var _area3=document.getElementById('area3');
 //var _area4=document.getElementById('area4');
 //var _area5=document.getElementById('area5');


 var _seucomercial=document.getElementById('comercial');

 _seucomercial.style.display='';

 //_area1.style.display='';
 //_area2.style.display='';
 //_area3.style.display='';
 //_area4.style.display='';
 //_area5.style.display='';

 if (document.Endereco.tip_ant[0].checked == true) {
  //_area1.style.display='none';
  //_area2.style.display='none';
  //_area3.style.display='none';
  //_area4.style.display='none';
  //_area5.style.display='none';
  _seucomercial.style.display='none';
                
  document.Endereco.url.value = '';
}
return true;
} 
/********************************************************************** 
Função de formatação de valores numéricos na digitação 

Objetivos : 
    - Inclusão automática de . e , 

Parametros : 
    objeto        -> Nome do campo de formulário (Usar this) 
    teclapres    -> Tecla pressionada (Usar event) 
    tammax        -> Tamanho máximo de caracteres 
    decimais    -> Nº de casas decimais 

Exemplo: 
    OnKeyDown     FormataValor(this,event,17,0); 


/**********************************************************************/ 
function FormataValor(objeto,teclapres,tammax,decimais) 
{ 

    var tecla            = teclapres.keyCode; 
    var tamanhoObjeto    = objeto.value.length; 
 
    if((tecla == 8) || (tecla == 9) || (tecla == 13) || (tecla == 35) || (tecla == 36) || (tecla == 46)) 
    { 
        return true;
    } 
    if ((tecla > 47) && (tecla < 58))
    {  
        return true;
    } 
    if ((tecla > 95) && (tecla < 106))
    {  
        return true;
    } 
    return false;
} 
function gr_ck() {
with (document.form1) {
	if (LGmail.value == '') {
		window.alert('Informe seu e-mail cadastrado.');
		LGmail.focus();
		return false;
	}
	if (pws.value == '') {
		window.alert('Informe sua senha.');
		pws.focus();
		return false;
	}
}
return true;
}
function msg_wait() {
   document.getElementById('msg_wait').style.visibility = 'visible';
   return true;
}
function uf_selecionado() {
with (document.busca_rapida){
	if (!document.getElementById('prp1').checked & !document.getElementById('prp2').checked & !document.getElementById('prp3').checked) {
		window.alert('Selecione Venda / Locação / Temporada.');
		return false;
	}
	if (estado.value == '') {
		window.alert('Selecione um estado.');
		estado.focus();
		return false;
	}
}
document.busca_rapida.submit();		
return true;
}
function marca_bairro() {
with (document.busca){
	for (xbai in bai)
	{
		bai[xbai].checked = bai_all.checked;
	}
}
return true;
}
function marca_bai_all() {
with (document.busca){
	for (xbai in bai)
	{
		if (!bai[xbai].checked){
		bai_all.checked = false;
	  }
	}
}
return true;
}

