// Funzione per visualizzare i banner function banner(banner, tabella, keyword, punti) { // creo gli id da aggiornare nei div var id_aggiornare; id_aggiornare=banner.replace("sponsor_", ""); // visualizzo la scritta loading...e nascondi lo spazio del banner document.getElementById('elaborazione_'+id_aggiornare).style.display="block"; document.getElementById(id_aggiornare).style.display="none"; var xmlHttp = getXmlHttpObject(); xmlHttp.open("GET", "http://www.case24.it/include/ajax_banner.php?tabella="+tabella+"&banner="+banner+"&"+keyword, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; var parametri=resp.split("#;#"); if(parametri[0]!="") { contenuto=""; document.getElementById('elaborazione_'+id_aggiornare).style.display="none"; document.getElementById(id_aggiornare).style.display="block"; document.getElementById(id_aggiornare).innerHTML=contenuto; }else{ document.getElementById('elaborazione_'+id_aggiornare).style.display="none"; document.getElementById(id_aggiornare).style.display="none"; } } } } } // inserisci confronto function inserisci_confronto(codice_inserzione, codice_utente) { document.getElementById('inserisci_confronto').style.display="none"; document.getElementById('rimuovi_confronto').style.display="block"; var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "../../../include/ajax_scheda_immobile.php?tabella=inserisci_confronto&codice_inserzione="+codice_inserzione+"&codice_utente="+codice_utente, true); xmlHttp.send(null); alert("Annuncio correttamente inserito nella lista di confronto"); } // Rimuovi confronto function rimuovi_confronto(codice_inserzione, codice_utente) { document.getElementById('rimuovi_confronto').style.display="none"; document.getElementById('inserisci_confronto').style.display="block"; var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "../../../include/ajax_scheda_immobile.php?tabella=rimuovi_confronto&codice_inserzione="+codice_inserzione+"&codice_utente="+codice_utente, true); xmlHttp.send(null); alert("Annuncio correttamente rimosso dalla lista di confronto"); } // Nascondi telefono function nascondi_telefono() { document.getElementById('telefono_agenzia').style.display="none"; } // Visualizza telefono function visualizza_telefono_agenzia(codice_cliente) { document.getElementById('telefono_agenzia').style.display="block"; document.getElementById('visualizza_telefono').style.display="none"; // Aggiorno il campo visualizzazione_telefono tramite ajax var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?tabella=visualizzazione_telefono_agenzia&codice_cliente="+codice_cliente, true); xmlHttp.send(null); } // Carica gli annunci nella pagina dell'agenzia function carica_annunci_agenzia(codice_cliente, annunci_totali, pagina) { document.getElementById("div_annunci").style.display="none"; document.getElementById("loading").style.display="block"; var xmlHttp = getXmlHttpObject(); xmlHttp.open("GET", "../../../include/ajax.php?funzione=annunci_agenzia&codice_cliente="+codice_cliente+"&annunci_totali="+annunci_totali+"&pagina="+pagina, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; document.getElementById("div_annunci").innerHTML=resp; document.getElementById("loading").style.display="none"; document.getElementById("div_annunci").style.display="block"; } } } } // Funzione per ripristinare la classe del div function nonEvidenzia(numero_riga) { document.getElementById(numero_riga).className="elencoAgenzie"; } // Funzione per evidenziare il div function evidenzia(numero_riga) { document.getElementById(numero_riga).className="elencoAgenzieEvidenzia"; } // Funzione per verificare la corretta compilazione dei dati contatti function verifica_contatti() { procedi=true; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; var valori_numerici=/[0-9._%-]/; document.getElementById('richieste').nome.className="text"; document.getElementById('richieste').cognome.className="text"; document.getElementById('richieste').email.className="text"; document.getElementById('richieste').indirizzo.className="text"; document.getElementById('richieste').cap.className="text02"; document.getElementById('richieste').provincia.className="text"; document.getElementById('richieste').comune.className="text"; document.getElementById('richieste').telefono.className="text"; document.getElementById('richieste').messaggio.className="note02"; if(document.getElementById('richieste').nome.value=="") { document.getElementById('richieste').nome.focus(); document.getElementById('richieste').nome.className="textErrore"; alert("ATTENZIONE! Inserire il nome o la ragione sociale"); procedi=false; }else if(document.getElementById('richieste').cognome.value==""){ document.getElementById('richieste').cognome.focus(); document.getElementById('richieste').cognome.className="textErrore"; alert("ATTENZIONE! Inserire il cognome o il nome del legale rappresentante"); procedi=false; }else if((document.getElementById('richieste').email.value=="")||(!document.getElementById('richieste').email.value.match(valori_email))){ document.getElementById('richieste').email.focus(); document.getElementById('richieste').email.className="textErrore"; alert("ATTENZIONE! Inserire un indirizzo e-mail valido"); procedi=false; }else if(document.getElementById('richieste').indirizzo.value==""){ document.getElementById('richieste').indirizzo.focus(); document.getElementById('richieste').indirizzo.className="textErrore"; alert("ATTENZIONE! Inserire l'indirizzo"); procedi=false; }else if((document.getElementById('richieste').cap.value=="")||(!document.getElementById('richieste').cap.value.match(valori_numerici))){ document.getElementById('richieste').cap.focus(); document.getElementById('richieste').cap.className="text02Errore"; alert("ATTENZIONE! Inserire il CAP"); procedi=false; }else if(document.getElementById('richieste').comune.value==""){ document.getElementById('richieste').comune.focus(); document.getElementById('richieste').comune.className="textErrore"; alert("ATTENZIONE! Inserire il comune"); procedi=false; }else if(document.getElementById('richieste').provincia.value==""){ document.getElementById('richieste').provincia.focus(); document.getElementById('richieste').provincia.className="textErrore"; alert("ATTENZIONE! Inserire la provincia"); procedi=false; }else if(document.getElementById('richieste').telefono.value==""){ document.getElementById('richieste').telefono.focus(); document.getElementById('richieste').telefono.className="textErrore"; alert("ATTENZIONE! Inserire il telefono"); procedi=false; }else if(document.getElementById('richieste').messaggio.value==""){ document.getElementById('richieste').messaggio.focus(); document.getElementById('richieste').messaggio.className="note02Errore"; alert("ATTENZIONE! Inserire il messaggio"); procedi=false; }else if(document.getElementById('richieste').privacy[1].checked==true){ alert("ATTENZIONE! Per inviare il modulo bisogna accettare il trattamento dei propri dati personali"); procedi=false; } if(procedi==true) { document.getElementById('richieste').submit(); } } // Funzione per verificare la corretta compilazione dei dati Newsletter function verifica_newsletter() { procedi=true; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; var valori_numerici=/[0-9._%-]/; document.getElementById('richieste').nome.className="text"; document.getElementById('richieste').cognome.className="text"; document.getElementById('richieste').email.className="text"; if(document.getElementById('richieste').nome.value=="") { document.getElementById('richieste').nome.focus(); document.getElementById('richieste').nome.className="textErrore"; alert("ATTENZIONE! Inserire il nome"); procedi=false; }else if(document.getElementById('richieste').cognome.value==""){ document.getElementById('richieste').cognome.focus(); document.getElementById('richieste').cognome.className="textErrore"; alert("ATTENZIONE! Inserire il cognome"); procedi=false; }else if((document.getElementById('richieste').email.value=="")||(!document.getElementById('richieste').email.value.match(valori_email))){ document.getElementById('richieste').email.focus(); document.getElementById('richieste').email.className="textErrore"; alert("ATTENZIONE! Inserire un indirizzo e-mail valido"); procedi=false; }else if(document.getElementById('richieste').privacy[1].checked==true){ alert("ATTENZIONE! Per inviare il modulo bisogna accettare il trattamento dei propri dati personali"); procedi=false; } if(procedi==true) { document.getElementById('richieste').submit(); } } //funzione per verificare l'iscrizione al contest function verifica_contest() { procedi=true; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; var valori_numerici=/[0-9._%-]/; document.getElementById('richieste').nome.className="text"; document.getElementById('richieste').cognome.className="text"; document.getElementById('richieste').email.className="text"; if(document.getElementById('richieste').nome.value=="") { document.getElementById('richieste').nome.focus(); document.getElementById('richieste').nome.className="textErrore"; alert("ATTENZIONE! Inserire il nome"); procedi=false; }else if(document.getElementById('richieste').cognome.value==""){ document.getElementById('richieste').cognome.focus(); document.getElementById('richieste').cognome.className="textErrore"; alert("ATTENZIONE! Inserire il cognome"); procedi=false; }else if(document.getElementById('richieste').telefono.value==""){ document.getElementById('richieste').telefono.focus(); document.getElementById('richieste').telefono.className="textErrore"; alert("ATTENZIONE! Inserire un numero di telefono"); procedi=false; }else if(document.getElementById('richieste').provincia.value==""){ document.getElementById('richieste').provincia.focus(); document.getElementById('richieste').provincia.className="textErrore"; alert("ATTENZIONE! Selezionare la provincia"); procedi=false; }else if(document.getElementById('richieste').comune.value==""){ document.getElementById('richieste').comune.focus(); document.getElementById('richieste').comune.className="textErrore"; alert("ATTENZIONE! Selezionare il comune"); procedi=false; }else if((document.getElementById('richieste').email.value=="")||(!document.getElementById('richieste').email.value.match(valori_email))){ document.getElementById('richieste').email.focus(); document.getElementById('richieste').email.className="textErrore"; alert("ATTENZIONE! Inserire un indirizzo e-mail valido"); procedi=false; }else if(document.getElementById('dont_agree').checked==true){ alert("ATTENZIONE! Acconsentire al trattamento dei dati personali"); procedi=false; }else if(document.getElementById('richieste').maggiorenne.checked==false){ document.getElementById('richieste').maggiorenne.focus(); alert("ATTENZIONE! E' necessario dichiarare di essere maggiorenne"); procedi=false; }else if(document.getElementById('richieste').regolamento.checked==false){ document.getElementById('richieste').regolamento.focus(); alert("ATTENZIONE! E' necessario accettare il regolamento e le condizioni"); procedi=false; } if(procedi==true) { document.getElementById('richieste').submit(); } } // Funzione per la verifica dei commenti inseriti nella sezione blog/news function verifica_commenti() { procedi=true; document.commenti.nome.className="invia"; document.commenti.email.className="invia"; document.commenti.messaggio.style.border="1px solid #7f9db9"; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; if(document.commenti.nome.value=="") { document.commenti.nome.focus(); procedi=false; document.commenti.nome.className="inviaErrore"; alert("Inserire il nome"); }else if((document.commenti.email.value=="")||(!document.commenti.email.value.match(valori_email))){ procedi=false; document.commenti.email.focus(); document.commenti.email.className="inviaErrore"; alert("Attenzione! Inserire un indirizzo e-mail valido\nTi ricordiamo che l'indirizzo e-mail non verrā visualizzato nel commento."); }else if(document.commenti.messaggio.value==""){ procedi=false; document.commenti.messaggio.focus(); document.commenti.messaggio.style.border="2px solid #d21509"; alert("Attenzione! Inserire il testo del commento."); } if(procedi==true) { document.commenti.submit(); } } // funzione per eliminare le richieste/proposte di affidamento function elimina_richieste(tabella) { var email_eliminare=document.getElementById('formEliminazione').email.value; if(document.getElementById('formEliminazione').email.value=="") { alert("ATTENZIONE! Inserire un indirizzo e-mail valido."); }else{ var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?tabella='+tabella+'&email='+email_eliminare, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; if(resp==1) { document.getElementById('formEliminazione').email.value=""; alert("La sua richiesta di rimozione č stata correttamente inviata."); }else{ alert("ATTENZIONE! Inserire un indirizzo e-mail valido."); } } } } } } // verifica richiesta immobili alle agenzie function verifica_proposta_immobile() { procedi=true; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; var valori_numerici=/[0-9._%-]/; document.getElementById('richieste').provincia.className="comuni"; document.getElementById('richieste').comune.className="comuni"; document.getElementById('richieste').tipo_immobile.className="comuni"; document.getElementById('richieste').numero_camere.className="comuni"; document.getElementById('richieste').numero_bagni.className="comuni"; document.getElementById('richieste').prezzo.className="text"; document.getElementById('richieste').superficie.className="text"; document.getElementById('richieste').nome.className="text"; document.getElementById('richieste').cognome.className="text"; document.getElementById('richieste').email.className="text"; document.getElementById('richieste').indirizzo.className="text"; document.getElementById('richieste').cap.className="text02"; document.getElementById('richieste').provincia_utente.className="comuni"; document.getElementById('richieste').comune_utente.className="comuni"; document.getElementById('richieste').tel.className="text"; if(document.getElementById('richieste').provincia.value==""){ document.getElementById('richieste').provincia.className="comuniErrore"; document.getElementById('richieste').provincia.focus(); alert("ATTENZIONE! Inserire la provincia dell'immobile"); procedi=false; }else if(document.getElementById('richieste').comune.value==""){ document.getElementById('richieste').comune.className="comuniErrore"; document.getElementById('richieste').comune.focus(); alert("ATTENZIONE! Inserire il comune dell'immobile"); procedi=false; }else if(document.getElementById('richieste').tipo_immobile.value==""){ document.getElementById('richieste').tipo_immobile.className="comuniErrore"; document.getElementById('richieste').tipo_immobile.focus(); alert("ATTENZIONE! Inserire la tipologia dell'immobile"); procedi=false; }else if((document.getElementById('richieste').numero_camere.value=="")&&(document.getElementById('richieste').tipo_immobile.value>=15)&&(document.getElementById('richieste').tipo_immobile.value<=20)){ document.getElementById('richieste').numero_camere.className="comuniErrore"; document.getElementById('richieste').numero_camere.focus(); alert("ATTENZIONE! Inserire il numero di camere dell'immobile"); procedi=false; }else if((document.getElementById('richieste').numero_bagni.value=="")&&(document.getElementById('richieste').tipo_immobile.value>=15)&&(document.getElementById('richieste').tipo_immobile.value<=20)){ document.getElementById('richieste').numero_bagni.className="comuniErrore"; document.getElementById('richieste').numero_bagni.focus(); alert("ATTENZIONE! Inserire il numero bagni dell'immobile"); procedi=false; }else if(document.getElementById('richieste').prezzo.value==""){ document.getElementById('richieste').prezzo.className="textErrore"; document.getElementById('richieste').prezzo.focus(); alert("ATTENZIONE! Inserire il prezzo dell'immobile"); procedi=false; }else if(document.getElementById('richieste').superficie.value==""){ document.getElementById('richieste').superficie.className="textErrore"; document.getElementById('richieste').superficie.focus(); alert("ATTENZIONE! Inserire la superficie dell'immobile"); procedi=false; }else if(document.getElementById('richieste').nome.value==""){ document.getElementById('richieste').nome.className="textErrore"; document.getElementById('richieste').nome.focus(); alert("ATTENZIONE! Inserisci il tuo nome"); procedi=false; }else if(document.getElementById('richieste').cognome.value==""){ document.getElementById('richieste').cognome.className="textErrore"; document.getElementById('richieste').cognome.focus(); alert("ATTENZIONE! Inserisci il tuo cognome"); procedi=false; }else if((document.getElementById('richieste').email.value=="")||(!document.getElementById('richieste').email.value.match(valori_email))){ document.getElementById('richieste').email.className="textErrore"; document.getElementById('richieste').email.focus(); alert("ATTENZIONE! Inserisci un indirizzo e-mail valido"); procedi=false; }else if(document.getElementById('richieste').indirizzo.value==""){ document.getElementById('richieste').indirizzo.className="textErrore"; document.getElementById('richieste').indirizzo.focus(); alert("ATTENZIONE! Inserisci il tuo indirizzo"); procedi=false; }else if((document.getElementById('richieste').cap.value=="")||(!document.getElementById('richieste').cap.value.match(valori_numerici))){ document.getElementById('richieste').cap.className="text02Errore"; document.getElementById('richieste').cap.focus(); alert("ATTENZIONE! Inserisci il tuo cap di residenza"); procedi=false; }else if(document.getElementById('richieste').provincia_utente.value==""){ document.getElementById('richieste').provincia_utente.className="comuniErrore"; document.getElementById('richieste').provincia_utente.focus(); alert("ATTENZIONE! Inserire la tue provincia di residenza"); procedi=false; }else if(document.getElementById('richieste').comune_utente.value==""){ document.getElementById('richieste').comune_utente.className="comuniErrore"; document.getElementById('richieste').comune_utente.focus(); alert("ATTENZIONE! Inserire il tuo comune di residenza"); procedi=false; }else if((document.getElementById('richieste').tel.value=="")||(!document.getElementById('richieste').tel.value.match(valori_numerici))){ document.getElementById('richieste').tel.className="textErrore"; document.getElementById('richieste').tel.focus(); alert("ATTENZIONE! Inserisci il tuo numero di telefono nella forma prefisso.numero"); procedi=false; }else if(document.getElementById('richieste').privacy[1].checked==true){ alert("ATTENZIONE! Per inviare il modulo devi accettare il trattamento dei tuoi dati personali"); procedi=false; } if(procedi==true) { document.getElementById('richieste').submit(); } } // verifica richiesta immobili alle agenzie function verifica_richiesta_immobile() { procedi=true; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; var valori_numerici=/[0-9._%-]/; document.getElementById('richieste').provincia.className="comuni"; document.getElementById('richieste').comune.className="comuni"; document.getElementById('richieste').tipo_immobile.className="comuni"; document.getElementById('richieste').numero_bagni.className="comuni"; document.getElementById('richieste').prezzo_da.className="smallSelect"; document.getElementById('richieste').prezzo_a.className="smallSelect"; document.getElementById('richieste').superficie_da.className="smallSelect"; document.getElementById('richieste').superficie_a.className="smallSelect"; document.getElementById('richieste').nome.className="text"; document.getElementById('richieste').cognome.className="text"; document.getElementById('richieste').email.className="text"; document.getElementById('richieste').indirizzo.className="text"; document.getElementById('richieste').cap.className="text02"; document.getElementById('richieste').provincia_utente.className="comuni"; document.getElementById('richieste').comune_utente.className="comuni"; document.getElementById('richieste').tel.className="text"; if(document.getElementById('richieste').provincia.value==""){ document.getElementById('richieste').provincia.className="comuniErrore"; document.getElementById('richieste').provincia.focus(); alert("ATTENZIONE! Inserire la provincia dell'immobile"); procedi=false; }else if(document.getElementById('richieste').comune.value==""){ document.getElementById('richieste').comune.className="comuniErrore"; document.getElementById('richieste').comune.focus(); alert("ATTENZIONE! Inserire il comune dell'immobile"); procedi=false; }else if(document.getElementById('richieste').tipo_immobile.value==""){ document.getElementById('richieste').tipo_immobile.className="comuniErrore"; document.getElementById('richieste').tipo_immobile.focus(); alert("ATTENZIONE! Inserire la tipologia dell'immobile"); procedi=false; }else if(document.getElementById('richieste').numero_bagni.value==""){ document.getElementById('richieste').numero_bagni.className="comuniErrore"; document.getElementById('richieste').numero_bagni.focus(); alert("ATTENZIONE! Inserire il numero bagni dell'immobile"); procedi=false; }else if((document.getElementById('richieste').prezzo_da.value=="")&&(document.getElementById('richieste').prezzo_a.value=="")){ document.getElementById('richieste').prezzo_da.className="smallSelectErrore"; document.getElementById('richieste').prezzo_a.className="smallSelectErrore"; document.getElementById('richieste').prezzo_da.focus(); alert("ATTENZIONE! Inserire il range di prezzo dell'immobile"); procedi=false; }else if((document.getElementById('richieste').superficie_da.value=="")&&(document.getElementById('richieste').superficie_a.value=="")){ document.getElementById('richieste').superficie_da.className="smallSelectErrore"; document.getElementById('richieste').superficie_a.className="smallSelectErrore"; document.getElementById('richieste').superficie_da.focus(); alert("ATTENZIONE! Inserire la superficie dell'immobile"); procedi=false; }else if(document.getElementById('richieste').nome.value==""){ document.getElementById('richieste').nome.className="textErrore"; document.getElementById('richieste').nome.focus(); alert("ATTENZIONE! Inserisci il tuo nome"); procedi=false; }else if(document.getElementById('richieste').cognome.value==""){ document.getElementById('richieste').cognome.className="textErrore"; document.getElementById('richieste').cognome.focus(); alert("ATTENZIONE! Inserisci il tuo cognome"); procedi=false; }else if((document.getElementById('richieste').email.value=="")||(!document.getElementById('richieste').email.value.match(valori_email))){ document.getElementById('richieste').email.className="textErrore"; document.getElementById('richieste').email.focus(); alert("ATTENZIONE! Inserisci un indirizzo e-mail valido"); procedi=false; }else if(document.getElementById('richieste').indirizzo.value==""){ document.getElementById('richieste').indirizzo.className="textErrore"; document.getElementById('richieste').indirizzo.focus(); alert("ATTENZIONE! Inserisci il tuo indirizzo"); procedi=false; }else if((document.getElementById('richieste').cap.value=="")||(!document.getElementById('richieste').cap.value.match(valori_numerici))){ document.getElementById('richieste').cap.className="text02Errore"; document.getElementById('richieste').cap.focus(); alert("ATTENZIONE! Inserisci il tuo cap di residenza"); procedi=false; }else if(document.getElementById('richieste').provincia_utente.value==""){ document.getElementById('richieste').provincia_utente.className="comuniErrore"; document.getElementById('richieste').provincia_utente.focus(); alert("ATTENZIONE! Inserire la tua provincia di residenza"); procedi=false; }else if(document.getElementById('richieste').comune_utente.value==""){ document.getElementById('richieste').comune_utente.className="comuniErrore"; document.getElementById('richieste').comune_utente.focus(); alert("ATTENZIONE! Inserire il tuo comune di residenza"); procedi=false; }else if((document.getElementById('richieste').tel.value=="")||(!document.getElementById('richieste').tel.value.match(valori_numerici))){ document.getElementById('richieste').tel.className="textErrore"; document.getElementById('richieste').tel.focus(); alert("ATTENZIONE! Inserisci il tuo numero di telefono nella forma prefisso.numero"); procedi=false; }else if(document.getElementById('richieste').privacy[1].checked==true){ alert("ATTENZIONE! Per inviare il modulo devi accettare il trattamento dei tuoi dati personali"); procedi=false; } if(procedi==true) { document.getElementById('richieste').submit(); } } // Registrazione utenti privati function registrazionePrivati() { procedi=true; document.getElementById('registrazione').nome.className="invia"; document.getElementById('registrazione').cognome.className="invia"; document.getElementById('registrazione').email.className="invia"; var email=document.getElementById('registrazione').email.value; document.getElementById('registrazione').via.className="invia"; document.getElementById('registrazione').cap.className="invia"; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; // Verifico se l'e-mail č giā in uso var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?funzione=controlloEmail&email="+email, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; if(resp==1) { procedi=false; document.getElementById('registrazione').email.focus(); document.getElementById('registrazione').email.className="inviaErrore"; alert("Attezione! Questa e-mail risulta gia' registrata.\nE' necessario utilizzare un altro indirizzo e-mail"); }else{ if(document.getElementById('registrazione').nome.value=="") { procedi=false; document.getElementById('registrazione').nome.focus(); document.getElementById('registrazione').nome.className="inviaErrore"; alert("Attenzione! Inserire il nome"); }else if(document.getElementById('registrazione').cognome.value==""){ procedi=false; document.getElementById('registrazione').cognome.focus(); document.getElementById('registrazione').cognome.className="inviaErrore"; alert("Attenzione! Inserire il cognome"); }else if((document.getElementById('registrazione').email.value=="")||(!document.getElementById('registrazione').email.value.match(valori_email))){ procedi=false; document.getElementById('registrazione').email.focus(); document.getElementById('registrazione').email.className="inviaErrore"; alert("Attenzione! Inserire un indirizzo e-mail valido"); }else if((document.getElementById('registrazione').telefono.value=="")||(isNaN(document.getElementById('registrazione').telefono.value))||(document.getElementById('registrazione').telefono.value=="undefined")){ procedi=false; document.getElementById('registrazione').telefono.focus(); document.getElementById('registrazione').telefono.className="inviaErrore"; alert("Attenzione! Inserire un numero di telefono valido e nella forma 'prefisso.numero' senza spazi"); }else if(document.getElementById('registrazione').provincia.value==""){ procedi=false; document.getElementById('registrazione').provincia.focus(); alert("Attenzione! Inserire la provincia"); }else if(document.getElementById('registrazione').comune.value==""){ procedi=false; document.getElementById('registrazione').comune.focus(); alert("Attenzione! Inserire il comune"); }else if(document.getElementById('registrazione').via.value==""){ procedi=false; document.getElementById('registrazione').via.focus(); document.getElementById('registrazione').via.className="inviaErrore"; alert("Attenzione! Inserire l'indirizzo"); }else if((document.getElementById('registrazione').cap.value=="")||(isNaN(document.getElementById('registrazione').cap.value))||(document.getElementById('registrazione').cap.value=="undefined")){ procedi=false; document.getElementById('registrazione').cap.focus(); document.getElementById('registrazione').cap.className="inviaErrore"; alert("Attenzione! Inserire il C.A.P."); }else if(document.getElementById('registrazione').privacy[1].checked==true){ procedi=false; alert("Attenzione! Per registrarsi č necessario accettare il trattamento dei dati personali"); } if(procedi==true) { document.getElementById('registrazione').submit(); } } } } } } // Registrazione agenzie function registrazioneAgenzie() { procedi=true; document.getElementById('registrazione').nome.className="invia"; document.getElementById('registrazione').nome_interno.className="invia"; document.getElementById('registrazione').email.className="invia"; var email=document.getElementById('registrazione').email.value; document.getElementById('registrazione').prefisso.className="invia"; document.getElementById('registrazione').telefono.className="invia"; document.getElementById('registrazione').via.className="invia"; document.getElementById('registrazione').cap.className="invia"; var valori_email=/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; // Verifico se l'e-mail č giā in uso var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?funzione=controlloEmail&email="+email, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; if(resp==1) { procedi=false; document.getElementById('registrazione').email.focus(); document.getElementById('registrazione').email.className="inviaErrore"; alert("Attezione! Questa e-mail risulta gia' registrata.\nE' necessario utilizzare un altro indirizzo e-mail"); }else{ if(document.getElementById('registrazione').nome.value=="") { procedi=false; document.getElementById('registrazione').nome.focus(); document.getElementById('registrazione').nome.className="inviaErrore"; alert("Attenzione! Inserire il nome agenzia"); }else if((document.getElementById('registrazione').email.value=="")||(!document.getElementById('registrazione').email.value.match(valori_email))){ procedi=false; document.getElementById('registrazione').email.focus(); document.getElementById('registrazione').email.className="inviaErrore"; alert("Attenzione! Inserire un indirizzo e-mail valido"); }else if(document.getElementById('registrazione').nome_interno.value==""){ procedi=false; document.getElementById('registrazione').nome_interno.focus(); document.getElementById('registrazione').nome_interno.className="inviaErrore"; alert("Attenzione! Inserire la ragione sociale"); }else if((document.getElementById('registrazione').telefono.value=="")||(isNaN(document.getElementById('registrazione').telefono.value))||(document.getElementById('registrazione').telefono.value=="undefined")){ procedi=false; document.getElementById('registrazione').telefono.focus(); document.getElementById('registrazione').telefono.className="inviaErrore"; alert("Attenzione! Inserire un numero di telefono valido e senza spazi"); }else if(document.getElementById('registrazione').provincia.value==""){ procedi=false; document.getElementById('registrazione').provincia.focus(); alert("Attenzione! Inserire la provincia"); }else if(document.getElementById('registrazione').comune.value==""){ procedi=false; document.getElementById('registrazione').comune.focus(); alert("Attenzione! Inserire il comune"); }else if(document.getElementById('registrazione').via.value==""){ procedi=false; document.getElementById('registrazione').via.focus(); document.getElementById('registrazione').via.className="inviaErrore"; alert("Attenzione! Inserire l'indirizzo"); }else if((document.getElementById('registrazione').cap.value=="")||(isNaN(document.getElementById('registrazione').cap.value))||(document.getElementById('registrazione').cap.value=="undefined")){ procedi=false; document.getElementById('registrazione').cap.focus(); document.getElementById('registrazione').cap.className="inviaErrore"; alert("Attenzione! Inserire il C.A.P."); }else if(document.getElementById('registrazione').privacy[1].checked==true){ procedi=false; alert("Attenzione! Per registrarsi č necessario accettare il trattamento dei dati personali"); } if(procedi==true) { document.getElementById('registrazione').submit(); } } } } } } // Select comune/provincia function select_geografico(provincia, nome_select, tabindex) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?edit=comune&provincia="+provincia+"&tabindex="+tabindex+"&nome_select="+nome_select, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; document.getElementById('div_'+nome_select).innerHTML=resp; } } } } // Select comune/provincia ricerca agenzia function select_geografico_agenzie(provincia, comune_selezionato, nome_select, tabindex) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?edit=comune&provincia="+provincia+"&tabindex="+tabindex+"&nome_select="+nome_select+"&comune_selezionato="+comune_selezionato+"&select_vuoto=1", true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; document.getElementById('div_'+nome_select).innerHTML=resp; } } } } // Select comune/provincia ricerca agenzia function select_geografico_agenzie_02(provincia, comune_selezionato, nome_select, tabindex, punti) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', punti+"include/ajax.php?edit=comune&provincia="+provincia+"&tabindex="+tabindex+"&nome_select="+nome_select+"&comune_selezionato="+comune_selezionato+"&select_vuoto=1", true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; document.getElementById('div_'+nome_select).innerHTML=resp; } } } } // suggestion in home page var myAjax = ajax(); function ajax() { var ajax = null; if (window.XMLHttpRequest) { try { ajax = new XMLHttpRequest(); } catch(e) {} } else if (window.ActiveXObject) { try { ajax = new ActiveXObject("Msxm12.XMLHTTP"); } catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } return ajax; } function request(str) { if(str.length>3) { myAjax.open("POST", "./include/request_comuni.php"); myAjax.onreadystatechange = result; myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); myAjax.send("search="+str); } // Iposto a 0 il label per la visualizzazione e nascondo gli altri select document.getElementById('ricerca_comune').label_prezzo_da.value="0"; document.getElementById('ricerca_comune').label_prezzo_a.value="0"; document.getElementById('ricerca_comune').label_tipo_immobile.value="0"; document.getElementById('prezzo_da_div').style.display='none'; document.getElementById('prezzo_a_div').style.display='none'; document.getElementById('tipo_immobile_div').style.display='none'; } function request02(str) { if(str.length>3) { myAjax.open("POST", "../include/request_comuni.php"); myAjax.onreadystatechange = result; myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); myAjax.send("search="+str); } } function result() { if (myAjax.readyState == 4) { var liste = myAjax.responseText; var cible = document.getElementById('tag_update').innerHTML = liste; document.getElementById('tag_update').style.display = "block"; } } function selected(choice) { var cible = document.getElementById('s'); cible.value = choice; document.getElementById('tag_update').style.display = "none"; } // Fine suggestion in home page // Cambia la classe al campo comune_etichetta quando compilato function cambia_classe() { document.getElementById('ricerca_comune').comune_etichetta.className="home02"; } // Riscrive "As Es. Treviso" nel campo comune_etichetta se lasciato vuoto function controlla_comune() { if(document.getElementById('ricerca_comune').comune_etichetta.value=="") { document.getElementById('ricerca_comune').comune_etichetta.className="home"; document.getElementById('ricerca_comune').comune_etichetta.value="Ad es: Treviso"; } } function nascondi_div(valore) { document.getElementById(valore).style.display="none"; } function mostra_select(valore) { var procedi=false; if(valore=='prezzo_da_div') { if(document.getElementById('ricerca_comune').label_prezzo_da.value==0) { var mostra="prezzo_da_div"; var nascondi="prezzo_a_div"; var nascondi_02="tipo_immobile_div"; var nascondi_03="numero_camere_a_div"; var nascondi_04="numero_camere_da_div"; document.getElementById('ricerca_comune').label_prezzo_da.value="1"; document.getElementById('ricerca_comune').label_prezzo_a.value="0"; document.getElementById('ricerca_comune').label_tipo_immobile.value="0"; document.getElementById('ricerca_comune').label_numero_camere_a.value="0"; document.getElementById('ricerca_comune').label_numero_camere_da.value="0"; procedi=true; }else{ document.getElementById('prezzo_da_div').style.display='none'; procedi=false; document.getElementById('ricerca_comune').label_prezzo_da.value="0"; } }else if(valore=='prezzo_a_div'){ if(document.getElementById('ricerca_comune').label_prezzo_a.value==0) { var mostra="prezzo_a_div"; var nascondi="prezzo_da_div"; var nascondi_02="tipo_immobile_div"; var nascondi_03="numero_camere_a_div"; var nascondi_04="numero_camere_da_div"; document.getElementById('ricerca_comune').label_prezzo_a.value="1"; document.getElementById('ricerca_comune').label_prezzo_da.value="0"; document.getElementById('ricerca_comune').label_tipo_immobile.value="0"; document.getElementById('ricerca_comune').label_numero_camere_a.value="0"; document.getElementById('ricerca_comune').label_numero_camere_da.value="0"; procedi=true; }else{ document.getElementById('prezzo_a_div').style.display='none'; procedi=false; document.getElementById('ricerca_comune').label_prezzo_a.value="0"; } }else if(valore=="tipo_immobile_div"){ if(document.getElementById('ricerca_comune').label_tipo_immobile.value==0) { var nascondi="prezzo_a_div"; var nascondi_02="prezzo_da_div"; var mostra="tipo_immobile_div"; var nascondi_03="numero_camere_a_div"; var nascondi_04="numero_camere_da_div"; document.getElementById('ricerca_comune').label_tipo_immobile.value="1"; document.getElementById('ricerca_comune').label_prezzo_da.value="0"; document.getElementById('ricerca_comune').label_prezzo_a.value="0"; document.getElementById('ricerca_comune').label_numero_camere_a.value="0"; document.getElementById('ricerca_comune').label_numero_camere_da.value="0"; procedi=true; }else{ document.getElementById('tipo_immobile_div').style.display='none'; procedi=false; document.getElementById('ricerca_comune').label_tipo_immobile.value="0"; } }else if(valore=='numero_camere_a_div'){ if(document.getElementById('ricerca_comune').label_numero_camere_a.value==0) { var mostra="numero_camere_a_div"; var nascondi="prezzo_da_div"; var nascondi_02="tipo_immobile_div"; var nascondi_03="prezzo_a_div"; var nascondi_04="numero_camere_da_div"; document.getElementById('ricerca_comune').label_prezzo_a.value="0"; document.getElementById('ricerca_comune').label_prezzo_da.value="0"; document.getElementById('ricerca_comune').label_tipo_immobile.value="0"; document.getElementById('ricerca_comune').label_numero_camere_a.value="1"; document.getElementById('ricerca_comune').label_numero_camere_da.value="0"; procedi=true; }else{ document.getElementById('numero_camere_a_div').style.display='none'; procedi=false; document.getElementById('ricerca_comune').label_numero_camere_a.value="0"; } }else if(valore=='numero_camere_da_div'){ if(document.getElementById('ricerca_comune').label_numero_camere_da.value==0) { var mostra="numero_camere_da_div"; var nascondi="prezzo_da_div"; var nascondi_02="tipo_immobile_div"; var nascondi_03="numero_camere_a_div"; var nascondi_04="prezzo_a_div"; document.getElementById('ricerca_comune').label_prezzo_a.value="0"; document.getElementById('ricerca_comune').label_prezzo_da.value="0"; document.getElementById('ricerca_comune').label_tipo_immobile.value="0"; document.getElementById('ricerca_comune').label_numero_camere_a.value="0"; document.getElementById('ricerca_comune').label_numero_camere_da.value="1"; procedi=true; }else{ document.getElementById('numero_camere_da_div').style.display='none'; procedi=false; document.getElementById('ricerca_comune').label_numero_camere_da.value="0"; } } if(procedi==true) { document.getElementById(mostra).style.display='block'; document.getElementById(nascondi).style.display='none'; document.getElementById('tag_update').style.display='none'; document.getElementById(nascondi_02).style.display='none'; document.getElementById(nascondi_03).style.display='none'; document.getElementById(nascondi_04).style.display='none'; } } function tipo_immobile_func(valore, valore_testuale) { document.getElementById('ricerca_comune').tipo_immobile.value=valore; if(valore!="") { document.getElementById('tipo_immobile_span').innerHTML=valore_testuale; }else{ document.getElementById('tipo_immobile_span').innerHTML="Seleziona"; } document.getElementById('tipo_immobile_div').style.display="none"; } function salva_prezzo_da(valore) { document.getElementById('ricerca_comune').prezzo_da.value=valore; if(valore!="") { document.getElementById('prezzo_da_span').innerHTML="€ "+valore; }else{ document.getElementById('prezzo_da_span').innerHTML="da"; } document.getElementById('prezzo_da_div').style.display="none"; } function salva_prezzo_a(valore) { document.getElementById('ricerca_comune').prezzo_a.value=valore; if(valore!="") { document.getElementById('prezzo_a_span').innerHTML="€ "+valore; }else{ document.getElementById('prezzo_a_span').innerHTML="a"; } document.getElementById('prezzo_a_div').style.display="none"; } function salva_numero_camere_da(valore) { document.getElementById('ricerca_comune').numero_camere_da.value=valore; if(valore!="") { document.getElementById('numero_camere_da_span').innerHTML=valore; }else{ document.getElementById('numero_camere_da_span').innerHTML="da"; } document.getElementById('numero_camere_da_div').style.display="none"; } function salva_numero_camere_a(valore) { document.getElementById('ricerca_comune').numero_camere_a.value=valore; if(valore!="") { document.getElementById('numero_camere_a_span').innerHTML=valore; }else{ document.getElementById('numero_camere_a_span').innerHTML="da"; } document.getElementById('numero_camere_a_div').style.display="none"; } function carica_vetrina(partenza) { document.getElementById('vetrina_home').innerHTML="
"; var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?edit=vetrina_home&partenza="+partenza, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; document.getElementById('vetrina_home').innerHTML=resp; } } } } // FUNZIONE PER AJAX IN BASE AL BROWSER function getXmlHttpObject() { var xmlHttp=null; try { //Firefox e Opera xmlHttp=new XMLHttpRequest(); } catch(e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }