function hideContents() {
	in_progress = true;
}

function revealContents() {
	in_progress = false;
}

//setup globals
in_progress = false;
switcher_effect = {}

window.addEvent('domready', function() {
	var sections = $$("#strip .section");
	switcher_effect = new Fx.Elements(sections, {duration: 1000, transition: Fx.Transitions.expoOut, onStart: function() { hideContents();}, onComplete: function() { revealContents()} });	

	var max = $$("#strip .active")[0].getStyle("width").toInt();
	for(var i = 0; i < sections.length; i++)
		if(sections[i] != $$("#strip .active")[0]) {
			var min = sections[i].getStyle("width").toInt();
			break;
		}
		
	sections.each(function(section, i) {		
		section.addEvent("click", function(event) { 
			if(in_progress) {
				switcher_effect.stop();
			}				
				
			var fx_obj = {};

			fx_obj[i] = { width: [section.getStyle("width").toInt(), max] };

			sections.each(function(other, j) {
				if(i != j) {
					var other_width = other.getStyle("width").toInt();
					if(other_width != 40) fx_obj[j] = { width: [other_width, min] };
				}
			})
			switcher_effect.start(fx_obj);
		})
	});
});
