function aff_cache(id){
	if(document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "";
	else
		document.getElementById(id).style.display = "none";
}

function aff_cache2(id){
	if(document.getElementById(id).style.visibility == "hidden")
		document.getElementById(id).style.visibility = "visible";
	else
		document.getElementById(id).style.visibility = "hidden";
}

function aff(id){
	if(document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "";
}

function cache(id){
	if(document.getElementById(id).style.display == "")
		document.getElementById(id).style.display = "none";
}

function aff2(id){
	document.getElementById(id).style.visibility = "visible";
}

function cache2(id){
	document.getElementById(id).style.visibility = "hidden";
}

function centrer_div(nom,l,h){
	largeur=((document.body.clientWidth)/2)-(l/2);
	hauteur=((document.body.clientHeight)/2)-(h/2);
	document.getElementById(nom).style.top=hauteur;
	document.getElementById(nom).style.left=largeur;
}

function centrer_div2(nom,l){
	largeur=((document.body.clientWidth)/2)-(l/2);
	document.getElementById(nom).style.left=largeur;
}

function voirSelect(v){	
	if(!window.Event){
		oSelects = document.getElementsByTagName('SELECT'); 
		for (i = 0; i < oSelects.length; i++) { 
			oSlt = oSelects[i]; 
			oSlt.style.visibility=v;
		}			
	}
}

function reset_check(){
	oSelects = document.getElementsByTagName('INPUT'); 
	for (i = 0; i < oSelects.length; i++) { 
		oSlt = oSelects[i];
		if(oSlt.type == "checkbox") {
			oSlt.checked = false;
		}
	}
}

function add_categorie(){	
	document.form.categorie.value = "";
	document.getElementById('categorie_label').innerHTML = "";

	oSelects = document.getElementsByTagName('INPUT'); 
	for (i = 0; i < oSelects.length; i++) { 
		oSlt = oSelects[i];
		if(oSlt.type == "checkbox" && oSlt.checked) {
			//alert(oSlt.value);
			var letab = Array();
			letab = oSlt.value.split("-");
			//alert(letab[0] + " - " + letab[1]);
			if(document.form.categorie.value == "")
			{
				document.form.categorie.value += letab[0];
				document.getElementById('categorie_label').innerHTML += letab[1];
			}
			else
			{
				document.form.categorie.value += "," + letab[0];
				document.getElementById('categorie_label').innerHTML += ", " + letab[1];
			}
		}
	}
}

var selection_en_cours=0;
var lecture = true;
var url_site="";
var selection_max=0;

function selection_suivante(){
	if(selection_en_cours<selection_max-1){
		pause();
		selection_en_cours++;
		new_margin=parseInt(selection_en_cours*630);
		$('#selection').animate({marginLeft: -new_margin+'px'}, 500);
		for(var i=1; i<=selection_max; i++){
			if(i-1==selection_en_cours){
				document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+"_actif.png";
			}else{
				document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+".png";
			}
		}
	}
}
function selection_precedente(){
	if(selection_en_cours>0){
		pause();
		selection_en_cours--;
		new_margin=parseInt(selection_en_cours*630);
		$('#selection').animate({marginLeft: -new_margin+'px'}, 500);
		for(var i=1; i<=selection_max; i++){
			if(i-1==selection_en_cours){
				document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+"_actif.png";
			}else{
				document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+".png";
			}
		}
	}
}

function go_to_selec(selection){
	//alert(selection);
	pause();
	selection_en_cours=selection-1;
	new_margin=parseInt(selection_en_cours*630);
	$('#selection').animate({marginLeft: -new_margin+'px'}, 500);
	for(var i=1; i<=selection_max; i++){
		if(i-1==selection_en_cours){
			document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+"_actif.png";
		}else{
			document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+".png";
		}
	}
}

function suivant_auto(){
	//alert(lecture);
	if(lecture == true){
		
		if(selection_en_cours == selection_max-1)
			selection_en_cours=0;
		else
			selection_en_cours++;
			
		new_margin=parseInt(selection_en_cours*630);
		$('#selection').animate({marginLeft: -new_margin+'px'}, 500);
		for(var i=1; i<=selection_max; i++){
			if(i-1==selection_en_cours){
				document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+"_actif.png";
			}else{
				document.getElementById("chiffre_"+i).src=url_site+"images/bt_"+i+".png";
			}
		}
		
		setTimeout("suivant_auto()", 5000);
	}
}

function pause()
{
	lecture = false;
}

function affiche_niveaux(){
	if(document.getElementById('niveaux_forum').style.display=="none"){
		$('#niveaux_forum').slideDown(500);
	}else{
		$('#niveaux_forum').slideUp(500);
	}
}





