I'm fairly new to Javascript and I'm finding it hard to debug this error. My console is reading the following message:

Uncaught TypeError: Cannot read property '__e3_' of undefined

I'v pasted my code below, any help or hints would be much appreciated as always. Thanks!

Code:
 var map;

              function initialize() {

                var latlng = new google.maps.LatLng(31.267694, 17.341919);

                var mapOptions = {
                  zoom: 3,
                  center: latlng,
                  minZoom:3,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
                };

                var map = new google.maps.Map(document.getElementById('google_map_div'), mapOptions);

                map.setOptions({styles: styles});
              }

              google.maps.event.addDomListener(window, 'load', initialize);

              // from above is working
              
              var marker;
              var infowindow;

              var html = "<table>" +
                 "<tr><td>Name:</td> <td><input type='text' id='site_name'/> </td> </tr>" +
                 "<tr><td>Address:</td> <td><input type='text' id='marker_address'/></td> </tr>" +
                 "<tr><td>Type:</td> <td><select id='site_dive_type'>" +
                 "<option value='bar' SELECTED>bar</option>" +
                 "<option value='restaurant'>restaurant</option>" +
                 "</select></td></tr>" +
                 "<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>";

              infowindow = new google.maps.InfoWindow({
               content: html
              });

              google.maps.event.addListener(map, "click", function(event) {
                  marker = new google.maps.Marker({
                    position: event.latLng,
                    map: map
                  });
              
              google.maps.event.addListener(marker, "click", function() {
                    infowindow.open(map, marker);
                  });
              });
              
              function saveData() {
              var site_name = escape(document.getElementById("site_name").value);
              var marker_address = escape(document.getElementById("marker_address").value);
              var site_dive_type = document.getElementById("site_dive_type").value;
              var latlng = marker.getPosition();
         
              var url = "process_add_marker.php?site_name=" + site_name + "&marker_address=" + marker_address +
                        "&site_dive_type=" + site_dive_type + "&lat=" + latlng.lat() + "&lng=" + latlng.lng();
              downloadUrl(url, function(data, responseCode) {
                if (responseCode == 200 && data.length <= 1) {
                  infowindow.close();
                  document.getElementById("message").innerHTML = "Location added.";
                }
              });
            }

            function downloadUrl(url, callback) {
              var request = window.ActiveXObject ?
                  new ActiveXObject('Microsoft.XMLHTTP') :
                  new XMLHttpRequest;

              request.onreadystatechange = function() {
                if (request.readyState == 4) {
                  request.onreadystatechange = doNothing;
                  callback(request.responseText, request.status);
                }
              };

              request.open('GET', url, true);
              request.send(null);
            }

            function doNothing() {}