window.addEvent('domready', function() {
	var list = $$('#navigation a');
	list.each(function(element) {
		element.set('morph', {duration:400});
		element.setStyles({'background-color': '#948979'});
		element.addEvents({
			mouseenter:function(){
				this.morph({'background-color': '#C5BDA6'});
			},
			mouseleave:function(){
				this.morph({'background-color': '#948979'});
			}
		});
	});
	
	var abstracts = $$('span.abstract');
	abstracts.each(function(abs) {
		var link = abs.getElement('a.expand');
		var div = abs.getElement('div');
		var fullsize = div.getSize().y;
		div.set('morph', {duration:500});
		div.setStyles({'height':'1px'});
		var toggle = true;
		link.addEvent('click', function(e) {
			e.stop();
			if (toggle) {
				div.morph({'height':fullsize});
				link.set('html', 'abstract &laquo;');
			} else {
				div.morph({'height':1});
				link.set('html', 'abstract &raquo;');
			}
			
			toggle = !toggle;
		});
	});
});
