var Maps = new Class({
	ap_h: null,
	ap_r: null,
	ap_s: null,
	ap_p: null,
	mp_h: null,
	mp_r: null,
	mp_s: null,
	mp_p: null,
	initialize: function()
	{
		this.ap_h = $('ap_h');
		this.ap_r = $('ap_r');
		this.ap_s = $('ap_s');
		this.ap_p = $('ap_p');
		this.mp_h = $('mp_h');
		this.mp_r = $('mp_r');
		this.mp_s = $('mp_s');
		this.mp_p = $('mp_p');
		this.add_events();
	},
	add_events: function()
	{
		if (this.ap_h != null)
		{
			this.ap_h.addEvent('click', function(){
				this.mp_h.setStyle('display', 'block');
				this.mp_r.setStyle('display', 'none');
				this.mp_s.setStyle('display', 'none');
				if (this.mp_p != null) this.mp_p.setStyle('display', 'none');
			}.bind(this));
		}
		if (this.ap_r != null)
		{
			this.ap_r.addEvent('click', function(){
				this.mp_h.setStyle('display', 'none');
				this.mp_r.setStyle('display', 'block');
				this.mp_s.setStyle('display', 'none');
				if (this.mp_p != null) this.mp_p.setStyle('display', 'none');
			}.bind(this));
		}
		if (this.ap_s != null)
		{
			this.ap_s.addEvent('click', function(){
				this.mp_h.setStyle('display', 'none');
				this.mp_r.setStyle('display', 'none');
				this.mp_s.setStyle('display', 'block');
				if (this.mp_p != null) this.mp_p.setStyle('display', 'none');
			}.bind(this));
		}
		if (this.ap_p != null)
		{
			this.ap_p.addEvent('click', function(){
				this.mp_h.setStyle('display', 'none');
				this.mp_r.setStyle('display', 'none');
				this.mp_s.setStyle('display', 'none');
				if (this.mp_p != null) this.mp_p.setStyle('display', 'block');
			}.bind(this));
		}
	},
	show_help: function(obj)
	{
		var el = $('help');
		if (obj.get('html') == 'Show usage instructions')
		{
			el.set('html', '<p>How to navigate on our interactive map</p>\
				   <ul>\
				   <li>Use the pan & zoom controls located on the map to navigate.</li>\
				   <li>Clicking a point on the map will display information for the place, below the map.</li>\
				   <li>Use the legend to learn the coordinates of the location you are interested in checking.</li>\
				   </ul>');
			el.setStyle('display', 'block');
			obj.set('html', 'Hide usage instructions');
		}
		else
		{
			el.set('html', '');
			el.setStyle('display', 'none');
			obj.set('html', 'Show usage instructions');
		}
	}
});
var maps = null;
window.addEvent('domready', function(){maps = new Maps();});