
	var icons = new Array();
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/map_tube_station_grey.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(28, 28);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["landmark_grey"] = icon;
	
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/map_tube_station.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(28, 28);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["landmark_colored"] = icon;
	
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/tube/1_grey.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(28, 28);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["landmark_1"] = icon;
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/tube/10_grey.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(28, 28);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["landmark_10"] = icon;
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/tube/11_grey.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(28, 28);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["landmark_11"] = icon;
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/tube/12_grey.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(28, 28);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["landmark_12"] = icon;
	
	
	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/map_hotel_not_selected_smal.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(20, 20);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(8, 16);
	icon.infoWindowAnchor = new GPoint(14, 14);

	icons["hotel_small"] = icon;
	
	

	var icon = new GIcon();
	icon.image = "http://www.subwayhotels.com/images/icons/map_hotel_not_selected.gif";
	icon.shadow = "http://www.subwayhotels.com/images/icons/trans_pix.gif";
	icon.iconSize = new GSize(27, 27);
	icon.shadowSize = new GSize(1, 1);
	icon.iconAnchor = new GPoint(14, 27);
	icon.infoWindowAnchor = new GPoint(14, 14);
	
	icons["hotel_big"] = icon;



    var map_center_lat = "51.5"; 
    var map_center_long = "0.1"; 
    var map_zoom_level = 12; 
    
 
 	var city_min_zoom = 1;
	var city_max_zoom = 7;

 	var landmark_min_zoom = 7;
	var landmark_max_zoom = 13;
	
	var hotel_min_zoom = 10;
	var hotel_max_zoom = 17;
	
	var markers = new Array(); 
	var landmark_details = new Array(); 

	var hotel_details = new Array(); 

	var current_landmark_type_id = 1;
	var map_move_enabled = false;
	
	var map = new Object();
	
	var labeled_marker_opts = {
			"icon": icon,
			"clickable": false,
			"draggable": false,
			"labelText": "",
			"labelOffset": new GSize(-14, -14)
		};
	
	
	
	
    function load_map() {
    	
      if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng( map_center_lat, map_center_long), map_zoom_level);
		
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());

		landmarkers_manager = new GMarkerManager(map, {trackMarkers: true});
		hotels_manager = new GMarkerManager(map, {trackMarkers: true});

		GEvent.addListener(map, "zoomend", function (oldLevel, newLevel)
			{
				if ( (oldLevel > newLevel) && (newLevel < 7) && (newLevel > 4))
				{
					map.openInfoWindow(map.getCenter(), "zoom in to see tubestations");
				}
			}
		
		);

		GEvent.addListener(map, "moveend", function() {
			

			if (hotels_manager.getMarkerCount() > 50)
			{

				return true;
			}
			if (!map_move_enabled)
			{

				return true;
			}
			map_bounds = map.getBounds();
			sw = map_bounds.getSouthWest();
			ne = map_bounds.getNorthEast();
			
			min_lat = sw.lat();
			max_lat = ne.lat();

			min_long = sw.lng();
			max_long = ne.lng();
			
			
			var url = "ajax.php";
			var pars = 'action=landmark_map_moved&landmark_id=&min_lat='
		    	+min_lat+'&max_lat='+max_lat+'&min_long='+min_long+'&max_long='+max_long;
			var myAjax = new Ajax.Request( url,
	
										{ method: 'get',
										  parameters: pars,
										  onComplete: js_eval
										}
	
									 );
			
	
			
				
		});




		
      }
    }
    

	function createLandMarker(point, number, type) {
		  var marker = new GMarker(point, icons["landmark_"+type] );

		  GEvent.addListener(marker, "click", function() {
			  try{
				marker_open_info(number);
			  }
			  catch(err)
			  {
			  }
		  });

		  GEvent.addListener(marker, "mouseover", function() {
			  try{
				marker_set_color_icon(number);
			  }
			  catch(err)
			  {
			  }
		  });

		  GEvent.addListener(marker, "mouseout", function() {
			  try{
				marker_set_grey_icon(number);
			  }
			  catch(err)
			  {
			  }

		  });

		  markers[number] = marker;
		  return marker;
		}


		
	
		
	function marker_open_info(number)
	{
	
		
		if (markers[number])
		{
			name = landmark_details[number]["name"];
			link = landmark_details[number]["link"];
			
			markers[number].openInfoWindowHtml("<div class='landmark_overlay'><a href='"+link+"' class='txt_hotel_blue_12'><b>" + name + "</b></a></div>", ({maxWidth:'100'}) );
			marker_set_color_icon(number);
		}

		
	}

	function marker_set_color_icon(number)
	{
		try
		{
			if (div = document.getElementById("land_"+number))
			{
				  div.style.fontWeight = "bold";
			}
			if (markers[number])
			{
				type = landmark_details[number]["type"];
				markers[number].setImage("http://www.subwayhotels.com/images/icons/tube/"+type+".gif");
			}

		}
		catch (err)
		{
		}
	}
	function marker_set_grey_icon(number)
	{
		try
		{
			
			if (div = document.getElementById("land_"+number))
			{
				  div.style.fontWeight = "normal";  				 
			}
			if (markers[number])
			{
				type = landmark_details[number]["type"];
				markers[number].setImage("http://www.subwayhotels.com/images/icons/tube/"+type+"_grey.gif");
			}
		}
		catch (err)
		{
		}

	}



	function initialize_landmark_map()
	{
		
		var landmark = createLandMarker( new GLatLng( map_center_lat, map_center_long ), current_landmark_id, current_landmark_type_id);
		landmarkers_manager.addMarker(landmark, landmark_min_zoom, landmark_max_zoom); 
		landmarkers_manager.refresh();

	}



	
    function createLabeledMarker(point, number, icon, label)
    {
	
		opts = {
			"icon": icon,
			"clickable": false,
			"draggable": false,
			"labelText": label,
			"labelOffset": new GSize(-9, -22)
		};
		
		var marker = new LabeledMarker(point, opts);
		
		GEvent.addListener(marker, "click", function() {
			hotel_open_info(number);
		  });
		  
	    GEvent.addListener(marker, "mouseover", function() {
			  hotel_set_selected_icon(number);
		  });

		GEvent.addListener(marker, "mouseout", function() {
			   hotel_set_not_selected_icon(number);
		  });

		  
		markers[number] = marker;
		return marker;
	}
	
	
	function hotel_open_info(hotel_id)
	{
		try{
			if (markers[hotel_id])
			{
				name = marker_details[hotel_id]["name"];
				link = marker_details[hotel_id]["link"];
				thumb_url = marker_details[hotel_id]["thumb_url"];
				address = marker_details[hotel_id]["address"];
				price = marker_details[hotel_id]["price"];
				price = "";
				
				if (thumb_url)
				{
					image_td = '<td rowspan="4"><a href="'+link+'"><img width="70" border="0" src="'+thumb_url+'"></a></td><td rowspan="4" class="spacer" width="10">&nbsp;</td>';
				}
				else
				{
					image_td = '';
				}
				markers[hotel_id].openInfoWindowHtml('<table class="hotel_overlay" cellpadding="0" cellspacing="0"><tr>'+image_td+'<td><a class="txt_hotel_blue" href="'+link+'"><b>'+name+'</b></a></td></tr>				<tr><td>'+address+'</td></tr>				<tr><td>'+price+'</td></tr>					</table>');
				hotel_set_selected_icon(hotel_id);
			}

		}
		catch(err)
		{
		}
		
	}

	function hotel_set_selected_icon(hotel_id)
	{
		try{
			if (div = document.getElementById("hotel_"+hotel_id))
			{
				  div.style.backgroundColor = "fff5de";
			}
		}
		catch(err)
		{
		}
		try{
			if (div = document.getElementById("hotel_details_"+hotel_id))
			{
				  div.style.backgroundColor = "fff5de";
			}
		}
		catch(err)
		{
		}
		try{
			if (div = document.getElementById("hotel_"+hotel_id+"_number"))
			{
				  div.style.backgroundImage = "url(http://www.subwayhotels.com/images/icons/map_hotel_selected.gif)";
			}
		}
		catch(err)
		{
		}
		try{
			if (markers[hotel_id])
			{
				markers[hotel_id].setImage("http://www.subwayhotels.com/images/icons/map_hotel_selected_smal.gif");
			}
		}
		catch(err)
		{
		}
	}
	
	function hotel_set_not_selected_icon(hotel_id)
	{
		try{
			if (div = document.getElementById("hotel_"+hotel_id))
			{
				  div.style.backgroundColor = "";  				 
			}
		}
		catch(err)
		{
		}
		try{
			if (div = document.getElementById("hotel_details_"+hotel_id))
			{
				  div.style.backgroundColor = "";
			}
		}
		catch(err)
		{
		}
		try{
			if (div = document.getElementById("hotel_"+hotel_id+"_number"))
			{
				  div.style.backgroundImage = "url(http://www.subwayhotels.com/images/icons/map_hotel_not_selected.gif)";
			}
		}
		catch(err)
		{
		}
		try{
			if (markers[hotel_id])
			{
				markers[hotel_id].setImage("http://www.subwayhotels.com/images/icons/map_hotel_not_selected_smal.gif");
			}
		}
		catch(err)
		{
		}

	}

	