// JavaScript Document var ge; var tour = null; var jacreat = false; var tracks = new Array(); var tracksinvitado = new Array(); var inifin3d; var campamentos3d; var cp3d; var avituallamiento3d; var meteo3d; var panoramio3d; var toggleStatetrack3d = new Array(); var toggleStatetrackinvitado3d = new Array(); var toggleinifin3d = 1; var togglecampamentos3d = 1; var togglecp3d = 0; var toggleavituallamiento3d = 1; var togglemeteo3d = 0; var togglepanoramio3d = 0; google.load("earth", "1"); function init() { google.earth.createInstance('map_tour', initCB, failureCB); } function initCB(instance) { ge = instance; ge.getWindow().setVisibility(true); // add a navigation control ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO); // add some layers ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true); // create the tour by fetching it out of a KML file var href = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + '/'; href += 'static/etapa3.kmz?id=2393'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KMZ.'); }, 0); return; } tour = kmlObject; ge.getFeatures().appendChild(tour); //ge.getTourPlayer().setTour(tour); }); google.earth.addEventListener(ge.getWindow(), 'mousemove', function(event) { var statusHTML = 'N/A'; if (event.getDidHitGlobe()) { var latitude = event.getLatitude(); var longitude = event.getLongitude(); /* var groundAltitude = ge.getGlobe().getGroundAltitude(latitude, longitude); if (groundAltitude) { statusHTML = '' + groundAltitude.toFixed(2) + ' meters'; }*/ document.getElementById('text_latitude').innerHTML = latitude; document.getElementById('text_longitude').innerHTML = longitude; } }); //var href = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + '/'; var la = ge.createLookAt(''); la.set(,, 0, // altitude ge.ALTITUDE_RELATIVE_TO_GROUND, 0, // heading 0, // straight-down tilt 5000 // range (inverse of zoom) ); ge.getView().setAbstractView(la); //////////////////////////ETPAASS//////////////////////////// var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/josef_xml.php?id=2166'; track = google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML Josef.'); }, 0); return; } //track=kmlObject; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/invitado_xml.php?id=726'; track = google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML Invitado.'); }, 0); return; } //track=kmlObject; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/josef_track1_xml.php?id=613'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } tracks[1]=kmlObject; toggleStatetrack3d[1]=1; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/invitado_track1_xml.php?id=3357'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } tracksinvitado[1]=kmlObject; toggleStatetrackinvitado3d[1]=1; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/etapa1.kml?id=3733'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } //campamentobase=kmlObject; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/josef_track2_xml.php?id=273'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } tracks[2]=kmlObject; toggleStatetrack3d[2]=1; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/invitado_track2_xml.php?id=3529'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } tracksinvitado[2]=kmlObject; toggleStatetrackinvitado3d[2]=1; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/etapa2.kml?id=2351'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } //campamentobase=kmlObject; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/josef_track3_xml.php?id=3834'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } tracks[3]=kmlObject; toggleStatetrack3d[3]=1; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/invitado_track3_xml.php?id=2783'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } tracksinvitado[3]=kmlObject; toggleStatetrackinvitado3d[3]=1; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/etapa3.kml?id=1034'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } //campamentobase=kmlObject; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ntd/kml/global-cloud-layer-nl.kml'; //var href = 'http://josef-ajram.racetracker.es/ntd/kml/global-clouds-animation.kml'; track = google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } meteo3d=kmlObject; // Show the entire KML file in the plugin. //ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ntd/kml/popular.kml'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } panoramio3d=kmlObject; // Show the entire KML file in the plugin. //ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); //////////////////////////////////////////////////////////////////MARKESRS//////////////////////////////////////// var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/inifin_xml.php?id=3354'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } inifin3d=kmlObject; // Show the entire KML file in the plugin. ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/etapa1_cps.kml?id=3816'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } cp3d=kmlObject; // Show the entire KML file in the plugin. //ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/etapa2_cps.kml?id=3572'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } cp23d=kmlObject; // Show the entire KML file in the plugin. //ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); var href = 'http://josef-ajram.racetracker.es/ultraman_canada/kml/etapa3_cps.kml?id=1944'; google.earth.fetchKml(ge, href, function(kmlObject) { if (!kmlObject) { // wrap alerts in API callbacks and event handlers // in a setTimeout to prevent deadlock in some browsers setTimeout(function() { alert('Bad or null KML.'); }, 0); return; } cp33d=kmlObject; // Show the entire KML file in the plugin. //ge.getFeatures().appendChild(kmlObject); // Walk the DOM looking for a KmlTour }); ////////////////////////////////////////////////////////////////////////////////////////FIN MARKERS////////////////// //document.getElementById('installed-plugin-version').innerHTML = //ge.getPluginVersion().toString(); } function toggleTrack3d(valor) { if (toggleStatetrack3d[valor] == 0) { // add the township lines ge.getFeatures().appendChild(tracks[valor]); toggleStatetrack3d[valor] = 1; } else { // remove the township lines ge.getFeatures().removeChild(tracks[valor]); toggleStatetrack3d[valor] = 0; } } function toggleTrackinvitado3d(valor) { if (toggleStatetrackinvitado3d[valor] == 0) { // add the township lines ge.getFeatures().appendChild(tracksinvitado[valor]); toggleStatetrackinvitado3d[valor] = 1; } else { // remove the township lines ge.getFeatures().removeChild(tracksinvitado[valor]); toggleStatetrackinvitado3d[valor] = 0; } } function toggleKmlinifin3d() { if (toggleinifin3d == 0) { // add the township lines ge.getFeatures().appendChild(inifin3d); document.getElementById("bot_inifin3d").src='img/inifin_on.png'; toggleinifin3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(inifin3d); document.getElementById("bot_inifin3d").src='img/inifin_off.png'; toggleinifin3d = 0; } } function toggleKmlcp3d() { if (togglecp3d == 0) { // add the township lines ge.getFeatures().appendChild(cp3d); ge.getFeatures().appendChild(cp23d); ge.getFeatures().appendChild(cp33d); document.getElementById("bot_cp3d").src='img/cp_on.png'; togglecp3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(cp3d); ge.getFeatures().removeChild(cp23d); ge.getFeatures().removeChild(cp33d); document.getElementById("bot_cp3d").src='img/cp_off.png'; togglecp3d = 0; } } function toggleKmlmeteo3d() { if (togglemeteo3d == 0) { // add the township lines ge.getFeatures().appendChild(meteo3d); document.getElementById("bot_meteo3d").src='img/meteo_on.png'; togglemeteo3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(meteo3d); document.getElementById("bot_meteo3d").src='img/meteo_off.png'; togglemeteo3d = 0; } } function toggleKmlpanoramio3d() { if (togglepanoramio3d == 0) { // add the township lines ge.getFeatures().appendChild(panoramio3d); document.getElementById("bot_panoramio3d").src='img/panoramio_on.png'; togglepanoramio3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(panoramio3d); document.getElementById("bot_panoramio3d").src='img/panoramio_off.png'; togglepanoramio3d = 0; } } function failureCB(errorCode) { } function enterTour() { ge.getTourPlayer().setTour(tour); } function playTour() { ge.getTourPlayer().play(); } function pauseTour() { ge.getTourPlayer().pause(); } function resetTour() { ge.getTourPlayer().reset(); } function exitTour() { // just like setBalloon(null) ge.getTourPlayer().setTour(null); }