old_contents: /**
   * Created by User2 on 4/7/2015.
   */
  var x = document.getElementById("map_holder");
  getLocation();
  function getLocation() {
      if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(showPosition, showError);
      } else {
          x.innerHTML = "Geolocation is not supported by this browser.";
      }
  }
  function showPosition(position) {
      var s = document.querySelector('#status');
  
      if (s.className == 'success') {
          // not sure why we're hitting this twice in FF, I think it's to do with a cached result coming back
          return;
      }
  
      s.innerHTML = "<div><br/>Found you!</div>";
      s.className = 'success';
  
      document.querySelector("#mapcanvas").style.height='300px';
      var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
      var myOptions = {
          zoom: 15,
          center: latlng,
          mapTypeControl: false,
          navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
          mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
  
      var marker = new google.maps.Marker({
          position: latlng,
          map: map,
          title:"You are here! (at least within a "+position.coords.accuracy+" meter radius)"
      });
  }
  
  
  function showError(error) {
      switch (error.code) {
          case error.PERMISSION_DENIED:
              x.innerHTML = "User denied the request for Geolocation."
              break;
          case error.POSITION_UNAVAILABLE:
              x.innerHTML = "Location information is unavailable."
              break;
          case error.TIMEOUT:
              x.innerHTML = "The request to get user location timed out."
              break;
          case error.UNKNOWN_ERROR:
              x.innerHTML = "An unknown error occurred."
              break;
      }
  }
  
new_contents: /**
   * Created by User2 on 4/7/2015.
   */
  var x = document.getElementById("map_holder");
  var map;
  getLocation();
  function getLocation() {
      if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(showPosition, showError);
      } else {
          x.innerHTML = "Geolocation is not supported by this browser.";
      }
  }
  function showPosition(position) {
  
  
      document.querySelector("#mapcanvas").style.height='300px';
      var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
      var myOptions = {
          zoom: 15,
          center: latlng,
          mapTypeControl: false,
          navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
          mapTypeId: google.maps.MapTypeId.ROADMAP
      };
       map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
  
      var marker = new google.maps.Marker({
          position: latlng,
          map: map,
          title:"You are here! (at least within a "+position.coords.accuracy+" meter radius)"
      });
  
      var request = {
          location: latlng,
          radius: 500,
          types: ['store']
      };
      infowindow = new google.maps.InfoWindow();
      var service = new google.maps.places.PlacesService(map);
      service.nearbySearch(request, callback);
  }
  
  function callback(results, status) {
      if (status == google.maps.places.PlacesServiceStatus.OK) {
          for (var i = 0; i < results.length; i++) {
              createMarker(results[i]);
          }
      }
  }
  
  function createMarker(place) {
      var placeLoc = place.geometry.location;
      var marker = new google.maps.Marker({
          map: map,
          position: place.geometry.location
      });
  
      google.maps.event.addListener(marker, 'click', function() {
          infowindow.setContent(place.name);
          infowindow.open(map, this);
      });
  }
  
  function showError(error) {
      switch (error.code) {
          case error.PERMISSION_DENIED:
              x.innerHTML = "User denied the request for Geolocation."
              break;
          case error.POSITION_UNAVAILABLE:
              x.innerHTML = "Location information is unavailable."
              break;
          case error.TIMEOUT:
              x.innerHTML = "The request to get user location timed out."
              break;
          case error.UNKNOWN_ERROR:
              x.innerHTML = "An unknown error occurred."
              break;
      }
  }
  
subject: add a marker