// JavaScript Document
	try{
	xmlhttp = new XMLHttpRequest();}catch(ee){try{
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
	catch(E){xmlhttp = false;}}}
function ajaxLogin() {
		xmlhttp.open("POST", "login.asp" ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('login').innerHTML = '<div align="center"><font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font></div>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('login').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// imóveis

function ajaxViewPlanoImovel() {
		var page = "viewPlanoImovel.asp?tipo="+document.getElementById('tipo').value+"&op="+document.getElementById('op').value+"&cod_anunciante="+document.getElementById('cod_anunciante').value+"&cod_plano="+ document.getElementById('planopgto').value+"&cod_cupom="+document.formcupom.cod_cupom.value;
		xmlhttp.open("POST", page, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('planospgto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('planospgto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxTrocaPlanoImovel() {
		var page = "trocaPlanoImovel.asp?tipo="+document.getElementById('tipo').value+"&op="+document.getElementById('op').value+"&cod_anunciante="+document.getElementById('cod_anunciante').value+"&cod_plano="+ document.getElementById('planopgto').value+"&cod_cupom="+document.formcupom.cod_cupom.value;
		xmlhttp.open("POST", page, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('planospgto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('planospgto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxVerifyDesc() {
		xmlhttp.open("POST", "verifyDesc.asp?cod_cupom="+ document.getElementById('cod_cupom').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('verifyDesc').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('verifyDesc').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxCheckDestaque() {
		xmlhttp.open("POST", "checkDestaque.asp?codigo="+ document.getElementById('planopgto').value ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('checkDestaque').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('checkDestaque').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// DESABILITA ANUNCIO

function ajaxDisableAnuncio(codigo) {
		var urlDisable = "disableAnuncio.asp?action=disable&codigo="+codigo
		xmlhttp.open("POST", urlDisable, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('actionAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('actionAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// HABILITA ANÚNCIO

function ajaxEnableAnuncio(codigo) {
		var urlDisable = "disableAnuncio.asp"+codigo
		xmlhttp.open("POST", urlDisable, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('actionAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('actionAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// DESABILITA/HABILITA DESTAQUE

function ajaxDisableDestaque(codigo) {
		var urlDisable = "disableDestaque.asp?"+codigo
		xmlhttp.open("POST", urlDisable, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('actionAnuncio').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('actionAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxExcluirAnuncio(codigo){
       if (confirm("Deseja realmente excluir este anúncio?"))
	   {
		var urlDisable = "updateAnuncio.asp?action=delete&codigo="+codigo
		xmlhttp.open("POST", urlDisable, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tdanuncios').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tdanuncios').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
	   }
}

function ajaxExcluirAnuncioVoce(codigo){
       if (confirm("Deseja realmente excluir este anúncio?"))
	   {
		var urlDisable = "updateAnuncioVoce.asp?action=delete&codigo="+codigo
		xmlhttp.open("POST", urlDisable, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tdanuncios').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tdanuncios').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
	   }
}


// ANÚNCIO PARTICULAR

function ajaxViewPlano() {
		var page = "viewPlanoVoce.asp?tipo="+document.getElementById('tipo').value+"&op="+document.getElementById('op').value+"&cod_anunciante="+document.getElementById('cod_anunciante').value+"&cod_anuncio="+ document.getElementById('cod_anuncio').value +"&cod_plano="+ document.getElementById('planopgto').value+"&cod_cupom="+document.getElementById('cod_cupom').value;
		xmlhttp.open("POST", page, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('pgto').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('pgto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}


function ajaxVerifyCnpjCpf() {
		var urlDelCompare = "verifyUserCnpjCpf.asp?cpfcnpj="+document.getElementById('cpfcnpj').value;
		xmlhttp.open("POST", urlDelCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('verifycpfcnpj').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('verifycpfcnpj').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxVerifyCpf() {
		var urlDelCompare = "verifyUserCnpjCpf.asp?cpf="+document.getElementById('cpfcnpj').value;
		xmlhttp.open("POST", urlDelCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('verifycpfcnpj').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('verifycpfcnpj').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxVerifyEmail() {
		var urlDelCompare = "verifyUserCnpjCpf.asp?email="+document.getElementById('email').value;
		xmlhttp.open("POST", urlDelCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('verifyemail').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('verifyemail').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxCloseWindow() {
		var urlClose = "close.asp"
		xmlhttp.open("POST", urlClose, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('contatoAnuncio').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('contatoAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxClose() {
		var urlClose = "close.asp"
		xmlhttp.open("POST", urlClose, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('vejaAnuncio').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('vejaAnuncio').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxLoadingFotos() {
		var urlClose = "loading.asp"
		xmlhttp.open("POST", urlClose, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('loadingFoto').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('loadingFoto').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxAltSenha() {
	var urlDelCompare = "upSenha.asp?senha_ant="+document.formaltsenha.senha_ant.value+"&senha_new="+document.formaltsenha.senha_new.value;
	xmlhttp.open("POST", urlDelCompare, true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
	xmlhttp.onreadystatechange=function() { 
				document.getElementById('altSenha').innerHTML = '<img src="img/loading2.gif"/>'
	   if(xmlhttp.readyState == 4){
				document.getElementById('altSenha').innerHTML = xmlhttp.responseText
			}}
		xmlhttp.send('') 
}
function ajaxAltSenhaVoce() {
	var urlDelCompare = "upSenhaVoce.asp?senha_ant="+document.formaltsenha.senha_ant.value+"&senha_new="+document.formaltsenha.senha_new.value;
	xmlhttp.open("POST", urlDelCompare, true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
	xmlhttp.onreadystatechange=function() { 
				document.getElementById('altSenha').innerHTML = '<img src="img/loading2.gif"/>'
	   if(xmlhttp.readyState == 4){
				document.getElementById('altSenha').innerHTML = xmlhttp.responseText
			}}
		xmlhttp.send('') 
}
function ajaxRemoveFoto(varPar) {
		var urlDel = "removeFoto.asp"+varPar+"&action=delete"
		xmlhttp.open("POST", urlDel, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('listThumb').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('listThumb').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxRemoveFotoVoce(varPar) {
		var urlDel = "removeFotoVoce.asp"+varPar+"&action=delete"
		xmlhttp.open("POST", urlDel, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('listThumb').innerHTML = '<img src="img/loading2.gif"/>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('listThumb').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxThumbFotoCompara(filtro) {
		var page = "fotoThumbFotoCompara.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('thumb').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('thumb').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxAddClick(filtro) {
		var page = "addClickFotoCompara.asp?"+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('addclick').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('addclick').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxGlossario(filtro) {
		var page = "viewGlossario.asp?letra="+filtro
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('glossario').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('glossario').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
// distâncias

function ajaxDistanciaNacional() {
		var page = "destinoNacional.asp?origem1="+document.formnacional.origem1.value;
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mdestino1').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mdestino1').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxViewDistanciaNacional() {
		var page = "mdistancia.asp?distancia="+document.formnacional.distancia1.value;
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mdistancia1').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mdistancia1').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxDistanciaRegional() {
		var page = "destinoRegional.asp?origem2="+document.formregional.origem2.value;
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mdestino2').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mdestino2').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxViewDistanciaRegional() {
		var page = "mdistancia.asp?distancia="+document.formregional.distancia2.value;
		xmlhttp.open("POST", page ,true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('mdistancia2').innerHTML = '<img src="img/loading3.gif" width="15" height="15" />'
		   if(xmlhttp.readyState == 4){
					document.getElementById('mdistancia2').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}

// PLANOS DE ANÚNCIO IMÓVEIS

function ajaxImovCorp() {
		var urlCompare = "planoImovelCorp.asp";
		xmlhttp.open("POST", urlCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tabplanos').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tabplanos').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
function ajaxImovVoce() {
		var urlCompare = "planoImovelVoce.asp";
		xmlhttp.open("POST", urlCompare, true);
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
		xmlhttp.onreadystatechange=function() { 
					document.getElementById('tabplanos').innerHTML = '<font size="1" face="tahoma"><img src="img/loading2.gif"/> Aguarde carregando...</font>'
		   if(xmlhttp.readyState == 4){
					document.getElementById('tabplanos').innerHTML = xmlhttp.responseText
				}}
			xmlhttp.send('') 
}
