$(document).ready(function() {
	
	// Add title tag to all images:
	$("img").each(function() {
	
	 var alternate_text = $(this).attr("alt");
		$(this).attr("title", alternate_text);
	
	});
	
	// Toggle content via read more links:
	$(".read_more").click(function() {
																																
		// Which link was clicked?
		var index = $(".read_more").index(this);
		
		// Hide this link:
		$(this).fadeOut("slow", function() {
	 
			// Show the corresponding details item:
			$("div.details:eq("+index+")").fadeIn("slow"); });
		
		// Capture the click:
		return false;
	
	});
	
	// Toggle play_status:
	$("li#play_status a.prod").click(function() {

		$.ajax({
   type: "POST",
   url: "functions/toggle_play_status.php",
			success: function(){
				if($("img#ppp_paused").hasClass("hidden")) {
			$("img#paused").removeClass("hidden");
			$("img#active").addClass("hidden"); }
		else {
			$("img#active").removeClass("hidden");
			$("img#paused").addClass("hidden"); }}
			
		});
		
		return false; });
	
 // Unlist a blacklisted/whitelisted stock:
	$("div.member_stock_list > a").click(function() {
	 
		var stock = $(this).text();
		
		if($(this).hasClass("blacklist")) {
		 var list = 'blacklist'; }
			
		else {
			var list = 'whitelist'; }
			
		$(this).fadeOut("slow");

		$.ajax({
   type: "POST",
   url: "test.php?pid=members&mpid=settings_test",
			data: "unlist=true&stock="+stock+"&list="+list,
			success: function(){
				$(this).fadeOut("slow"); }		
		});
		
		return false; });

});
