window.addEvent('domready', function()
{
  $$('a[href$=mail.html]').each(function(el) {
  	var tmp = el.rel.split(',');
  	if (tmp.length == 3)
  	{
	  	var str = tmp[2] + '@' + tmp[1] + '.' + tmp[0];
	  	el.set('text',str);
	  	el.setProperty('href','mailto:' + str);
	  	el.setProperty('rel','nofollow');
  	}
  });
  if (Browser.Engine.trident) {
    return;
  }
  if ($('mainnavigation')) {
	  $('mainnavigation').getElements('ul.level_2').each(function(el) {
		el.set({'opacity':0});
	  });
	  $('mainnavigation').getElements('.submenu').each(function(el) {
		var ul = el.getParent().getElement('ul.level_2');
		el.addEvent('mouseenter', function() {
		  new Fx.Morph(ul, {'duration':300}).start({'opacity':1});
		});
		el.addEvent('mouseout', function() {
		  setTimeout(function() {
			if (ul.getStyle('left').toInt() < 0) {
			  ul.set({'opacity':0});
			}
		  }, 50);
		});
	});
  }
});

