
    
;
function displayNews(item)
{
	$jq('.news_container').each(  function(index){
																			if($jq(this).attr('name') == 'news_'+item ) $jq(this).css('display','block');
																			else{ $jq(this).css('display','none') }
																					}
														)
	$jq('.multipages a').each(  function(index){
																			if($jq(this).attr('name') == 'selector_'+item ) $jq(this).attr('class','selected');
																			else{ $jq(this).attr('class','') }
																					}
														);
}

function displayDelegNews(item)
{
	$jq('.news_deleg_container').each(  function(index){
																			if($jq(this).attr('name') == 'news_deleg_'+item ) $jq(this).css('display','block');
																			else{ $jq(this).css('display','none') }
																					}
														)
	$jq('#news_deleg_selector a').each(  function(index){
																			if($jq(this).attr('name') == 'selector_deleg_'+item ) $jq(this).attr('class','selected');
																			else{ $jq(this).attr('class','') }
																					}
														)
}

function displayAllVideos()
{
		$jq("#home_videos").animate({"height": "toggle"}, 600);
}


var player = null;
function playerReady() {
	player = document.getElementById("home_video");
	addListeners();
}

function addListeners() {
  if (player) {
    player.addModelListener("STATE", "stateListener");
  } else {
    setTimeout("addListeners()",100);
  }
}


function petit_pause(file) {
	document.getElementById('home_video').sendEvent("LOAD", file);
	document.getElementById('home_video').sendEvent("PLAY", "true");
	return;
}
function playNormal(file, legend, legend_cut, is_ios)
{
	$jq('#home_video_daily').css('visibility','hidden');
	$jq('#home_video_daily').html('');
	$jq('#home_video').css('height','205px');
	$jq('#home_video').css('visibility','visible');
	$jq('#home_video').css('display','block');

  //$.jPlayer.event.ready event
  // probleme: appel LOAD and PLAY events avant fin de chargement du player
  if(!is_ios)
	{
	//	setTimeout("petit_pause('"+file+"')",1000);
		
			document.getElementById('home_video').sendEvent("LOAD", file);
			document.getElementById('home_video').sendEvent("PLAY", "true");
	}
	else {
		var content = '<video id="mod_video_ios" width="240" height="205" title="" preload controls><source src="'+file+'" /></video>';
		
		$jq('#home_video').css('visibility','visible');
		$jq('#home_video').css('position','relative');
		$jq('#home_video').html(content);
	}

	correct = true;

	changeLegend(legend, legend_cut);
}

function playDailymotion(file, legend, legend_cut, is_ios)
{
	$jq('#home_video').css('visibility','hidden');
	$jq('#home_video').css('height','0');
	$jq('#home_video').css('display','none');
	try
	{
		document.getElementById('home_video').sendEvent('STOP');
	}
	catch(e)
	{
		// Video déjà arrêtée
	}

	if(is_ios)
	{
		var content = '<iframe id="wrapDailymotion" src="'+file+'" width="240" height="204" frameborder="0"></iframe>';
	}
	else
	{
		var content = '<div id="wrapDailymotion" style="width:240px;height:204px;overflow:hidden;"><object id="objectDailymotion" style="width:240px;height:205px;"><param name="movie" value="'+file+'?additionalInfos=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed id="embedDailymotion" type="application/x-shockwave-flash" src="'+file+'?additionalInfos=0&autoplay=1" allowfullscreen="true" allowscriptaccess="always" style="width:240px;height:205px;"></embed></object></div>';
	}
	

	$jq('#home_video_daily').css('visibility','visible');
	$jq('#home_video_daily').html(content);

  changeLegend(legend, legend_cut);
}

function changeLegend(legend, legend_cut)
{
	$jq('#video_legend').html('<p class="tooltip" title="'+legend+'">'+legend_cut+'</p>');
	  $jq.fn.qtip.styles.mystyle = {
		 width: 210,
		 background: '#f9f7e9',
		 color: '#534543',
		 textAlign: 'center',
		 border: {
				width: 1,
				radius: 1,
				color: '#978783'
		 },

		 tip: {
			 corner: 'topMiddle', // We declare our corner within the object using the corner sub-option
			 color: '#978783',
			 size: {
					x: 10, // Be careful that the x and y values refer to coordinates on screen, not height or width.
					y : 5 // Depending on which corner your tooltip is at, x and y could mean either height or width!
			 }
			},

		 name: 'dark'
	}

  $jq('p.tooltip[title]').qtip(
	{
		content: {
			 text: false
		},

		position: {
			corner: {
				 target: 'bottomMiddle',
				 tooltip: 'topMiddle'
			},
			adjust: { x: 0, y: 7 }
		},

		style: 'mystyle'

	 });
}

function changeLegendTooltip()
{
  $jq.fn.qtip.styles.mystyle = {
		 width: 210,
		 background: '#f9f7e9',
		 color: '#534543',
		 textAlign: 'center',
		 border: {
				width: 1,
				radius: 1,
				color: '#978783'
		 },

		 tip: {
			 corner: 'topMiddle', // We declare our corner within the object using the corner sub-option
			 color: '#978783',
			 size: {
					x: 10, // Be careful that the x and y values refer to coordinates on screen, not height or width.
					y : 5 // Depending on which corner your tooltip is at, x and y could mean either height or width!
			 }
			},

		 name: 'dark'
	}

	$jq('p.tooltip[title]').qtip(
	{
		content: {
			 text: false
		},

		position: {
			corner: {
				 target: 'bottomMiddle',
				 tooltip: 'topMiddle'
			},
			adjust: { x: 0, y: 7 }
		},

		style: 'mystyle'

	 });

}

