function Mapa(Endereco){
	var Endereco = Endereco;
	xmlHttp=GetXmlHttpObject();
	url="mapa.asp?";
    url = url + "&sid=" + Math.random();
    url = url + "Endereco="+Endereco;
	xmlHttp.onreadystatechange=MostrarMapa;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
	if (xmlHttp.readyState == 1) 
		{
				document.getElementById('mapa').innerHTML='';
		}
		
		function MostrarMapa() 
		{ 
			if (xmlHttp.readyState==4)
				{ 
					document.getElementById('mapa').innerHTML=xmlHttp.responseText;
				}
		}
		
}

function Session(id_imoveis,excluir,img)
{
	xmlHttp=GetXmlHttpObject();
	url="session.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=CriaSession;
	
	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';
				}
			
			
			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_b').style.display='none';
							document.getElementById(id_imoveis+'_imovel').style.display='block';
						}
						
					
				}
		}

	function CriaSession() 
		{ 
			if (xmlHttp.readyState==4)
				{ 
					document.getElementById('foto').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;  
	}
