function principeToggle() {

	if ($('.post#principe').css('display') == 'none') {
	
		$('.post#principe').slideDown();
	
	} else {
	
		$('.post#principe').slideUp();
	
	}

}

function nonabus(id) {
	$.get('/ajax/moderate/moderate.php?vdm='+id+'&statut=0',function(xml) {
		$('.post.vdm .contain').slideUp(function() {
			if ($('billet',xml).length > 0) {
				$('.post.vdm .contain').attr('id',$('id',xml).text());
				$('.post.vdm .contain .billet').html($('billet',xml).text());
				$('.post.vdm .contain .date').html($('date',xml).text());
				$('.post.vdm .contain #abus').html('<a href="javascript:abus(\''+$('id',xml).text()+'\')">'+lang.moderate.reportabuse+'</a>');
				$('.post.vdm .contain').slideDown();
			} else {
				$('.post.vdm .contain .billet').css('height','35px');
				$('.post.vdm .contain .billet').css('padding-top','30px');
				$('.post.vdm .contain .billet').css('text-align','center');
				$('.post.vdm .contain .billet').html(lang.moderate.nomorefml);
				$('.post.vdm .contain .date').html('');
				$('.post.vdm .contain #abus').html('');
				$('.post.vdm .contain').slideDown();
				$('.boutons').fadeOut();
			}
		});
	});
}

function abus(id) {
	$('#abus').css('display','none');
	$.get("/ajax/moderate/abuse.php?id="+id,function(html) {
		$('#abus').html(lang.moderate.abusereported);
	});
	$('#abus').fadeIn();
	setTimeout("nonabus("+id+")",1000);
}

$(document).ready(function() {

	$('#menu h1').mouseover(function() {
		$(this).addClass('active');
	});
	$('#menu h1').mouseout(function() {
		if (!$(this).is('.selected')) {
			$(this).removeClass('active');
		}
	});

	$('.boutons #oui').click(function() {
	
		var id = $('.post.vdm .contain').attr('id');
		$.get('/ajax/moderate/moderate.php?vdm='+id+'&statut=1',function(xml) {
			$('.post.vdm .contain').slideUp(function() {
				if ($('billet',xml).length > 0) {
					$('.post.vdm .contain').attr('id',$('id',xml).text());
					$('.post.vdm .contain .billet').html($('billet',xml).text());
					$('.post.vdm .contain .date').html($('date',xml).text());
					$('.post.vdm .contain #abus').html('<a href="javascript:abus(\''+$('id',xml).text()+'\')">'+lang.moderate.reportabuse+'</a>');
					$('.post.vdm .contain').slideDown();
				} else {
					$('.post.vdm .contain .billet').css('height','35px');
					$('.post.vdm .contain .billet').css('padding-top','30px');
					$('.post.vdm .contain .billet').css('text-align','center');
					$('.post.vdm .contain .billet').html(lang.moderate.nomorefml);
					$('.post.vdm .contain .date').html('');
					$('.post.vdm .contain #abus').html('');
					$('.post.vdm .contain').slideDown();
					$('.boutons').fadeOut();
				}
			});
		});
		
		try {
		pageTracker._trackEvent("Modération", "Oui");
		} catch(err) {}
	
	});
	
	$('.boutons #non').click(function() {
	
		var id = $('.post.vdm .contain').attr('id');
		$.get('/ajax/moderate/moderate.php?vdm='+id+'&statut=0',function(xml) {
			$('.post.vdm .contain').slideUp(function() {
				if ($('billet',xml).length > 0) {
					$('.post.vdm .contain').attr('id',$('id',xml).text());
					$('.post.vdm .contain .billet').html($('billet',xml).text());
					$('.post.vdm .contain .date').html($('date',xml).text());
					$('.post.vdm .contain #abus').html('<a href="javascript:abus(\''+$('id',xml).text()+'\')">'+lang.moderate.reportabuse+'</a>');
					$('.post.vdm .contain').slideDown();
				} else {
					$('.post.vdm .contain .billet').css('height','35px');
					$('.post.vdm .contain .billet').css('padding-top','30px');
					$('.post.vdm .contain .billet').css('text-align','center');
					$('.post.vdm .contain .billet').html(lang.moderate.nomorefml);
					$('.post.vdm .contain .date').html('');
					$('.post.vdm .contain #abus').html('');
					$('.post.vdm .contain').slideDown();
					$('.boutons').fadeOut();
				}
			});
		});
		
		try {
		pageTracker._trackEvent("Modération", "Non");
		} catch(err) {}
	
	});

});