$(document).ready(function() { 
	$("#actionButton").click(function() { 
		$("#mainAction").slideUp("slow");
		$("#conversationUsers").html("");
		var currentValue = $("#textbox").val();
		$.post("request.php", { request: currentValue }, function(data) { 
			var finalResponse = data.split(",");
			var userText = finalResponse[0];
			var userText = $.base64.decode(userText);
			var finalResponsex = $.base64.decode(finalResponse[1]);
			$("#conversationUsers").html(userText);
			$("#mainAction").html(finalResponsex);
			$("#mainAction").slideDown("slow");		
		});
	});
	
	$(".loadConvo").click(function() { 
		var convoField = $(this).attr("id");
		$("#mainAction").slideUp("slow");
		$("#conversationUsers").html("");
		$.post("request.php", { request: convoField }, function(data) { 
			var finalResponse = data.split(",");
			var userText = finalResponse[0];
			var userText = $.base64.decode(userText);
			var finalResponsex = $.base64.decode(finalResponse[1]);
			$("#conversationUsers").html(userText);
			$("#mainAction").html(finalResponsex);
			$("#mainAction").slideDown("slow");		
		});		
	});
	
	$("#textbox").click(function() { 
		var currentValue = $("#textbox").val();
		if(currentValue == "http://twitter.com/as/status/994188627") {
			$("#textbox").val("");
		}
	});
	
	$("#textbox").blur(function() { 
		var currentValue = $("#textbox").val();
		if(currentValue == "") {
			$("#textbox").val("http://twitter.com/as/status/994188627");
		}		
	});
});

/*
		$usernamesArray = array_unique($usernamesArray);
		$user1Name = $usernamesArray[0];
		$user2Name = $usernamesArray[1];
		$usernamesResponse = base64_encode('<h1><span class="conversationUsername">'.$user1Name.'</span> and <span class="conversationUsername">'.$user2Name.'Ős</span> convo:</h1>');
		$echoResponse = base64_encode($echoResponse);
		$finalResponse = "$usernamesResponse,$echoResponse";
		print($finalResponse);

*/
