// validação de formulários
function ValidaMailing() {
  if (document.frmMailingList.email.value == "") {
    alert("Informe o seu e-mail!");
    document.frmMailingList.email.focus();
    return false;
  }

  if ((document.frmMailingList.email.value != "") && (document.frmMailingList.email.value.indexOf("@") < 1)) {
    alert("Informe corretamente seu e-mail!");
    document.frmMailingList.email.value = "";
    document.frmMailingList.email.focus();
    return false;
  }
}
//--------------------------------------------------------------
function ValidaAmigo() {

  if (document.Amigo.NmRemet.value == "") {
    alert("Informe o seu nome!");
    document.Amigo.NmRemet.focus();
    return false;
  }

  if (document.Amigo.MailRemet.value.indexOf("@") < 1) {
    alert("Informe corretamente seu e-mail!");
    document.Amigo.MailRemet.value = "";
    document.Amigo.MailRemet.focus();
    return false;
  }
  if (document.Amigo.NmDest.value == "") {
    alert("Informe o nome do destinatário!");
    document.Amigo.NmDest.focus();
    return false;
  }
  if (document.Amigo.MailDest.value.indexOf("@") < 1) {
    alert("Informe corretamente o e-mail do destinatário!");
    document.Amigo.MailDest.value = "";
    document.Amigo.MailDest.focus();
    return false;
  }
  }
//-------------------------------------------------------------- 
//--------------------------------------------------------------
function validaFaleconosco() {

  if (document.email.Nome.value == "") {
    alert("Informe o seu nome!");
    document.email.Nome.focus();
    return false;
  }

  if (document.email.Email.value.indexOf("@") < 1) {
    alert("Informe corretamente seu e-mail!");
    document.email.Email.value = "";
    document.email.Email.focus();
    return false;
  }
  if (document.email.Telefone.value == "") {
    alert("Informe seu telefone de contato!");
    document.email.Telefone.focus();
    return false;
  }
  i = document.email.Titulo.selectedIndex;
  if (document.email.Titulo.options[i].value == "0") {
    alert("Informe o tipo de contato!");
    document.email.Titulo.focus();
    return false;
  }
  
  if (document.email.Texto.value == "") {
    alert("Escreva sua mensagem!");
    document.email.Texto.focus();
    return false;
  } 
  }
