$(document).ready(function(){
	
// Setup Featured Outfitters popup
	$("li","#fo")
		.hover(function(){
			var HasPopup = $(this).children("#outfitter_popup").length;
			
			if (!HasPopup) {
				var full_id = $(this).attr("id");
				var id = full_id.substring(full_id.lastIndexOf("_") + 1, full_id.length);
				var offset = $(this).offset();
				
				var $outfitter_popup = 
					$("<div />").attr("id","outfitter_popup")
						.appendTo(this)
						.css({ position: "absolute", top: (offset.top - 210) + "px", left: (offset.left + 220) + "px" });
				
				var $outfitter_popup_content =
					$("<div />").attr("id", "outfitter_popup_content")
						.appendTo($outfitter_popup);
					
				$.get("http://www.huntingconnections.com/wp-content/plugins/outfitters/outfitters_ajax.php?outfitter="+id,
					function(data, status){
						if (status === "success") {
							$outfitter_popup_content.html(data);
						}
					}
				);
			}
		}, function(){
			$(this).children("#outfitter_popup").remove();
		});
		
// Outfitter Searchbar
	$("#frmOutfitterSearchbar")
		.find("select").change(function(){ $(this).parents("form").submit(); }).end()
		.find(".button").hide();
});