function calcolo_statistiche(codice_cliente, codice_provincia, portale_provenienza) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?aggiorna_statistiche=1&codice_cliente="+codice_cliente+"&codice_provincia_utente="+codice_provincia+"&portale_provenienza="+portale_provenienza, 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("statistiche").innerHTML=resp; } } } } // Funzione per contare il numero di caratteri per il campo testoVetrineMobili function getObject(obj) { var theObj; if(document.all) { if(typeof obj=="string") { return document.all(obj); } else { return obj.style; } } if(document.getElementById) { if(typeof obj=="string") { return document.getElementById(obj); } else { return obj.style; } } return null; } function Count(entrada,salida,texto,caracteres) { var entradaObj=getObject(entrada); var salidaObj=getObject(salida); var longitud=caracteres - entradaObj.value.length; if(longitud <= 0) { longitud=0; texto=' '+texto+' '; entradaObj.value=entradaObj.value.substr(0,caracteres); } salidaObj.innerHTML = texto.replace("{CHAR}",longitud); } function uncheck(cosa) { nomecheck=cosa+'_NO'; if(document.getElementById(nomecheck).checked) { var w = document.getElementsByTagName('input'); for(var i = 0; i < w.length; i++) { if(w[i].type=='checkbox' && w[i].name.indexOf("_NO")==-1 && w[i].name.indexOf(cosa)>-1) { w[i].checked = false; } } if(cosa=="cerco") { document.getElementById("tipo_proposta_cerco").disabled=true; } else if(cosa=="offro") { document.getElementById("tipo_proposta_offro").disabled=true; } } else { if(cosa=="cerco") { document.getElementById("tipo_proposta_cerco").disabled=false; } else if(cosa=="offro") { document.getElementById("tipo_proposta_offro").disabled=false; } } } function checktutte(cosa) { var w = document.getElementsByTagName('input'); for(var i = 0; i < w.length; i++) { if(w[i].type=='checkbox' && w[i].name.indexOf("_NO")==-1 && w[i].name.indexOf(cosa)>-1) { w[i].checked = true; } if(w[i].name.indexOf("_NO")>-1) { w[i].checked = false; } } if(cosa=="cerco") { document.getElementById("tipo_proposta_cerco").disabled=false; document.getElementById("tipo_proposta_cerco").options[0].selected = true; } else if(cosa=="offro") { document.getElementById("tipo_proposta_offro").disabled=false; document.getElementById("tipo_proposta_offro").options[0].selected = true; } } function salva_vetrine_mobili(codice_inserzione, valore, step) { if(valore==0) { if(step=="") { document.getElementById('label_vetrina_mobile_'+codice_inserzione).innerHTML=""; }else if(step=="alert"){ document.getElementById('label_vetrina_mobile_'+codice_inserzione).innerHTML="
Annuncio non conforme alle impostazioni dei monitor

