var apiRollOnglets = null;

function ModifierInfos(value) {

	if (jQuery('#'+value).is(":visible")) {
		jQuery('#'+value).hide();
		jQuery('#'+value+'_1').show();
		apiRollOnglets.getConf().keyboard = false;
		apiRollOnglets.reload();
	} else {
		jQuery('#'+value).show();
		jQuery('#'+value+'_1').hide();
		// apiRollOnglets.getConf().keyboard = true;
		apiRollOnglets.reload();
	}
}


function pose_lightbox(){
			jQuery('#medias_photos a.lightbox').lightBox();
			jQuery('#medias_photos_1 a.lightbox').lightBox();
		}

function setOnClickOnTitreArticlePresse() {
	jQuery(".sportif_presse .selection .reponse").hide();
	jQuery(".sportif_presse .selection .item_presse .titre").click(function() {

		// Actions uniquement si la réponse n'est pas déjà visible
		if(jQuery(this).parent().find(".resume").is(":visible") == true) {
			// Masquage des réponses
			//jQuery(".sportif_presse .selection .question .resume").show();
			//	jQuery(this).next().css("float","left");
			jQuery(this).parent().find(".reponse").show();
			jQuery(this).parent().find(".resume").hide();
		}
		else {
			jQuery(this).parent().find(".reponse").hide();
			jQuery(this).parent().find(".resume").show();
		}
		apiRollOnglets.reload();
	});
	apiRollOnglets.reload();
}

// wait until document is fully scriptable
jQuery(document).ready(documentLoaded);
function documentLoaded() {


	// select #flowplanes and make it scrollable. use circular and navigator plugins
	apiRollOnglets = jQuery("#informations_sportifs").scrollable({size: 1, clickable: false}).navigator({
		// select #flowtabs to be used as navigator
		navi: "#onglets_sportifs",

		// select A tags inside the navigator to work as items (not direct children)
		naviItem: 'a',

		// assign "current" class name for the active A tag inside navigator
		activeClass: 'current',
		api: true
	});

	jQuery(".sportif_presse .selection .question").hover(
		function () {
			  jQuery(this).addClass("hilite");
		},
		function () {
			  jQuery(this).removeClass("hilite");
		}
	);

	setOnClickOnTitreArticlePresse();

	pose_lightbox();

	apiRollOnglets.onReload(function() {
		var height = 0;
		var visible = this.getVisibleItems();
		visible.each(function() {
			height = jQuery(this).height();
			height = height + 50;
			return false;
		});
		this.getRoot().add(this.getItemWrap()).height(height);
		jQuery('#information_sportifs').css('height',height +'px');
		jQuery('#information_sportifs').css('width','100%');

	});

	apiRollOnglets.onSeek(function() {
		var newHeight = 0;
		var scrollIndex = this.getIndex();
		var visible = this.getVisibleItems();
		visible.each(function() {
			newHeight = jQuery(this).height();
			newHeight = newHeight + 50;
			return false;
		});
		jQuery('#information_sportifs').css('height',newHeight +'px');
		this.getRoot().add(this.getItemWrap()).animate({ height : newHeight });

	});

	if(jQuery(document).find("#t6").is(":visible")== true) {
		jQuery('#onglets_sportifs a').css('width','83px');
	}
	apiRollOnglets.reload();
};

