$(function() {
	// Preserves the mouse-over on top-level menu elements when hovering over children
	$(".menu-top .wrapper").each(function(i) {
		$(this).hover(function() {
			$(this).closest("li.menu-0").find("a").slice(0, 1).addClass("hover");
		}, function() {
			$(this).closest("li.menu-0").find("a").slice(0, 1).removeClass("hover");
		});
	});

	// IE6 Fix: Drop-down fix due to lack of support for :hover on list elements
	if($.browser.msie && ($.browser.version < 7)) {
		$(".menu-top .wrapper").each(function(i) {
			$(this).find("a").hover(function() {
				$(this).addClass("hover");
			}, function() {
				$(this).removeClass("hover");
			});
		});
	}

	// Transfer link to main image caption when clicking on thumbnail image.
	$("#content-more .items a.cloud-zoom-gallery").click(function() {
		var caption = $("#content-sub .caption");
		var link;
		if($(this).hasClass("link")) {
			link = $(this);
		} else {
			link = $(this).siblings("a.link").first();
		}
		if(caption.length && link.length) {
			caption.text(link.text());
		}
	});
});
