// JavaScript Document var ge; var tour = null; var jacreat = false; var tracks = new Array(); var inifin3d; var campamentos3d; var cp3d; var avituallamiento3d; var meteo3d; var panoramio3d; var toggleStatetrack3d = new Array(); var toggleinifin3d = 1; var togglecampamentos3d = 1; var togglecp3d = 1; 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/recorridoetapa5.kmz?id=4466'; 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(30.9045,-6.9259, 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/ntd/kml/josef.kml?id=2225'; 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/kasbah.kml?id=3891'; 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/1etapa.kml?id=3808'; 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/2etapa.kml?id=1748'; 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/etapa2/track.kml?id=128'; 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/3etapa.kml?id=917'; 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/etapa3/track.kml?id=4795'; 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/4etapa.kml?id=3885'; 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/etapa4/track.kml?id=393'; 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/5etapa.kml?id=4187'; 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/etapa5/track.kml?id=3536'; 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 = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + '/'; var href = 'http://josef-ajram.racetracker.es/ntd/kml/josef_ntd.kml?id=903'; 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; } //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/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 }); var href = 'http://josef-ajram.racetracker.es/ntd/kml/spotjosef_1.kml?id=2905'; 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/ntd/kml/spotjosef_2.kml?id=2785'; 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/ntd/kml/spotjosef_3.kml?id=2852'; 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/ntd/kml/spotjosef_4.kml?id=2705'; 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[4]=kmlObject; toggleStatetrack3d[4]=1; // 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/ntd/kml/inifin.kml?id=2616'; 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/ntd/kml/campamentos.kml?id=829'; 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; } campamentos3d=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/cp.kml?id=4296'; 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/ntd/kml/avituallamiento.kml?id=1854'; 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; } avituallamiento3d=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/comentarios.kml?id=942'; 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 }); ////////////////////////////////////////////////////////////////////////////////////////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 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 toggleKmlcampamentos3d() { if (togglecampamentos3d == 0) { // add the township lines ge.getFeatures().appendChild(campamentos3d); document.getElementById("bot_campamentos3d").src='img/campamentos_on.png'; togglecampamentos3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(campamentos3d); document.getElementById("bot_campamentos3d").src='img/campamentos_off.png'; togglecampamentos3d = 0; } } function toggleKmlcp3d() { if (togglecp3d == 0) { // add the township lines ge.getFeatures().appendChild(cp3d); document.getElementById("bot_cp3d").src='img/cp_on.png'; togglecp3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(cp3d); document.getElementById("bot_cp3d").src='img/cp_off.png'; togglecp3d = 0; } } function toggleKmlavituallamiento3d() { if (toggleavituallamiento3d == 0) { // add the township lines ge.getFeatures().appendChild(avituallamiento3d); document.getElementById("bot_avituallamiento3d").src='img/avituallamiento_on.png'; toggleavituallamiento3d = 1; } else { // remove the township lines ge.getFeatures().removeChild(avituallamiento3d); document.getElementById("bot_avituallamiento3d").src='img/avituallamiento_off.png'; toggleavituallamiento3d = 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); }