/*
 function load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    var mgr = new GMarkerManager(map);
  }
}
*/

// A TextualZoomControl is a GControl that displays textual "Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons used in
// Google Maps).
function TextualZoomControl() {
}

TextualZoomControl.prototype = new GControl();

TextualZoomControl.prototype.initialize = function(map) {
	var container = document.createElement("div");
	
	var toUpDiv = document.createElement("div");
	this.setButtonStyle_(toUpDiv);
	container.appendChild(toUpDiv);
	toUpDiv.innerHTML = '<img src="googlemaps/up.png" alt="" />';
	toUpDiv.style.top = '10px'; toUpDiv.style.left = '25px';
	GEvent.addDomListener(toUpDiv, "click", function() {
		map.panDirection(0, 1);
	});
	
	var toLeftDiv = document.createElement("div");
	this.setButtonStyle_(toLeftDiv);
	container.appendChild(toLeftDiv);
	toLeftDiv.innerHTML = '<img src="googlemaps/left.png" alt="" />';
	toLeftDiv.style.top = '30px'; toLeftDiv.style.left = '10px';
	GEvent.addDomListener(toLeftDiv, "click", function() {
		map.panDirection(1, 0);
	});
	
	var toRightDiv = document.createElement("div");
	this.setButtonStyle_(toRightDiv);
	container.appendChild(toRightDiv);
	toRightDiv.innerHTML = '<img src="googlemaps/right.png" alt="" />';
	toRightDiv.style.top = '30px'; toRightDiv.style.left = '40px';
	GEvent.addDomListener(toRightDiv, "click", function() {
		map.panDirection(-1, 0);
	});
	
	var toDownDiv = document.createElement("div");
	this.setButtonStyle_(toDownDiv);
	container.appendChild(toDownDiv);
	toDownDiv.innerHTML = '<img src="googlemaps/down.png" alt="" />';
	toDownDiv.style.top = '50px'; toDownDiv.style.left = '25px';
	GEvent.addDomListener(toDownDiv, "click", function() {
		map.panDirection(0, -1);
	});
	
	var zoomInDiv = document.createElement("div");
	this.setButtonStyle_(zoomInDiv);
	container.appendChild(zoomInDiv);
	zoomInDiv.innerHTML = '<img src="googlemaps/plus.png" alt="" />';
	zoomInDiv.style.top = '75px'; zoomInDiv.style.left = '25px';
	GEvent.addDomListener(zoomInDiv, "click", function() {
		map.zoomIn();
	});

	var zoomOutDiv = document.createElement("div");
	this.setButtonStyle_(zoomOutDiv);
	container.appendChild(zoomOutDiv);
	zoomOutDiv.innerHTML = '<img src="googlemaps/minus.png" alt="" />';
	zoomOutDiv.style.top = '95px'; zoomOutDiv.style.left = '25px';
	GEvent.addDomListener(zoomOutDiv, "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.
TextualZoomControl.prototype.getDefaultPosition = function() {
	return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0, 0));
}

// Sets the proper CSS for the given button element.
TextualZoomControl.prototype.setButtonStyle_ = function(button) {
	button.className = 'gmap_button';
}

function load() {
   if (GBrowserIsCompatible()) {

	  var map = new GMap2(document.getElementById("map"));
	  map.addControl(new TextualZoomControl());
	  map.setCenter(new GLatLng(60.978765, 25.658108), 15);
 	  
	  var icon = new GIcon();
	  icon.image = "googlemaps/beer_icon.png";
	  icon.shadow = "googlemaps/beer_icon_shadow.png";
	  icon.iconSize = new GSize(15, 32);
	  icon.shadowSize = new GSize(27, 30);
	  icon.iconAnchor = new GPoint(15, 32);
	  
	  //icon.infoWindowAnchor = new GPoint(5, 1);
	  var point = new GLatLng(60.9787, 25.6581);
	  map.addOverlay(new GMarker(point, icon));
   }
}

