﻿/**
 * Textual Zoom Control
 * 
 * @desc        Provides a back button that reverts map latlng and zoom values
 * @url         http://www.bilisimhizmetleriofisi.com
 * @author      Berk Demirkır <bdemirkir@mixoffice.com>
 * @copyright   February 2010 - Bilişim Hizmetleri Ofisi
 */
function TextualZoomControl() {}
TextualZoomControl.prototype = new GControl();
TextualZoomControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}
TextualZoomControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
  // If this isn't IE we can add a shadow for beauty & native-look map button
  if(!$.browser.msie) {
    container.style.borderRight = "2px solid rgba(50, 50, 50, 0.4)";
    container.style.borderBottom = "2px solid rgba(50, 50, 50, 0.4)";
  }
  var zoomOutDiv = document.createElement("div");
  zoomOutDiv.style.textDecoration = "none";
  zoomOutDiv.style.backgroundColor = "white";
  zoomOutDiv.style.font = "small Arial";
  zoomOutDiv.style.border = "1px solid black";
  zoomOutDiv.style.marginLeft = "-2px";
  zoomOutDiv.style.marginTop = "-2px";
  zoomOutDiv.style.textAlign = "center";
  zoomOutDiv.style.width = "6em";
  zoomOutDiv.style.cursor = "pointer";
  container.appendChild(zoomOutDiv);
  zoomOutDiv.appendChild(document.createTextNode("Geri"));
  GEvent.addDomListener(zoomOutDiv, "click", function() {
    map.getInfoWindow().hide();
    // Attention! This variables are non-standard. Please ensure that these are set.
    map.setCenter(map.defaultLatLng, map.defaultZoom);
	$('#city').val(0).change();
  });

  map.getContainer().appendChild(container);
  return container;
}
