window.addEvent('domready', function() {

	$$('.menu li a').each(function(el) {
		var round = new Element('div').inject(el, 'before').adopt(
			new Element('b', {'class': 'round2'}).adopt(
				new Element('b', {'class': 'round21', 'html': '<b class="round2b"></b>'}),
				new Element('b', {'class': 'round22', 'html': '<b class="round2b"></b>'}),
				new Element('b', {'class': 'round23'}),
				new Element('b', {'class': 'round24'}),
				new Element('b', {'class': 'round25'})
			),
			new Element('div', {'class': 'round2fg'}).wraps(el),
			new Element('b', {'class': 'round2'}).adopt(
				new Element('b', {'class': 'round25'}),
				new Element('b', {'class': 'round24'}),
				new Element('b', {'class': 'round23'}),
				new Element('b', {'class': 'round22', 'html': '<b class="round2b"></b>'}),
				new Element('b', {'class': 'round21', 'html': '<b class="round2b"></b>'})
			)
		);
		round.setStyle('margin', el.getStyle('margin'));

		el.setStyles({
			'margin': 0,
			'padding-top': 0,
			'padding-bottom': 0,
			'background-color': 'transparent'
		});

		round.set({
			'morph': {duration: 300, link: 'cancel'}
		}).addEvents({
			'mouseenter': function() {
				round.getElements('b,div').each(function(el) {
					el.morph('.' + el.get('class').replace('round2','round1'));
				});
			},
			'mouseleave': function() {
				if (round.getParent('li').hasClass('active')) return;

				round.getElements('b,div').each(function(el) {
					el.morph('.' + el.get('class').replace('round1','round2'));
				});
			}
		});

		if (round.getParent('li').hasClass('active')) round.fireEvent('mouseenter');
	});



	$$('.top-right div').setStyles({
		'color': '#FFF',
		'opacity': 0.4
	}).addEvents({
		'mouseenter': function() {
			this.morph({'opacity': 1});
		},
		'mouseleave': function() {
			this.morph({'opacity': 0.4});
		}
	})

});