if ( typeof miseEnPlaceChrono != 'function' ) {
	function miseEnPlaceChrono(cible,chrono,chargement)
	{
		if ( $(cible).length == 0 ){
			return;
		}
		if (cible.find('select').length ){
			cible.find('select').unbind('change').val(chrono).change(function(){
				cible.data('chronoSport',$(this).val());
				cible.find('.contenu_chrono').css('top','0px').empty();
				cible.data('chronoNumero',0);
				cible.data('chronoMax',0);
				cible.data('chronoEnd',10);
				chargeChrono(cible,'+');
			});
		}
		
		cible.data('chronoSport',chrono);
		cible.data('chronoNumero',0);
		cible.data('chronoMax',0);
		cible.data('chronoEnd',10);
		cible.data('hauteur',parseInt(cible.find('.contenu_chrono').parent().css('height')));
		
		cible.find('.chrono_suite').unbind('click').click(function(){changeBreves(cible,'-');});
		cible.find('.chrono_retour').unbind('click').click(function(){changeBreves(cible,'+');});
		
		if (chargement ){
			cible.find('.contenu_chrono').css('top','0px').empty();
			chargeChrono(cible,'+');
		}
	}
	function changeBreves(cible,sens)
	{
		var chronoNumero = cible.data('chronoNumero');
		if (sens == '-'){chronoNumero--;}
		else {chronoNumero++;}
		if ( chronoNumero < 0 ){chronoNumero=0;return;}
		if ( chronoNumero > 9 ){chronoNumero=9;return;}
		cible.data('chronoNumero',chronoNumero);
		chargeChrono(cible,sens);
	}
	function chargeChrono(cible,sens)
	{
		var hauteur = cible.data('hauteur');
		
		if (sens == '-'){
			cible.find('.contenu_chrono').animate({'top':'+='+hauteur+'px'},'slow');
		}
		else if( cible.data('chronoNumero') > 0 && cible.data('chronoNumero') <= cible.data('chronoMax')) {
			cible.find('.contenu_chrono').animate({'top':'-='+hauteur+'px'},'slow');
		}
		else if ( cible.data('chronoNumero') < cible.data('chronoEnd')){
			$.ajax({
				type:'GET',
				url:'/include/chronos/'+cible.data('chronoSport')+cible.data('chronoNumero')+'.html',
				success:function(data){
					cible.find('.contenu_chrono').append(data);
					if ( cible.data('chronoNumero') != 0 ){
						cible.find('.contenu_chrono').animate({'top':'-='+hauteur+'px'},'slow');
					}
					cible.data('chronoMax',cible.data('chronoNumero'));
				},
				error:function(){
					if ( Math.abs(parseInt(cible.find('.contenu_chrono').css('top'))) < cible.find('.contenu_chrono a').length*parseInt(cible.find('.contenu_chrono a:eq(0)').attr('clientHeight') )-hauteur) {
						cible.find('.contenu_chrono').animate({'top':'-='+hauteur+'px'},'slow');
					}
					cible.data('chronoNumero',cible.data('chronoNumero')-1);
					cible.data('chronoMax',cible.data('chronoNumero'));
					cible.data('chronoEnd',cible.data('chronoNumero'));
				}
			});
		}
		else if ( Math.abs( parseInt(cible.find('.contenu_chrono').css('top')) ) < cible.find('.contenu_chrono a').length*parseInt(cible.find('.contenu_chrono a:eq(0)').attr('clientHeight') )-hauteur) {
			cible.find('.contenu_chrono').animate({'top':'-='+hauteur+'px'},'slow');
			cible.data('chronoNumero',cible.data('chronoNumero')-1);
		}
	}
}
