YHA.Page.Hostels.Map = Base.extend
({
	constructor: function(lat, lng)
	{
		this.lat = lat;
		this.lng = lng;
		
		Event.observe(window, 'load', this.windowOnLoad.bindAsEventListener(this));
	},
	
	windowOnLoad: function()
	{
		this.hostelMap = new YHA.Map
					(
						element = $('map'), 
						lat = this.lat, 
						lng = this.lng
					);
	
		this.observers = 
		{
			btCenterMapOnClick: this.btCenterMapOnClick.bindAsEventListener(this)	
		}
		
		this.hostelMarker = this.hostelMap.addCenterMarker( { clickable: false } );
		
		Event.observe($('btCenterMap'), 'click', this.observers.btCenterMapOnClick);
	
		new RedSquare.PopupBuilder('popup', 'map', 'width=1024,height=768,left=c,top=c,resizable');
		new RedSquare.PopupBuilder('popupprint', 'print', 'width=800,height=600,left=c,top=c,resizable,scrollbars,menubar');
	},
	
	btCenterMapOnClick: function(event)
	{
		this.hostelMap.panCenter();	
	
		Event.stop(event);
		Event.element(event).blur();	
	}
});