window.addEvent("domready", function(){
	$$('#menu li.level1').each(function(el){
		var a = el.getElement('a');
		var s = el.hasClass('current');
		el.set('morph', {'duration':200});
		a.set('morph', {'duration':200});
		el.addEvents({
			'mouseenter': function(){
				if(!s){
					el.morph({
						'background-color':'#C30021'
					});
					a.morph({
						'color':'#ffffff'
					});
				}
				if(ul = el.getElement('ul')){
					ul.reveal({'duration':200});
				}
			},
			'mouseleave': function(){
				if(!s){
					el.morph({
						'background-color':'#ffffff'
					});
					a.morph({
						'color':'#6c6c6c'
					});
				}
				if(ul = el.getElement('ul')){
					ul.dissolve({'duration':200});
				}
			}
		});
	});
	$$('#menu li.level2').each(function(el){
		var s = el.hasClass('current');
		el.set('morph', {'duration':200});
		el.addEvents({
			'mouseenter': function(){
				if(!s){
					el.morph({
						'background-color':'#000000'
					});
				}
			},
			'mouseleave': function(){
				if(!s){
					el.morph({
						'background-color':'#9d0a0e'
					});
				}
			}
		});
	});
	$$('#center div.submenu li, ul.menu li').each(function(el){
		var a = el.getElement('a');
		var s = el.hasClass('current');
		el.set('morph', {'duration':200});
		a.set('morph', {'duration':200});
		el.addEvents({
			'mouseenter': function(){
				if(!s){
					a.morph({
						'background-color':'#9d0a0e'
					});
				}
			},
			'mouseleave': function(){
				if(!s){
					a.morph({
						'background-color':'#000000'
					});
				}
			}
		});
	});
	$$('table.sort').each(function(el){
		var parsers = [];
		el.getElements('th').each(function(th){
			parsers.push(th.get('abbr'));
		});
		new HtmlTable(el, {
			sortable: true,
			selectable: true,
			parsers: parsers
		});
	});
	

});
