      // *************************
      // * Entre contato
      // *************************

      function entreContato(indicador) {
            document.getElementById("divEnviaAmigo" + indicador).style.display = "none";
          if (document.getElementById("divContato" + indicador).style.display == 'none') {
                document.getElementById("divContato" + indicador).style.display = "";
          } else {
                 document.getElementById("divContato" + indicador).style.display = "none";
          }
      }


      function envioContato(valor) {
             
             if ( valor == 'Anuncio') { 
             } else {

             }

             var msg = "";
             var contatoNome = "";
             if (document.getElementById("contatoNome" + valor) != null) {
                contatoNome = document.getElementById("contatoNome" + valor).value;
             } else {
                 msg = msg + "Nome obrigatório \n";
             }
 if (contatoNome == "") {
                 msg = msg + "Nome obrigatório \n";
             }

            

             if ( valor == 'Anuncio') {   

                   contatoTo = 'redacao@informativogeral.com.br';
             } else {
                  var contatoTo = "";
                  if (document.getElementById("email" + valor) != null) {
                     contatoTo = document.getElementById("email" + valor).value;
                  } else {
                     msg = msg + "Email para obrigatório. \n";
                  }
             }

             var contatoTelefone= "";
             if (document.getElementById("contatoTelefone" + valor) != null) {
                contatoTelefone= document.getElementById("contatoTelefone" + valor).value;
             }  else {
                 msg = msg + "Telefone obrigatório. \n";
             } 

 if (contatoTelefone== "") {
                msg = msg + "Telefone obrigatório. \n";
             }

             var contatoEmail = "";
             if (document.getElementById("contatoEmail" + valor) != null) {
                contatoEmail = document.getElementById("contatoEmail" + valor).value;
             }  else {
                 msg = msg + "Email obrigatório. \n";
             } 
 if (contatoEmail == "") {
               msg = msg + "Email obrigatório. \n";
             }

             var contatoCidade= "";
             if (document.getElementById("contatoCidade" + valor) != null) {
                contatoCidade= document.getElementById("contatoCidade" + valor).value;
             }  else {
                  msg = msg + "Cidade obrigatória. \n";
             }
 if (contatoCidade== "") {
               msg = msg + "Cidade obrigatória. \n";
             }
 

             var contatoMensagem= "";
             if (document.getElementById("contatoMensagem" + valor) != null) {
           
                contatoMensagem= document.getElementById("contatoMensagem" + valor).value;
             } else {
                  msg = msg + "Mensagem obrigatória. \n";
             }    
             if (contatoMensagem == "") {
                msg = msg + "Mensagem obrigatória. \n";
             }
             

              if ( valor == 'Anuncio') {    
                      contatoMensagem = "ESTE É UM NOVO ANUNCIANTE ANALISE SEU CADASTRO :" + contatoMensagem;
              }
             

             if (msg == "") {
                     var url = "http://www.informativogeral.com.br/geeral/enviaContato.jsp?contatoTo="+contatoTo+"&contatoNome=" + contatoNome + "&contatoEmail=" + contatoEmail + "&contatoTelefone=" + contatoTelefone + "&contatoCidade=" + contatoCidade + "&contatoMensagem=" + contatoMensagem;
                      
                      alert("Mensagem enviada.");	
                      var ajax = openAjax();
	              ajax.open("GET",url,true);
	              ajax.onreadystatechange = function(){
	   	      
                      if (ajax.readyState == 4) {
			if (ajax.status == 200) {
				//alert('Confirmação de recebimento, seu amigo já recebeu a mensagem indicando o anuncio. ');
			}else{
				//alert("Erro ao enviar email. Verifique dados informados.");
			} 
		      }		
	             }	 
	             ajax.send(null);
             } else {
                 alert(msg);
             }
                
               

      }

