
$(document).ready(
	function()
	{
		/**
		 * Lock the 'touch' event handlers for iPhone/iPod (not iPads, they're OK)
		 */
		//if (typeof(navigator.userAgent) !== "undefined" && (/iPhone/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent))) {
		//	iphoneOveride();
		//}

		/**
		 * Apply the jscrollpane plugin to the content wrapper
		 */
		$("div#ContentWrapper").jScrollPane({
			"showArrows": true,
			"verticalGutter": 15
		});

		/**
		 * The divesite page tooltip thingy
		 */
		if ($("#OverviewDiveSiteMap").length > 0 && $("#OverviewDiveSiteMapContent").length > 0) {
			$("#OverviewDiveSiteMap area").each(
				function()
				{
					var className = $(this).attr("class");

					if ($("#OverviewDiveSiteMapContent div." + className).length == 0) {
						return;
					}

					$(this).tooltip({
						"delay": 0,
						"bodyHandler":
							function()
							{
								return "<div class=\"DiveSiteToolTip\">" + $("#OverviewDiveSiteMapContent div." + className).html() + "</div>";
							}
					});
				}
			);
		}

		/**
		 * Apply the image carousel if we have one. Safari want's this loaded when the window is ready, otherwise you'll have to define
		 * thw width and height on all the images
		 */
		$("#ImageCarousel ul li img:first").css("display", "inline");

		$(window).load(
			function()
			{
				$("#ImageCarousel ul li img").css("display", "inline");

				$("#ImageCarousel").jCarouselLite({
					"btnNext": "#ImageCarousel .Next",
					"btnPrev": "#ImageCarousel .Prev",
					"visible": 1,
					"scroll": 1
				});
			}
		);
	}
);
