function validaFormRicercaImmobili(){ regione_id = document.getElementById('regione_id'); provincia_id = document.getElementById('provincia_id'); comune_id = document.getElementById('comune_id'); if (typeof(regione_id) != 'undefined' && typeof(provincia_id) != 'undefined' && typeof(comune_id) != 'undefined' && regione_id.value != 'ND' && provincia_id.value != 'ND') { return true; }else { if (regione_id.value == 'EEE') { alert('Devi compilare il campo nazione'); }else { alert('I seguenti campi sono obbligatori:\n -regione\n -provincia'); } return false; } } function validaFormRicercaAgenzie(){ regione_id = document.getElementById('regione_id'); provincia_id = document.getElementById('provincia_id'); comune_id = document.getElementById('comune_id'); if (typeof(regione_id) != 'undefined' && typeof(provincia_id) != 'undefined' && typeof(comune_id) != 'undefined' && regione_id.value != 'ND' && provincia_id.value != 'ND') { return true; }else { alert('I seguenti campi sono obbligatori:\n -regione\n -provincia'); return false; } } function ConvalidaContattoWeb(agenzia_id, immobile_id){ if (document.contatta.agenzia_id.value == agenzia_id && document.contatta.annuncio_id.value == immobile_id && document.contatta.nome.value != '' && (document.contatta.email.value != '' || document.contatta.telefono.value != '') && document.contatta.richiesta.value != '' && document.contatta.privacy.checked == true) { inviaRichiestaSpecifica(false); }else { if (document.contatta.agenzia_id.value != agenzia_id || document.contatta.annuncio_id.value != immobile_id || document.contatta.nome.value == '' || (document.contatta.email.value == '' && document.contatta.telefono.value == '') || document.contatta.richiesta.value == '') { alert('I seguenti campi sono obbligatori:\n -nome\n -email o telefono\n -richiesta'); }else { if (document.contatta.privacy.checked == false) { document.getElementById('div_privacy').style.background = '#ffDDDD'; alert('Per poter inviare la richiesta all\'agenzia devi acconsentire al trattamento dei dati personali'); } } return false; } } function ConvalidaContattoWebAltreAgenzie(immobile_id){ if (document.contatta_altri.agenzia_id.value != '' && document.contatta_altri.annuncio_id.value == immobile_id && document.contatta_altri.nome.value != '' && (document.contatta_altri.email.value != '' || document.contatta_altri.telefono.value != '') && document.contatta_altri.richiesta.value != '' && document.contatta_altri.privacy.checked == true) { inviaRichiestaSpecifica(true); }else { if (document.contatta_altri.agenzia_id.value == '') { alert('Devi prima selezionare l\'agenzia da contattare'); }else { if (document.contatta_altri.annuncio_id.value != immobile_id || document.contatta_altri.nome.value == '' || (document.contatta_altri.email.value == '' && document.contatta_altri.telefono.value == '') || document.contatta_altri.richiesta.value == '') { alert('I seguenti campi sono obbligatori:\n -nome\n -email o telefono\n -richiesta'); }else { if (document.contatta_altri.privacy.checked == false) { document.getElementById('div_privacy_altri').style.background = '#ffDDDD'; alert('Per poter inviare la richiesta all\'agenzia devi acconsentire al trattamento dei dati personali'); } } } return false; } } function ConvalidaContattoWebSchedaAgenzia(agenzia_id, referer){ if (document.contatta.agenzia_id.value == agenzia_id && document.contatta.referer.value == referer && document.contatta.nome.value != '' && (document.contatta.email.value != '' || document.contatta.telefono.value != '') && document.contatta.richiesta.value != '' && document.contatta.privacy.checked == true) { return true; }else { if (document.contatta.agenzia_id.value != agenzia_id || document.contatta.referer.value != referer || document.contatta.nome.value == '' || (document.contatta.email.value == '' && document.contatta.telefono.value == '') || document.contatta.richiesta.value == '') { alert('I seguenti campi sono obbligatori:\n -nome\n -email o telefono\n -richiesta'); }else { if (document.contatta.privacy.checked == false) { document.getElementById('div_privacy').style.background = '#ffDDDD'; alert('Per poter inviare la richiesta all\'agenzia devi acconsentire al trattamento dei dati personali'); } } return false; } } function ConvalidaFormAgenzieVicine(){ regione_id = document.getElementById('regione_id'); provincia_id = document.getElementById('provincia_id'); comune_id = document.getElementById('comune_id'); if (typeof(regione_id) != 'undefined' && typeof(provincia_id) != 'undefined' && typeof(comune_id) != 'undefined' && regione_id.value != 'ND' && provincia_id.value != 'ND') { document.contatta.agenzia_id.value = ''; CercaAgenzieVicine(); }else { alert('I seguenti campi sono obbligatori:\n -regione\n -provincia'); } } function showImgRegione (regione) { var divContenitore = document.getElementById("div_regioni"); divContenitore.style.backgroundImage = 'url(/immagini/cartine/reg_' + regione + '.gif)'; return true; } function hideImgRegione (region) { var divContenitore = document.getElementById("div_regioni"); divContenitore.style.backgroundImage = 'url(/immagini/cartine/trasparente.gif)'; return true; } function impostaValoreSelect(nomeSelect, valore){ //nomeSelect.options[nomeSelect.selectedIndex].value; //nomeSelect.options[nomeSelect.selectedIndex].value = valore; var idx = document.getElementById(nomeSelect); for(var k=0;k0) img.style.marginLeft= moveleft + "px"; movetop = Math.round((height - imgheight) / 2); if (movetop>0) img.style.marginTop= movetop + "px"; } /* AJAX */ // funzione per assegnare l'oggetto XMLHttpRequest // compatibile con i browsers più recenti e diffusi function assegnaXMLHttpRequest() { // lista delle variabili locali var // variabile di ritorno, nulla di default XHR = null, // informazioni sul nome del browser browserUtente = navigator.userAgent.toUpperCase(); // browser standard con supporto nativo // non importa il tipo di browser if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object") XHR = new XMLHttpRequest(); // browser Internet Explorer // è necessario filtrare la versione 4 else if(window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) { // la versione 6 di IE ha un nome differente // per il tipo di oggetto ActiveX if(browserUtente.indexOf("MSIE 5") < 0) XHR = new ActiveXObject("Msxml2.XMLHTTP"); // le versioni 5 e 5.5 invece sfruttano lo stesso nome else XHR = new ActiveXObject("Microsoft.XMLHTTP"); } return XHR; } function CercaAgenzieVicine() { // assegnazione oggetto XMLHttpRequest var ajax = assegnaXMLHttpRequest(); var provincia_id = document.getElementById('provincia_id'); var comune_id = document.getElementById('comune_id'); var annuncio_id = document.getElementById('cerca_agenzie_annuncio_id'); var div_agenzie_vicine = document.getElementById('div_agenzie_vicine'); if (ajax) { // impostazione richiesta asincrona in GET // del file specificato ajax.open("post", '/includes/js/getAgenzieVicine.php', true); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // rimozione dell'header "connection" come "keep alive" ajax.setRequestHeader("connection", "close"); ajax.onreadystatechange = function() { if(ajax.readyState == 4){ if (ajax.status == 200) { var response = ajax.responseText; if(response != ''){ div_agenzie_vicine.innerHTML = response; }else { div_agenzie_vicine.innerHTML = 'Pagina vuota'; } } }else { div_agenzie_vicine.innerHTML = 'Caricamento in corso...'; } } // invio richiesta ajax.send('comune_id=' + comune_id.value+'&provincia_id=' + provincia_id.value+'&annuncio_id='+annuncio_id.value); } return false; } function inviaRichiestaSpecifica(altri) { if (altri == false) { var div_biglietto_retro = document.getElementById('biglietto_retro'); var annuncio_id = document.getElementById('annuncio_id').value; var agenzia_id = document.getElementById('agenzia_id').value; var nome = document.getElementById('nome').value; var telefono = document.getElementById('telefono').value; var email = document.getElementById('email').value; var richiesta = document.getElementById('richiesta').value; var privacy = document.getElementById('privacy').value; }else { var div_biglietto_retro = document.getElementById('biglietto_retro_altri'); var annuncio_id = document.getElementById('annuncio_id_altri').value; var agenzia_id = document.getElementById('agenzia_id_altri').value; var nome = document.getElementById('nome_altri').value; var telefono = document.getElementById('telefono_altri').value; var email = document.getElementById('email_altri').value; var richiesta = document.getElementById('richiesta_altri').value; var privacy = document.getElementById('privacy_altri').value; } // assegnazione oggetto XMLHttpRequest var ajax = assegnaXMLHttpRequest(); if (ajax) { // impostazione richiesta asincrona in POST // del file specificato ajax.open("post", '/includes/js/invia_richiesta_specifica.php', true); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // rimozione dell'header "connection" come "keep alive" ajax.setRequestHeader("connection", "close"); ajax.onreadystatechange = function() { if(ajax.readyState == 4){ if (ajax.status == 200) { var response = ajax.responseText; if(response != ''){ div_biglietto_retro.innerHTML = response; pageTracker._trackPageview("/richieste-specifiche"); }else { div_biglietto_retro.innerHTML = 'Pagina vuota'; } } }else { div_biglietto_retro.innerHTML = '
'; } } // invio richiesta ajax.send('agenzia_id=' + agenzia_id + '&annuncio_id=' + annuncio_id + '&nome=' + nome + '&telefono=' + telefono + '&email=' + email + '&richiesta=' + richiesta + '&privacy=' + privacy); } return false; } function getProvince(regione) { var div_provincia = document.getElementById('div_provincia'); // assegnazione oggetto XMLHttpRequest var ajax = assegnaXMLHttpRequest(); if (ajax) { // impostazione richiesta asincrona in POST // del file specificato ajax.open("post", '/includes/js/getProvince.php', true); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // rimozione dell'header "connection" come "keep alive" ajax.setRequestHeader("connection", "close"); ajax.onreadystatechange = function() { if(ajax.readyState == 4){ if (ajax.status == 200) { var response = ajax.responseText; if(response != ''){ div_provincia.innerHTML = response; }else { div_provincia.innerHTML = 'Pagina vuota'; } } }else { div_provincia.innerHTML = ''; } } // invio richiesta ajax.send('regione=' + regione); } return false; } function getComuni(provincia) { var div_comune = document.getElementById('div_comune'); // assegnazione oggetto XMLHttpRequest var ajax = assegnaXMLHttpRequest(); if (ajax) { // impostazione richiesta asincrona in GET // del file specificato ajax.open("post", '/includes/js/getComuni.php', true); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // rimozione dell'header "connection" come "keep alive" ajax.setRequestHeader("connection", "close"); ajax.onreadystatechange = function() { if(ajax.readyState == 4){ if (ajax.status == 200) { var response = ajax.responseText; if(response != ''){ div_comune.innerHTML = response; }else { div_comune.innerHTML = 'Pagina vuota'; } } }else { div_comune.innerHTML = ''; } } // invio richiesta ajax.send('provincia=' + provincia); } return false; } function statsAddTelefono(agenzia) { // assegnazione oggetto XMLHttpRequest var ajax = assegnaXMLHttpRequest(); if (ajax) { // impostazione richiesta asincrona in POST // del file specificato ajax.open("post", '/includes/js/statsAddTelefono.php', true); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"); // rimozione dell'header "connection" come "keep alive" ajax.setRequestHeader("connection", "close"); // invio richiesta ajax.send('agenzia=' + agenzia); } return false; } function popupPrivacy(){ window.open("http://mls.info-immobili.it/privacy.php","privacy","location=no,width=600,height=400,scrollbars=yes,resizable=yes,top=" + ((screen.height-400)/2) + ",left=" + ((screen.width-600)/2)); } function openNewWindow (url) { blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes'); } function openNewWindow(sUrl,w,h,cb,sb){ if (cb=='yes') { sProp=''; }else { if ((w==-1) || (h==-1)) { sProp= 'width='+screen.width+',height='+screen.height+',top=0,left=0,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; } else { l=(screen.width)?(screen.width-w)/2:100; t=(screen.height)?(screen.height-h)/2:100; sProp='width='+ w +',height='+ h +',top='+ t +',left='+ l +',scrollbars='+ sb +',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; } } oWin=window.open(sUrl,'',sProp); oWin.focus(); } function preloadImage(image_url) { pic1 = new Image(); pic1.src = image_url; } preloadImage("/immagini/ajax-loader.gif"); preloadImage("/immagini/ajax-loader-bar.gif");