var hh_pop = null;
function goSchedaImmobile(opid, id, des) {
    var sUrl = "/98/HouseAndOffice/mobile/Mobile-SchedaImmobile.aspx?opid=" + opid + "&id=" + id;
    document.location = sUrl;
}
function toggleVL(id) {
    if (id == 0) {
        if ($get("ctl00_ctl02_vendita").checked) {
            $get("ctl00_ctl02_locazione").checked = false;
            $get("ctl00_ctl02_locazione-i").src = "/98/HouseAndOffice/mobile/images/locazione_False.png";
        }
        else {
            $get("ctl00_ctl02_locazione").checked = true;
            $get("ctl00_ctl02_locazione-i").src = "/98/HouseAndOffice/mobile/images/locazione_True.png";
        }
    }
    else {
        if ($get("ctl00_ctl02_locazione").checked) {
            $get("ctl00_ctl02_vendita").checked = false;
            $get("ctl00_ctl02_vendita-i").src = "/98/HouseAndOffice/mobile/images/vendita_False.png";
        }
        else {
            $get("ctl00_ctl02_vendita").checked = true;
            $get("ctl00_ctl02_vendita-i").src = "/98/HouseAndOffice/mobile/images/vendita_True.png";
        }
    }

}
//*********************************************************************************
//                           UpdatePanel  gestore eventi elenco
//
function callBackhandler() {
    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginCallback)
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endCallback)
}
function beginCallback(sender, args) {
    windowWait(true, "Inizializzo la ricerca...", "Cerca Immobili");
}
function endCallback(sender, args) {
    windowWait(false);
}
function goSearch() {
    $('#search').show();
}
function closeSearch() {
    $('#search').hide();
}
function search() {
    var preId = "ctl00_ctl02_";
    var params = "&mg=" + $get(preId + "mg").value;
    params += "&ido=" + $get(preId + "tipoOfferta").value;
    
    if ($get(preId + "idTipoImmobile").value != "0") {
        params += "&ti=" + $get(preId + "idTipoImmobile").value;
    }
    if ($get(preId + "idLocalita").value != "0") {
        params += "&idl=" + $get(preId + "idLocalita").value;
    }
    windowWait(true, "Ricerca immobili...", "Cerca Immobili");

    var sUrl = "/mobile.aspx?pid=98" + params + "&s=" + $get(preId + "searchFilter").value;
    document.location = sUrl;
}

function windowWait(bShow, strText, strTitle) {
    var ctl = $get("windowWaitContainer");
    var txt = $get("windowWaitText");
    txt.innerHTML = "<img src='/98/HouseAndOffice/images/ajax-loader.gif' border='0' /><br /> " + strText;
    if (bShow == true) {
        ctl.style.display = "block";
        txt.style.display = "block";
    }
    else {
        ctl.style.display = "none";
        txt.style.display = "none";
    }
}

function switch_vl(id) {
    var preId = "ctl00_ctl02_";
    var preId = "ctl00_ctl02_";
    if (id == 1) {
        $get("ve").src = "/98/HouseAndOffice/mobile/Images/it/vendita_on.png";
        $get("lo").src = "/98/HouseAndOffice/mobile/Images/it/locazione_off.png";
    }
    else {
        $get("ve").src = "/98/HouseAndOffice/mobile/Images/it/vendita_off.png";
        $get("lo").src = "/98/HouseAndOffice/mobile/Images/it/locazione_on.png";
    }
    $get(preId + "tipoOfferta").value = id;

}
function switch_to(id) {
    var preId = "ctl00_ctl02_";
    switch (id) {
        case 1:
            $get("re").src = "/98/HouseAndOffice/mobile/Images/it/residenziale_on.png";
            $get("co").src = "/98/HouseAndOffice/mobile/Images/it/commerciale_off.png";
            $get("tu").src = "/98/HouseAndOffice/mobile/Images/it/turistico_off.png";
            break;
        case 2:
            $get("re").src = "/98/HouseAndOffice/mobile/Images/it/residenziale_off.png";
            $get("co").src = "/98/HouseAndOffice/mobile/Images/it/commerciale_on.png";
            $get("tu").src = "/98/HouseAndOffice/mobile/Images/it/turistico_off.png";
            break;
        case 3:
            $get("re").src = "/98/HouseAndOffice/mobile/Images/it/residenziale_off.png";
            $get("co").src = "/98/HouseAndOffice/mobile/Images/it/commerciale_off.png";
            $get("tu").src = "/98/HouseAndOffice/mobile/Images/it/turistico_on.png";
            break;
    }
    $get(preId + "mg").value = id;
}


function initCursors() {
    var preId = "ctl00_ctl02_";
    if ($get(preId + "tipoOfferta").value == 2) {
        $get("ve").src = "/98/HouseAndOffice/mobile/Images/it/vendita_off.png";
        $get("lo").src = "/98/HouseAndOffice/mobile/Images/it/locazione_on.png";
    }
    if ($get(preId + "mg").value == 2) {
        $get("re").src = "/98/HouseAndOffice/mobile/Images/it/residenziale_off.png";
        $get("co").src = "/98/HouseAndOffice/mobile/Images/it/commerciale_on.png";
        $get("tu").src = "/98/HouseAndOffice/mobile/Images/it/turistico_off.png";
    }
    if ($get(preId + "mg").value == 3) {
        $get("re").src = "/98/HouseAndOffice/mobile/Images/it/residenziale_off.png";
        $get("co").src = "/98/HouseAndOffice/mobile/Images/it/commerciale_off.png";
        $get("tu").src = "/98/HouseAndOffice/mobile/Images/it/turistico_on.png";
    }

    $("#aspnetForm").submit(function () { return false});
}

