	var map;
	function getGoogleMap(controls,lat,lng,zoom)
	{			
		map = new GMap2(document.getElementById("map"));
		
		if(controls == 1)
		{
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			//map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
		}
		
		map.setCenter(new GLatLng(lat, lng), zoom);
		map.enableDoubleClickZoom();
	}
	
			
	function addPunts(punts)
	{
		for (var i =  0 ; i <punts.length ; i++) {
			map.addOverlay(punts[i]);
		}
	}
	
	function addUnPunt(punt)
	{
		map.addOverlay(punt);
	}

	function setIcon(icona)
	{		
		var markerOptions = null;
		var Icon = new GIcon(G_DEFAULT_ICON);
			
		Icon.image = icona;
		Icon.iconSize = new GSize(24,24);
		Icon.shadowSize = new GSize(0,0); 
		
		// Set up our GMarkerOptions object
		markerOptions = { icon:Icon };
		return markerOptions;
	}
				
	function removePunts(punts)
	{
		for (var i =  0 ; i <punts.length ; i++) {
			map.removeOverlay(punts[i]);
		}
	}
			
	function removeUnPunt()
	{
		map.removeOverlay(punts[0]);
	}
	
	function creaPunt4Loca(inf,bocata){
		var markerOptions=null;
		var titol = inf["nom"];
		var posn = new GLatLng(inf["posn"][0], inf["posn"][1]);
		var icona = inf["icona"];		
		if((icona != null) && (icona != ""))
		{	
			markerOptions = setIcon(icona);
		}			
		var nouPunt = new GMarker(posn,markerOptions);
		if(bocata == 1)
		{
			var html = inf["html"];
			if((html != null) && (html != ""))
			{
				GEvent.addListener(nouPunt, "click", function() {
				  nouPunt.openInfoWindowHtml(html);
				});
			}
		}
		return nouPunt;
	}
	

