$(function() {
	switch(Math.floor(Math.random()*2))
	{
		case 0: $("#header_image").attr("class", "lk"); break;
		case 1: $("#header_image").attr("class", "il"); break;
	}
	
	$(".topnav li").each(function() {
		var subnav = $(this).find("ul.subnav");
		var subnav_wth = 0;
		
		if (subnav.length > 0) {
			if (subnav.children().length > 0) {
				// set sub
				subnav.find("li > *").each(function() {
					if ($(this).width() > subnav_wth)
						subnav_wth = $(this).width();
				});
	
				subnav.find("li > *").each(function() {
					$(this).width(subnav_wth);
				});
				
				// add events
				$(this).mouseenter( function(){ subnav.slideToggle(400); });
				$(this).mouseleave( function(){ subnav.slideToggle(500); });
			}
			
			// hide subnav
			subnav.hide();
		}
	});
});