Modifica le impostazioni dei monitor per poterlo selezionare
"; } }else if(valore==1){ document.getElementById('label_vetrina_mobile_'+codice_inserzione).innerHTML="Annuncio correttamente pubblicato"; } var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?salva_vetrine_mobili=1&valore="+valore+"&codice_inserzione="+codice_inserzione, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { if(valore==1) { var resp = xmlHttp.responseText; document.getElementById("label_vetrina_mobile_"+codice_inserzione).innerHTML="Annuncio correttamente pubblicato"+resp; } } } } } function conta_click_corriere() { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?conta_click_corriere=1', true); xmlHttp.send(null); } function controllo_utente(testobreve,testorubrica) { if(document.formAnnuncio.InserzionistaPrivato.value==0) { controlla_rif_agenzia_submit(testobreve,testorubrica); } else { verificaAnnuncio(testobreve,testorubrica); } } function controlla_rif_agenzia_submit(testobreve,testorubrica) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?edit=valida_rif_agenzia&rif_agenzia='+document.formAnnuncio.rif_agenzia.value+'&codice_inserzione='+document.formAnnuncio.codice_inserzione.value+'&codice_cliente='+document.formAnnuncio.codice_cliente.value, 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) { alert("ATTENZIONE:Il codice riferimento agenzia e' duplicato"); //document.formAnnuncio.rif_agenzia.className="evidenza"; //document.formAnnuncio.rif_agenzia.style.backgroundColor="#caf0ff"; //document.formAnnuncio.rif_agenzia.style.fontWeight="bold"; document.formAnnuncio.rif_agenzia.focus(); return false; } else { verificaAnnuncio(testobreve,testorubrica); } } } } } function valida_rif_agenzia(rif_agenzia,codice_inserzione,codice_cliente) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?edit=valida_rif_agenzia&rif_agenzia='+rif_agenzia+'&codice_inserzione='+codice_inserzione+'&codice_cliente='+codice_cliente, 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('alert_rif_agenzia').innerHTML="ATTENZIONE:codice riferimento duplicato
Assegna il codice annuncio"; document.getElementById('alert_rif_agenzia').style.display="block"; } else if(resp==0) { document.getElementById('alert_rif_agenzia').innerHTML=""; document.getElementById('alert_rif_agenzia').style.display="none"; } } } } } function imposta_rif_agenzia(codice_inserzione) { if(codice_inserzione===undefined) { codice_inserzione='XXXXXXXXXX' } document.getElementById('rif_agenzia').value=codice_inserzione; document.getElementById('alert_rif_agenzia').innerHTML=""; } function compila_camere(tipologia_immobile) { if(tipologia_immobile==15) { num_option=document.getElementById('numero_camere').options.length; for(a=num_option;a>=0;a--) { document.getElementById('numero_camere').options[a]=null; } for(a=0;a<2;a++) { document.getElementById('numero_camere').options[a]=new Option('',a,false,false); document.getElementById('numero_camere').options[a].innerHTML = a; } document.formAnnuncio.numero_camere.selectedIndex=1; document.formAnnuncio.numero_camere_bis.value=1; document.formAnnuncio.numero_camere.disabled=true; } else if(tipologia_immobile==16) { num_option=document.getElementById('numero_camere').options.length; for(a=num_option;a>=0;a--) { document.getElementById('numero_camere').options[a]=null; } for(a=0;a<3;a++) { document.getElementById('numero_camere').options[a]=new Option('',a,false,false); document.getElementById('numero_camere').options[a].innerHTML = a; } document.formAnnuncio.numero_camere.selectedIndex=2; document.formAnnuncio.numero_camere_bis.value=2; document.formAnnuncio.numero_camere.disabled=true; } else if(tipologia_immobile==17) { num_option=document.getElementById('numero_camere').options.length; for(a=num_option;a>=0;a--) { document.getElementById('numero_camere').options[a]=null; } for(a=0;a<4;a++) { document.getElementById('numero_camere').options[a]=new Option('',a,false,false); document.getElementById('numero_camere').options[a].innerHTML = a; } document.formAnnuncio.numero_camere.selectedIndex=3; document.formAnnuncio.numero_camere_bis.value=3; document.formAnnuncio.numero_camere.disabled=true; } else if(tipologia_immobile==18) { //preparo le camere da 4 a 99 num_option=document.getElementById('numero_camere').options.length; for(a=num_option;a>=0;a--) { document.getElementById('numero_camere').options[a]=null; } for(a=0;a<96;a++) { b=a+4 document.getElementById('numero_camere').options[a]=new Option('',b,false,false); document.getElementById('numero_camere').options[a].innerHTML = b; } document.formAnnuncio.numero_camere.selectedIndex=0; document.formAnnuncio.numero_camere.disabled=false; } else { for(a=0;a<99;a++) { document.getElementById('numero_camere').options[a]=new Option('',a,false,false); if(a==0) { document.getElementById('numero_camere').options[a].innerHTML = "Seleziona"; } else { document.getElementById('numero_camere').options[a].innerHTML = a; } if(a==document.formAnnuncio.numero_camere_old.value) { document.getElementById('numero_camere').options[a].selected=true; } } document.formAnnuncio.numero_camere.disabled=false; } } function compila_ipe(classe_energetica) { if(document.formAnnuncio.classe_energetica.value=="122") { //a++ document.formAnnuncio.ipe.value=15; } else if(document.formAnnuncio.classe_energetica.value=="123") { //a document.formAnnuncio.ipe.value=35; } else if(document.formAnnuncio.classe_energetica.value=="124") { //b document.formAnnuncio.ipe.value=50; } else if(document.formAnnuncio.classe_energetica.value=="125") { //c document.formAnnuncio.ipe.value=75; } else if(document.formAnnuncio.classe_energetica.value=="126") { //d document.formAnnuncio.ipe.value=100; } else if(document.formAnnuncio.classe_energetica.value=="127") { //e document.formAnnuncio.ipe.value=125; } else if(document.formAnnuncio.classe_energetica.value=="128") { //f document.formAnnuncio.ipe.value=150; } else if(document.formAnnuncio.classe_energetica.value=="129") { //g document.formAnnuncio.ipe.value=175; } else if(document.formAnnuncio.classe_energetica.value=="130") { //ns document.formAnnuncio.ipe.value=""; } } function misura_ipe(tipologia_immobile) { if(tipologia_immobile==15 || tipologia_immobile==16 || tipologia_immobile==17 || tipologia_immobile==18 || tipologia_immobile==19 || tipologia_immobile==20 || tipologia_immobile==22 || tipologia_immobile==24 || tipologia_immobile==25 || tipologia_immobile==26) { document.getElementById('misura_ipe').innerHTML = " kWh/mq annui"; } else if(tipologia_immobile==21 || tipologia_immobile==23 || tipologia_immobile==27) { document.getElementById('misura_ipe').innerHTML = " kWh/mc annui"; } } function pubblica_per_riviste(codice_inserzione, codice_cliente) { var campo="pubblica_valore_"+codice_inserzione; var nomeForm="pubblica_form_"+codice_inserzione; var valore_definitivo=(eval("document."+nomeForm+"."+campo+".value")); var valore_get=0; if(valore_definitivo=="0") { eval("document."+nomeForm+"."+campo+".value=1"); valore_get=1; }else{ eval("document."+nomeForm+"."+campo+".value=0"); } var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', "./include/ajax.php?edit=seleziona_annuncio_export&codice_inserzione="+codice_inserzione+"&valore="+valore_get+"&codice_cliente="+codice_cliente, true); xmlHttp.send(null); } function restrictinput(maxlength,e,placeholder) { if (window.event&&event.srcElement.value.length>=maxlength) return false else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength) { var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys if (pressedkey.test(String.fromCharCode(e.which))) e.stopPropagation() } } function ContoMaiuscole(testo,etichetta_campo) { var contatore=0; var percentuale=parseInt(testo.length*0.1); for (var i = 0 ; ipercentuale) { alert ("ATTENZIONE:Inserire il campo "+etichetta_campo+" rigorosamente in minuscolo."); return false; } else { var contatore1=0; for (var i = 0 ; i2) { alert ("ATTENZIONE:Inserire il campo "+etichetta_campo+" rigorosamente in minuscolo."); return false; } } return true; } } function displaylimit(thename, theid, thelimit) { var theform=theid!=""? document.getElementById(theid) : thename var numero_caratteri; //alert(eval(thename).value.length); if(eval(thename).value.length==0) { numero_caratteri=thelimit; } else { numero_caratteri=thelimit-(eval(thename).value.length); } var limit_text='Hai ancora '+numero_caratteri+' caratteri disponibili' if (document.all||ns6) document.write(limit_text) if (document.all) { eval(theform).onkeypress=function() { return restrictinput(thelimit,event,theform) } eval(theform).onkeyup=function() { countlimit(thelimit,event,theform) } } else if (ns6) { document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); document.body.addEventListener('keyup', function(event) {countlimit(thelimit,event,theform) }, true); } } function countlimit(maxlength,e,placeholder) { var theform=eval(placeholder) var lengthleft=maxlength-theform.value.length var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder) if (window.event||e.target&&e.target==eval(placeholder)) { if(lengthleft<0) { //theform.value=theform.value.substring(0,maxlength); } if (lengthleft<0) { //alert ("ATTENZIONE:E' stato raggiunto il massimo dei caratteri consentiti."); placeholderobj.innerHTML=""+lengthleft+""; } else { placeholderobj.innerHTML=lengthleft } } } // Verifico che sia compilato almeno un campo per la ricerca immobile function verificaRicerca(riviste) { // Riviste indica se l'utente ha o meno la pubblicazione // In base a questo parametro gestisco la verifica if(riviste==0) { if((document.ricerca.tipo_proposta.value=="")&&(document.ricerca.codice_inserzione.value=="")&&(document.ricerca.rif_agenzia.value=="")&&(document.ricerca.tipo_immobile.value=="")&&(document.ricerca.codice_provincia_inserzione.value=="")&&(document.ricerca.codice_comune_inserzione.value=="")&&(document.ricerca.attivo.value=="")&&(document.ricerca.prezzo_a.value=="")&&(document.ricerca.prezzo_da.value=="")) { alert("Selezionare almeno un parametro per la ricerca"); }else{ document.ricerca.submit(); } }else{ if((document.ricerca.tipo_proposta.value=="")&&(document.ricerca.codice_inserzione.value=="")&&(document.ricerca.rif_agenzia.value=="")&&(document.ricerca.tipo_immobile.value=="")&&(document.ricerca.codice_provincia_inserzione.value=="")&&(document.ricerca.codice_comune_inserzione.value=="")&&(document.ricerca.attivo.value=="")&&(document.ricerca.pubblicato_su.value=="")&&(document.ricerca.prezzo_a.value=="")&&(document.ricerca.prezzo_da.value=="")) { alert("Selezionare almeno un parametro per la ricerca"); }else{ document.ricerca.submit(); } } } // Verifico la correttezza dei dati inseriti. function verificaAnnuncio(testobreve,testorubrica) { procedi=true; /*document.formAnnuncio.codice_provincia_inserzione.className="evidenza02"; document.formAnnuncio.codice_comune_inserzione.className="evidenza02"; document.formAnnuncio.tipo_immobile.className="evidenza02"; document.formAnnuncio.prezzo.className="evidenza02";*/ /* if(document.formAnnuncio.rif_agenzia.value=="" && document.formAnnuncio.InserzionistaPrivato.value=="0"){ procedi=false; alert("Inserire il Codice riferimento agenzia"); //document.formAnnuncio.rif_agenzia.className="evidenza"; document.formAnnuncio.rif_agenzia.focus(); }else */ if(document.formAnnuncio.codice_provincia_inserzione.value==""){ procedi=false; alert("Selezionare la provincia"); //document.formAnnuncio.codice_provincia_inserzione.className="evidenza"; document.formAnnuncio.codice_provincia_inserzione.focus(); }else if(document.formAnnuncio.codice_comune_inserzione.value==""){ procedi=false; alert("Selezionare il comune"); //document.formAnnuncio.codice_comune_inserzione.className="evidenza"; document.formAnnuncio.codice_comune_inserzione.focus(); }else if((document.formAnnuncio.prezzo.value=="" || document.formAnnuncio.prezzo.value=="0") && document.formAnnuncio.info_in_agenzia[0].checked){ procedi=false; alert("E' necessario inserire il prezzo per pubblicare l'annuncio su Casa.it"); //document.formAnnuncio.prezzo.className="evidenza"; document.formAnnuncio.prezzo.focus(); }else if(document.formAnnuncio.tipo_immobile.value==""){ procedi=false; alert("Selezionare la tipologia"); //document.formAnnuncio.tipo_immobile.className="evidenza"; document.formAnnuncio.tipo_immobile.focus(); }else if(document.formAnnuncio.numero_camere.value=="" || document.formAnnuncio.numero_camere.value=="0"){ //il numero di camere è obbligatorio //solo se l'immobile è un residenziale(categorie 15/16/17/18/19/20/24/25/26) if(document.formAnnuncio.tipo_immobile.value=="15" || document.formAnnuncio.tipo_immobile.value=="16" || document.formAnnuncio.tipo_immobile.value=="17" || document.formAnnuncio.tipo_immobile.value=="18" || document.formAnnuncio.tipo_immobile.value=="19" || document.formAnnuncio.tipo_immobile.value=="20" || document.formAnnuncio.tipo_immobile.value=="24" || document.formAnnuncio.tipo_immobile.value=="25" || document.formAnnuncio.tipo_immobile.value=="26") { procedi=false; alert("Per gli immobili residenziali il numero di camere e' obbligatorio"); //document.formAnnuncio.numero_camere.className="evidenza"; document.formAnnuncio.numero_camere.focus(); } }else if(document.formAnnuncio.superficie.value=="" || document.formAnnuncio.superficie.value=="0"){ //la superficie è obbligatoria //solo se l'immobile è un residenziale(categorie 15/16/17/18/19/20/24/25/26) if(document.formAnnuncio.tipo_immobile.value=="15" || document.formAnnuncio.tipo_immobile.value=="16" || document.formAnnuncio.tipo_immobile.value=="17" || document.formAnnuncio.tipo_immobile.value=="18" || document.formAnnuncio.tipo_immobile.value=="19" || document.formAnnuncio.tipo_immobile.value=="20" || document.formAnnuncio.tipo_immobile.value=="24" || document.formAnnuncio.tipo_immobile.value=="25" || document.formAnnuncio.tipo_immobile.value=="26") { procedi=false; alert("Per gli immobili residenziali la superficie e' obbligatoria"); //document.formAnnuncio.superficie.className="evidenza"; document.formAnnuncio.superficie.focus(); } }else if(document.formAnnuncio.prezzo.value!=""){ //cerco se è presente alla fine della stringa il ,00 e lo rimuovo if(document.formAnnuncio.prezzo.value.indexOf(',00')!="-1" && document.formAnnuncio.prezzo.value.indexOf(',00')==document.formAnnuncio.prezzo.value.substring(0,document.formAnnuncio.prezzo.value.indexOf(',00')).length && document.formAnnuncio.prezzo.value.length-3==document.formAnnuncio.prezzo.value.indexOf(',00')){ document.formAnnuncio.prezzo.value=document.formAnnuncio.prezzo.value.substring(0,document.formAnnuncio.prezzo.value.indexOf(',00')); } //cerco se è presente alla fine della stringa il .00 e lo rimuovo if(document.formAnnuncio.prezzo.value.indexOf('.00')!="-1" && document.formAnnuncio.prezzo.value.indexOf('.00')==document.formAnnuncio.prezzo.value.substring(0,document.formAnnuncio.prezzo.value.indexOf('.00')).length && document.formAnnuncio.prezzo.value.length-3==document.formAnnuncio.prezzo.value.indexOf('.00')){ document.formAnnuncio.prezzo.value=document.formAnnuncio.prezzo.value.substring(0,document.formAnnuncio.prezzo.value.indexOf('.00')); } //rimuovo la restante punteggiatura document.formAnnuncio.prezzo.value=document.formAnnuncio.prezzo.value.replace(/\./g,""); document.formAnnuncio.prezzo.value=document.formAnnuncio.prezzo.value.replace(/\,/g,""); //ora controllo se il prezzo è compatibile con la tipologia scelta //ovvero avviso se è un affitto residenziale sopra i 15000 euro //oppure se è una vendita inferiore a 20000 euro escludendo il garage //se il flag doppia_conferma_prezzo vale 0,se vale 1 vuol dire che confermo il prezzo inserito if(document.formAnnuncio.doppia_conferma_prezzo.value==0) { document.formAnnuncio.doppia_conferma_prezzo.value=1; if(document.formAnnuncio.prezzo.value>15001 && document.formAnnuncio.tipo_proposta[0].checked && (document.formAnnuncio.tipo_immobile.value=="25" || document.formAnnuncio.tipo_immobile.value=="15" || document.formAnnuncio.tipo_immobile.value=="16" || document.formAnnuncio.tipo_immobile.value=="17" || document.formAnnuncio.tipo_immobile.value=="18" || document.formAnnuncio.tipo_immobile.value=="19" || document.formAnnuncio.tipo_immobile.value=="20" || document.formAnnuncio.tipo_immobile.value=="24" || document.formAnnuncio.tipo_immobile.value=="26")) { alert ("Attenzione : inserito prezzo superiore ai 15000 euro per un affitto residenziale,controllare se e' corretto"); procedi=false; document.formAnnuncio.prezzo.className="evidenza"; document.formAnnuncio.prezzo.focus(); } else if(document.formAnnuncio.prezzo.value<20000 && document.formAnnuncio.prezzo.value>0 && document.formAnnuncio.tipo_proposta[1].checked && document.formAnnuncio.tipo_immobile.value!="22") { alert ("Attenzione : inserito prezzo inferiore ai 20000 euro per una vendita,controllare se e' corretto"); procedi=false; //document.formAnnuncio.prezzo.className="evidenza"; document.formAnnuncio.prezzo.focus(); } } } if(testobreve=="1"){ if(!ContoMaiuscole(document.formAnnuncio.TestoBreve.value,'Descrizione per Fotocase24')){ procedi=false; }else{ var testo_obj=document.getElementById("TestoBreve"); var testo=testo_obj.value; if(testo.length>190) { alert ("ATTENZIONE:E' stato raggiunto il massimo dei caratteri consentiti per il campo Descrizione per Fotocase24."); procedi=false; } } } if(testorubrica=="1"){ if(!ContoMaiuscole(document.formAnnuncio.TestoRubrica.value,'Descrizione per Rubriche')){ procedi=false; }else{ var testo_obj=document.getElementById("TestoRubrica"); var testo=testo_obj.value; if(testo.length>260) { alert ("ATTENZIONE:E' stato raggiunto il massimo dei caratteri consentiti per il campo Descrizione per Rubriche."); procedi=false; } } } if(procedi==true) { document.formAnnuncio.submit(); } } // Visualizza la tabella con gli optional function optional() { if(document.formAnnuncio.optional_valore.value==0){ document.getElementById("div_optional").style.display="block"; document.getElementById("optional_valore").value="1"; }else{ document.getElementById("div_optional").style.display="none"; document.getElementById("optional_valore").value="0"; } } function select_zone(zona_selezionata,codice_comune_inserzione,tabindex) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?edit=select_zona&zona_selezionata='+zona_selezionata+'&codice_comune_inserzione='+codice_comune_inserzione+'&tabindex='+tabindex, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; // Creo il div con dentro il select della zona var option = document.createElement("div"); option.value = resp; $update("div_select", option.value); } } } } // crea il select comuni function select_geografico(etichetta, valore_etichetta, valore_selezionato, zona, tabindex) { var xmlHttp = getXmlHttpObject(); xmlHttp.open("GET", "./include/ajax.php?funzione=select_geografico&etichetta="+etichetta+"&zona="+zona+"&valore_etichetta="+valore_etichetta+"&valore_selezionato="+valore_selezionato+"&tabindex="+tabindex, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; $update("div_geografico", resp); $nascondi("div_geografico_vuoto"); $visualizza("div_geografico"); } } } } function select_order_direction(order_by,order_direction) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', 'include/ajax.php?edit=select_order_direction&order_by='+order_by+'&order_direction='+order_direction, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var resp = xmlHttp.responseText; // Creo il div con dentro il select dell'order_direction if(resp) { var option = document.createElement("div"); option.value = resp; document.getElementById('div_select_order_direction').innerHTML=option.value; } } else { alert(xmlHttp.responseText); } } } } // Funzione per la cancellazione delle foto function editPics(codice_utente, codice_inserzione, edit) { var a=confirm("Cancellare la foto?"); if(a) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?action=delete_pics&codice_utente='+codice_utente+'&codice_inserzione='+codice_inserzione+'&edit='+edit, true); xmlHttp.send(null); $nascondi('immagine_foto_'+edit); $nascondi('bottone_foto_'+edit); $visualizza('cancellata_'+edit); } } // Funzione per la cancellazione delle foto function ruota_immagine(codice_utente, codice_inserzione, edit) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?action=ruota_immagine&codice_utente='+codice_utente+'&codice_inserzione='+codice_inserzione+'&edit='+edit, 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('immagine_foto_'+edit).src= resp; } } } } // Visualizza il form di login nella pagina login.php function visualizza_form() { $visualizza('visualizza_form_login'); } // ACCESSO AREA RISERVATA // Funzione per la verifica della login richiamata da verifica_login() function avvia_login(usr, password, ricorda_password) { var xmlHttp = getXmlHttpObject(); password=password.replace("+", "XXXX"); xmlHttp.open('GET', 'area_clienti/include/ajax.php?tabella=utenti&username='+usr+'&password='+password+"&ricorda_password="+ricorda_password, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var res = xmlHttp.responseText; if(res) { // se feedback = 0 login + sessione + redirect var feedback=res; if(feedback==0) { location.href = "area_clienti/index.php"; }else if(feedback==1){ // feedback = 1 - Dati errati alert("ATTENZIONE!! Verificare i dati inseriti"); }else if(feedback==2){ // feedback = 2 - Account scaduto alert("ATTENZIONE! Account scaduto. Contattare l'assistenza"); }else{ alert("ATTENZIONE! Account non attivo. Contattare l'assistenza"); } } } } } } function verifica_login(id) { var procedi=true; document.getElementById('formLogin_'+id).username.className="areaRis02"; document.getElementById('formLogin_'+id).pwd.className="areaRis02"; var usr=document.getElementById('formLogin_'+id).username.value; var password=document.getElementById('formLogin_'+id).pwd.value; if(document.getElementById('formLogin_'+id).username.value=="") { procedi=false; document.getElementById('formLogin_'+id).username.focus(); document.getElementById('formLogin_'+id).username.className="areaRis02Errore"; alert("ATTENZIONE! Inserire l'username"); }else if(document.getElementById('formLogin_'+id).pwd.value==""){ procedi=false; document.getElementById('formLogin_'+id).pwd.focus(); document.getElementById('formLogin_'+id).pwd.className="areaRis02Errore"; alert("ATTENZIONE! Inserire la password"); } if(document.getElementById('formLogin_'+id).ricorda_dati.checked==true) { ricorda_password="1"; }else{ ricorda_password="0"; } if(procedi==true) { avvia_login(usr, password, ricorda_password); } } // Controllo campi prima di invio e-mail ad assistenza function richiesta_assistenza() { procedi=true; document.assistenza.oggetto.className="evidenza02"; document.assistenza.messaggio.style.background="#ffffff"; if(document.assistenza.oggetto.value=="") { document.assistenza.oggetto.focus(); document.assistenza.oggetto.className="evidenza"; alert("Inserire l'oggetto del messaggio"); procedi=false; }else if(document.assistenza.messaggio.value==""){ document.assistenza.messaggio.focus(); document.assistenza.messaggio.style.background="#caf0ff"; alert("Inserire il testo del messaggio"); procedi=false; } if(procedi==true) { document.assistenza.submit(); } } // Verifica la correttezza dei campi impostati nel profilo prima di salvarli function verificaProfilo() { var procedi; procedi=true; // Setto il valore di default dalle classe degli input document.formProfilo.nome.className="evidenza02"; document.formProfilo.via.className="evidenza02"; document.formProfilo.cap.className="evidenza02"; document.formProfilo.tel.className="evidenza02"; document.formProfilo.email.className="evidenza02"; document.formProfilo.pwd.className="evidenza02"; document.formProfilo.codice_provincia_utente.className="evidenza02"; document.formProfilo.codice_comune_utente.className="evidenza02"; // Verifico la corretta compilazione dei campi. if(document.formProfilo.InserzionistaPrivato.value==0) { if(document.formProfilo.FirmaSms.value.length>25) { alert("ATTENZIONE : il campo FIRMA PER RIVISTA deve essere lungo al massimo 25 caratteri."); procedi=false; }else if(document.formProfilo.tel.value.length>27){ alert("ATTENZIONE : il campo TELEFONO deve essere lungo al massimo 27 caratteri."); procedi=false; } } if(document.formProfilo.nome.value==""){ document.formProfilo.nome.focus(); document.formProfilo.nome.className="evidenza"; alert("Inserire il nome!"); procedi=false; } else if(document.formProfilo.via.value==""){ document.formProfilo.via.focus(); document.formProfilo.via.className="evidenza"; alert("Inserire la via!"); procedi=false; } else if(document.formProfilo.cap.value==""){ document.formProfilo.cap.focus(); document.formProfilo.cap.className="evidenza"; alert("Inserire il CAP!"); procedi=false; } else if(document.formProfilo.tel.value==""){ document.formProfilo.tel.focus(); document.formProfilo.tel.className="evidenza"; alert("Inserire il numero di telefono!"); procedi=false; } else if(document.formProfilo.email.value==""){ document.formProfilo.email.focus(); document.formProfilo.email.className="evidenza"; alert("Inserire l'e-mail!"); procedi=false; } else if(document.formProfilo.pwd.value==""){ document.formProfilo.pwd.focus(); document.formProfilo.pwd.className="evidenza"; alert("Inserire la password"); procedi=false; } else if(document.formProfilo.codice_provincia_utente.value==""){ document.formProfilo.codice_provincia_utente.focus(); document.formProfilo.codice_provincia_utente.className="evidenza"; alert("Selezionare la provincia"); procedi=false; }else if(document.formProfilo.codice_comune_utente.value==""){ document.formProfilo.codice_comune_utente.focus(); document.formProfilo.codice_comune_utente.className="evidenza"; alert("Selezionare la città"); procedi=false; } // Se tutti i campi son compilati correttamente invio il modulo if(procedi==true) { document.formProfilo.submit(); } } //pubblica gli annunci per soluzioneportali function pubblica_sp(parametro,numero_annunci_totali) { var pezzi=parametro.split("_"); var codice_inserzione=pezzi[0]; var codice_cliente=pezzi[1]; var id_portale=pezzi[2]; var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?tabella=annunci_portali_sp&codice_inserzione='+codice_inserzione+'&id_portale='+id_portale+'&codice_cliente='+codice_cliente, true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var annunci_selezionati = xmlHttp.responseText; var numero_annunci=document.getElementById("contatore_annunci_pagina"); for(i=0;i<(numero_annunci.value);i=i+1) { nome_variabile="quantita_"+id_portale+"_"+(i+1); if(numero_annunci_totali>-1) { $update(nome_variabile,annunci_selezionati+" sel. su "+numero_annunci_totali+" disp."); } } if(numero_annunci_totali>-1) { if(numero_annunci_totali<=annunci_selezionati) { //ha selezionato tutti gli annunci disponibili per la testata //devo ciclare tutti i checkbox //e mettere su disabled quelli non checked for(j=0;j<(numero_annunci.value);j=j+1) { id_checkbox=(j+1)+"_"+id_portale; obj_checkbox=document.getElementById(id_checkbox); if(obj_checkbox.checked==false) { obj_checkbox.disabled=true; } } } else { for(j=0;j<(numero_annunci.value);j=j+1) { id_checkbox=(j+1)+"_"+id_portale; obj_checkbox=document.getElementById(id_checkbox); if(obj_checkbox.checked==false && obj_checkbox.disabled==true) { obj_checkbox.disabled=false; } } } } } } } } // Apre il popup function open_scroll(url,w,h) { var zoom; if(zoom) { zoom.close(); } zoom=window.open(url,'pop','height='+h+',width='+w+'location=no,resizable=no,scrollbars=no'); zoom.focus(); } // Apre il popup con scroll function open_scroll_02(url,w,h) { var zoom; if(zoom) { zoom.close(); } zoom=window.open(url,'pop','height='+h+',width='+w+'location=no,resizable=no,scrollbars=yes'); } // Questa funzione apre il div che contiene i campi per la galleria fotografica function galleriaFotografica(){ if(document.formAnnuncio.galleria_valore.value==0){ $visualizza("galleria"); document.formAnnuncio.galleria_valore.value=1; }else{ $nascondi("galleria"); document.formAnnuncio.galleria_valore.value=0; } } // Controlla i campi nel profilo Firma Sms function controlla_campi() { } function confermaeliminatutti() { if (confirm("Confermi l'operazione?Verranno eliminati tutti gli annunci.")) { document.elimina_tutti.submit(); }; } function confermadeseleziona(nomeform) { if (confirm("Confermi l'operazione?Verranno deselezionati tutti gli annunci della testata selezionata.")) { eval('document.'+nomeform+'.submit()'); }; } function confermaseleziona(nomeform) { if (confirm("Confermi l'operazione?Verranno pubblicati tutti gli annunci disponibili sulla testata selezionata.")) { eval('document.'+nomeform+'.submit()'); }; } function confermaseleziona_sp(id_portale,codice_cliente,numero_annunci_totali) { if (confirm("Confermi l'operazione?Verranno pubblicati tutti gli annunci disponibili sul portale selezionato.")) { seleziona_sp(id_portale,codice_cliente,numero_annunci_totali); }; } function seleziona_sp(id_portale,codice_cliente,numero_annunci_totali) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?tabella=annunci_portali_sp&id_portale='+id_portale+'&codice_cliente='+codice_cliente+'&subaz=seleziona_tutti', true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var pezzi=xmlHttp.responseText.split("-"); //il primo pezzo è annunci_selezionati //gli altri sono i checkbox da checkare var annunci_selezionati = pezzi[0]; var numero_annunci=document.getElementById("contatore_annunci_pagina"); for(i=0;i<(numero_annunci.value);i=i+1) { nome_variabile="quantita_"+id_portale+"_"+(i+1); if(numero_annunci_totali>-1) { $update(nome_variabile,annunci_selezionati+" sel. su "+numero_annunci_totali+" disp."); } id_checkbox=(i+1)+"_"+id_portale; obj_checkbox=document.getElementById(id_checkbox); for(j=1;j-1) { if(obj_checkbox.checked==false) { obj_checkbox.disabled=true; } } } } } } } function confermadeseleziona_sp(id_portale,codice_cliente,numero_annunci_totali) { if (confirm("Confermi l'operazione?Verranno deselezionati tutti gli annunci del portale selezionato.")) { deseleziona_sp(id_portale,codice_cliente,numero_annunci_totali); }; } function deseleziona_sp(id_portale,codice_cliente,numero_annunci_totali) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?tabella=annunci_portali_sp&id_portale='+id_portale+'&codice_cliente='+codice_cliente+'&subaz=deseleziona_tutti', true); xmlHttp.onreadystatechange = stateChanged; xmlHttp.send(null); function stateChanged() { if(xmlHttp.readyState == 4) { //Stato OK if (xmlHttp.status == 200) { var numero_annunci=document.getElementById("contatore_annunci_pagina"); for(i=0;i<(numero_annunci.value);i=i+1) { nome_variabile="quantita_"+id_portale+"_"+(i+1); if(numero_annunci_totali>-1) { $update(nome_variabile,"0 sel. su "+numero_annunci_totali+" disp."); } id_checkbox=(i+1)+"_"+id_portale; obj_checkbox=document.getElementById(id_checkbox); obj_checkbox.checked=false; obj_checkbox.disabled=false; } } } } } function check_gestionale(codice_cliente) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?edit=check_gestionale&codice_cliente='+codice_cliente, true); xmlHttp.send(null); } function blocca_sincronizzazione_annuncio(codice_inserzione,bloccato) { var xmlHttp = getXmlHttpObject(); xmlHttp.open('GET', './include/ajax.php?edit=blocca_sincronizzazione&codice_inserzione='+codice_inserzione+'&bloccato='+bloccato, true); xmlHttp.send(null); } var horizontal_offset="9px" //horizontal offset of hint box from anchor link var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change. var ie=document.all var ns6=document.getElementById&&!document.all function getposOffset(what, offsettype) { var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; var parentEl=what.offsetParent; while (parentEl!=null) { totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return totaloffset; } function iecompattest() { return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function clearbrowseredge(obj, whichedge) { var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1 if (whichedge=="rightedge") { var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40 dropmenuobj.contentmeasure=dropmenuobj.offsetWidth if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset) } else { var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 dropmenuobj.contentmeasure=dropmenuobj.offsetHeight if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight } return edgeoffset } function showhint(menucontents, obj, e, tipwidth) { if ((ie||ns6) && document.getElementById("hintbox")) { dropmenuobj=document.getElementById("hintbox") dropmenuobj.innerHTML=menucontents dropmenuobj.style.left=dropmenuobj.style.top=-500 if (tipwidth!="") { dropmenuobj.widthobj=dropmenuobj.style dropmenuobj.widthobj.width=tipwidth } dropmenuobj.x=getposOffset(obj, "left") dropmenuobj.y=getposOffset(obj, "top") dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px" dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px" dropmenuobj.style.visibility="visible" obj.onmouseout=hidetip } } function hidetip(e) { dropmenuobj.style.visibility="hidden" dropmenuobj.style.left="-500px" } function createhintbox() { var divblock=document.createElement("div") divblock.setAttribute("id", "hintbox") document.body.appendChild(divblock) } if (window.addEventListener) { window.addEventListener("load", createhintbox, false) }else if (window.attachEvent){ window.attachEvent("onload", createhintbox) }else if (document.getElementById){ window.onload=createhintbox } /* ADD PER ovviare a problemi con ajax di alcuni browser*/ /* if (typeof(Sys.Browser.WebKit) == "undefined") { Sys.Browser.WebKit = {}; } if (navigator.userAgent.indexOf("WebKit/") > -1) { Sys.Browser.agent = Sys.Browser.WebKit; Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]); Sys.Browser.name = "WebKit"; } */ // FUNZIONE PER AJAX IN BASE AL BROWSER // la funziona sottostante sostituisce quella usata in precedenza commentata sotto. function getXmlHttpObject() { var xmlhttp = false; var XMLHttpFactories = [ function () {return new XMLHttpRequest()}, function () {return new ActiveXObject("Msxml2.XMLHTTP")}, function () {return new ActiveXObject("Msxml3.XMLHTTP")}, function () {return new ActiveXObject("Microsoft.XMLHTTP")} ]; for (var i=0;i