$(document).ready(function() {
	
	//Side Navigation
	$("#menu a").click(function() {
		if ($(this).next("ul").length > 0) {
			if ($(this).next("ul").css("display") == "none") {
				$(this).next("ul").animate({ height: "show", opacity: "show"}, "slow");
			} else {
				$(this).next("ul").animate({ height: "hide", opacity: "hide"}, "slow");
			}
			return false;
		} else {
			return true;
		}
	});
	
	// Add border to boxouts
	//$(".boxout1_right").prepend("<div style='border-left: 1px solid #DAB399;'>").append("</div>").css("borderLeft", "10px solid White");
	
	
	//Hiltonian Media text colour
	//$("span.hm").html('<span class="hiltonian">Hiltonian</span><span class="media">Media</span>');
	
	$('table.prices tr').hover(function() {
		$('td, th.label', this).css('background-color', '#F8F8F8');
	}, function () {
		$('td, th.label', this).css('background-color', '#FFFFFF');
	});

});


function addRevealListRecursive(list, linkTextShow, linkTextHide) {
	var speed = "fast";
	
	var showList = function (item) {
		var next = $(item).next("li");
		if (next.length > 0) {
			$(item).animate({ height: "show", opacity: "show" }, speed, function() { showList(next); });
		} else {
			$(item).animate({ height: "show", opacity: "show" }, speed).parent("ul").prev().children("a").html(linkTextHide);
		}
	};
	
	var hideList = function (item) {
		var prev = $(item).prev("li");
		if (prev.length > 0) {
			$(item).animate({ height: "hide", opacity: "hide" }, speed, function() { hideList(prev); });
		} else {
			$(item).animate({ height: "hide", opacity: "hide" }, speed, function() { $(this).parent("ul").animate({ paddingTop: 0, paddingBottom: 0, opacity: "hide"}, speed); }).parent("ul").prev().children("a").html(linkTextShow);
		}
	};
	
	
	$(document).ready(function() {
		// Add the show/hide link and hide the list items
		$(list).before("<p class=\"bullet\"><a href=\"#\">" + linkTextShow + "</a></p>").children("li").hide();
		$(list).hide();
		
		// Add the click events to the show/hide link
		$(list).prev().children("a").click(function() {
			var targetList = $(this).parent("p").next("ul");
			var listItems = targetList.children("li");
			var firstItem = listItems.get(0);
			var lastItem = listItems.get(listItems.length - 1);
			
			if (firstItem.style.display == "none" && lastItem.style.display == "none") {
				$(firstItem).parent("ul").fadeIn("slow");
				showList(firstItem);
			} else if (firstItem.style.display != "none" && lastItem.style.display != "none") {
				hideList(lastItem);
			}
			return false;
		});
	});
}

function addRevealList(list, linkTextShow, linkTextHide) {
	$(document).ready(function() {
		var paddingTop = $(list).css("paddingTop");
		var paddingBottom = $(list).css("paddingBottom");
		// Add the show/hide link and hide the list items
		$(list).before("<p class=\"bullet\"><a href=\"#\">" + linkTextShow + "</a></p>");
		$(list).hide();
		
		// Add the click events to the show/hide link
		$(list).prev().children("a").toggle(function() {
			$(this).html(linkTextHide).parent("p").next("ul").animate({ height: "show", opacity: "show" }, "slow");
			return false;
		}, function() {
			$(this).html(linkTextShow).parent("p").next("ul").animate({ height: "hide", opacity: "hide" }, "slow");
			return false;
		});
	});
}