window.onload=show;
function show(id)
{
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++)
	{
		if (document.getElementById('p'+i))
			document.getElementById('p'+i).style.display='none';
	}
	if (d)
		d.style.display='block';
}

function fbs_click()
{
	u=location.href;
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

function update_chat_state()
{
	$.post("chat.php?check", {}, function(data){ $("#chat_state").html(data);});  
	setTimeout('update_chat_state()', 3000);
}

$(document).ready(function() {
	update_chat_state();

	$(".votePour").click(function() {
		$(this).html("<em>vote en cours</em>");
		var id=$(this).attr('id');
			$.post('vote_par_mysql.php', {id_entree: id}, function(data) {
				 $("#"+id).html(data);
			});
	});
	$(".voteContre").click(function() {
		$(this).html("<em>vote en cours</em>");
		var id=$(this).attr('id');
			$.post('vote_par_mysql.php', {id_entree: id}, function(data) {
				 $("#"+id).html(data);
			});
	});
	$(".supprimer_avatar").click(function() {
		$("#photo_avatar").html("Aucun avatar, uploadez-en un maintenant !");
		$(this).html("<i>Avatar supprimé</i>");
		$.post('profil.php?func=1', function(data) {});
	});
	$(".supprimer_background").click(function() {
		$("#photo_background").html("Aucun background, uploadez-en un maintenant !");
		$(this).html("<i>Background supprimé</i>");
		$.post('profil.php?func=2', function(data) {});
	});
	$(".supprimer_news_feed").click(function() {
		var id=$(this).attr('id');
		$.post('modules/mod_3_newsfeedback.php?func=1', {id: id}, function(data) {
			$("#div_module_newsfeed").html(data);
		});
	});
});
