//Vérifie si tous les champs sont complets
	function profilComCheckForm()
	{
		var profilComText = $('#commentForm');
		
		if(profilComText.attr('value'))
			return true;
		else
			return false;
	}
	
//Met à jour l'affichage des commentaires
	function profilComUpdate(userId, start)
	{
		var profilComLoading = $('#loaderProfilCom');
		var profilComArea = $('#profilcom');
		var profilComAreaHeight = $('#profilcom').height();
		
		if(profilComAreaHeight < 50)
			profilComAreaHeight = 50;
		profilComLoading.height(profilComAreaHeight);
		profilComLoading.fadeIn();
		profilComArea.hide();
		
		$.ajax(
			{
				type: 'POST', url: '../user/com/view.php', data: 'userId=' + userId + '&start=' + start,
				complete: function(data)
							{
								profilComArea.html(data.responseText);
								profilComArea.fadeIn();
								profilComLoading.hide();
							}
			}
		);
	}
	
//Affiche le formulaire de réponse à un commentaire
	function showAnswer(user, id)
	{		
		if($('#formAnswer' + id).length)
		{
			$('#formAnswer' + id).remove();
		}
		else
		{
			$('.formAnswer').remove();
		
			form = $('<form />').attr(
				{
					method : 'post',
					action : user + '#comment',
					id : 'formAnswer' + id
				}
			);
			form.attr('class', 'formAnswer');
			
			textarea = $('<textarea />').attr(
				{
					name : 'comment',
					cols : '50',
					rows : '7'
				}
			);
			
			p1 = $('<p />');
			
			inputSubmit = $('<input />').attr(
				{
					type : 'submit',
					name : 'newComment',
					value : 'Envoyer la réponse'
				}
			);
			
			p2 = $('<p />');
			
			textarea.appendTo(p1);
			p1.appendTo(form);
			inputSubmit.appendTo(p2);
			p2.appendTo(form);
			form.appendTo('#profilcomanswer' + id);
		}
	}
	
//Affiche le formulaire d'édition d'un commentaire
	function showEdit(user, id)
	{
		if($('#formEdit' + id).length)
		{
			$('#formEdit' + id).remove();
		}
		else
		{
			$('.formEdit').remove();
			
			form = $('<form />').attr(
				{
					method : 'post',
					action : user + '#comment',
					id : 'formEdit' + id
				}
			);
			form.attr('class', 'formEdit');
			
			textarea = $('<textarea />').attr(
				{
					name : 'edit',
					cols : '50',
					rows : '7',
					id : 'textareaEdit' + id
				}
			);
			
			p1 = $('<p />');
			
			inputHidden = $('<input />').attr(
				{
					type : 'hidden',
					name : 'idEdit',
					value : id
				}
			);
			
			inputSubmit = $('<input />').attr(
				{
					type : 'submit',
					name : 'editComment',
					value : 'Éditer'
					
				}
			);
			
			p2 = $('<p />');
			
			textarea.appendTo(p1);
			p1.appendTo(form);
			inputHidden.appendTo(p2);
			inputSubmit.appendTo(p2);
			p2.appendTo(form);
			form.appendTo('#profilcomedit' + id);
			
			textarea.val($('#comtexte' + id).text());
		}
	}
	
//Supprime un commentaire
	function profilComDelete(id)
	{
		var deleteAnswer = confirm('Êtes-vous sûr de vouloir effacer ce message ?');
		if(deleteAnswer)
		{
			$.ajax(
				{
					type: 'POST', url: '../user/com/delete.php', data: 'idDelete=' + id,
					complete: function(data)
					{
						if(data.responseText == 'true')
						{
							$('#profilcom' + id).slideUp('normal');
						}
					}
				}
			);
		}
	}