// control botons google personalitzats

function CatControl() {}

CatControl.prototype = new GControl();

CatControl.prototype.initialize = function(map) {
	var container = document.createElement("div");
	// botons
	var mapbtn = document.createElement("div");
	mapbtn.appendChild(document.createTextNode("Mapa"));
	this.setButtonStyle_(mapbtn);
	GEvent.addDomListener(mapbtn, "click", function() {
    	map.setMapType(G_NORMAL_MAP);
	});
	
	
	var hibridbtn = document.createElement("div");
	hibridbtn.appendChild(document.createTextNode("Híbrid"));
	this.setButtonStyle_(hibridbtn);
	GEvent.addDomListener(hibridbtn, "click", function() {
    	map.setMapType(G_HYBRID_MAP);
	});
	
	var satelitbtn = document.createElement("div");
	satelitbtn.appendChild(document.createTextNode("Satèl.lit"));
	this.setButtonStyle_(satelitbtn);
	GEvent.addDomListener(satelitbtn, "click", function() {
    	map.setMapType(G_SATELLITE_MAP);
	});
	
	container.appendChild(mapbtn);
	container.appendChild(satelitbtn);
	container.appendChild(hibridbtn);
	
	map.getContainer().appendChild(container);
	return container;
}

CatControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

CatControl.prototype.setButtonStyle_ = function(button) {
  // button.style.textDecoration = "underline";
  button.style.color = "#000";
  button.style.backgroundColor = "white";
  button.style.font = "small Arial";
  button.style.border = "1px solid black";
  button.style.padding = "2px";
  button.style.marginBottom = "1px";
  button.style.textAlign = "center";
  button.style.width = "5em";
  button.style.cursor = "pointer";
}