if (document.images) {
	img1 = new Image();
	img1.src = "/wp-content/themes/icc_v1/images/global/header-hover.png";
	img2 = new Image();
	img2.src = "/wp-content/themes/icc_v1/images/global/header-selected.png";
	img3 = new Image();
	img3.src = "/wp-content/themes/icc_v1/images/global/bg-usual-top1.jpg";
	img4 = new Image();
	img4.src = "/wp-content/themes/icc_v1/images/global/bg-usual-top2.jpg";
	img5 = new Image();
	img5.src = "/wp-content/themes/icc_v1/images/global/bg-usual-top3.jpg";
	img6 = new Image();
	img6.src = "/wp-content/themes/icc_v1/images/global/bg-usual-top4.jpg";
	img7 = new Image();
	img7.src = "/wp-content/themes/icc_v1/images/global/bg-usual-top5.jpg";
	img8 = new Image();
	img8.src = "/wp-content/themes/icc_v1/images/global/bullet-normal-top.png";
}

$(function() {
	$("#header ul > li").hover(function() {
		if ($(this).find("ul").length > 0) {
			// change background to solid white block
			$(this).css("background-image", "url(/wp-content/themes/icc_v1/images/global/header-hover.png)");
			// display submenu
			$(this).find("ul").css("display","block"); 
			// add an active class to the link
			$(this).find("a:first").addClass("active");
			// get rid of the border on the last item in the list
			$(this).find("a:last").css("border-bottom", "none");
		}
	},function() {
		if ($(this).find("ul").length > 0) {
			$(this).not(".current_page_item").not(".current_page_ancestor").not(".current_page_parent").css("background-image", "url('')");
			// this is already selected
			if ($(this).is(".current_page_ancestor") || $(this).is(".current_page_parent") || $(this).is(".current_page_item")) {
				$(this).css("background-image", "url('/wp-content/themes/icc_v1/images/global/header-selected.png')");
			}
			$(this).find("ul").css("display","none"); 
			$(this).find("a:first").removeClass("active");
		}
	});
	//$("#header ul li ul").each(function() { 
	//	$(this).find("li:last").addClass("last"); 
	//	$(this).append($("<li class=\"bottom\"></li>")); 
	//});
});
