// JavaScript Document


//LE MENU
var currentDiv = 'blog';

function menu(divIn){
	 Effect.Fade(currentDiv, { duration: 0.2 });
	 Effect.Appear(divIn, { duration: 0.5, delay: 0.2 });
	 currentDiv = divIn;
}

function comment_display(div){
	Effect.toggle(div, 'blind');
}


//LE MENU DES ARCHIVES
function anneesArchives_toggle(div){
	Effect.toggle(div, 'blind');
}

function getMoisArchives(month, year){
	new Ajax.Updater('billetsArchives', 'php/archive.class.php', {method:'post', postBody:'action=archives&month='+month+'&year='+year});
}



//FONCTIONS AJOUT
function callback(reponseAjax){
	//alert(reponseAjax.responseText);
	new Ajax.Updater('nb_'+reponseAjax.responseText, 'php/comment.class.php', {method:'post', postBody:'action=nb&id='+reponseAjax.responseText});
	$('commentaire_form_'+reponseAjax.responseText).reset();
}

function commentaire_add(nom, email, site, message, id, reponse){
	//if (reponse.toUpperCase() != 'MARRON') {
	if(reponse != '5'){
		alert('C\'est ça ouais !');
	} else {
		var data = 'nom='+nom+'&email='+email+'&website='+site+'&message='+message+'&id='+id;
		new Ajax.Request('php/comment.class.php', {method:'post', postBody:data+'&action=add&ajax=1', onComplete:callback});		
	}
}