$(document).ready(function() {
	$('textarea#daily-update').val('What are you doing to improve your health today?');
	$('textarea#daily-update').focus(function() {
		$(this).val(' ');
		$(".update_inputs").show();
	});	
	$("button.submit_cancel").click(function() {
	$(".update_inputs").hide();
	$('textarea#daily-update').val('What are you doing to improve your health today?');
	$("#daily-update").height('20px');	
	return false;
	});
	$('textarea').autogrow();
	$("#daily-update").height('20px');	
	$(".submit_update").click(function() {
		$(".update_inputs").hide();			
		$.post("/daily_updates", { comment: $('textarea#daily-update').val() });
		$("textarea#daily-update").height('20px');	
		$('textarea#daily-update').val('What are you doing to improve your health today?');
		$('#daily-update-form').html("<p><span style='font-weight:bold;'>Your profile has been updated.</span>&nbsp; <a href='/updates'>View Updates</a></p>");
		$('#updates-content p').css("marginBottom","0px");
		return false;
	});
	
});

