var Store = Store || {};
Store.Utils = Store.Utils || {};


Store.Utils.NavFunction = function() {
	$('#nav').find('li').hover(function(){
		// find number of uls(columns) and set the variable ColCount
		var ColCount = $(this).find('.tier1').children('ul').not(".tier2 ul").length;
		// add hover class to this li on hover
		$(this).addClass('hover');
		if (typeof document.body.style.maxHeight == "undefined") {
			var t1width = $(this).find(".tier1").width();
			var t1height = $(this).find(".tier1").height();
			var iframe = '<iframe class="iframeshim" src="javascript:false;" frameBorder="0" scrolling="no" style=" position:absolute; top:0; left:0; width:'+t1width+'px; height:'+t1height+'px; border:none;"></iframe>';
			$(this).find(".tier1").prepend(iframe);
		}
		// add col count class to sub nav div
		$(this).find('.tier1').addClass('col'+ColCount);
	},
	function() {
		// Remove the hover class to hide the sub nav
		$(this).removeClass('hover');
	});
};

$(document).ready(function(){
	Store.Utils.NavFunction();
	
});
