window.addEvent('domready', function() {
	var currentContent = $('contentabout'),
		contentMorph;
	
	$$('#navspc a').each(function(navlink){
		navlink.addEvent('click', function(e) {
			targetspc = $(navlink.get('rel'));
			targetspcmargintop = navlink.get('rev');
			if (currentContent != targetspc) {
				contentMorph = new Fx.Morph(currentContent, {duration: 'short', transition: Fx.Transitions.Sine.easeOut});
				contentMorph.start({
				    'height': 1,
				    'margin-top': 0
				}).chain(function(){
					currentContent.setStyle('visibility','hidden');
					currentContent = targetspc;
					currentContent.setStyle('visibility','visible');
					targetspcheight = currentContent.getScrollSize().y;
					contentMorph = new Fx.Morph(targetspc, {duration: 'short', transition: Fx.Transitions.Sine.easeOut});
					contentMorph.start({
					    'height': targetspcheight,
					    'margin-top': targetspcmargintop
					})
				});
			}
			e.stop();	
		});
	});
});
