﻿$(function() {
	$('#headerMenu li ul').hover(function(e) {
		return false;
	}, function(e) {
		$(this).hide();
		return false;
	});
	var liWidths = [];
	$('#headerMenu > ul > li').each(function() {
		liWidths.push($(this).width());
	});
	$('#headerMenu > ul > li').has('ul').hover(function(e) {
		var left = 0,
			$this = $(this);

		for (var i = 0; i < liWidths.length && i < $this.index(); i++)
			left += liWidths[i];

		$this.find('ul').css({
			'left': left
		}).show();
	}, function() {
		$(this).parent().find('ul').hide();
	});
	$('#headerMenu li ul').hide();

	// IE reflow fix
	document.getElementById('header').className = document.getElementById('header').className;
});
