     //Begins 
     function loadScript() {
     	var script = document.createElement('script');
     	script.type = 'text/javascript';
     	script.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyCSsor1E1STB_jcqIGYc2ljfGBya5z5ULA' +
		'&callback=initialize&libraries=places';	
		//https://maps.googleapis.com/maps/api/js?key=AIzaSyAgYK3ytwWRRFM3OHhKQ88Uezpt3i-4NQI&callback=initMap&libraries=places&v=weekly
     	document.body.appendChild(script);
     }

     window.onload = loadScript;
     //var executed=false;
     var manpng='/static/images/google_maps_icon/man.png';
     var projectpng='/static/images/google_maps_icon/red-map-marker.gif';
     
     //var projectpng='/static/images/google_maps_icon/google_maps_marker.png';
	 //var destpng='/static/images/google_maps_icon/red-map-marker.gif';
	 
     //var projectpng='/static/images/google_maps_icon/project.png';
     var z;
     var map;
     
  	var marker;
  	var mapOptions;
  	var ZOOM=16; // was 5
  	var ZOOMP=15; // was 4
     //Functions for current real time positions
//////////////////////////////////*CURRENT LOCATION Begin*/
  	var myCurrentLatLng;
  	var markerCurrent;
  	var bluedotpng = '/static/images/google_maps_icon/blue_dot.png';
    
     	function showPosition(position) {
     		myCurrentLatLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
     		//save to input
     		//$('[name=location_last_lat]').val(position.coords.latitude);
     		//$('[name=location_last_lng]').val(position.coords.longitude);
     		
     		// THESE OVER-RIDE THE SAVE POSITIONS WHICH WE MAY NOT WANT TO DO
     		//$('[name=location_lat]').val(position.coords.latitude);
     		//$('[name=location_lng]').val(position.coords.longitude);
     		//show on map real position
    		markerCurrent = new google.maps.Marker({
      			position: myCurrentLatLng,
      			map: map,
      			title: 'I am here!',
      			icon: bluedotpng
      		});

     	}

     	function showError(error) {
     		switch (error.code) {
     			case error.PERMISSION_DENIED:
     				map.innerHTML = "User denied the request for Geolocation."
     				break;
     			case error.POSITION_UNAVAILABLE:
     				map.innerHTML = "Location information is unavailable."
     				break;
     			case error.TIMEOUT:
     				map.innerHTML = "The request to get user location timed out."
     				break;
     			case error.UNKNOWN_ERROR:
     				map.innerHTML = "An unknown error occurred."
     				break;
     		}
     	}
 
     	function addCurrentLocationMarker() {
     		//if (!executed) {
     			if (navigator.geolocation) {
     				//executed = true;
     				navigator.geolocation.getCurrentPosition(showPosition, showError);
     			} else {
     				map.innerHTML = "Geolocation is not supported by this browser.";
     			}
     		/*} else {
     			markerCurrent.setPosition(myCurrentLatLng);
     		}*/
     	}
///////////////////////////////////*CURRENT LOCATION END*/ 
     	function geocodePosition(pos) {
     		geocoder = new google.maps.Geocoder();
     		geocoder.geocode({
     			latLng: pos
     		},

     		function(results, status) {
     			if (status == google.maps.GeocoderStatus.OK) {
     				$('[name=location]').val(results[0].formatted_address);
     				$('[name=location_lat]').val(results[0].geometry.location.lat);
     				$('[name=location_lng]').val(results[0].geometry.location.lng);
     				// these were there before
     				//$('[name=location_lat]').val(results[0].geometry.location.A);
     				//$('[name=location_lng]').val(results[0].geometry.location.F);
     				$("#mapErrorMsg").hide(100);
     			} else {
     				$("#mapErrorMsg").html('Cannot determine address at this location.' + status).show(100);
     			}
     		});
     	}    	
     	function geocodeAddress() {
     		var ajson = "https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyCSsor1E1STB_jcqIGYc2ljfGBya5z5ULA&address=" + $('[name=location]').val()
     		$.ajax({
     			dataType: "json",
     			url: ajson,
     			success: function(d) {
     				z = d.results[0].geometry.location
     				$('[name=location_lat]').val(z.lat);
     				$('[name=location_lng]').val(z.lng);
     				marker.setPosition(z);
     				map.setCenter(z);
     			}
     		});
     	}

     	function geocodeAddress2() {
     		var ajson = "https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyCSsor1E1STB_jcqIGYc2ljfGBya5z5ULA&address=" + $('[name=location2]').val()
     		$.ajax({
     			dataType: "json",
     			url: ajson,
     			success: function(d) {
     				z = d.results[0].geometry.location
     				$('[name=location2_lat]').val(z.lat);
     				$('[name=location2_lng]').val(z.lng);
     				marker.setPosition(z);
     				map.setCenter(z);
     			}
     		});
     	}

     function initialize() {
     	posLatLngHome = new google.maps.LatLng($('[name=location_lat]').val(),$('[name=location_lng]').val());
//     	var mylat = $('[name=location_lat]').val();
//     	var mylng = $('[name=location_lng]').val();
     	posTelegraph = new google.maps.LatLng($('[name=location2_lat]').val(), $('[name=location2_lng]').val());
     	//var posTelegraph = new google.maps.LatLng('41.884821','-87.628118');
     	//alert(mylng);
     	//posLatLngHome = new google.maps.LatLng('41.884821','-87.628118');
     	
     	//coordinates = obj.getCoordinates();
		//current_pos = new google.maps.LatLng(coordinates.latitude, coordinates.longitude);
     	// zoom: was ZOOM
     	mapOptions = {
     		zoom: 15,
     		center: posLatLngHome,
            scrollwheel: false
     	}
     	map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
     	
     	marker = new google.maps.Marker({
     		position: posLatLngHome,
     		draggable: true,
     		animation: google.maps.Animation.DROP,
     		map: map,
     		title: 'I was here!',
     		icon: projectpng

     	});
     	
     	marker2 = new google.maps.Marker({
			 position: posTelegraph,
			 draggable: true,
			 animation: google.maps.Animation.DROP,
			 map: map,
			 title: 'Telegraph Location',
			 icon: projectpng

		 });
		 
     	addCurrentLocationMarker();
     	google.maps.event.addListener(marker, 'dragend', function() {
      		geocodePosition(marker.getPosition());
      		//marker2.setPosition(posTelegraph);
      		geocodePosition(marker2.getPosition());
      	});
     }
     
     