initializeGMap = function() {
	
	geocoder = new google.maps.Geocoder();
	
	var myOptions = {
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.TERRAIN,
      scaleControl : true,
	  navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.ZOOM_PAN},
	  mapTypeControl: true,
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT }
    };
	
    gmap = new google.maps.Map(document.getElementById("gmap_box"),myOptions);
    $("#gmap_box").show();
    
}

/**
 * LatLngControl class displays the LatLng and pixel coordinates
 * underneath the mouse within a container anchored to it.
 * @param {google.maps.Map} map Map to add custom control to.
 */
function LatLngControl(map) {
  /**
   * Offset the control container from the mouse by this amount.
   */
  this.ANCHOR_OFFSET_ = new google.maps.Point(8, 8);
  
  /**
   * Pointer to the HTML container.
   */
  this.node_ = this.createHtmlNode_();
  
  // Add control to the map. Position is irrelevant.
  map.controls[google.maps.ControlPosition.TOP].push(this.node_);
  
  // Bind this OverlayView to the map so we can access MapCanvasProjection
  // to convert LatLng to Point coordinates.
  this.setMap(map);
  
  // Register an MVC property to indicate whether this custom control
  // is visible or hidden. Initially hide control until mouse is over map.
  this.set('visible', false);
}
	
	// Extend OverlayView so we can access MapCanvasProjection.
	LatLngControl.prototype = new google.maps.OverlayView();
	LatLngControl.prototype.draw = function() {};
	
	/**
	 * @private
	 * Helper function creates the HTML node which is the control container.
	 * @return {HTMLDivElement}
	 */
	LatLngControl.prototype.createHtmlNode_ = function() {
	  var divNode = document.createElement('div');
	  divNode.id = 'latlng-control';
	  divNode.index = 100;
	  return divNode;
	};

	/**
	 * MVC property's state change handler function to show/hide the
	 * control container.
	 */
	LatLngControl.prototype.visible_changed = function() {
	  this.node_.style.display = this.get('visible') ? '' : 'none';
	};

	LatLngControl.prototype.getPoint= function(latLng) {
		  var projection = this.getProjection();
		  var point = projection.fromLatLngToContainerPixel(latLng);
		  return point;
	};
	
	LatLngControl.prototype.getLatLng = function(poiny) {
		  var projection = this.getProjection();
		  var point = projection.fromLatLngToContainerPixel(latLng);
		  return point;
	};
	


/**
 * Called on the initial pageload.
 */
function init() {
  var centerLatLng = new google.maps.LatLng(37.748582,-122.418411);
  var map = new google.maps.Map(document.getElementById('map'), {
    'zoom': 10,
    'center': centerLatLng,
    'mapTypeId': google.maps.MapTypeId.ROADMAP
  });
  
  // Create new control to display latlng and coordinates under mouse.
  var latLngControl = new LatLngControl(map);
  
  // Register event listeners
  google.maps.event.addListener(map, 'mouseover', function(mEvent) {
    latLngControl.set('visible', true);
  });
  google.maps.event.addListener(map, 'mouseout', function(mEvent) {
    latLngControl.set('visible', false);
  });
  google.maps.event.addListener(map, 'mousemove', function(mEvent) {
    latLngControl.updatePosition(mEvent.latLng);
  });
}


