/**
* $Date: 2009-05-18 13:42:06 +0200 (må, 18 maj 2009) $
* $Author: lars.huring $
* $Revision: 303 $
**/

KL.ZoomControl = function()
{
}

KL.ZoomControl.prototype = new GControl();


// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
KL.ZoomControl.prototype.initialize = function(map) {
	var container = document.createElement("div");

	var zoomin = this.getButton();
	zoomin.src = KLParams.baseURL + "images/maps/map-zoomin.png";
	zoomin.alt = "Zoom in";

	container.appendChild(zoomin);
	GEvent.addDomListener(zoomin, "click", function() {
		map.zoomIn();
	});

	var zoomout = this.getButton();
	zoomout.src = KLParams.baseURL + "images/maps/map-zoomout.png";
	zoomout.alt = "Zoom out";

	container.appendChild(zoomout);
	GEvent.addDomListener(zoomout, "click", function() {
		map.zoomOut();
	});

	map.getContainer().appendChild(container);
	return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
KL.ZoomControl.prototype.getDefaultPosition = function()
{
	return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
KL.ZoomControl.prototype.getButton = function() {

	var button = new Image();

	button.style.display = "block";
	button.style.cursor = "pointer";
	button.style.margin = "0 0 2px 0";

	return button;

}