$(function() {

    $('#hideEmail').hide();

    $('#emailTable').hide();

    var userID = $('#userID').text();

    


    $('#hideEmail').click(function() {
	$(this).hide();
	$('#showEmail').show();
	$('#emailTable').slideUp('fast');
    });


    $('#showEmail').click(function() {
	
	$('#showEmail').hide();
	  $("#ajaxLoadEmail").show();
	
	$.get('/emails/view_user_emails/'+userID, function(data) {
	    $('#emailTable').html(data);
	    $('#emailTable').slideDown('fast', function() {
		$('#ajaxLoadEmail').hide();
	    });
	    $('#hideEmail').show();
	});

    });


});