jQuery(document).ready(function() {

	if ( $("div#quotes") && $("div#show_quotes") )
	{
		
		$("div#quotes").css("position","absolute").css("top","0px").css("left","0px").css("z-index","255").css("width","200px").css("background-color","#FFF3E6").css("border","solid 3px #125A48").css("padding","0px 10px 5px 10px").css("cursor","pointer").css("min-height","100px").hide();
		
		$("div#quote_text").hide();
	
		var offset_L_quotes = $("#container").offset().left+235;
		var offset_T_quotes = $("#container").offset().top+260;
		$("div#quotes").css("left",offset_L_quotes+"px").css("top",offset_T_quotes+"px");
		
		var max_select_quotes,curr_select_quote,cnt_quotes;
		
		var select_quote = new Array();
		/* Start Quote of the Month here */
		/* This version has photo */
		select_quote[0] = '<p class="selection_txt"><img src="root_pages/root_images/DanielKahneman.jpg" style="float:right;border: solid 2px white;margin-left: 5px;height: 100px;width:82px;" />"A reliable way to make people to believe in falsehoods is frequent repetition, because familiarity is not easily distinguished from truth. Authoritarian institutions and marketers have always know this fact."</p><p class="selection_src">Daniel Kahneman, in <em>Thinking, Fast and Slow</em>, 2011</p>';
		/* End photo version */
		/* This version has no photo */
		/*select_quote[0] = '<p class="selection_txt">"Practically every day the government launches a massively expensive new initiative to solve the problems that the last day\'s initiative did not. It is hard to discern any principles behind these actions. The lack of a coherent strategy has increased uncertainty and undermined the public\'s perception of the government\'s competence and trustworthiness."</p><p class="selection_src">Oliver Hart of Harvard and Luigi Zingales at the University of Chicago, December 2008</p>';*/
		/* End no photo version */
		/* End Quote of the Month here */
		select_quote[1] = '<p class="selection_txt">Quote 2</p><p class="selection_src">Quoter</p>';
		select_quote[2] = '<p class="selection_txt">Quote 3</p><p class="selection_src">Quoter</p>';
		select_quote[3] = '<p class="selection_txt">Quote 4</p><p class="selection_src">Quoter</p>';
		max_select_quote = select_quote.length-1; //max array value
		$("div#show_quotes").click(function () {	
			$("div#exhibits").hide();
			$("div#quotes").show();		
			//get a random number - requires lps_utils.js->getRand(min,max)
			cnt_quotes = 0;//getRand(0,max_select);
			curr_select_quote = cnt_quotes;			
			//n = getNext();
			//$("div#quote_text").html('<span class="selection_no_quote">#'+(cnt_quotes+1)+'</span>'+select_quote[cnt_quotes]);
			$("div#quote_text").html(select_quote[cnt_quotes]);
			$("div#quote_text").fadeIn();
		});
		$("span#close_quote").click(function () {				
			$("div#quote_text").fadeOut();
			$("div#quotes").fadeOut();
		});
		$("span#prev_quote").click(function () {	
			// go back one
			if ( curr_select_quote > 0 ) curr_select_quote--;
			else curr_select_quote = max_select_quotes;
				cnt_quotes = curr_select_quote+1;
			$("div#quote_text").html('<span class="selection_no_quote">#'+cnt_quotes+'</span>'+select_quote[curr_select_quote]);
		});
		$("span#next_quote").click(function () {	
			// go next one
			if ( curr_select_quote < max_select_quote ) curr_select_quote++;
			else curr_select_quote = 0;
				cnt_quotes = curr_select_quote+1;
			$("div#quote_text").html('<span class="selection_no_quote">#'+cnt_quotes+'</span>'+select_quote[curr_select_quote]);
		});
	}
	
	if ( $("div#exhibits") && $("div#show_exhibits") )
	{
		
		$("div#exhibits").css("position","absolute").css("top","0px").css("left","0px").css("z-index","255").css("width","460px").css("background-color","#FFF").css("border","solid 3px #125A48").css("padding","40px 10px 5px 10px").css("cursor","pointer").css("height","480px").hide();
		
		$("div#exhibit_text").hide();
	
		var offset_L_exhibits = $("#container").offset().left+115;
		var offset_T_exhibits = $("#container").offset().top+150;
		$("div#exhibits").css("left",offset_L_exhibits+"px").css("top",offset_T_exhibits+"px");
		
		var max_select_exhibits,curr_select_exhibit,cnt_exhibits;
		
		var select_exhibit = new Array();
		select_exhibit[0] = '<table align="center" width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td align="center"><img src="root_pages/root_images/Zimbabwe50T.jpg" width="400" height="212" alt="Zimbabwe 50 Trillion Dollar" style="border:solid 1px #063;" /></td></tr><td align="center"><img src="root_pages/root_images/Zimbabwe100T.jpg" width="400" height="202" alt="Zimbabwe 100 Trillion Dollar" style="border:solid 1px #063;" /></td></tr></table>';
		select_exhibit[1] = '<p class="selection_txt">exhibit 2</p>';
		select_exhibit[2] = '<p class="selection_txt">exhibit 3</p>';
		select_exhibit[3] = '<p class="selection_txt">exhibit 4</p>';
		max_select_exhibit = select_exhibit.length-1; //max array value
		$("div#show_exhibits").click(function () {	
			$("div#quotes").hide();
			$("div#exhibits").show();		
			//get a random number - requires lps_utils.js->getRand(min,max)
			cnt_exhibits = 0;//getRand(0,max_select);
			curr_select_exhibit = cnt_exhibits;			
			//n = getNext();
			//$("div#exhibit_text").html('<span class="selection_no_exhibit">#'+(cnt_exhibits+1)+'</span>'+select_exhibit[cnt_exhibits]);
			$("div#exhibit_text").html(select_exhibit[cnt_exhibits]);
			$("div#exhibit_text").fadeIn();
		});
		$("span#close_exhibit").click(function () {				
			$("div#exhibit_text").fadeOut();
			$("div#exhibits").fadeOut();
		});
		$("span#prev_exhibit").click(function () {	
			// go back one
			if ( curr_select_exhibit > 0 ) curr_select_exhibit--;
			else curr_select_exhibit = max_select_exhibits;
				cnt_exhibits = curr_select_exhibit+1;
			$("div#exhibit_text").html('<span class="selection_no_exhibit">#'+cnt_exhibits+'</span>'+select_exhibit[curr_select_exhibit]);
		});
		$("span#next_exhibit").click(function () {	
			// go next one
			if ( curr_select_exhibit < max_select_exhibit ) curr_select_exhibit++;
			else curr_select_exhibit = 0;
				cnt_exhibits = curr_select_exhibit+1;
			$("div#exhibit_text").html('<span class="selection_no_exhibit">#'+cnt_exhibits+'</span>'+select_exhibit[curr_select_exhibit]);
		});
	}
	
});
