jQuery(document).ready(
	function()
	{
		
		var isIE = navigator.userAgent.match(/msie/gi);
		var isIE7 = navigator.userAgent.match(/msie 7\.0/gi);
		
		
		/**
		 * Ugly IE7 css bug fix
		 */
		if (isIE7)
		{
			jQuery("#subCatsHoverWrapper").css("visibility", "hidden").show();
			var outerWidth = jQuery("#subCatsListContainer ul").width();
			jQuery("#subCatsListContainer ul li").each(
				function()
				{
					jQuery(this).width(outerWidth);
				}
			)
			jQuery("#hoverMenuTop").width(outerWidth);
			jQuery("#subCatsHoverWrapper").hide().css("visibility", "visible");
		}
		
		if (isIE)
		{
			var index = 0;
			// if ie, we show the tbale rows as alternate with js
			jQuery("table.easy-table-creator tr").each(
				function()
				{
					jQuery(this).addClass(index++ % 2 == 0 ? "even" : "odd");
				}
			)
			
		}
		
		/**
		 * This makes the product roll over menu appear and disappear correctly, with timeouts and stuff
		 */
		var hideMenuTimeout = null;
		jQuery("#productsTopMenuItem, #hoverMenuItem span, #subCatsListContainer").mouseover(
			function()
			{
				clearTimeout(hideMenuTimeout);
				
				if (!isIE)
				{
					jQuery("#subCatsHoverWrapper").fadeIn(200);
				}
				else
				{
					jQuery("#subCatsHoverWrapper").show();
				}
				
				jQuery("#hoverMenuItem span, #subCatsListContainer")
					.mouseleave(
						function()
						{
							clearTimeout(hideMenuTimeout);
							hideMenuTimeout = setTimeout(
								function()
								{
									if (!isIE)
									{
										jQuery("#subCatsHoverWrapper").fadeOut(100);
									}
									else
									{
										jQuery("#subCatsHoverWrapper").hide();
									}
								}, 400);
						}
					);
			}
		);
		
		
		
	}
)

