	function edificios_showMap(nombre) {

			var place = [];
			place = MARKERS[TYPE]["places"][0];
			
			cmaps = new CGoogleMaps();	
			cmaps.setMarkerLayers(MARKERS);
	
			cmaps.initMap(nombre, place, onMapLoad, 16);
			edificios_addControls();
		
			cmaps.addIcon(0,0,18,edificios_getIcon(0));
			cmaps.addIcon(1,0,18,edificios_getIcon(1));
			cmaps.selectLayer(TYPE,true);
			cmaps.showMarkers();
		
		}	
	
	
	function edificios_getIcon(tipo) {
			var img ='';
			switch(tipo) {
				case 0: img = 'icon_disp.png'; break;
				case 1: img = 'icon_nodisp.png'; break;
			}
	
			icon = new GIcon();
			icon.image = '../imagesGestactin/maps/'+img;		
			icon.shadow = '../imagesGestactin/maps/shadow50.png';		
			icon.iconSize = new GSize(24, 49);
			icon.shadowSize = new GSize(37, 34);
			icon.iconAnchor = new GPoint(13, 44);
			icon.infoWindowAnchor = new GPoint(1,11);
		
			return icon;
	}


		// **** controles ****
		
		function edificios_addControls() {
				var imgPath = '../imagesGestactin/maps/';
				var size = cmaps.map_.getSize();
				cmaps.map_.addControl(new FlechaUpControl(size.width, size.height, imgPath));
				cmaps.map_.addControl(new FlechaDownControl(size.width, size.height, imgPath));
				cmaps.map_.addControl(new FlechaLeftControl(size.width, size.height, imgPath));
				cmaps.map_.addControl(new FlechaRightControl(size.width, size.height, imgPath));
		}
		
		 function edificios_onZoomIn() {
				cmaps.map_.zoomIn();
	   }
	   
	   function edificios_onZoomOut() {
		   	cmaps.map_.zoomOut();
	   }
	  
		
	   function edificios_onClickMapType(selected) {
	   		var imgPath = '../imagesGestactin/maps/';
	    	var imgNames = ['','bot_map','bot_sat','bot_hib'];
	    	var mapTypes = ['',G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP];
	    	
	    	for (var i=1; i <= 3 ; i++) {
	    		var tab = document.getElementById("maptype"+i);
		    	if (i==selected) {
		    		tab.setAttribute('src',imgPath+imgNames[i]+'_on.png');
		    	}	
		    	else {
					tab.setAttribute('src',imgPath+imgNames[i]+'_off.png');
		    	}	
		    }	
		    cmaps.map_.setMapType(mapTypes[selected]);
    }  
    
    
    function mouseOver(obj) {
			obj.style.cursor = 'pointer';
		}
		
		function edificios_onClickTable(id) {
			var place = cmaps.getPlaceById(id);
			var type = cmaps.getTypeById(id);
	    	cmaps.setFocus(place);
	 		cmaps.openInfo(place, type, getHTML_Info(place)); 
			checkCell(id);
		}
		
		function onClickMarker(overlay, point)  {
			var id = '';
			if (overlay) 
			{
				id = cmaps.getMarkerId(overlay);
				if (id) edificios_onClickTable(id);
			} 
			checkCell(id);
		}	
		
		function onInfoWindowClose() {
			uncheckCell(null);
		}
		
		function onMapZoom(oldLevel, newLevel) {
			this.closeInfoWindow();
		}
		
		// ------------ DISEŅO --------------
		
		function checkCell(id) {
			if (id) {
				var cell = document.getElementById(id);
				if (cell) {
					cell.className = cell.className + ' seleccionado';
					uncheckCell(id);
				}	
			}	
		}
		function uncheckCell(id) 
		{ 
			var selectedId = document.getElementById("selected_id");
			if (selectedId.value && selectedId.value!=id) {
				var lastCell = document.getElementById(selectedId.value);
				if (lastCell) lastCell.className = '';
			}	
			selectedId.value = id;
		}
		
		// -----------
		
		
		
		
	function edificios_showMap_general(nombre) 
	{
	
			var DOWNLEFT = new GLatLng(40.43-10,-3.69-5); 
			var TOPRIGHT = new GLatLng(40.43+10,-3.69+5);
			
			var place = [];
			place.lat = TOPRIGHT.lat()-(TOPRIGHT.lat()-DOWNLEFT.lat())/2;
			place.lng = DOWNLEFT.lng()-(DOWNLEFT.lng()-TOPRIGHT.lng())/2;
						
	
						
			cmaps = new CGoogleMaps();	
			cmaps.setMarkerLayers(MARKERS);
			cmaps.initMap(nombre, place, function() {}, 12);
			cmaps.addListener("map","click", onClickMarker);
			cmaps.addListener("map","infowindowclose", onInfoWindowClose);
			cmaps.addListener("map","zoomend", onMapZoom);
			
			edificios_addControls();
			
			
			for (var tipo=0;tipo<=1;tipo++)
			{
					cmaps.addIcon(tipo,0,18,edificios_getIcon(tipo));
					
					clist[tipo] = new CListManager(cmaps, document.getElementById("listado"), insertTableRow);	
					clist[tipo].addListIcon(tipo, true, '../imagesGestactin/maps/cuadrito'+(tipo+1)+'.gif');
					
					cmaps.selectLayer(tipo,true);
			}
			
			cmaps.showMarkers();
			
			
			//aņadimos a la lista los edificios
			var minlat = null, minlng = null, maxlat = null, maxlng = null;
			var bounds = new GLatLngBounds(DOWNLEFT,TOPRIGHT);
			
			for (var layer = 1;layer>=0; layer--){ 
				clist[layer].init();	 
				for (var x in MARKERS[layer]["places"]) {
					var id = cmaps.getId(layer, x);
					clist[layer].add(id); 
					clist[layer].show(id,bounds); 
					// recogemos datos para calcular el valor del centro
						if (!minlat) { 
							
							minlat = maxlat = MARKERS[layer]["places"][x].lat;
							minlng = maxlng = MARKERS[layer]["places"][x].lng;
						}	else {
							if (minlat > MARKERS[layer]["places"][x].lat)  minlat = MARKERS[layer]["places"][x].lat; 
							if (minlng > MARKERS[layer]["places"][x].lng)  minlng = MARKERS[layer]["places"][x].lng;
							if (maxlat < MARKERS[layer]["places"][x].lat)  maxlat = MARKERS[layer]["places"][x].lat; 
							if (maxlng < MARKERS[layer]["places"][x].lng)  maxlng = MARKERS[layer]["places"][x].lng;
						}
				}
			}
			
			place.lat = (minlat+maxlat)/2;
			place.lng = (minlng+maxlng)/2;
			cmaps.setCenter(place);
			
			
		}	
