function initializeMaps()
{
	if (GBrowserIsCompatible())
	{
		map = new GMap2($("map"));
		map.setCenter(new GLatLng(38.711233,1.458435), 11);
		map.setUIToDefault();

		hotelsTable.each(function(hotel, index)
		{
			map.addOverlay(createMarker(hotel, index));
		});
  	}
}

function createMarker(hotel, index)
{
	var point = new GLatLng(hotel.lat, hotel.lng);
	var hotelIcon = new GIcon(G_DEFAULT_ICON);
	hotelIcon.iconSize = new GSize(13, 23);
	hotelIcon.shadowSize = new GSize(28, 23);
	hotelIcon.image = "../img/ico-map.png";
	var marker = new GMarker(point, hotelIcon);

	markers.push(marker);

	GEvent.addListener(marker, "click", function()
	{
		var sel = $$('#data-grid-hotels tr([class*="selected"])').first();
		var elt = $('data-grid-hotels-'+hotel.index);

		if(sel) sel.removeClassName("selected");
		// Seleccionamos éste
		if(elt) elt.addClassName('selected');
		// Abrimos un bocadillo de información

		var category = '';
		var picture = !hotel.picture.blank() ? hotel.picture : '/img/nothumbnail.gif';
		category = '<img src="/img/'+hotel[Object.keys(hotel)[2]]+'.png">';

		var myHtml = '<table border="0" width="420px" height="90" style="font-size:11px">'+
			'<tr><td width="105" rowspan="2"><img style="margin-right:5px; width:100px;" src="' + picture + '" alt="' + hotel[Object.keys(hotel)[1]] + '"/></td>'+
			'<td width="200" valign="top"><b>' + hotel[Object.keys(hotel)[1]] + '</b> '+ category + '<br/>' + hotel.address + '</td></tr>'+
			'<tr>'+
    			'<td valign="top">'+
    			'<table border="0" width="300px"><tbody><tr><td>'+
					Object.keys(hotel)[5] +": <b>" + (Object.values(hotel)[5] != 0 ? Object.values(hotel)[5] : strnoavail)+
					'</b></td><td>'+
					Object.keys(hotel)[6] +": <b>" + (Object.values(hotel)[6] != 0 ? Object.values(hotel)[6] : strnoavail)+
					'</b></td><td>'+
					Object.keys(hotel)[7] +": <b>" + (Object.values(hotel)[7] != 0 ? Object.values(hotel)[7] : strnoavail)+
					'</b></td></tr><tr><td>'+
					Object.keys(hotel)[8] +": <b>" + (Object.values(hotel)[8] != 0 ? Object.values(hotel)[8] : strnoavail)+
					'</b></td><td>'+
					Object.keys(hotel)[9] +": <b>" + (Object.values(hotel)[9] != 0 ? Object.values(hotel)[9] : strnoavail)+
					'</b></td>'+'<td>'+
					Object.keys(hotel)[10] +": <b>" + (Object.values(hotel)[10] != 0 ? Object.values(hotel)[10] : strnoavail)+
					'</b></td></tr><tr><td>'+
					Object.keys(hotel)[11] +": <b>" + (Object.values(hotel)[11] != 0 ? Object.values(hotel)[11] : strnoavail) +'</b><td>&nbsp;</td><td>&nbsp;</td></tr>'
					'</tbody></table>'+
    			+'</td>'+
  			'</tr>'+
			'</table>';

		map.openInfoWindowHtml(point, myHtml);

	});

	return marker;
}