//-------------------------------------------------------------- 
function Anuncia() {

  if (document.Anunciar.Nome.value == "") {
    alert("Informe o seu nome!");
    document.Anunciar.Nome.focus();
    return false;
  }
  
  if ((document.Anunciar.Fone.value == "") | (document.Anunciar.Fone.value.length < 8)) {
    alert("Informe corretamente o seu Telefone ou Celular!");
    document.Anunciar.Fone.value = "";
    document.Anunciar.Fone.focus();
    return false;
  }

  /*if ((document.Anunciar.Cel.value == "") | (document.Anunciar.Cel.value.length < 8)) {
    alert("Informe corretamente o seu Celular!");
    document.Anunciar.Cel.value = "";
    document.Anunciar.Cel.focus();
    return false;
  }*/

  if ((document.Anunciar.Email.value == "") | (document.Anunciar.Email.value.indexOf("@") < 1)) {
    alert("Informe corretamente seu e-mail!");
    document.Anunciar.Email.value = "";
    document.Anunciar.Email.focus();
    return false;
  }
  
  if (document.Anunciar.Cid.value == "") {
    alert("Informe a Cidade que você Reside!");
    document.Anunciar.Cid.focus();
    return false;
  }
  
  if (document.Anunciar.Veic.value == "") {
    alert("Informe o Endereço do Imóvel!");
    document.Anunciar.Veic.focus();
    return false;
  }
    
  i = document.Anunciar.MarcaVeic.selectedIndex;
  if (document.Anunciar.MarcaVeic.options[i].value == "0") {
    alert("Informe o Tipo do Imóvel!");
    document.Anunciar.MarcaVeic.focus();
    return false;
  }
  
  i = document.Anunciar.Procedencia.selectedIndex;
  if (document.Anunciar.Procedencia.options[i].value == "0") {
    alert("Informe o Nº de Quartos do Imóvel!");
    document.Anunciar.Procedencia.focus();
    return false;
  }

  if (document.Anunciar.Valor.value == "") {
    alert("Informe o Valor do Imóvel!");
    document.Anunciar.Valor.focus();
    return false;
  }
  
  i = document.Anunciar.AnoFabricacao.selectedIndex;
  if (document.Anunciar.AnoFabricacao.options[i].value == "0") {
    alert("Informe a Cidade do Imóvel!");
    document.Anunciar.AnoFabricacao.focus();
    return false;
  }
  
  i = document.Anunciar.AnoModelo.selectedIndex;
  if (document.Anunciar.AnoModelo.options[i].value == "0") {
    alert("Informe o Bairro do Imóvel!");
    document.Anunciar.AnoModelo.focus();
    return false;
  }
  
 /* i = document.Anunciar.Modelo.selectedIndex;
  if (document.Anunciar.Modelo.options[i].value == "0") {
    alert("Informe o Nº de Vagas na Garagem do Imóvel!");
    document.Anunciar.Modelo.focus();
    return false;
  }*/
  
  i = document.Anunciar.Quilometragem.selectedIndex;
  if (document.Anunciar.Quilometragem.options[i].value == "0") {
    alert("Informe o Nº de WC Social do Imóvel!");
    document.Anunciar.Quilometragem.focus();
    return false;
  }
  
 /*  i = document.Anunciar.Cor.selectedIndex;
  if (document.Anunciar.Cor.options[i].value == "0") {
    alert("Informe o Nº de Suítes do Imóvel!");
    document.Anunciar.Cor.focus();
    return false;
  }*/
  
  i = document.Anunciar.Categoria.selectedIndex;
  if (document.Anunciar.Categoria.options[i].value == "0") {
    alert("Informe a Categoria do Imóvel!");
    document.Anunciar.Categoria.focus();
    return false;
  }
}
//-------------------------------------------------------------- 
function Solicitar(){

var form 		   = document.solicitar
var Nome	 	   = form.Nome
var Email	 	   = form.Email
var Fone	 	   = form.Fone
var Cid	 	       = form.Cid
var Categoria	   = form.Categoria
var MarcaVeic	   = form.MarcaVeic
var AnoFabricacao  = form.AnoFabricacao
var AnoModelo 	   = form.AnoModelo

if (Nome.value == "") {
   alert("Informe o Nome!")
   Nome.focus();
   return false;
}

if ((Email.value == "") | (Email.value.indexOf("@") < 1)) {
   alert("Informe corretamente seu Email.")
   Email.value="";
   Email.focus();
   return false;
 }
 
if ((Fone.value == "") | (Fone.value.length < 8)) {
   alert("Informe corretamente o seu Telefone ou Celular!")
   Fone.value="";
   Fone.focus();
   return false;
 } 

if ((Cid.value == "")) {
   alert("Informe a Cidade que você Reside!")
   Cid.value="";
   Cid.focus();
   return false;
 } 

i = Categoria.selectedIndex;
  if (Categoria.options[i].value == "0") {
    alert("Informe a Categoria do Imóvel!");
    Categoria.focus();
    return false;
  }
 
i = MarcaVeic.selectedIndex;
  if (form.MarcaVeic.options[i].value == "0") {
    alert("Informe o Tipo do Imóvel!");
    form.MarcaVeic.focus();
    return false;
  }
  
  i = AnoFabricacao.selectedIndex;
  if (AnoFabricacao.options[i].value == "0") {
    alert("Informe a Cidade do Imóvel!");
    AnoFabricacao.focus();
    return false;
  }
  
  i = AnoModelo.selectedIndex;
  if (AnoModelo.options[i].value == "0") {
    alert("Informe o Bairro do Imóvel!");
    AnoModelo.focus();
    return false;
  }
}
//--------------------------------------------------------------
function validaProposta() {

  if (document.frmProp.Nome.value == "") {
    alert("Informe o seu nome!");
    document.frmProp.Nome.focus();
    return false;
  }
  if (document.frmProp.Email.value.indexOf("@") < 1) {
    alert("Informe corretamente seu e-mail!");
    document.frmProp.Email.value = "";
    document.frmProp.Email.focus();
    return false;
  }
  if (document.frmProp.Telefone.value == "") {
    alert("Informe seu telefone de contato!");
    document.frmProp.Telefone.focus();
    return false;
  }
  if (document.frmProp.Texto.value == "") {
    alert("Escreva sua mensagem!");
    document.frmProp.Texto.focus();
    return false;
  } 
  }
//-------------------------------------------------------------- 
function ValidaBusca() {
  if (document.FrmBusca.Marca.value == "") {
    alert("Informe pelo menos o Tipo");
    document.FrmBusca.Marca.focus();
    return false;
  }
}

// obriga a selecionar checkbox para comparar carros

function validaCheckbox(form) {
var total = 0;
var max = form.Carro.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.frmPesqComparar.Carro[" + idx + "].checked") == true) {
    total += 1;
   }
}
if (total < 2) {
alert("Selecione, pelo menos, dois imóveis.");
return false;
}
}

// cria parâmetros para busca

function CreateString()
{
	document.FrmBusca.action='Pesq.asp?Veic='+document.getElementById("Veic").value+'&Mod='+document.getElementById("Mod").value+'&Marca='+document.getElementById("Marca").value+'&Ano='+document.getElementById("Ano").value+'&VI='+document.getElementById("VI").value+'&VF='+document.getElementById("VF").value+'&QtdCarPag='+document.getElementById("QtdCarPag").value
	document.FrmBusca.submit();	
}

function MudaQtd()
{
		document.FrmBusca.action='Pesq.asp?Veic='+document.getElementById("Veiculo").value+'&Mod='+document.getElementById("Mod").value+'&Marca='+document.getElementById("Marca").value+'&Ano='+document.getElementById("Ano").value+'&VI='+document.getElementById("VI").value+'&VF='+document.getElementById("VF").value+'&QtdCarPag='+document.getElementById("QtdCarPag").value
	
	document.FrmBusca.submit();
}

// funções do arquivo detalhes.asp
function DoPrinting(){
  if (!window.print){
  alert("Use o Netscape ou Internet Explorer \n nas versões 4.0 ou superior!")
  return
}
window.print()
}
//--------------------------------------------------------------
// Tirar serrilhado do swf
function objectSwf(swf,width,height) {
document.write('<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" data="' + swf + '">');
document.write('<param name="movie" value="' + swf + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<embed src="' + swf + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed>');
document.write('</object>');
}