function formatText(index, panel) {
	return index + "";
}

$(document).ready(function() {
	//les tableaux de droite
	$('#resultats .feminin td.lien, #resultats .masculin td.lien').mouseover(function(){
		$(this).addClass('actif');
	});

	$('#resultats .feminin td.lien, #resultats .masculin td.lien').mouseout(function(){
		$(this).removeClass('actif');
	});

	$('#resultats td.lien').click(function(){
		cat=$(this).attr('rel');
		
		$('#resultats .feminin td.lien, #resultats .masculin td').removeClass('actif2');

		$.ajax({
			url: 'ajax-classement.php',
			type: 'post',
			success: function(data){
				$('#ajaxClassement').html(data);
				active_lien_classement();
			},
			data: { cat: cat }
		});

		$(this).addClass('actif2');
	});

	/*$('#resultats .masculin td').click(function(){
		cat=$(this).html();

		$('#resultats .feminin td, #resultats .masculin td').removeClass('actif2');

		$.ajax({
			url: 'ajax-classement.php',
			type: 'post',
			success: function(data){
				$('#ajaxClassement').html(data);
				active_lien_classement();
			},
			data: { cat: cat+'m' }
		});

		$(this).addClass('actif2');
	});*/
	
	if($('#bloc-inscription form').size())
		$('#bloc-inscription form').validate();

	/* Hauteur des blocs */
	/*$("#parcours-dexcellence .bloc-content, #la-ligue-du-centre .bloc-content, #pratiquer-le-handball .bloc-content").height($("#services-clubs .bloc-content").height());*/
	h1=$('#la-ligue-du-centre .bloc-content').height();
	h2=$('#services-clubs .bloc-content').height();
	if(h1>h2)
		$('#services-clubs .bloc-content').height(h1);
	else
		$('#la-ligue-du-centre .bloc-content').height(h2);
    	
	/* Actualités */
	if($('.anythingSlider').size()){
		$('.anythingSlider').anythingSlider({
			easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
			autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
			delay: 3000,                    // How long between slide transitions in AutoPlay mode
			startStopped: false,            // If autoPlay is on, this can force it to start stopped
			animationTime: 600,             // How long the slide transition takes
			hashTags: true,                 // Should links change the hashtag in the URL?
			buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
				pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
			startText: "Go",             // Start text
			stopText: "Stop",               // Stop text
			navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
		});
			
		$("#slide-jump").click(function(){
			$('.anythingSlider').anythingSlider(6);
		});
	}
});

function active_lien_classement(){
	$('#ajaxClassement .liens a.lien').click(function(){
		$('#resultatHand, #classementHand, #calendrierHand').hide();
		$('#ajaxClassement .liens a').attr('id', '');

		tmp=$(this).attr('href').split('/');
		$(tmp[tmp.length-1]).show();

		$(this).attr('id', 'resultats-current');

		return false;
	});
}

function hauteur_index(){
	return false;

	h1=$('#left-content').height();
	h2=$('#right-content').height();

	if(h1>h2){
		h=Math.round((h1-h2)/4);

		$('#espace-comites, #resultats, #agenda, #right-content .bloc-pub').after('<div style="height: '+h+'px"></div>');
	}
	if(h1<h2){
		h=h2-h1;
		$('#services-clubs, #parcours-dexcellence').after('<div style="height: '+h+'px"></div>');
	}
}
