var module_main_menu = new Class(
	{
	menuItems: null,
	gaJsHost:null,
	initialize: function() {

	this.gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");	
	 
	//var pageTracker = _gat._getTracker("UA-10982435-6");
	//pageTracker._trackPageview();
	 
		//try {
		//	_uacct = "UA-10982435-6";
		//	urchinTracker();
		//	} catch(err) {}


		this.menuItems = $$('DIV.hoverMenuItem');

		this.menuItems.each((function(el) {
			var totalHeight = 0;
			var removeBottom = 0;

			el.getElements('a').each(function(a) {
				removeBottom = a.getStyle('border-bottom-width').toInt();
				totalHeight += a.getSize().y;
			}, this);

			el.store('full-height', totalHeight - removeBottom);

			el.set('morph',
				{
				duration: 250,
				transition: 'bounce:out',
				link: 'cancel'
				});

			el.addEvent('mouseenter', this.onMouseEnter.bindWithEvent(this, el));
			el.addEvent('mouseleave', this.onMouseLeave.bindWithEvent(this, el));
		}), this);
	},
	onMouseEnter: function(event, el) {
		$clear(el.retrieve('hide-timer'));

		if (Browser.Engine.trident) $$('select').each(function(el) {
			el.setStyle('visibility', 'hidden');
		});
		el.morph(
			{
			'height': el.retrieve('full-height'),
			'background-color': '#EEE'
			});
	},
	onMouseLeave: function(event, el) {
		el.store('hide-timer', this.hideItem.pass(el, this).delay(150, this));
	},
	hideItem: function(el) {
		if (Browser.Engine.trident) $$('select').each(function(el) {
			el.setStyle('visibility', 'visible');
		});
		el.morph(
			{
			'height': el.getElement('a').getStyle('height').toInt(),
			'background-color': '#DDD'
			});
	}
	});

window.addEvent('domready', function() {
	new module_main_menu();
});