var CE_Map_Controller = new Class({
    options: {
		id: null,
		members: null,
		fx_duration: 250
    },

    initialize: function(options) {
		this.setOptions(options);
		
		/*for (var x = 0; x < this.options.members.length; x++) {
			this.do_link(this.options.members[x].area, this.options.members[x].content);
		}*/
		
		this.current_area = this.options.members[0].content;
	},
	
	do_link: function(area, content) {
		var controller = this;
		$(area).addEvent("click", function() {
			controller.do_area(content);
		});
	},
	
	transition: function(from, to) {		
		var f = new Fx.Tween(from, { property: "opacity", duration: this.options.fx_duration, onComplete:function(elem) { elem.style.display = "none"; } });
		var t = new Fx.Tween(to, { property: "opacity", duration: this.options.fx_duration });
		
		f.start(1, 0).chain(
			function() {
				$(to).setStyles({ opacity: 0, display:"block" });
				t.start(0, 1);
			}
		);
	},

	do_area: function(which) {
		if (this.current_area !== which) {
			this.transition(this.current_area, which);
			this.current_area = which;
		}
	}
});

CE_Map_Controller.implement(new Options);