function VFclick_onglet(onglet)
{
    if (onglet==0)
    {
        $('bloc_visu_1').style.display="block";
        $('bloc_visu_2').style.display="none";
        clic_lien( 0, 1 );
    }
    else
    {
        $('bloc_visu_1').style.display="none";
        $('bloc_visu_2').style.display="block";
        clic_lien( 3, 4 );
    }
}

function VFchangeonglet(id,chaine,auto)
{
	if(!auto){
		if(typeof VFtabblocs != "undefined" && VFtabblocs[chaine]){
			if(VFtabblocs[chaine]["active"]){
				VFstopSwitch(chaine);				
			}
		}
	}
	var i=1;
	var item=chaine+i;
	var bool=0;
	while(document.getElementById(item+'Bloc'))
	{
		if(id!=item)
		{
			document.getElementById(item+'Bloc').style.display='none';
		}else{
			var elt=document.getElementById(item+'Bloc');
			elt.style.display='';
			VFresizeImg( elt, 200 );
			bool=1;
		}
		i=i+1;
		item=chaine+i;
	}
	if(bool==0)
	{
		if(document.getElementById(chaine+'1Bloc'))
			document.getElementById(chaine+'1Bloc').style.display='';
	}
}

function VFchangeongletHome(id,chaine,id_img)
{
	if(typeof VFtabblocs != "undefined" && VFtabblocs[chaine]){
		VFstopSwitch(chaine);	
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/pause_on.gif"					
	}
	stopAll = true
	
	var i=1;
	var item=chaine+i;
	var bool=0;
	while(document.getElementById(item+'Bloc'))
	{
		if(id!=item)
		{
			document.getElementById(item+'Bloc').style.display='none';
		}else{
			var elt=document.getElementById(item+'Bloc');
			elt.style.display='';
			VFresizeImg( elt, 200 );
			bool=1;
		}
		i=i+1;
		item=chaine+i;
	}
	if(bool==0)
	{
		if(document.getElementById(chaine+'1Bloc'))
			document.getElementById(chaine+'1Bloc').style.display='';
	}
}

function VFswitchTabs(){
	if(typeof VFtabblocs == "undefined") return;
	for(var i in VFtabblocs){
		if(VFtabblocs[i]["active"]){
			VFchangeonglet(VFtabblocs[i]["id"]+VFtabblocs[i]["elements"][VFtabblocs[i]["current"]],VFtabblocs[i]["id"],true);
			VFtabblocs[i]["current"] = (VFtabblocs[i]["current"]+1)%VFtabblocs[i]["elements"].length;
			for(var j=1;j<3;j++){
				var barre = document.getElementById('barre'+j+'Onglet');
				if(typeof barre != "undefined" && barre){
					barre.src="http://ctu-24.fr/includes/flashnews/inc_fichiers/barre_on.gif"
				}
			}
		}
	}
} 
function VFmarche_arret(chaine,id_img)
{
	if(VFtabblocs[chaine]["active"]){
		VFstopSwitch(chaine);
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/pause_on.gif"
		stopAll = true
	} else {
		VFstartSwitch(chaine);
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/play_on.gif"
		stopAll = false
	}
	
}

function VFarret(chaine,id_img)
{
	VFstopSwitch(chaine);
	document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/pause_on.gif"
}
function VFmarche(chaine,id_img)
{
	if(typeof stopAll == "undefined" || !stopAll) {
		VFstartSwitch(chaine);
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/play_on.gif"
	}
}

function VFmarche_arret_over(chaine,id_img)
{
	if(VFtabblocs[chaine]["active"]){
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/play_off.gif"
	} else {
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/pause_off.gif"
	}
}
function VFmarche_arret_out(chaine,id_img)
{
	if(VFtabblocs[chaine]["active"]){
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/play_on.gif"
	} else {
		document.getElementById(id_img).src="http://ctu-24.fr/includes/flashnews/inc_fichiers/pause_on.gif"
	}
}
function VFstartSwitch(chaine){
	for(var i=0;i<VFtabblocs[chaine]["elements"].length;i++){
		j = VFtabblocs[chaine]["elements"][i];
		node = document.getElementById('VFplayer'+j+'Onglet');
		barre = document.getElementById('barre'+j+'Onglet');
		if(node){
			node.src="http://ctu-24.fr/includes/flashnews/inc_fichiers/play_on.gif"
		}
		if(barre){
			barre.src="http://ctu-24.fr/includes/flashnews/inc_fichiers/barre_on.gif"
		}
	}
	VFtabblocs[chaine]["active"] = true;
}

function VFstopSwitch(chaine){
	if(typeof VFtabblocs == "undefined") return;
	var j,node;
	for(var i=0;i<VFtabblocs[chaine]["elements"].length;i++){
		j = VFtabblocs[chaine]["elements"][i];
		/*node = document.getElementById(chaine+j+'Titre');*/		
		node = document.getElementById('VFplayer'+j+'Onglet');
		barre = document.getElementById('barre'+j+'Onglet');
		if(node){
			node.src="http://ctu-24.fr/includes/flashnews/inc_fichiers/pause_on.gif"
		}
		if(barre){
			barre.src="http://ctu-24.fr/includes/flashnews/inc_fichiers/barre_off.gif"
		}
	}

	VFtabblocs[chaine]["active"] = false;
}


function VFresizeImg( elt, maxWidth)
{
	var imgs = elt.getElementsByTagName( 'img' );
	var img;
	for(var i=0; i!=imgs.length; i++ )
	{
		img = imgs[i];
		if ( img.width > maxWidth )
			img.setAttribute( 'width', maxWidth );
	}
}
