//****CARICO QUELLO CHE MI SERVE.... function addJavascript_per_jifs(jsname,pos) { var th = document.getElementsByTagName(pos)[0]; var s = document.createElement('script'); s.setAttribute('type','text/javascript'); s.setAttribute('src',jsname); //th.appendChild(s); document.body.insertBefore(s,th.firstChild); } function loadScript_mappa_per_jifs() { //addJavascript_per_jifs('http://maps.google.com/maps/api/js?sensor=true&key=AIzaSyALCyFr5bBgXaiCXmdA-RQ02ECux4ORxVg','body'); document.write(''); /* //alert('appeNDO..'); var script = document.createElement("script"); script.setAttribute('id','script_esterno_mappa_per_jifs_1'); script.type = "text/javascript"; //script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize"; script.src = "http://maps.google.com/maps/api/js?sensor=true&key=AIzaSyALCyFr5bBgXaiCXmdA-RQ02ECux4ORxVg"; //document.body.appendChild(script); //document.body.insertBefore(script,document.body.firstChild); document.body.appendChild(script); //alert('appeso'); /* //aggiungo anche la localizzazione del dispositivo secondo google.. //http://code.google.com/apis/gears/gears_init.js script = document.createElement("script"); script.setAttribute('id','script_esterno_mappa_per_jifs_2'); script.type = "text/javascript"; //script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize"; script.src = "http://code.google.com/apis/gears/gears_init.js"; document.body.appendChild(script); //*/ } loadScript_mappa_per_jifs(); //invoco subito... //************************ GESTIONE AJAX*********************// function CreateXmlHttpReq_jifs(handler) { var xmlhttp = null; try { xmlhttp = new XMLHttpRequest(); } catch(e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } } xmlhttp.onreadystatechange = handler; return xmlhttp; } var myRequest_jifs=[]; var Tiporisposta_jifs=[]; var funzionirisposta_jifs=[]; var contatoreFunzioni_jifs=0; var modificati_jifs=[]; function RispostaIndirizzo_jifs(){ var contenuto=''; try { var idfunzione=0; for (idfunzione=0;idfunzione<=myRequest_jifs.length-1;idfunzione++) { if (myRequest_jifs[idfunzione]==null) continue; if (modificati_jifs[idfunzione] && myRequest_jifs[idfunzione].readyState == 4 && myRequest_jifs[idfunzione].status == 200) //if (myRequest_jifs[idfunzione].readyState == 4 ) { modificati_jifs[idfunzione]=false; //azzero il risultato per evitare di tornare... if (Tiporisposta_jifs[idfunzione]=='txt') contenuto=myRequest_jifs[idfunzione].responseText; if (Tiporisposta_jifs[idfunzione]=='xml') contenuto=myRequest_jifs[idfunzione].responseXML; funzionirisposta_jifs[idfunzione](contenuto); } } } catch(err) { //gestione eccezioni... txt="There was an error on this page.\n\n"; txt+="Error description: " + err.description + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } } function Cicla_jifs(indirizzo,idfunzione,Tiporisposta){ var random_jifs_var = Math.random(); Tiporisposta_jifs[idfunzione]=Tiporisposta; myRequest_jifs[idfunzione] = CreateXmlHttpReq_jifs(RispostaIndirizzo_jifs); myRequest_jifs[idfunzione].open("GET",indirizzo+"&random_jifs_var="+escape(random_jifs_var)); //myRequest_jifs[idfunzione].open("GET",indirizzo,true); modificati_jifs[idfunzione]=true; myRequest_jifs[idfunzione].send(null); } function Cicla_jifs_post(indirizzo,idfunzione,Tiporisposta,variabili){ var random_jifs_var = Math.random(); Tiporisposta_jifs[idfunzione]=Tiporisposta; myRequest_jifs[idfunzione] = CreateXmlHttpReq_jifs(RispostaIndirizzo_jifs); myRequest_jifs[idfunzione].open("POST",indirizzo+"&random_jifs_var="+escape(random_jifs_var)); //myRequest_jifs[idfunzione].open("GET",indirizzo,true); myRequest_jifs[idfunzione].setRequestHeader("Content-type", "application/x-www-form-urlencoded"); myRequest_jifs[idfunzione].setRequestHeader("Content-length", variabili.length); myRequest_jifs[idfunzione].setRequestHeader("Connection", "close"); modificati_jifs[idfunzione]=true; myRequest_jifs[idfunzione].send(variabili); } function Definisci_Chiamata_jifs(funzione,Tiporisposta){ var ricordo=[]; ricordo["tipo"]=Tiporisposta; ricordo["id"]=contatoreFunzioni_jifs; funzionirisposta_jifs[contatoreFunzioni_jifs]=funzione; modificati_jifs[contatoreFunzioni_jifs]=false; contatoreFunzioni_jifs++; return ricordo; } function Chiamata_jifs(indirizzo,ricordo){ Cicla_jifs(indirizzo,ricordo["id"],ricordo["tipo"]); } function Chiamata_jifs_post(indirizzo,ricordo,variabili){ Cicla_jifs_post(indirizzo,ricordo["id"],ricordo["tipo"],variabili); } //************GESTIONE TRASGERIMENTO OGGETTI JSON SU TAG**************// function SostituzioneJSON_jifs(div_elemento_esempio,oggetto,striptags){ //[$valore] //[?booleano][^booleano] //[@array]idsostituzione[°array] //[%oggetto]idsostituzione[=oggetto] if (oggetto==null) return ''; var esempio=urldecode_JSON_jifs(document.getElementById(div_elemento_esempio).innerHTML); if (typeof oggetto=='boolean') { var ritorno=''; if (oggetto) ritorno=esempio; return ritorno; } if (typeof oggetto=='object' && oggetto instanceof Array) { var ritorno=''; for (var iext=0;iext]+)>)/ig,""); sostituto=stripped; } sostituto=HTMLencode_JSON_jifs(sostituto); esempio=str_replace_JSON_jifs(esempio,pat,sostituto); } return esempio; } function str_replace_JSON_jifs(haystack, needle, replacement) { var temp = haystack.split(needle); return temp.join(replacement); } function urldecode_JSON_jifs(str){ var temp=str_replace_JSON_jifs(str,"%5B","["); return str_replace_JSON_jifs(temp,"%5D","]"); } function HTMLencode_JSON_jifs(str){ var temp=str_replace_JSON_jifs(str,"[","["); return str_replace_JSON_jifs(temp,"]","]"); } function array_sostituzione_JSON_jifs(testo,variabile,lista,striptags) { var inizio='[@'+variabile+']'; var fine='[°'+variabile+']'; var temp1 = testo.split(inizio); var buono=temp1[0]; for (var iext=1;iext1) temp2 = temp2+fine; temp2 = temp2+arrsp2[iext]; } testo=temp1+temp2; }while (conto_inizi>1); } var ritorno=str_replace_JSON_jifs(testo,inizio,''); ritorno=str_replace_JSON_jifs(ritorno,fine,''); return ritorno; } function ElaborazioneJSON_jifs(tag_esempio,variabile,tag_destinazione,striphtmltag){ var risultato=SostituzioneJSON_jifs(tag_esempio,variabile,striphtmltag); document.getElementById(tag_destinazione).innerHTML=risultato; } //**************gestione parsing JSON var JSON = JSON || {}; //implement JSON.stringify serialization JSON.stringify = JSON.stringify || function (obj) { var t = typeof (obj); if (t != "object" || obj === null) { // simple data type if (t == "string") obj = '"'+obj+'"'; return String(obj); } else { // recurse array or object var n, v, json = [], arr = (obj && obj.constructor == Array); for (n in obj) { v = obj[n]; t = typeof(v); if (t == "string") v = '"'+v+'"'; else if (t == "object" && v !== null) v = JSON.stringify(v); json.push((arr ? "" : '"' + n + '":') + String(v)); } return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}"); } }; //implement JSON.parse de-serialization JSON.parse = JSON.parse || function (str) { if (str === "") str = '""'; eval("var p=" + str + ";"); return p; }; //***************** Posizionamento in assoluto rispetto un secondo elemento //Posizionare in riferimento a un tag // //tag_elemento = tag da posizionare //tag_riferimento = dove posizionarlo (angolo uperiore sinistro coincidono) //sx_fix = spostato da sx di costante... //top_fix = sopostato da in alto di costante.. //mult_sx_rif = spostato per volte dimensione riferimento a sinistra //mult_top_rif= spostato per volte dimensione riferimento in alto //mult_sx_el = spostato per volte dimensione elemento a sinistra //mult_top_el = spostato per volte dimensione elemento in alto // es : Posizionamento_assoluto_jifs("movimento","riferimento",0,0,0.5,0.5,-0.5,-0.5); // posiziono perfettamente centrato nel riferimento... function Posizionamento_assoluto_jifs(tag_elemento,tag_riferimento,sx_fix,top_fix,mult_sx_rif,mult_top_rif,mult_sx_el,mult_top_el){ var div = document.getElementById(tag_elemento); var base_popup=document.getElementById(tag_riferimento); var curr_left=0; var curr_top=0; if(base_popup.offsetParent) do { curr_left += base_popup.offsetLeft; curr_top += base_popup.offsetTop; } while(base_popup = base_popup.offsetParent) base_popup=document.getElementById(tag_riferimento); var space_left=parseInt( parseInt(base_popup.offsetWidth)*mult_sx_rif ); var space_top=parseInt( parseInt(base_popup.offsetHeight)*mult_top_rif ); var div_left=parseInt( parseInt(div.offsetWidth)*mult_sx_el ); var div_top=parseInt( parseInt(div.offsetHeight)*mult_top_el ); var abs_left=sx_fix+curr_left+space_left+div_left; var abs_top=top_fix+curr_top+space_top+div_top; div.style.left = abs_left +'px'; div.style.top = abs_top +'px'; } //****************MOVIMENTO da a (vene posizionto al centro...) // tag_da = elemento da cui partire(al centro) // tag_a = elemento a cui arrivare(al centro) // tempo_secondi = durata in secondi dell'animazione // azioneAllaFIne = codice da eseguire quando terminata l'animazione // es : Sposta_in_assoluto_jifs("partenza","arrivo","movimento",0.3,""); function Sposta_in_assoluto_jifs(tag_da,tag_a,tag_elemento,tempo_secondi,azioneAllaFIne){ Lista_OggettiInMovimento_jifs[tag_elemento]=null; var oggettino = new Oggetto_Movimento_jifs(); oggettino.tag_da=tag_da; oggettino.tag_a=tag_a; oggettino.tag_elemento=tag_elemento; oggettino.tempo_secondi=tempo_secondi; oggettino.azioneAllaFIne=azioneAllaFIne; Calcolo_Movimento_assoluto_jifs(oggettino); oggettino.coordinate_assoluto_top_jifs=oggettino.partenza_movimento_top_jifs; oggettino.coordinate_assoluto_left_jifs=oggettino.partenza_movimento_left_jifs Lista_OggettiInMovimento_jifs[tag_elemento]=oggettino; Animazione_Movimento_assoluto_jifs(tag_elemento); } var Lista_OggettiInMovimento_jifs=[]; function Oggetto_Movimento_jifs() { this.partenza_movimento_left_jifs = null; this.partenza_movimento_top_jifs = null; this.arrivo_movimento_left_jifs = null; this.arrivo_movimento_top_jifs = null; this.coordinate_assoluto_top_jifs = null; this.coordinate_assoluto_left_jifs = null; this.tag_elemento=null; this.tag_da=null; this.tag_a=null; this.tempo_secondi=1; } function Animazione_Movimento_assoluto_jifs(tag_elemento) { if (Lista_OggettiInMovimento_jifs[tag_elemento]==null) return; var oggettino=Lista_OggettiInMovimento_jifs[tag_elemento]; //var tag_da=oggettino.tag_da; //var tag_a=oggettino.tag_a; Posiziona_Coordinate_assoluto_jifs(tag_elemento); Sistema_Moviemento_assoluto_jifs(tag_elemento); if (oggettino.coordinate_assoluto_left_jifs==oggettino.arrivo_movimento_left_jifs) { Posiziona_Coordinate_assoluto_jifs(tag_elemento); var azioneAllaFIne=oggettino.azioneAllaFIne; oggettino=null; //oggettino.partenza_movimento_left_jifs=null; //oggettino.coordinate_assoluto_top_jifs=null; eval(azioneAllaFIne); return; } setTimeout("Animazione_Movimento_assoluto_jifs('"+tag_elemento+"')",1); } function Sistema_Moviemento_assoluto_jifs(tag_elemento){ var oggettino=Lista_OggettiInMovimento_jifs[tag_elemento]; var distanza_sx=oggettino.arrivo_movimento_left_jifs-oggettino.partenza_movimento_left_jifs; var distanza_top=oggettino.arrivo_movimento_top_jifs-oggettino.partenza_movimento_top_jifs; var tempo_secondi=oggettino.tempo_secondi; var moltiplicatore_sx=distanza_sx/(100*tempo_secondi); var moltiplicatore_top=distanza_top/(100*tempo_secondi); oggettino.coordinate_assoluto_left_jifs=oggettino.coordinate_assoluto_left_jifs+moltiplicatore_sx; oggettino.coordinate_assoluto_top_jifs=oggettino.coordinate_assoluto_top_jifs+moltiplicatore_top; if ( (Math.abs(oggettino.coordinate_assoluto_left_jifs-oggettino.arrivo_movimento_left_jifs)1) // this.ZoomStart--; //this.Sposta(); this.OggettoGmap.panToBounds(Quadrato); } this.Sposta= function () { var myLatlng = new google.maps.LatLng(this.LatStart,this.LngStart); this.OggettoGmap.setCenter(myLatlng); this.OggettoGmap.setZoom(this.ZoomStart); } this.AscoltatoriEventi=[]; this.AscoltatoriNomiEventi=[]; this.RimuoniEvento=function (nomeevento){ if (nomeevento=='' || nomeevento=='mappaistanziata') return; var indiceAscoltatore=-1; for (idtmp3=0;idtmp3=0) continue; var testofunzione=this.ListaEventiMappaFunzione[idtmp2]; this.AscoltatoriEventi[this.AscoltatoriEventi.length]=google.maps.event.addListener(this.OggettoGmap,nomeevento,function(argomentoevento) { if (!this.Blocca_eventi_mappa) eval(testofunzione); }); this.AscoltatoriNomiEventi[this.AscoltatoriNomiEventi.length]=nomeevento; } } this.mapload = function () { try{ var myLatlng = new google.maps.LatLng(this.LatStart,this.LngStart); //this.MapTypeControlOptions.style=this.MapTypeControlStyle; var myOptions = { zoom: this.ZoomStart, center: myLatlng, mapTypeId: this.TipoStart, navigationControl: this.navigationControl, mapTypeControl: this.mapTypeControl, mapTypeControlOptions: { style: this.MapTypeControlStyle }, navigationControlOptions: { style: this.NavigationControlStyle }, streetViewControl: this.streetViewControl } this.OggettoGmap = new google.maps.Map(document.getElementById(this.DOMGmap),myOptions); this.RicaricaEventi(); /* for (idtmp2=0;idtmp2=4.6) { blackberry.location.removeLocationUpdate(handleBlackBerryLocation); } bb_successCallback = null; bb_errorCallback = null; } } function CodificaPosizioneAttuale_jifs(EsitoPosistivo,EsitoNegativo,Oggetto_LatLng) { var latlng=null; // Try W3C Geolocation (Preferred) if(navigator.geolocation) { //if(false) { navigator.geolocation.getCurrentPosition(function(position) { latlng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); Oggetto_LatLng.lat=latlng.lat(); Oggetto_LatLng.lng=latlng.lng(); eval(EsitoPosistivo); }, function() { eval(EsitoNegativo); }); } else if (typeof(Mojo) != "undefined" && typeof(Mojo.Service) != "undefined" && typeof(Mojo.Service.Request) != "Mojo.Service.Request") { parameters = {}; r = new Mojo.Service.Request('palm://com.palm.location', { method: "getCurrentPosition", parameters: parameters, onSuccess: function(p){ Oggetto_LatLng.lat=p.latitude; Oggetto_LatLng.lng=p.longitude; eval(EsitoPosistivo); }, onFailure: function(e){ eval(EsitoNegativo); } }); } //Try device service else if (typeof(device) != "undefined" && typeof(device.getServiceObject) != "undefined") { var provider = device.getServiceObject("Service.Location", "ILocation"); //override default method implementation pub.getCurrentPosition = function(){ function callback(transId, eventCode, result){ if (eventCode == 4) { eval(EsitoNegativo); } else { //no timestamp of location given? Oggetto_LatLng.lat=result.ReturnValue.Latitude; Oggetto_LatLng.lng=result.ReturnValue.Longitude; eval(EsitoPosistivo); } } //location criteria var criteria = new Object(); criteria.LocationInformationClass = "BasicLocationInformation"; //make the call provider.ILocation.GetLocation(criteria, callback); } } //Try blackberry function else if (typeof(window.blackberry) != "undefined" && blackberry.location.GPSSupported) { // set to autonomous mode blackberry.location.setAidMode(2); bb_successCallback_jifs=EsitoPosistivo; bb_errorCallback_jifs=EsitoNegativo; bb_Oggetto_LatLng_jifs=Oggetto_LatLng; //override default method implementation pub.getCurrentPosition = function(){ if(parseFloat(navigator.appVersion)>=4.6) { blackberry.location.onLocationUpdate(handleBlackBerryLocation_jifs); } else { blackberry.location.onLocationUpdate("handleBlackBerryLocation_jifs()"); } blackberry.location.refreshLocation(); } // Browser doesn't support Geolocation } else { eval(EsitoNegativo); } //*/ } //************************************ //* var funzioni_caricate_jifs=[]; var pagina_caricata_jifs=false; var funzione_onload_precedente_jifs=null; function CaricaFunzioniInAttesa_hide_jifs(){ //alert('caricato'); pagina_caricata_jifs=true; if (funzione_onload_precedente_jifs!=null) funzione_onload_precedente_jifs(); for (var iext=0;iextCaricaFunzioniInAttesa_hide_jifs();'); //s.innerHTML='CaricaFunzioniInAttesa_hide_jifs();'; //th.appendChild(s); //alert('ready?';) //var timerid=setTimeout('CaricaFunzioniInAttesa_hide_jifs()',5000); } function EseguiFunzione_quando_pronto_jifs(stringa_funzione){ if (pagina_caricata_jifs) { eval(stringa_funzione); return; } for (var iext=0;iext