text: // File origin: VS1LAB A2
  
  /* eslint-disable no-unused-vars */
  
  // This script is executed when the browser loads index.html.
  
  // "console.log" writes to the browser's console. 
  // The console window must be opened explicitly in the browser.
  // Try to find this output in the browser...
  console.log("The geoTagging script is going to start...");
  
  function updateLocation() {
      if((document.getElementById("latitude").value=="")||(document.getElementById("longitude").value=="")){
          LocationHelper.findLocation(locationFoundCallback); 
      }
      else {
          callMapUrl(document.getElementById("latitude").value, document.getElementById("longitude").value)
      }
  }
  
  function locationFoundCallback(locationHelper) {
      document.getElementById("latitude").value = locationHelper.latitude;
      document.getElementById("longitude").value = locationHelper.longitude;
      document.getElementById("latitude_hidden").value = locationHelper.latitude;
      document.getElementById("longitude_hidden").value = locationHelper.longitude;
  
      callMapUrl(locationHelper.latitude, locationHelper.longitude)
  }
  
  function callMapUrl (latitude, longitude) {
      MapManager = new MapManager("W3WPRnYCjtvrt59wmj7VAIXDSGZEUaUo");
      let taglist_json = document.getElementById("mapView").dataset.tags;
      document.getElementById("mapView").src = MapManager.getMapUrl(latitude, longitude, JSON.parse(taglist_json), 12);
  }
  
  // Wait for the page to fully load its DOM content, then call updateLocation
  document.addEventListener("DOMContentLoaded", () => {
      updateLocation();
  });