
function init () {
	$('archive').observe('change', function(){
		window.location="index.php?when="+$('archive').options[$('archive').selectedIndex].value
	});
}
function showcomm (idpost) {
	langue="fr";
	commbox='comm'+idpost;
	comm_h=$(commbox).getHeight();
	if (comm_h==0) {
		new Ajax.Updater(commbox, 'commentaires.php', {method: 'get', parameters:"ajax=1&langue="+langue+"&idpost="+idpost,evalScripts: true,
		onSuccess: function () {
			$('nb_comm'+idpost).addClassName('bordure_d');
			//alert(window.pageYOffset+" "+mouse_y+" "+window.innerHeight);
			//var truc=mouse_y;
			//$('alert_box').innerHTML="souris : "+mouse_y+" - scroll : "+window.pageYOffset+" - hauteur : "+window.innerHeight;
			//setTimeout(function() { bidule(mouse_y) },300);
			//alert(idpost)
			new Effect.ScrollTo('nb_comm'+idpost, { duration:0.7, offset:-100});
			//scrolldelay = setTimeout("alert(comm_h)",600);
			//new Effect.BlindDown(combox, { duration: 0.7 });
		}
		});
	} else {
		$('nb_comm'+idpost).removeClassName('bordure_d');
		$(commbox).update();
	}

}

function bidule (mouse_y) {
	//ancien scroll centré sur la boite commentaires
	//auto_scroll=window.pageYOffset+mouse_y-(window.innerHeight-$(commbox).getHeight())/2
	
	auto_scroll=mouse_y+window.pageYOffset-100
	//-(window.innerHeight-$(commbox).getHeight())/2

	window.scrollTo(0,auto_scroll)
}

var img_memory="";
	function play_tune (mp3,play_id) {

		//switch de l'image en position active
		
		//on desactive l'ancienne image
		if (img_memory!=""&&img_memory!=play_id) {
			document.getElementById(img_memory).src="pic/player/play.gif";
		};
		//on remplace la mémoire par l'id actuel
		img_memory=play_id
		//et switch
		file_name=document.getElementById(play_id).src
		if (!file_name.match("-active")) {
			new_file = file_name.replace(/(.*?)\.(\w+)$/, "$1-active.$2");
		} else {
			new_file = file_name.replace(/(.*?)-active\.(\w+)$/, "$1.$2");
		}
		document.getElementById(play_id).src=new_file

		//envoi du nom de morceau à flash
		document.getElementById("monoplayer").play_mrc(mp3);
		//alert(mp3);
	}
	function stop_tune (play_id) {
		document.getElementById("monoplayer").stop_mrc();
		if (img_memory!=""&&img_memory!=play_id) {
			document.getElementById(img_memory).src="pic/player/play.gif";
		};
	}
	function vol_tune (action) {
		document.getElementById("monoplayer").vol_mrc(action);
	}
	
	function active_me (id) {
		if (id=="flash") {
			id=img_memory
		};
		file_name=document.getElementById(id).src
		if (!file_name.match("-active")) {
			new_file = file_name.replace(/(.*?)\.(\w+)$/, "$1-active.$2");
		} else {
			new_file = file_name.replace(/(.*?)-active\.(\w+)$/, "$1.$2");
		}
		document.getElementById(id).src=new_file
	}
	
