var mapContainer;
var mapWidth;
var mapHeight;
var zoom;
var coords;
var map;
var marker;
var defaultZoom = 6;

function mapInit() {
if (GBrowserIsCompatible()) {
  map = new GMap2(document.getElementById(mapContainer),{size:new GSize(mapWidth,mapHeight)});
  map.setUIToDefault();
  map.setCenter(coords);
  map.setZoom(zoom);
  window.onresize = function() {
      window.map.checkResize();
  };

  //  map.addControl(new TextualCenterControl());
	}
}

function getMarker()
{
	point = map.getCenter();
	if(point)
	{
		if(marker)
			map.removeOverlay(marker);
		
	marker = new GMarker(point);		

	map.addOverlay(marker);
}
	
function TextualCenterControl() {
}

TextualCenterControl.prototype = new GControl();

TextualCenterControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  zoomInDiv.appendChild(document.createTextNode(centerText));
  GEvent.addDomListener(zoomInDiv, "click", function() {
		map.setCenter(marker.getLatLng(), zoom);
  });

  map.getContainer().appendChild(container);
  return container;
}

// By default, the control will appear in the top right corner of the
// map with 7 pixels of padding.
TextualCenterControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
TextualCenterControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "#000000";
  button.style.backgroundColor = "white";
  button.style.font = "small Arial";
  button.style.border = "1px solid black";
  button.style.padding = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "6em";
  button.style.cursor = "pointer";
}
}
