$(document).ready(function(){
// Main level child navigation show / hide
	$("ul li", "#header .menu")
		.children("ul")
			.each(function(){
				var off = $(this).parent().offset();
				var pad_left = 400;
				
				$(this).css({ "position": "relative", "left": off.left - pad_left + "px", "top": 0 + "px" });
			})
		.end()
		.hover(function(){
			$(this).children("ul").show();
		}, function(){
			$(this).children("ul").hide();
		});
	
// Setup multi-media tabs
	$("#mm").before("<div id=\"mm-tabs\"></div>")
		.children(".wrapper").css("backgroundImage","none").end()
		.find("div[id^='']")
		.each(function(){
			var thisid = $(this).attr("id");
			$(this).find("h3")
				.data("content",thisid)
				.click(function(){
					var content = $(this).data("content");
					$(this).addClass("active").siblings().removeClass("active");
					$("#"+content).show().siblings().hide();
				});
		}).find("h3")
			.appendTo("#mm-tabs")
			.eq(0).click();
			
	if ($.fn.colorbox) {
	// Colorbox global setting of background opacity
		$.fn.colorbox.settings.bgOpacity = "0.45";
	}
	
// Add AJAX hook to the Youtube videos
	$("#mm-v .yt a", "#mm").each(function(){
		var url = $(this).attr("href");
		
		$(this).colorbox({ href: "http://www.huntingconnections.com/wp-content/themes/hunting_connections_2009/ajax.php?function=youtube&url=" + encodeURI(url) });
	});
	
// Add AJAX hook to the Youtube videos
	$("#mm-p .fl a", "#mm").each(function(){
		var url = $(this).attr("href");
		
		$(this).colorbox({ href: "http://www.huntingconnections.com/wp-content/themes/hunting_connections_2009/ajax.php?function=flickr&url=" + encodeURI(url) });
	});
	
	$("#outfitter_right .thumbnail a").colorbox();
	
	$(".frmGameSearch select").change(function(){ $(this).parent().submit(); });
});
