$(function() {

	//=========================== Controls the expandable thumbnail area. ===========================
	$("#Content .Media").each(
		function()
		{		
			var Gallery = "#Gallery";
			var YourMore = "#YourMore";
			var YourLess = "#YourLess";
			
			//Initially only shows the first 4 photos.
			$(Gallery + " li").hide().filter("li:lt(5)").show();
																	
			//Hides the more button is less than 5 list items.
			if($(Gallery + " li").size() <=5 )
				{
					$(YourMore).hide();
				}
			else if ($(Gallery).size() >5 )
				{
					$(YourMore).show();
				}

			//Expands the thumbnail panel.
			$(YourMore).click(function()
				{
					$(YourLess).show();
					$(YourMore+","+Gallery + " li").hide()
						.filter("li:lt(30)")
						.show();
				}
			);
			
			//Minimises the thumbnail panel.
			$(YourLess).click(function()
				{
					$(YourMore).show();
					$(YourLess+","+Gallery + " li").hide()
						.filter("li:lt(5)")
						.show();
				}
			);
		}
	);
});