function controllo_passaggio_default() { if (location.href==top.location.href){location.href="../home/default.asp"} } //------------------------------------------------------------ function carica_iframe_corpo(link) { if(link==""){return} top.document.getElementById('corpo').src=link } //------------------------------------------------------------ function verifica_cookie() { Nome="TEMP" Dato="xyzrq" Dati=Dato+"\t" Str = Nome + "="+ escape(Dati) Str += "; path=/" document.cookie = Str t=false if (EstraeCampo(LeggiCookie(Nome),1)==Dato){t=true} return t } //------------------------------------------------------------ function pagine(direzione) { PAGINA=PAGINA-0 NUMERO_PAGINE=NUMERO_PAGINE-0 if (direzione==">"){PAGINA=PAGINA+1} if (direzione=="<"){PAGINA=PAGINA-1} if (direzione==">>"){PAGINA=NUMERO_PAGINE} if (direzione=="<<"){PAGINA=1} if (direzione==""){PAGINA=stringa_pulizia(prompt("Vai a pagina",""),"0123456789")-0} if (PAGINA<=0){PAGINA=1} if (PAGINA>NUMERO_PAGINE){PAGINA=NUMERO_PAGINE} locazione=stringa_prima(location.href) + "?ID="+ ID + "&PAGINA=" + PAGINA //alert (locazione) location.href=locazione } //------------------------------------------------------------ function chiudi_iframe_sopra() { top.document.getElementById('sopra').height=0 //top.document.getElementById('corpo').height=top.corpo.document.body.scrollHeight top.scrollTo(0,0) } //------------------------------------------------------------ function carica_sito(link) { if(link==""){return} window.open(link) top.scrollTo(0,0) } //------------------------------------------------------------ function carica_iframe_sopra(link) { if(link==""){return} //top.document.getElementById('corpo').height=0 top.document.getElementById('sopra').src=link top.scrollTo(0,0) } //------------------------------------------------------------ function stringa_dopo(par) { x=unescape(par) p=x.indexOf('?') y="" if (p>=0){y=x.substring(p+1)} return y } //------------------------------------------------------------ function stringa_prima(par) { x=unescape(par) p=x.indexOf('?') y=x if (p>=0){y=x.substring(0,p)} return y } //------------------------------------------------------------ function dimensiona_iframe() { m=0 //alert("0 - "+self.document.title+"\n"+self.name) if (self!=top) { //alert("1 - "+parent.self.document.title+"\n"+parent.self.name) parent.self.document.getElementById(self.name).height=1 parent.self.document.getElementById(self.name).height=self.document.body.scrollHeight+m if (parent.self!=top) { //alert("2 - "+parent.parent.self.document.title+"\n"+parent.parent.self.name) parent.parent.self.document.getElementById(parent.self.name).height=1 parent.parent.self.document.getElementById(parent.self.name).height=parent.self.document.body.scrollHeight+m if (parent.parent.self!=top) { //alert("3 - "+parent.parent.parent.self.document.title+"\n"+parent.parent.parent.self.name) parent.parent.parent.self.document.getElementById(parent.parent.self.name).height=1 parent.parent.parent.self.document.getElementById(parent.parent.self.name).height=parent.parent.self.document.body.scrollHeight+m if (parent.parent.parent.self!=top) { //alert("4 - "+parent.parent.parent.parent.self.document.title+"\n"+parent.parent.parent.parent.self.name) parent.parent.parent.parent.self.document.getElementById(parent.parent.self.name).height=1 parent.parent.parent.parent.self.document.getElementById(parent.parent.self.name).height=parent.parent.parent.self.document.body.scrollHeight+m } } } } } //------------------------------------------------------------ function parametro_stringa_query(indirizzo,parametro) { parametro=parametro.toLowerCase() stringa=indirizzo.toLowerCase()+"&&" valore_parametro="" while (stringa!="") { controllo=EstraePrimoRecord(stringa,"&") stringa=EstraeRimanenzaRecords(stringa,"&") id_parametro=EstraePrimoRecord(controllo,"=") if (id_parametro==parametro) { valore_parametro=EstraeRimanenzaRecords(controllo,"=") stringa="" } } return valore_parametro } //------------------------------------------------------------ function bottone(x,y) { if (y) { x.style.backgroundColor='#E6E6FF' x.style.color='#6A6AD4' } else { x.style.backgroundColor='#6A6AD4' x.style.color='#E6E6FF' } x.blur() } //------------------------------------------------------------ function bottone_inoltra(id,flag,w) { max=150 step=2 tempo=1 if(arguments.length<=1) { document.getElementById(id).disabled=true document.getElementById(id).innerHTML="...INOLTRO..." document.getElementById(id).style.borderStyle='solid' document.getElementById(id).style.backgroundColor='#E6E6FF' bottone_inoltra(id,true,max) } else { if(flag) { if(w<=0){flag=false} else{w=w-step} } else { if(w>=max){flag=true} else{w=w+step} } document.getElementById(id).style.width=w chiama="bottone_inoltra('"+ id + "'," + flag + "," + w + ")" setTimeout(chiama,tempo) } } //------------------------------------------------------------ function scritta_mobile(id,flag,w) { max=18 step=1 tempo=100 if(arguments.length<=1) { scritta_mobile(id,true,max) } else { if(flag) { if(w<=0){flag=false} else{w=w-step} } else { if(w>=max){flag=true} else{w=w+step} } document.getElementById(id).style.fontSize=w chiama="scritta_mobile('"+ id + "'," + flag + "," + w + ")" timer= setTimeout(chiama,tempo) } } //------------------------------------------------------------ function EstraePrimoRecord(stringa,separatore) { campo="" p=stringa.indexOf(separatore,0) if (p>=0) { campo=stringa.substring(0,p) } else { campo="" } return campo } //------------------------------------------------------------ function EstraeRimanenzaRecords(stringa,separatore) { campo="" p=stringa.indexOf(separatore,0) if (p>=0) { campo=stringa.substring(p+separatore.length,stringa.length) } else { campo=stringa } return campo } //------------------------------------------------------------ function stringa_pulizia(stringa,ammessi) { stringa=stringa+'' y='' for (i=0;i=0){y += a} } return y } //-------------------------------------------------------- function LeggiCookie(NomeCookie){ var searchName = NomeCookie + "=" var cookies = document.cookie var start = cookies.indexOf(NomeCookie) if (start == -1){ // cookie not found return "" } start += searchName.length // start of cookie data var end = cookies.indexOf(";", start) if (end == -1){ end = cookies.length } return unescape(cookies.substring(start, end)) } //-------------------------------------------------------- function RegistraCookie(NomeCookie, DatiCookie){ cookieStr = NomeCookie + "="+ escape(DatiCookie) cookieStr += "; expires=Wed, 23-Jan-2030 15:40:27 GMT" cookieStr += "; path=/" document.cookie = cookieStr } //-------------------------------------------------------- function EstraeCampo(stringa,n) { campo="" prec=-1 for (i =1; i <= n; i++) { inizio=prec+1 p=stringa.indexOf("\t",inizio) if (p>=inizio) { campo=stringa.substring(inizio,p) } else { campo="" i=n+1 } prec=p } return campo } //------------------------------------------------------------ function arrotonda_logico(a) { b=parseInt(a) if ((a-b)>0.5){b = b + 1} return b } //------------------------------------------------------------ function trim(stringa) { y='' z=stringa+'' flag=false for (i=0;i=0) { p=y.toUpperCase().indexOf(al_posto_di.toUpperCase()) if (p<0){break} y = y.substring(0,p) + cosa_mettere + y.substring(p+al_posto_di.length) } } return y } //------------------------------------------------------------ function sostituire_mantenendo(testo, cosa_mettere, al_posto_di) { if (testo!=null && cosa_mettere!=null && al_posto_di!=null && cosa_mettere!=al_posto_di) { y = testo+'' p=0 while (p>=0) { p=y.indexOf(al_posto_di) if (p<0){break} y = y.substring(0,p) + cosa_mettere + y.substring(p+al_posto_di.length) } } return y } //------------------------------------------------------------ function rimpiazza_accentate(testo) { y= unicode_limita(testo) /* y=sostituire_mantenendo(y, "a'", "à") y=sostituire_mantenendo(y, "o'", "ò") y=sostituire_mantenendo(y, "e'", "è") y=sostituire_mantenendo(y, "e'", "é") y=sostituire_mantenendo(y, "i'", "ì") y=sostituire_mantenendo(y, "u'", "ù") y=sostituire_mantenendo(y, "A'", "À") y=sostituire_mantenendo(y, "O'", "Ò") y=sostituire_mantenendo(y, "E'", "È") y=sostituire_mantenendo(y, "E'", "É") y=sostituire_mantenendo(y, "I'", "Ì") y=sostituire_mantenendo(y, "U'", "Ù") */ return y } //--------------------------------------------------------- LETTURA COOKIE function carica_anagrafica() { titolo="" cognome="" nome="" email="" telefoni="" DatiCookie=LeggiCookie("INGEGNERI ROMANI 2006") cognome=EstraeCampo(DatiCookie,1) nome=EstraeCampo(DatiCookie,2) email=EstraeCampo(DatiCookie,3) telefoni=EstraeCampo(DatiCookie,4) z=trim(cognome)+trim(nome)+trim(email)+trim(telefoni) if (z.length == 0) { DatiCookie=LeggiCookie("INGEGNERI ROMANI SETTEMBRE 2002") cognome=EstraeCampo(DatiCookie,1) nome=EstraeCampo(DatiCookie,2) email=EstraeCampo(DatiCookie,3) telefoni=EstraeCampo(DatiCookie,4) } top.cognome=cognome top.nome=nome top.email=email top.telefoni=telefoni } //--------------------------------------------------------- SCRITTURA COOKIE function registra_anagrafica(x) { DatiCookie="" DatiCookie=DatiCookie+top.cognome+"\t" DatiCookie=DatiCookie+top.nome+"\t" DatiCookie=DatiCookie+top.email+"\t" DatiCookie=DatiCookie+top.telefoni+"\t" RegistraCookie("INGEGNERI ROMANI 2006", DatiCookie) } //--------------------------------------------------------- LETTURA COOKIE 2007 function carica_anagrafica_2007() { titolo="" cognome="" nome="" email="" telefoni="" //---------------------------------- INGEGNERI ROMANI SETTEMBRE 2002 DatiCookie=LeggiCookie("INGEGNERI ROMANI SETTEMBRE 2002") cognome_c=EstraeCampo(DatiCookie,1) nome_c=EstraeCampo(DatiCookie,2) email_c=EstraeCampo(DatiCookie,3) telefoni_c=EstraeCampo(DatiCookie,4) if (trim(cognome_c)!=""){cognome=trim(cognome_c)} if (trim(nome_c)!=""){nome=trim(nome_c)} if (trim(email_c)!=""){email=trim(email_c)} if (trim(telefoni_c)!=""){telefoni=trim(telefoni_c)} //---------------------------------- TMC 2004 DatiCookie=LeggiCookie("TMC 2004") titolo_c=EstraeCampo(DatiCookie,1) cognome_c=EstraeCampo(DatiCookie,2) nome_c=EstraeCampo(DatiCookie,3) email_c=EstraeCampo(DatiCookie,4) telefoni_c=EstraeCampo(DatiCookie,5) if (trim(titolo_c)!=""){titolo=trim(titolo_c)} if (trim(cognome_c)!=""){cognome=trim(cognome_c)} if (trim(nome_c)!=""){nome=trim(nome_c)} if (trim(email_c)!=""){email=trim(email_c)} if (trim(telefoni_c)!=""){telefoni=trim(telefoni_c)} //---------------------------------- INGEGNERI ROMANI 2006 DatiCookie=LeggiCookie("INGEGNERI ROMANI SETTEMBRE 2002") cognome_c=EstraeCampo(DatiCookie,1) nome_c=EstraeCampo(DatiCookie,2) email_c=EstraeCampo(DatiCookie,3) telefoni_c=EstraeCampo(DatiCookie,4) if (trim(cognome_c)!=""){cognome=trim(cognome_c)} if (trim(nome_c)!=""){nome=trim(nome_c)} if (trim(email_c)!=""){email=trim(email_c)} if (trim(telefoni_c)!=""){telefoni=trim(telefoni_c)} //---------------------------------- INGEGNERI ROMANI 2007 DatiCookie=LeggiCookie("INGEGNERI ROMANI 2007") titolo_c=EstraeCampo(DatiCookie,1) cognome_c=EstraeCampo(DatiCookie,2) nome_c=EstraeCampo(DatiCookie,3) email_c=EstraeCampo(DatiCookie,4) telefoni_c=EstraeCampo(DatiCookie,5) if (trim(titolo_c)!=""){titolo=trim(titolo_c)} if (trim(cognome_c)!=""){cognome=trim(cognome_c)} if (trim(nome_c)!=""){nome=trim(nome_c)} if (trim(email_c)!=""){email=trim(email_c)} if (trim(telefoni_c)!=""){telefoni=trim(telefoni_c)} //--------------------------------------------------------- top.titolo=titolo top.cognome=cognome top.nome=nome top.email=email top.telefoni=telefoni } //--------------------------------------------------------- SCRITTURA COOKIE 2007 function registra_anagrafica_2007() { DatiCookie="" DatiCookie=DatiCookie+top.titolo+"\t" DatiCookie=DatiCookie+top.cognome+"\t" DatiCookie=DatiCookie+top.nome+"\t" DatiCookie=DatiCookie+top.email+"\t" DatiCookie=DatiCookie+top.telefoni+"\t" RegistraCookie("INGEGNERI ROMANI 2007", DatiCookie) } //------------------------------------------------------------ function top_leggi(obj) { obj.cognome.value=rimpiazza_accentate(trim(top.cognome).toUpperCase()) obj.nome.value=rimpiazza_accentate(trim(top.nome).toUpperCase()) obj.telefoni.value=rimpiazza_accentate(trim(top.telefoni).toUpperCase()) obj.email.value=trim(sostituire_mantenendo(top.email,"tiscali","tiscalinet").toLowerCase()) } //------------------------------------------------------------ function top_scrivi(obj) { top.cognome=rimpiazza_accentate(trim(obj.cognome.value).toUpperCase()) top.nome=rimpiazza_accentate(trim(obj.nome.value).toUpperCase()) top.telefoni=rimpiazza_accentate(trim(obj.telefoni.value).toUpperCase()) top.email=trim(sostituire_mantenendo(obj.email.value,"tiscali","tiscalinet").toLowerCase()) } //------------------------------------------------------------ function elimina_html(testo) { y=testo p1=0 p2=0 while (p1>=0 && p2>=0) { p1=y.indexOf('<') if (p1<0){break} p2=y.substring(p1).indexOf('>') if (p2<0){break} y = y.substring(0,p1) + y.substring(p1+p2+1) } return y } //------------------------------------------------------------ function elimina_contenuto(testo,contenuto) { y=testo p=0 while (p>=0) { p=y.toUpperCase().indexOf(contenuto.toUpperCase()) if (p<0){break} p1=0 p2=y.length-1 { for (i=p;i>=p1;i--) { if (y.charAt(i)==' ' || y.charAt(i)=='\n' || y.charAt(i)=='\r'){p1=i;break} } for (i=p;i<=p2;i++) { if (y.charAt(i)==' ' || y.charAt(i)=='\n' || y.charAt(i)=='\r'){p2=i;break} } } y = y.substring(0,p1) +' '+ y.substring(p2+1) } return y } //------------------------------------------------------------ function limita_messaggio(stringa,max_percento_maiuscole,max_lunghezza_parole) { totale=0 minuscole=0 c1=" " c2="\n" z="" p=0 for (i=0;i=max_lunghezza_parole) { p=1 z=z+c1+y } else { p=p+1 z=z+y } } totale=totale+1 if (y==y.toLowerCase()){minuscole=minuscole+1} } kk=0 if (totale!=0){kk=100*(totale-minuscole)/totale} if (kk>max_percento_maiuscole){z=z.toLowerCase()} return z } //------------------------------------------------------------ function controllo_email(indirizzo) { ammessi="&'*+-./0123456789=?^_abcdefghijklmnopqrstuvwxyz{}~" y=indirizzo y=trim(y.toLowerCase()) iniziale=y //--------------------- SEPARAZIONE prima@dopo prima="" p=y.indexOf("@") if(p<0){return false} prima=y.substring(0,p) dopo=y.substring(p+1) //alert(prima+"\n"+dopo) //--------------------- CONTROLLO ESISTENZA PRIMA E DOPO if(trim(prima)==""){return false} if(trim(dopo)==""){return false} //--------------------- CONTROLLO CARATTERI INAMMISSIBILI if(stringa_pulizia(prima,ammessi)!=prima){return false} if(stringa_pulizia(dopo,ammessi)!=dopo){return false} //--------------------- CONTROLLO SEQUENZE INAMMISSIBILI if(iniziale.indexOf(".@")>=0){return false} if(iniziale.indexOf("@.")>=0){return false} if(iniziale.indexOf("..")>=0){return false} //--------------------- CONTROLLO CHE 'DOPO' FINISCE CON .XX o .xxx flag=true kount=0 l=0 for (j=dopo.length-1;j>=0;j--) { l=l+1 if(flag && dopo.charAt(j)=="."){flag=false;kount=l} } if(kount<3 || kount>4){return false} //--------------------- OK return true } //------------------------------------------------------------ function errore_dati_anagrafici(obj) { errore=false testo="" if (obj.email.value==""){errore=true;testo=testo+"- Manca l'Email\r\n"} else {if (!controllo_email(obj.email.value)) {errore=true;testo=testo+"- Sintassi Email errata\r\n"}} if (obj.cognome.value==""){errore=true;testo=testo+"- Manca il Cognome\r\n"} if (obj.nome.value==""){errore=true;testo=testo+"- Manca il Nome\r\n"} if (obj.telefoni.value==""){errore=true;testo=testo+"- Manca il Telefono\r\n"} if (errore){alert(testo)} return errore } //------------------------------------------------------------ function modifica_testo(obj,lunghezza_massima,maiuscolo) { lunghezza_massima = stringa_pulizia(lunghezza_massima,"0123456789")-0 testo=obj.value if (lunghezza_massima>0){testo=testo.substring(0,lunghezza_massima)} testo=rimpiazza_accentate(testo) testo=elimina_html(testo) testo=elimina_contenuto(testo,"www") testo=elimina_contenuto(testo,"@") testo=limita_messaggio(testo,10,21) testo=trim(testo) if(maiuscolo){testo=testo.toUpperCase()} testo=testo.substring(0,1).toUpperCase()+testo.substring(1) obj.value=testo dimensiona_iframe() } //------------------------------------------------------------ function testo_firmato(obj,m) { firma1=obj.nome.value + " " + obj.cognome.value firma2=obj.cognome.value + " " + obj.nome.value firma3=obj.nome.value + " " + obj.cognome.value firma4=obj.cognome.value + " " + obj.nome.value firma1=firma1.toUpperCase() firma2=firma2.toUpperCase() firma3=firma3.toLowerCase() firma4=firma4.toLowerCase() obj=obj.messaggio testo=obj.value testo=sostituire(testo, "", firma1) testo=sostituire(testo, "", firma2) testo=sostituire(testo, "", firma3) testo=sostituire(testo, "", firma4) obj.value = testo modifica_testo(obj,m,false) testo=testo + " " + firma1 obj.value = testo } //------------------------------------------------------------ function toglie_firma_vecchia(obj) { testo = obj.messaggio.value firma1=top.nome + " " + top.cognome firma2=top.cognome + " " + top.nome firma3=top.nome + " " + top.cognome firma4=top.cognome + " " + top.nome firma1=firma1.toUpperCase() firma2=firma2.toUpperCase() firma3=firma3.toLowerCase() firma4=firma4.toLowerCase() testo=sostituire(testo, "", firma1) testo=sostituire(testo, "", firma2) testo=sostituire(testo, "", firma3) testo=sostituire(testo, "", firma4) obj.messaggio.value = testo } //------------------------------------------------------------ function prepara_inoltro_1(obj,id) { errore=false testo="" if (obj.email.value==""){errore=true;testo=testo+"- Manca l'Email\r\n"} else {if (!controllo_email(obj.email.value)) {errore=true;testo=testo+"- Sintassi Email errata\r\n"}} if (obj.cognome.value==""){errore=true;testo=testo+"- Manca il Cognome\r\n"} if (obj.nome.value==""){errore=true;testo=testo+"- Manca il Nome\r\n"} if (obj.telefoni.value==""){errore=true;testo=testo+"- Manca il Telefono\r\n"} if (obj.messaggio.value==""){errore=true;testo=testo+"- Manca il testo\r\n"} if (errore){alert(testo);return} if (confirm("Hai letto le informazioni sulla Privacy nella Home Page e le accetti ?\r\nIl testo che verrà pubblicato potrebbere essere stato modificato in automatico; lo hai controllato ?\r\nConfermi la richiesta di pubblicazione ?")) { bottone_inoltra(id) obj.submit() } } //------------------------------------------------------------ function test_check(obj,campo) { x=false for (var i = 0; i -1)) { if (obj.elements[i].checked) { x=true } } } return x } //------------------------------------------------------------ function estensione_file(file) { x=file.substring(file.lastIndexOf('.') + 1,file.length); x=trim(x) x=x.toLowerCase() return x } //------------------------------------------------------------ function ggmmaaaa_aggiusta(stringa) { giorno=0 mese=0 anno=0 z=stringa_pulizia(stringa,'/0123456789') x=z.indexOf('/') if (x>=0){giorno=z.substring(0,x)-0;z=z.substring(x+1,z.length)} x=z.indexOf('/') if (x>=0){mese=z.substring(0,x)-0;anno=z.substring(x+1,z.length)-0} anno = (anno < 1000) ? anno + 1900 : anno d = new Date(anno,mese-1,giorno) giorno1=d.getDate() mese1=d.getMonth()+1 anno1=d.getYear() anno1 = (anno1 < 1000) ? anno1 + 1900 : anno1 if (anno1>9999 || anno1<2000){return "gg/mm/aaaa"} if (giorno==giorno1 && mese==mese1 && anno==anno1) { giorno=giorno+'' while (giorno.length<2){giorno='0'+giorno} mese=mese+'' while (mese.length<2){mese='0'+mese} anno=anno+'' while (anno.length<4){anno='0'+anno} return giorno+"/"+mese+"/"+anno } else { return "gg/mm/aaaa" } } //------------------------------------------------------------ function hhmm_aggiusta(stringa) { hh="" mm="0" z=stringa_pulizia(stringa,':0123456789') + ":" x=z.indexOf(':') if (x>=0){hh=z.substring(0,x);mm=z.substring(x+1,z.length)} if (x<0 || trim(hh)==""){return "hh:mm"} x=mm.indexOf(':') if (x>=0){mm=mm.substring(0,x)} mm=mm-0 hh=hh-0 if (hh<0 || hh>23 || mm<0 || mm >59) { return "hh:mm" } else { hh=hh+'' while (hh.length<2){hh='0'+hh} mm=mm+'' while (mm.length<2){mm='0'+mm} return hh+":"+mm } } //------------------------------------------------------------ function ggmmaaaa_hhmm_aggiusta(stringa) { data="" ora="" z=trim(stringa) x=z.indexOf(' ') if (x>=0){data=z.substring(0,x);ora=z.substring(x+1,z.length)} data=ggmmaaaa_aggiusta(data) ora=hhmm_aggiusta(ora) if (data=="gg/mm/aaaa" || ora=="hh:mm" || trim(data)=="" || trim(ora)=="") { return "gg/mm/aaaa hh:mm" } else { return data+" "+ora } } //------------------------------------------------------------ function unicode_limita(stringa) { //---- elimina i caratteri unicode maggiori di 255 e minori di 32 con eccezione di CR LF stringa=stringa+'' y='' for (i=0;i