// JavaScript Document
var G_addSpan;
var G_cancelSpan;
function MapAddControl(i) {
}
MapAddControl.prototype = new GControl();
MapAddControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  G_addSpan = document.createElement("span");
  this.setButtonStyle_(G_addSpan);
  container.appendChild(G_addSpan);

  G_addSpan.appendChild(document.createTextNode("add a place mark"));

  G_cancelSpan = document.createElement("span");
  this.setButtonStyle_(G_cancelSpan);
  container.appendChild(G_cancelSpan);
  G_cancelSpan.appendChild(document.createTextNode("cancel"));
  G_cancelSpan.style.display = 'none';
  
  GEvent.addDomListener(G_addSpan, "click", function() {
	if(WM.startAddMarker())
	{
		G_cancelSpan.style.display = 'inline';
		G_addSpan.style.display = 'none';
	}
  });
  
  GEvent.addDomListener(G_cancelSpan, "click", function() {
	WM.closeMarkerInfo();	
	G_addSpan.style.display = 'inline';
	G_cancelSpan.style.display = 'none';
  });

  map.getContainer().appendChild(container);
  return container;
}

MapAddControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 35));
}

MapAddControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "#ffffff";
  button.style.backgroundColor = "#eb8c2f";
  button.style.font = "12px Arial";
  button.style.fontWeight="600";
  button.style.border = "1px solid white";
  button.style.padding = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "6em";
  button.style.cursor = "pointer";
}



















