var cursor_x;
var cursor_y;
/*
function coordenadas(event){
  //cursor_x=event.clientX+"px"
  //cursor_y=event.clientY+"px"
	cursor_x=event.screenX +"px";
	cursor_y=event.screenY +"px";
}
*/
var cursor = {x:0, y:0};
function coordenadas(e) {
    e = e || window.event;

    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}
/////////////-----AJAX-----//////////////////////////////////

var xmlHttp

function localidades(localidad_id)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Cambia de navegador, o esto no va a ningun lado...")
 return
 }
var url="inc/ajax_localidad.php"
url=url+"?localidad_padre="+localidad_id;
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
document.getElementById("localidades").style.display = "";
document.getElementById("localidades").style.top = cursor.y+"px";
document.getElementById("localidades").style.left = cursor.x+"px";
if (xmlHttp.readyState!=4 || xmlHttp.readyState!="complete")
 {
     document.getElementById("localidades").innerHTML = '<img src="img/loading.gif" />';
 }
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
   if(xmlHttp.responseText != ""){
     document.getElementById("localidades").innerHTML = xmlHttp.responseText;
   }else{
     document.getElementById("localidades").innerHTML = 'No hay inmobiliarias disponibles en este partido';
   }
 }
}

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;
/* */
}
