﻿function BackControl() {
}

BackControl.prototype = new GControl();

BackControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
  var backDiv = document.createElement("div");
  this.setButtonStyle_(backDiv);
  container.appendChild(backDiv);
  backDiv.appendChild(document.createTextNode("Alkuun"));
  GEvent.addDomListener(backDiv, "click", function() {
    goToMainLevel();
  });

  map.getContainer().appendChild(container);
  return container;
}

BackControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(52, 8));
}

// Sets the proper CSS for the given button element.
BackControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "black";
  button.style.backgroundColor = "white";
  button.style.font = "small Arial";
  button.style.border = "2px ridge black";
  button.style.paddingTop = "0px";
  button.style.paddingBottom = "1px";
  button.style.paddingLeft = "8px";
  button.style.paddingRight = "8px";
  //button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  //button.style.width = "6em";
  button.style.cursor = "pointer";
}