var Map = Class.create({

	last_mouse_over_element: null,
	all_elements: null,

	initialize: function()
	{
		this.all_elements = $$('#idmap a');
	 	this.all_elements.invoke('observe', 'mouseover', this.mouseover.bindAsEventListener(this));
	 	this.all_elements.pluck('title').collect(function(id){return $('contact_'+id+'_info');}).invoke('hide');
	 	
	 	this.mouseover(this.all_elements[1]);
	},

	mouseover: function(e)
	{
	    var a = Object.isElement(e) ? e : Event.element(e);
		if(this.last_mouse_over_element == a) return;
		var els = [];

		if(this.last_mouse_over_element != null) {
			els.push($('contact_' + this.last_mouse_over_element.readAttribute('title') + '_info'));
			this.last_mouse_over_element.removeClassName('over');
		}
		a.addClassName('over');
		els.push($('contact_' + a.readAttribute('title') + '_info'));
		this.last_mouse_over_element = a;
		$A(els).invoke('toggle');
	}
});


document.observe('dom:loaded', function()  {
	new Map();
	//var t1 = new Map();
	//t1 = t.selectElement();

});

