// JavaScript Document
function MudaF(){
	xmlHttp=GetXmlHttpObject();
	url="contagemF.asp";

	url = url + "?sid="+ Math.random();
	
	xmlHttp.onreadystatechange=MudaValorF;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	if (xmlHttp.readyState == 1) {
	                              document.getElementById('comparar').innerHTML="Aguarde..";
                                 }	
function MudaValorF() 
	{ 
	
		if (xmlHttp.readyState==4)
			{ 
				document.getElementById('comparar').innerHTML=xmlHttp.responseText;
			}
	}
}
function GetXmlHttpObject()
	{
	 if (window.XMLHttpRequest) {   
			   a=new XMLHttpRequest(); } //Objeto nativo (FF/Safari/Opera7.6+)  
		   else {  
			 try {   
				a=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)  
			 }	 
			 catch(e) {  
			   try {   
				  a=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)  
			   }	 
			   catch(e) { /* O navegador não tem suporte */   
				  a=false;   
			   }  
			 }  
		   }   
		   return a;  
	}


function SessionF(id_imoveis,excluir,img)
{
	xmlHttp=GetXmlHttpObject();
	url="sessionF.asp";
	
	var id_imoveis = id_imoveis;
	var excluir = excluir;
	var img = img;
	
	url = url + "?sid=" + Math.random();
	url = url + "&id_imoveis="+ id_imoveis;
	url = url + "&excluir="+ excluir;
	
	xmlHttp.onreadystatechange=CriaSessionF;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	if (xmlHttp.readyState == 1) {
									 if(img=='img_1'){ 
										  document.getElementById(id_imoveis+'_imovel').style.display='none';
										  document.getElementById(id_imoveis+'_imovel_b').style.display='block';
										  document.getElementById('comparar').style.display='block';
									 }
									 
									 
									 if(excluir==1){
										 
										 
									  	 if(img=='img_2'){ 
										  document.getElementById(id_imoveis+'_imovel_b').style.display='none';
										  document.getElementById(id_imoveis+'_imovel').style.display='block';
									 }
									 	
										if(img=='img_3'){
											document.getElementById(id_imoveis+'_imovel').style.display='block';
											document.getElementById(id_imoveis+'_imovel_b').style.display='none';
										}
										
									 }
								 }

function CriaSessionF() 
	{ 
	
		if (xmlHttp.readyState==4)
			{ 
				//document.getElementById(id_imoveis+"_imovel").innerHTML=xmlHttp.responseText;
				setTimeout("MudaF()",1)
			}
	}
	
}
function GetXmlHttpObject()
	{
	 if (window.XMLHttpRequest) {   
			   a=new XMLHttpRequest(); } //Objeto nativo (FF/Safari/Opera7.6+)  
		   else {  
			 try {   
				a=new ActiveXObject("Msxml2.XMLHTTP");  //activeX (IE5.5+/MSXML2+)  
			 }	 
			 catch(e) {  
			   try {   
				  a=new ActiveXObject("Microsoft.XMLHTTP"); //activeX (IE5+/MSXML1)  
			   }	 
			   catch(e) { /* O navegador não tem suporte */   
				  a=false;   
			   }  
			 }  
		   }   
		   return a;  
	}
