/* home page history */
function showHistory(ID){
	$("div.historySnapshot").show();
	$("div.historyDetail").hide();
	$(this).css({backgroundPosition: "0px -10px"});
	$("div.historySnapshot").find("div.content" + ID).show();
}

function hideHistory(){
	$("div.historySnapshot").hide();
	$(this).css({backgroundPosition: "0px 0px"});
}

$(document).ready(function(){
	
	$("ul.market-list li").each(
		function(i)
		{
			$(this).click(function(){
				$("ul.market-list li").removeClass("selected-market");
				$(this).addClass("selected-market");
				$("ul.marketDetailsList").hide();
				$("div.mapDetailOverlay").hide();
				$("ul#market" + i).show();
				$("div#overlay" + i).show();
				$(".market-map").attr("src", "../img/content/bg-markets-map.gif");
				return false;	
			});
		}
	);
	
	$(".market-location").click(function(){
		
		if ( $(this).hasClass("united-kingdom") )
		{
			$(".market-location").removeClass("in-view");
			$(this).addClass("in-view");
			$("ul.market-list li").removeClass("selected-market");
			$(".market-map").attr("src", "../img/content/bg-markets-map-uk.gif");
			$("ul.marketDetailsList").hide();
			$("div.mapDetailOverlay").hide();
			$("ul.marketDetailsList").hide();
			$("ul#uk").show();
			return false;
		}
		else
		{
			$(".market-location").removeClass("in-view");
			$(this).addClass("in-view");
			$("ul.market-list li").removeClass("selected-market");
			$("ul.market-list li:eq(0)").addClass("selected-market");
			$("ul.marketDetailsList").hide();
			$("div.mapDetailOverlay").hide();
			$("ul#market0").show();
			$("div#overlay0").show();
			$(".market-map").attr("src", "../img/content/bg-markets-map.gif");
			return false;
		}
		
	});
	
	
	/* continue reading content link */
	$("a#continueReading").click(function(){
		$(this).fadeOut(500);
		$("div.defaultContent").animate({marginTop: "-458px"}, 800);
		$("div.contentContinued").fadeIn(800);
		return false;
	});
	/* return to first screen of content */
	$("a.previousPage").click(function(){
		$("div.defaultContent").animate({marginTop: "0px"}, 800);
		$("div.contentContinued").fadeOut(500);
		$("a#continueReading").fadeIn(800);
		return false;
	});
	
	// $("a#submitButton").click(function(){
	// 
	// });	

});
