// JavaScript Document
function AgregarFavoritos(Titulo,URL) {

/* Condición para el navegador Firefox */
if (navigator.appName=="Netscape") {
/* Agrega la página a favoritos y asigna un título al enlace */
	window.sidebar.addPanel(Titulo,URL,""); 
}

/* Condición para el navegador IE */
if (navigator.appName=="Microsoft Internet Explorer"){
/* Agrega la página a favoritos y asigna un título al enlace */
	window.external.AddFavorite(URL,Titulo);
}

}



// openWindow Gallery
function openGallery(aux) {
popupWin = window.open(aux,'Gallery', 'top=5, left=5, width=750, height=600, buttons=no, location=no, menubar=no, directories=no, scrollbars=no, status=no, toolbar=no')
}
function openPrint(aux) {
popupWin = window.open(aux,'Print', 'top=5, left=5, width=750, height=600, buttons=no, location=no, menubar=no, directories=no, scrollbars=yes, status=no, toolbar=no')
}
function openPhoto(aux) {
popupWin = window.open(aux,'Photo', 'top=5, left=5, width=525, height=625, buttons=no, location=no, menubar=no, directories=no, scrollbars=no, status=no, toolbar=no')
}
function openRequest(aux) {
popupWin = window.open(aux,'Print', 'top=5, left=5, width=470, height=405, buttons=no, location=no, menubar=no, directories=no, scrollbars=yes, status=no, toolbar=no')
}


function switchDiv()
{
	HideDiv('house');
	HideDiv('land');
	if(document.forma.ptype.value!='LAND'){
	eval ("document.getElementById('house').style.display=''");  
  	}
	if(document.forma.ptype.value=='LAND'){
	eval ("document.getElementById('land').style.display=''");  
  	}
	if(document.forma.ptype.value=='all'){
	HideDiv('house');
	HideDiv('land'); 
  	}
	switchDivPriceHouse();
}
function switchDivPriceHouse()
{
	HideDiv('pricehouse');
	HideDiv('pricehouseRent');
	HideDiv('priceland');
	HideDiv('pricelandRent');
	document.forma.pPrice.value="all";
	document.forma.pPrice2.value="all";
	document.forma.pPriceRent.value="all";
	document.forma.pPrice2Rent.value="all";
	document.forma.pPriceLand.value="all";
	document.forma.pPriceLand2.value="all";
	document.forma.pPriceLandRent.value="all";
	document.forma.pPriceLand2Rent.value="all";
	//HideDiv('land');
	if(document.forma.ptype.value=='LAND')
	{
			if(document.forma.pSaleRentLand[1].checked){
			eval ("document.getElementById('priceland').style.display=''");  
			}
			else{
			eval ("document.getElementById('pricelandRent').style.display=''");  
			}
	}
	else
	{
			if(document.forma.pSaleRent[1].checked){
			eval ("document.getElementById('pricehouse').style.display=''");  
			}
			else{
			eval ("document.getElementById('pricehouseRent').style.display=''");  
			}
	}
	
	//if(document.getElementById('ptype').value=='LAND'){
	//eval ("document.getElementById('land').style.display=''");  
  	//}
	
}


function HideDiv(div_id)
{
   eval ("document.getElementById(div_id).style.display='none'");  
   
}


//AJAX

var xmlHttp

function showZone(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/_lib/asp/getZone.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}





function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
//document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
document.forma.pZone.parentNode.innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}