function openAjax(){
	var ajax;
	try{
		ajax = new XMLHttpRequest();
	} catch (ee) {
		try{
			ajax =  new ActiveXObject("Msxml2.XMLHTTP");
		} catch (eee) {
			try{
				ajax =  new ActiveXObject("Microsoft.XMLHTTP");
			}catch (eeee) {
				ajax = false;
			}
		}
	}
	return ajax;
}




     //****************************
     // Envie para amigo
     //****************************
     function envieAmigo(indicador) {

          if (document.getElementById("divContato" + indicador) != null) {
               document.getElementById("divContato" + indicador).style.display = "none";
          }
         
            
          if (document.getElementById("divEnviaAmigo" + indicador).style.display == 'none') {
                document.getElementById("divEnviaAmigo" + indicador).style.display = "";
          } else {
                 document.getElementById("divEnviaAmigo" + indicador).style.display = "none";
          }
     }

     function envio(valor) {

           //alert(valor);
 var nome = "";
if (document.getElementById("nome" + valor) != null) {
 nome = document.getElementById("nome" + valor).value;
}

 var site= "";
if (document.getElementById("site" + valor) != null) {
 site= document.getElementById("site" + valor).value;
}

 var email= "";
if (document.getElementById("email" + valor) != null) {
 email= document.getElementById("email" + valor).value;
}


 var telefone= "";
if (document.getElementById("telefone" + valor) != null) {
 telefone= document.getElementById("telefone" + valor).value;
}

 var bairro= "";
if (document.getElementById("bairro" + valor) != null) {
 bairro= document.getElementById("bairro" + valor).value;
}

var endereco= "";
if (document.getElementById("endereco" + valor) != null) {
 endereco= document.getElementById("endereco" + valor).value;
}

           var de = document.getElementById("fromEmail" + valor).value;
           var para = document.getElementById("toEmail" + valor).value;

           var nomeDe = document.getElementById("fromNome" + valor).value;
           var nomePara = document.getElementById("toNome" + valor).value;
           var msg = "";
           if (!(de.indexOf("@") > -1)) {
              msg = msg + "  Email inválido 'seu email'. \n"
           }

           if (!(para.indexOf("@") > -1)) {
              msg = msg + "  Email inválido 'email amigo'.  \n"
           }

           if (nomeDe == "") {
                 msg = msg + "  Nome é necessário.  \n"
           }

           if (nomePara == "") {
                 msg = msg + "  Nome do amigo é necessário.  \n"
           }
          
if (msg == "") {
        var url = "http://www.informativogeral.com.br/geeral/enviaAmigo.jsp?to=" + para + "&endereco="+endereco+"&from=" + de + "&telefone=" + telefone + "&site=" + site + "&email=" + email + "&nome=" + nome + "&bairro=" + bairro + "&nomePara=" + nomePara + "&nomeDe=" + nomeDe;
        alert("Sua indicação foi enviada.");	
var ajax = openAjax();
	ajax.open("GET",url,true);
	ajax.onreadystatechange = function(){
	   	if (ajax.readyState == 4) {
			if (ajax.status == 200) {
				//alert('Confirmação de recebimento, seu amigo já recebeu a mensagem indicando o anuncio. ');
			}else{
				//alert("Erro ao enviar email. Verifique dados informados.");
			} 
		}		
	}	 
	ajax.send(null);
} else {
 alert(msg);
}
          //alert(document.getElementById('divAnuncio' + valor).innerHTML);
     }


     // **************************
     // PUBLICIDADE
     // *************************

     var resolucao
     resolucao = screen.width + ' x ' + screen.height;     

	// *********************************************
	//   CATEGORIAS
	// *********************************************
     function mostrarCategorias() {
    	  if (document.getElementById("divCategorias").style.display == "none") {
    		  document.getElementById("divCategorias").style.display = "block";
    		  if (document.getElementById("tblCentro")!= null) {
 document.getElementById("tblCentro").style.height = "9600px";
}

if (document.getElementById("sidebar")!= null) {
 document.getElementById("sidebar").style.height = "9600px";
}
    		  document.getElementById("divEsconderCategorias").style.display = "block";
    		  document.getElementById("divMostrarCategorias").style.display = "none";
    		  document.getElementById("bairros").style.display = "none";
    		  document.getElementById("categorias").style.display = "block";
          } else {
        	  document.getElementById("divCategorias").style.display = "none";
        	  document.getElementById("divEsconderCategorias").style.display = "none";
    		  document.getElementById("divMostrarCategorias").style.display = "block";
    		  if (document.getElementById("tblCentro")!= null) {
 document.getElementById("tblCentro").style.height = "1200px";
}

if (document.getElementById("sidebar")!= null) {
 document.getElementById("sidebar").style.height = "1200px";
}
    		  document.getElementById("bairros").style.display = "block";
    		  document.getElementById("categorias").style.display = "block";
          }
         
     }

     // *********************************************
     //   BAIRROS
     // *********************************************
     function mostrarBairros() {
   	  	if (document.getElementById("divBairros").style.display == "none") {
   		  document.getElementById("divBairros").style.display = "block";
if (document.getElementById("tblCentro")!= null) {
 document.getElementById("tblCentro").style.height = "1200px";
}

if (document.getElementById("sidebar")!= null) {
 document.getElementById("sidebar").style.height = "1200px";
}
   		 
   		  document.getElementById("divEsconderBairros").style.display = "block";
   		  document.getElementById("divMostrarBairros").style.display = "none";
   		  document.getElementById("bairros").style.display = "block";
		  document.getElementById("categorias").style.display = "none";


document.getElementById("prop").style.display = "none";
   		  
         } else {
       	  document.getElementById("divBairros").style.display = "none";
       	  document.getElementById("divEsconderBairros").style.display = "none";
   		  document.getElementById("divMostrarBairros").style.display = "block";
   		  if (document.getElementById("tblCentro")!= null) {
 document.getElementById("tblCentro").style.height = "1200px";
}

if (document.getElementById("sidebar")!= null) {
 document.getElementById("sidebar").style.height = "1200px";
}
   		  document.getElementById("bairros").style.display = "block";
		  document.getElementById("categorias").style.display = "block";


document.getElementById("prop").style.display = "block";
         }
    }

     // **************************************
     // BUSCA
     //  **************************************
     function busca() {
    	
document.getElementById("frmSearch").submit();
     }


     function buscaPorBairro(id) {
    	 location.href="?bairro=" + id;
     }

     function buscaPorCategoria(id) {
    	 location.href="?categoria=" + id;
     }

     // *******************************
     // ANUNCIE
     // *******************************
     function anuncie() {
         document.getElementById("anuncie").style.display = "";
     }

     // HOME
     function home() {
         location.href="http://www.informativogeral.com.br/geeral";
     }

