$(window).load(function() {
	
	// Scrollbar de la tribune
	$('#liste_tribune').jScrollPane({scrollbarWidth:10, scrollbarMargin:0, showArrows :true, arrowSize :9});
	
	
	// Formulaire de contact
	//$("#fm_contact").hide(); // Je le masque par défaut
	$("#fm_contact a.fermer").click(function() {
		$("#fm_contact").hide("slow"); // Je le masque quand je clique sur la croix
	});
	
	$("#contact").click(function () { // Je l'affiche quand on clique sur contact
		$("#fm_contact").show("slow");
	});
	
	// Slideshow des affiches
	$("#slide").carousel({
		loop: true,
		autoSlide: true,
		autoSlideInterval: 5000,
		delayAutoSlide: 2000,
		pagination: true
	});
	

	$(".loader").css("display", "none");
	$("div.carousel ul li").css("display", "block");

});

// Fonction qui ajoute le code d'un smiley dans un textarea passé en paramètre
function AddSmiley(smiley, id) {
	if (document.getElementById(id).value == "Votre message")
		document.getElementById(id).value = ':' + smiley + ':';
	else if (document.getElementById(id).value.length > 0)
		document.getElementById(id).value += ' :' + smiley + ':';
	else
		document.getElementById(id).value += ':' + smiley + ':';
}


function afficheClassement(id) {

	for (i=1; i<=4; i++) {
		document.getElementById("classement" + i).style.display = "none";
		document.getElementById("voir_" + i).style.display = "none";
		document.getElementById("onglet_classement" + i).className = "none";
	}
	
	document.getElementById("classement" + id).style.display = "block";
	document.getElementById("voir_" + id).style.display = "block";
	document.getElementById("onglet_classement" + id).className = "actif";
}

function survolOnglet(id) {
	switch (id) {
		case 1:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -256px";
			break;
		case 2:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -382px";
			break;
		case 3:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -620px 0";
			break;
		case 4:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -156px 0";
			break;
	}
	
	if (id > 1) {
		switch (id) {
			case 2:
				document.getElementById("onglet_classement" + (id - 1)).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -214px";
				break;
			case 3:
				document.getElementById("onglet_classement" + (id - 1)).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -340px";
				break;
			case 4:
				document.getElementById("onglet_classement" + (id - 1)).style.background = "url(http://img1.vivofoot.com/sprites.png) -466px 0";
				break;
		}
	}
}


function desurvolOnglet(id) {
	switch (id) {
		case 1:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -172px";
			break;
		case 2:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -298px";
			break;
		case 3:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) -312px 0";
			break;
		case 4:
			document.getElementById("onglet_classement" + id).style.background = "url(http://img1.vivofoot.com/sprites.png) 0 0";
			break;
	
	}
	if (id > 1) {
		switch (id) {
			case 2:
				document.getElementById("onglet_classement" + (id - 1)).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -172px";
				break;
			case 3:
				document.getElementById("onglet_classement" + (id - 1)).style.background = "url(http://img1.vivofoot.com/sprites.png) -612px -298px";
				break;
			case 4:
				document.getElementById("onglet_classement" + (id - 1)).style.background = "url(http://img1.vivofoot.com/sprites.png) -312px 0";
				break;
		}
	}
}

function changeProno(id, prono) {

	// J'initialise la ligne : 
	document.getElementById("_"+ id + "_1").src = "/images/choix/1.jpg";
	document.getElementById("_"+ id + "_n").src = "/images/choix/n.jpg";
	document.getElementById("_"+ id + "_2").src = "/images/choix/2.jpg";
	
	document.getElementById("_"+ id + "_" + prono).src = "/images/choix/" + prono + "x.jpg";
	
	document.getElementById("h" + id).value = prono;
	
}
