			// ********************************* CustomScaleControl ********************************* 
			// controllo di scala personalizzato: la mappa è Euclidea, quindi calcola e 
			// visualizza la scala tenendo conto del solo fattore di zoom. La scala graduata
			// viene rappresentata con una gif trasparente. Il controllo estende GControl.
			function CustomScaleControl() {
			}
			
			CustomScaleControl.prototype = new GControl();
			
			CustomScaleControl.prototype.initialize = function(map) {
			
					var container = document.createElement("div");
					container.style.height = "20px";
					container.style.width = "110px";
					container.style.font = "small Arial";
					container.style.border = "1px solid black";
					container.style.padding = "1px";
					container.style.marginBottom = "0px";
					container.style.color = "#0000cc";
					 
					var tabella = document.createElement("table");
					
			    var riga=tabella.insertRow(0);
					riga.style.height = "15px";
					
					var cella1 = riga.insertCell(0);
					cella1.appendChild(document.createTextNode(" "));
					cella1.style.padding = "0px";
					cella1.style.width="65px";
					cella1.style.font = "x-small Arial";
					cella1.style.backgroundImage = "url(css/scala.gif)";
					
					var cella2 = riga.insertCell(1);
					cella2.style.padding = "0px";
					cella2.style.width="45px";
					cella2.style.font = "x-small Arial";
					cella2.style.color = "white";
					cella2.style.textAlign = "center";
					cella2.id="za";
					cella2.appendChild(document.createTextNode("0"));
					
					container.appendChild(tabella);
					map.getContainer().appendChild(container);

		      // listener sull'evento zoomend
		      GEvent.addListener(map, "zoomend", function(oldLevel, newLevel) { 
				    	var etichetta = document.getElementById("za");
				    	switch(newLevel) { 
						  case 10: 
				    		etichetta.firstChild.nodeValue = "10 km" ;
				    		break; 
						  case 9: 
				    		etichetta.firstChild.nodeValue = "20 km" ;
				    		break; 
						  case 8: 
				    		etichetta.firstChild.nodeValue = "40 km" ;
				    		break; 
						  case 7: 
				    		etichetta.firstChild.nodeValue = "80 km" ;
				    		break; 
						  case 6: 
				    		etichetta.firstChild.nodeValue = "160 km" ;
				    		break; 
						  case 5: 
				    		etichetta.firstChild.nodeValue = "320 km" ;
				    		break; 
				    	}
		      });

					return container;
			}
			
			CustomScaleControl.prototype.getDefaultPosition = function() {
			 		return new GControlPosition(G_ANCHOR_BOTTOM_LEFT , new GSize(70, 2));
			}
			// ******************************* CustomScaleControl End ******************************* 

