<!--

function fValidaNecessidade()
{
	var vForm=document.frmSuaNecessidade;
	
	if(vForm.txtNome.value=="")
	{
		alert("Digite o nome!");
		vForm.txtNome.focus();
		return false;
	}
	if(vForm.txtEmail.value=="")
	{
		alert("Digite o e-mail!");
		vForm.txtEmail.focus();
		return false;
	}
	if(vForm.txtTelefone.value=="")
	{
		alert("Digite o telefone!");
		vForm.txtTelefone.focus();
		return false;
	}
	if(vForm.txtDescricao.value=="")
	{
		alert("Digite a descrição!");
		vForm.txtDescricao.focus();
		return false;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function SendMe()
{
	var opt;
	if(document.frmCombo.txtHRegiao.value=='')
	{

		if(document.frmCombo.txtRegiao[0].checked==true)
		{
			opt=document.frmCombo.txtRegiao[0].value;
		}
		else if(document.frmCombo.txtRegiao[1].checked==true)
		{
			opt=document.frmCombo.txtRegiao[1].value;
		}
		else if(document.frmCombo.txtRegiao[2].checked==true)
		{
			opt=document.frmCombo.txtRegiao[2].value;
		}
		else if(document.frmCombo.txtRegiao[3].checked==true)
		{
			opt=document.frmCombo.txtRegiao[3].value;
		}
		else if(document.frmCombo.txtRegiao[4].checked==true)
		{
			opt=document.frmCombo.txtRegiao[4].value;
		}
	}
	else
	{
		opt=document.frmCombo.txtHRegiao.value;
	}
	
	 if(document.frmCombo.txtFlag.value=="false")
	 {
		
		var where_to = document.frmCombo.txtTipoImovel.options[document.frmCombo.txtTipoImovel.selectedIndex].value;
		if(where_to != '')
		{
		   parent.location = where_to + "&r=" + opt;
		 }
	 }
	 else
	 {
		var vTipo=document.frmCombo.txtTipoImovel.options[document.frmCombo.txtTipoImovel.selectedIndex].value;				
		if(vTipo.indexOf("2")>0 || vTipo.indexOf("3")>0 || vTipo.indexOf("14")>0 || vTipo.indexOf("84")>0 || vTipo.indexOf("1")>0 || vTipo.indexOf("63")>0 || vTipo.indexOf("15")>0)
		{		
			document.frmCombo.txtNumQuartos.disabled=false;
		}
		else
		{
			document.frmCombo.txtNumQuartos.disabled=true;
		}
	 }
	return false
}

function Ordena(tp)
{
var where_to = document.forms[1].order.options[document.forms[1].order.selectedIndex].value;
	if (tp==1 ){
	if (where_to != "value") location = where_to + "&optTpOrder=desc"
	return false
	}
	else {
	if (tp==2){
	 if (where_to != "value") location = where_to
	return false
	}
}
}

function fEnviar(setor,atendente)
{
var varLocal = 'atendimento.asp?opt=alterasetor&idSetor='+setor+'&idAtendente='+atendente;

			 document.frmGeral.action=varLocal;
		     document.frmGeral.method="post";
			 document.frmGeral.submit();
	   	     return false
}

function Imprimir() {
  var mac = (navigator.userAgent.indexOf("Mac") != -1); 
  var doc = (document.all) ? 1 : 0;
  var ie_ns = (window.print) ? 1 : 0;

  if (ie_ns)     			// Se for netscape 4 ou ie5
    window.print();
  else if (doc && !mac)     // Se for ie4
    vbPrintPage()
  else     					// Outros
    alert("Opção não suportada pela navegador ");
    return false;
}


function fCarregaLancamento(varID)
{
	if(varID!=0)
	{
		var varUrl='lancamento/lancamento_view.asp?id='+varID;
		MM_openBrWindow(varUrl,'jLancamento','width=300,height=500');
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function fTrocaCampo(varCampo)
{
    var varDados;
	if(varCampo=='0' || varCampo=='1' || varCampo=='3' || varCampo=='4' || varCampo=='5' || varCampo=='11')	
	{
		divCampo1.innerHTML="<input name=txtBusca class='lista_imoveis' type=text id=txtBusca value='Buscar por' size=15>";
	}
	else if(varCampo=='2' || varCampo=='6')
	{
		varDados="<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>";
		varDados=varDados + "<td><input name='txtCampo1' class='lista_imoveis' type=text id='txtCampo1' size=8></td><td  width='30' class='lista_imoveis' align='center'>a</td>";
		varDados=varDados + "<td><input name='txtCampo2' class='lista_imoveis' type=text id='txtCampo2' size=8></td></tr></table>";
	    divCampo1.innerHTML=varDados;
	}
	else if(varCampo=='7' || varCampo=='8' || varCampo=='9')
	{	 
		varDados="<select name='txtCampo3' class='lista_imoveis' id='txtCampo3'><option value='Sim' selected>Sim</option><option value='Não'>Não</option></select>";
	    divCampo1.innerHTML=varDados;
	}
	else if(varCampo=='10')
	{
		varDados="<select name='txtCampo4' class='lista_imoveis' id='txtCampo4'>";
		varDados=varDados + "<option value='1' selected>Residencial</option>";
		varDados=varDados + "<option value='2'>Comercial</option></select>";
	    divCampo1.innerHTML=varDados;
	}
	return false;
}

function fIndique(varImob,varRef,varPg)
{
   var varParam='indique.asp?imob='+varImob+'&ref='+varRef+'&pg='+varPg;
   window.open(varParam,'indique','width=350,height=220');
}

function fMapa(varUrl, varWinx, varWiny)
{
	if(varUrl!='')
	{
	   window.open(varUrl, 'aJanela' , 'width='+varWinx+',height='+varWiny);	   
	}
}


function fMudaTipo(varTipo,opt)
{
	var varAba=document.frmCombo.txtAba.value;
	var where_to = "imovel_ini.asp?pg="+opt+"&r=" + varTipo + "&a="+varAba;
    location = where_to;
	return false
}

function fEnviaPesqRapida()
{
	var vForm=document.frmDetalhes;
	if(vForm.txtReferencia.value!='')
	{
		document.frmDetalhes.action=document.frmDetalhes.action+"?ref="+vForm.txtReferencia.value;
		document.frmDetalhes.submit();
		return true;
	}
	else
	{
		return false;
	}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function fAbrirPop(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//Código para mostrar os tipos no (divvendas e divlocacao)
function getImoveis(varOpt)
{
	if(varOpt==1)
	{		
		document.divVendas.innerHTML='<%=getTiposImoveisVendas("0")%><br>';
		//divLocacao.innerHTML="";
	}
	else if(varOpt==2)
	{
	    document.divLocacao.innerHTML='<%=getTiposImoveisLocacao("0")%><br>';
		//divVendas.innerHTML="";
	}
}
//-->