var full_screen_actif=0;
var hauteur_bas=89;//legende + liste miniature
window.onload=function()
{
	var tab_galerie_slide=getElementsByClassName('galerie_slide');
	for(var cpt=0;cpt<tab_galerie_slide.length;cpt++)
	{
		tab_galerie_slide[cpt].id='galerie_slide_'+cpt;
		galerie_slide_init('galerie_slide_'+cpt);
	}
}
function resize_img(element,hauteur)
{
	height_av_resize=get_height(element);
	element.style.height=hauteur+'px';
	height_ap_resize=get_height(element);
	if(navigator.appName=='Microsoft Internet Explorer')
	{
		if(get_width(element)>0)
			element.style.width=((get_width(element))*(height_ap_resize))/(height_av_resize)+"px";
	}
}
function touche_body(e)
{
	if(typeof window.touche!='function')
		return;
	return touche(e);
}
function touche(e)
{
	if(window.event)
		e=window.event;
	var ma_touche=window.event?e.keyCode:e.which;
	if(ma_touche==16||ma_touche==17||ma_touche==18)//CTRL ALT SHIFT
		return true;
	
	var target=e.target?e.target:e.srcElement;//récupère l'élément qui a le focus
	
	if(e.ctrlKey&&e.shiftKey&&typeof window.touche_ctrl_shift=='function')
		return touche_ctrl_shift(touche_traduit(ma_touche),target);
	if(e.ctrlKey&&typeof window.touche_ctrl=='function')
		return touche_ctrl(touche_traduit(ma_touche),target);
	if(e.altKey&&typeof window.touche_alt=='function')
		return touche_alt(touche_traduit(ma_touche),target);
	if(e.shiftKey&&typeof window.touche_shift=='function')
		return touche_shift(touche_traduit(ma_touche),target);
	if(typeof window.touche_seule=='function')
		return touche_seule(touche_traduit(ma_touche),target);
	return true;
}
function touche_traduit(ma_touche)
{
	if(ma_touche==38)
		return 'HAUT';
	else if(ma_touche==40)
		return 'BAS';
	else if(ma_touche==37)
		return 'GAUCHE';
	else if(ma_touche==39)
		return 'DROITE';
	else if(ma_touche==33)
		return 'PAGEUP';
	else if(ma_touche==34)
		return 'PAGEDOWN';
	else if(ma_touche==13)
		return 'ENTREE';
	else if(ma_touche==27)
		return 'ECHAP';
	else if(ma_touche==46)
		return 'SUPPR';
	else if(ma_touche==112)
		return 'F1';
	else if(ma_touche==113)
		return 'F2';
	else if(ma_touche==114)
		return 'F3';
	else if(ma_touche==115)
		return 'F4';
	else if(ma_touche==116)
		return 'F5';
	else if(ma_touche==117)
		return 'F6';
	else if(ma_touche==118)
		return 'F7';
	else if(ma_touche==119)
		return 'F8';
	else if(ma_touche==120)
		return 'F9';
	else if(ma_touche==121)
		return 'F10';
	else if(ma_touche==122)
		return 'F11';
	else if(ma_touche==123)
		return 'F12';
	return String.fromCharCode(ma_touche);
}
function getElementsByClassName(className)
{
	return getSousElementsByClassName(document,className);
}
function getSousElementsByClassName(elt,className,tag)
{
	if(typeof(tag)=='undefined')
		var elts=elt.getElementsByTagName('*');
	else
		var elts=elt.getElementsByTagName(tag);
	var classArray=new Array();
	for(var j=0;j<elts.length;++j)
	{
		if(fcthasClass(elts[j],className))
			classArray.push(elts[j]);
	}
	return classArray;
}
function fcthasClass(element,className)
{
  return ( 
    element.className && 
    element.className.match( new RegExp( "\\b"+className+"\\b" ) ) 
  ) ? true : false;
}
function ID(id)
{
	return document.getElementById(id);
}
function addClass(element,ma_classe)
{
	delClass(element,ma_classe);
	if(element.className)
		element.className+=' '+ma_classe;
	else
		element.className=ma_classe;
}
function delClass(element,ma_classe)
{
	if(element.className.indexOf(' ')>0)
		element.className=element.className.replace(' '+ma_classe,'');
	else
		element.className=element.className.replace(ma_classe,'');
}
function get_left(element,limite)
{
	if(typeof(limite)!='undefined'){
		if(ID(limite)){
			if(element.parentNode&&element.parentNode.id!=limite){
				return get_left(element.parentNode,limite)+element.offsetLeft;
			}else{
				return element.offsetLeft;
				//return 0;
			}
		}
	}
	else{
		if(element.offsetParent&&element.offsetParent.nodeName!='BODY'){
			return get_left(element.offsetParent)+element.offsetLeft;
		}
		else{
			return element.offsetLeft;
		}
	}
}
function get_right(element)
{
	if(element.offsetParent&&element.offsetParent.nodeName!='BODY')
		return get_right(element.offsetParent)+element.offsetRight;
	else
		return element.offsetRight;
}
function hauteur_ecran_disponible()
{
	if(navigator.appName=='Microsoft Internet Explorer')
		return document.documentElement.clientHeight;
	else
		return window.innerHeight;
}
function get_height(element)
{
	return element.clientHeight;
}
function get_width(element)
{
	return element.clientWidth;
}
function largeur_ecran_disponible()
{
	if(navigator.appName=='Microsoft Internet Explorer')
		return document.documentElement.clientWidth;
	else
		return window.innerWidth;
}
var timeout_effet_block=new Array();
function effet_block(id,propriete,point_en_cours,point_arrivee,callback)
{
	if(eval('(document.getElementById(id).style.'+propriete+'!="")'))
	{
		eval('(point_en_cours=document.getElementById(id).style.'+propriete+')')
		point_en_cours=point_en_cours.replace('px','');
	}
	point_en_cours=point_en_cours*1;
	var temps=50;
	var pas=60;
	if(point_en_cours!=point_arrivee)
	{
		var distance_restante=point_arrivee-point_en_cours;
		var distance_deplace=distance_restante/Math.abs(distance_restante)*Math.min(Math.abs(pas),Math.abs(distance_restante));
		
		eval('(document.getElementById(id).style.'+propriete+'=point_en_cours+distance_deplace+"px")');
		point_en_cours=(point_en_cours*1)+(distance_deplace*1);
		clearTimeout(timeout_effet_block[id]);
		timeout_effet_block[id]=setTimeout("effet_block('"+id+"','"+propriete+"',"+point_en_cours+",'"+point_arrivee+"','"+callback+"')",temps);
	}
	else
	{
		if(typeof(callback)!='undefined')
		{
			eval(callback);
		}
		clearTimeout(timeout_effet_block[id]);
	}
}
function touche_seule(ma_touche,target)
{
	if(ma_touche=='GAUCHE')
	{
		if(ID('liste_galerie_slide_0'))
		{
			tab_li=ID('liste_galerie_slide_0').getElementsByTagName('LI');
			if(tab_li.length)
			{
				for(cpt_li=0;cpt_li<tab_li.length;cpt_li++)
				{
					tab_a=tab_li[cpt_li].getElementsByTagName('A');
					if(fcthasClass(tab_a[0],'sel'))
					{
						if(cpt_li>0)
						{
							delClass(tab_a[0],'sel');
							tab_a_prec=tab_li[cpt_li-1].getElementsByTagName('A');
							addClass(tab_a_prec[0],'sel');
							galerie_slide_sel('galerie_slide_0');
							break;
						}
					}
				}
			}
		}
		else
			return true;
	}
	else if(ma_touche=='DROITE')
	{
		prochain_tour_sel=0;
		if(ID('liste_galerie_slide_0'))
		{
			tab_li=ID('liste_galerie_slide_0').getElementsByTagName('LI');
			if(tab_li.length)
			{
				for(cpt_li=0;cpt_li<tab_li.length;cpt_li++)
				{
					tab_a=tab_li[cpt_li].getElementsByTagName('A');
					if(prochain_tour_sel==1)
					{
						addClass(tab_a[0],'sel');
						galerie_slide_sel('galerie_slide_0');
						break;
					}
					if(fcthasClass(tab_a[0],'sel'))
					{
						if(cpt_li<tab_li.length-1)
						{
							delClass(tab_a[0],'sel');
							prochain_tour_sel=1;
						}
					}
				}
			}
		}
		else
			return true;
	}
	else
		return true;
	return false;
}
function charge_chemin_vignette(id,cpt_deb,cpt_fin)
{
	tab_li=ID('liste_'+id).getElementsByTagName('LI');
	if(tab_li.length)
	{
		for(cpt_li=cpt_deb-1;cpt_li<=Math.min(tab_li.length,cpt_fin)-1;cpt_li++)
		{
			tab_chemin_vignette=getSousElementsByClassName(tab_li[cpt_li],'chemin_vignette','DIV');
			if(tab_chemin_vignette.length)
			{
				tab_li[cpt_li].getElementsByTagName('IMG')[0].src=tab_chemin_vignette[0].innerHTML;
				tab_chemin_vignette[0].parentNode.removeChild(tab_chemin_vignette[0]);
			}
		}
	}
}
var galerie_slide_premiere_img_visible=0;
function galerie_slide_init(id)
{
	var largeur_img=81;
	var largeur_ul_aff=553;

	tab_a=getSousElementsByClassName(ID(id),'sel','A');
	if(tab_a.length==0)
		return;

	galerie_slide_premiere_img_visible=1;
	
	var newDIV_vague=document.createElement('DIV');
	newDIV_vague.id='img_'+id;
	addClass(newDIV_vague,'vague');
	//newDIV_vague.setAttribute('class','vague');
	
	//newDIV_vague.setAttribute('style','background:url('+tab_a[0].href+') top left no-repeat;');
	
	var newIMG_fond=document.createElement('IMG');
	newIMG_fond.src=tab_a[0].href;
	newIMG_fond.id='img_aff_'+id;

	newDIV_vague.appendChild(newIMG_fond);
	ID(id).appendChild(newDIV_vague);
	
	newIMG_fond.style.visibility='hidden';
	if(get_width(newIMG_fond)>30)//sous IE si img pas chargée, il donne 28x30, ce qui correspond à la taille de la petite image avec la croix rouge
	{
		if(get_width(newIMG_fond)<get_width(ID(id)))
			newIMG_fond.style.marginLeft=(get_width(ID(id))-get_width(newIMG_fond))/2+"px";
		if(get_height(newIMG_fond)<(get_height(ID(id))-hauteur_bas))
			newIMG_fond.style.marginTop=((get_height(ID(id))-hauteur_bas)-get_height(newIMG_fond))+"px";
		newIMG_fond.style.visibility='visible';
	}
	else
	{
		newIMG_fond.onload=function()
		{
			if(get_width(newIMG_fond)<get_width(ID(id)))
				newIMG_fond.style.marginLeft=(get_width(ID(id))-get_width(newIMG_fond))/2+"px";
			if(get_height(newIMG_fond)<(get_height(ID(id))-hauteur_bas))
				newIMG_fond.style.marginTop=((get_height(ID(id))-hauteur_bas)-get_height(newIMG_fond))+"px";
			newIMG_fond.style.visibility='visible';
		}
	}

	tab_ul=ID(id).getElementsByTagName('UL');
	tab_ul[0].id='liste_'+id;
	left_init=get_left(tab_ul[0],id);
	
	tab_li=ID('liste_'+id).getElementsByTagName('LI');
	if(tab_li.length)
	{
		for(cpt_li=0;cpt_li<tab_li.length;cpt_li++)
		{
			if(fcthasClass(tab_li[cpt_li],'lecteur'))
			{
				newIMG_lecteur=document.createElement('IMG');
				newIMG_lecteur.src='../../images/lecteur.png';
				newIMG_lecteur.style.cursor='pointer';
				addClass(newIMG_lecteur,'img_lecteur');
				tab_li[cpt_li].appendChild(newIMG_lecteur);
				newIMG_lecteur.onclick=function()
				{
					tab=ID(id).getElementsByTagName('A');
					for(cpt=0;cpt<tab.length;cpt++)
						delClass(tab[cpt],'sel');
					
					tab_a=this.parentNode.getElementsByTagName('A');
					addClass(tab_a[0],'sel');
					galerie_slide_sel(id);
					this.blur();
					return false;
				}
			}
		}
	}
	
	var newIMG_prec=document.createElement('IMG');
	newIMG_prec.src='../../images/fleche_prec.png';
	addClass(newIMG_prec,'fleche_prec');
	//newIMG_prec.setAttribute('class','fleche_prec');
	newIMG_prec.onclick=function()
	{
		if(get_left(ID('liste_'+id),id)>=left_init)
			return false;
		else
		{
			galerie_slide_premiere_img_visible-=6;
			effet_block('liste_'+id,'left',get_left(ID('liste_'+id),id),get_left(ID('liste_'+id),id)+(largeur_img*6));
		}
	}
	ID(id).appendChild(newIMG_prec);
	
	var newIMG_suiv=document.createElement('IMG');
	newIMG_suiv.src='../../images/fleche_suiv.png';
	addClass(newIMG_suiv,'fleche_suiv');
	//newIMG_suiv.setAttribute('class','fleche_suiv');
	newIMG_suiv.onclick=function()
	{
		tab_img=ID('liste_'+id).getElementsByTagName('IMG');
		largeur_ul=tab_img.length*largeur_img;
		if(get_left(ID('liste_'+id),id)<=largeur_ul_aff-largeur_ul)
			return false;
		else
		{
			galerie_slide_premiere_img_visible+=6;
			charge_chemin_vignette(id,galerie_slide_premiere_img_visible,galerie_slide_premiere_img_visible+6);
			effet_block('liste_'+id,'left',get_left(ID('liste_'+id),id),get_left(ID('liste_'+id),id)-(largeur_img*6));//,'charge_chemin_vignette("'+id+'",'+(galerie_slide_premiere_img_visible+6)+','+(galerie_slide_premiere_img_visible+12)+');'
		}
	}
	ID(id).appendChild(newIMG_suiv);
	
	var newDIV=document.createElement('DIV');
	tab_img=tab_a[0].getElementsByTagName('IMG');
	newDIV.id="legende_"+id;
	texte_legende=tab_img[0].alt;
	tab_legende=texte_legende.split('|');
	if(tab_legende.length)
	{
		for(cpt_legende=0;cpt_legende<tab_legende.length;cpt_legende++)
		{
			newSpan=document.createElement('SPAN');
			newSpan.innerHTML=tab_legende[cpt_legende];
			if(cpt_legende==tab_legende.length-1)
				addClass(newSpan,'detail_legende_fin');
			else if(cpt_legende==tab_legende.length-2)
				addClass(newSpan,'detail_legende_mid');
			else
				addClass(newSpan,'detail_legende');
			newDIV.appendChild(newSpan);
		}
	}
	addClass(newDIV,'legende');
	//newDIV.setAttribute('class','legende');
	
	//full_screen
	li_sel=tab_a[0].parentNode;
//tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','IMG')
	tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','DIV')
	if(tab_img_fs.length)
	{
		var newIMG_full_screen=document.createElement('IMG');
		addClass(newIMG_full_screen,'full_screen');
		newIMG_full_screen.src='../../images/full_screen.gif';
		newIMG_full_screen.id="fs_"+id;
//newIMG_full_screen.img_src=tab_img_fs[0].src;
		newIMG_full_screen.img_src=tab_img_fs[0].innerHTML;
		newIMG_full_screen.onclick=function()
		{
			full_screen(id);
		}
		newDIV.appendChild(newIMG_full_screen);
	}
	ID(id).appendChild(newDIV);
	
	tab_a_all=ID(id).getElementsByTagName('A');
	for(cpt_a=0;cpt_a<tab_a_all.length;cpt_a++)
	{
		tab_a_all[cpt_a].onclick=function()
		{
			tab=ID(id).getElementsByTagName('A');
			for(cpt=0;cpt<tab.length;cpt++)
				delClass(tab[cpt],'sel');

			addClass(this,'sel');
			galerie_slide_sel(id);
			this.blur();
			return false;
		}
	}
	tab_li=ID('liste_'+id).getElementsByTagName('LI');
	if(tab_li.length)
	{
		for(cpt_li=0;cpt_li<tab_li.length;cpt_li++)
		{
			if(fcthasClass(tab_li[cpt_li],'lecteur'))
			{
				tab_a_sel=tab_li[cpt_li].getElementsByTagName('A');
				if(fcthasClass(tab_a_sel[0],'sel'))
				{
					tab_src_lecteur=getSousElementsByClassName(tab_li[cpt_li],'source_video_mov','DIV');
					if(tab_src_lecteur.length>0)
					{
						tab_emplacement_lecteur=getSousElementsByClassName(tab_li[cpt_li],'player_video_emplacement','DIV');
						if(tab_emplacement_lecteur.length>0)
							lance_lecteur(tab_src_lecteur[0],tab_emplacement_lecteur[0],'mov');
					}
					
					tab_src_lecteur=getSousElementsByClassName(tab_li[cpt_li],'source_video_wmv','DIV');
					if(tab_src_lecteur.length>0)
					{
						tab_emplacement_lecteur=getSousElementsByClassName(tab_li[cpt_li],'player_video_emplacement','DIV');
						if(tab_emplacement_lecteur.length>0)
							lance_lecteur(tab_src_lecteur[0],tab_emplacement_lecteur[0],'wmv');
					}
					
					tab_src_lecteur=getSousElementsByClassName(tab_li[cpt_li],'source_video_flv','DIV');
					if(tab_src_lecteur.length>0)
					{
						tab_id_lecteur=getSousElementsByClassName(tab_li[cpt_li],'id_video_flv','DIV');
						if(tab_id_lecteur.length>0)
							lance_lecteur_flv(tab_src_lecteur[0],tab_id_lecteur[0]);
					}
					tab_obj=tab_li[cpt_li].getElementsByTagName('OBJECT');
					newIMG_lecteur=document.createElement('IMG');
					newIMG_lecteur.src='../../images/v2home_edito_phodeo_video_fr.png';
					newIMG_lecteur.id='lien_lecteur_'+id;
					addClass(newIMG_lecteur,'lecteur_gd');
					ID('img_'+id).appendChild(newIMG_lecteur);
					ID('img_'+id).object=tab_obj[0];
					tab_flv=getSousElementsByClassName(tab_li[cpt_li],'flashcontent','DIV')
					if(tab_flv.length)
						ID('img_'+id).flv=tab_flv[0];
					
					ID('img_'+id).onclick=function()
					{
						tab_obj=this.getElementsByTagName('EMBED');
						if(tab_obj.length>0)
							return false;					
						if(typeof(this.object)!='undefined')
						{
							newOBJECT=this.object.cloneNode(true);
							newOBJECT.style.display='block';
							newOBJECT.style.position='absolute';
							newOBJECT.style.top='0';
							newOBJECT.style.left='0';
							newOBJECT.style.backgroundColor='#fff';
							tab_param=newOBJECT.getElementsByTagName('PARAM');
							if(tab_param.length)
							{
								for(cpt_param=0;cpt_param<tab_param.length;cpt_param++)
								{
									if(tab_param[cpt_param].name=='autoplay')
										tab_param[cpt_param].value=true;
								}
							}
							ID('img_'+id).appendChild(newOBJECT);
						}
						else
						{
							newFLV=this.flv.cloneNode(true);
							newFLV.style.display='block';
							newFLV.style.position='absolute';
							newFLV.style.top='0';
							newFLV.style.left='0';
							newFLV.style.zIndex='10';
							newFLV.style.backgroundColor='#fff';
							ID('img_'+id).appendChild(newFLV);
						}
						return false;
					}
				}
			}
		}
	}
}
function lance_lecteur(element_src,element_emplacement,type)
{
	src_video=element_src.innerHTML;
	if(type=='mov')
		element_emplacement.innerHTML='<object type="video/quicktime" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" style="width:633px;height:435px;display:none;"><param name="src" value="/'+src_video+'"/><param name="controller" value="true"/><param name="autoplay" value="false"/><embed pluginspage="http://www.apple.com/quicktime/download/" src="/'+src_video+'"/ width="633" height="435" autoplay="false" controller="true"></embed></object>';
	else if(type=='wmv')
		element_emplacement.innerHTML='<object type="application/x-mplayer2" codetype="anything" data="/'+src_video+'" style="width:633px;height:435px;display:none;"><param name="FileName" value="/'+src_video+'"/><param name="ShowControls" value="1"/><param name="AutoStart" value="0"/><param name="DisplaySize" value="4"/><embed src="/'+src_video+'"/ width="633" height="435" ShowControls="1" AutoStart="0" DisplaySize="4"></embed></object>';
}
function lance_lecteur_flv(element_src,element_id)
{
	src_video=element_src.innerHTML;
	id_video=element_id.innerHTML
	var so = new SWFObject(src_video, "video", "633", "435", "6", "#FFFFFF");
	so.addVariable("playerMode", "embedded");
	so.addVariable("autoPlay", "true");
	so.addVariable("hl", "en");
	so.write("flashcontent_"+id_video);
}
function galerie_slide_sel(id)
{
	tab_objet=ID(id).getElementsByTagName('OBJECT');
	if(tab_objet.length)
	{
		for(cpt_objet=0;cpt_objet<tab_objet.length;cpt_objet++)
			tab_objet[cpt_objet].style.display='none';			
	}
	tab_objet_play=ID('img_'+id).getElementsByTagName('OBJECT');
	if(tab_objet_play.length)
	{
		for(cpt_objet=0;cpt_objet<tab_objet_play.length;cpt_objet++)
			ID('img_'+id).removeChild(tab_objet_play[cpt_objet]);
	}
	tab_flv=getSousElementsByClassName(ID(id),'flashcontent','DIV')
	if(tab_flv.length)
	{
		for(cpt_flv=0;cpt_flv<tab_flv.length;cpt_flv++)
			tab_flv[cpt_flv].style.display='none';
	}
	tab_flv_play=getSousElementsByClassName(ID('img_'+id),'flashcontent','DIV')
	if(tab_flv_play.length)
	{
		for(cpt_flv=0;cpt_flv<tab_flv_play.length;cpt_flv++)
			ID('img_'+id).removeChild(tab_flv_play[cpt_flv]);
	}
	
	if(ID('lien_lecteur_'+id))
		ID('img_'+id).removeChild(ID('lien_lecteur_'+id));
	ID('img_'+id).onclick=function(){return false;}
	tab_li=ID('liste_'+id).getElementsByTagName('LI');
	if(tab_li.length)
	{
		for(cpt_li=0;cpt_li<tab_li.length;cpt_li++)
		{
			if(fcthasClass(tab_li[cpt_li],'lecteur'))
			{
				tab_emplacement_lecteur=getSousElementsByClassName(tab_li[cpt_li],'player_video_emplacement','DIV');
				if(tab_emplacement_lecteur.length>0)
					tab_emplacement_lecteur[0].innerHTML='';
				
				tab_emplacement_lecteur=getSousElementsByClassName(tab_li[cpt_li],'player_video_emplacement','DIV');
				if(tab_emplacement_lecteur.length>0)
					tab_emplacement_lecteur[0].innerHTML='';
				
				tab_id_lecteur=getSousElementsByClassName(tab_li[cpt_li],'id_video_flv','DIV');
				if(tab_id_lecteur.length>0)
					ID('flashcontent_'+tab_id_lecteur[0].innerHTML).innerHTML='';
				
				tab_a_sel=tab_li[cpt_li].getElementsByTagName('A');
				if(fcthasClass(tab_a_sel[0],'sel'))
				{
					tab_src_lecteur=getSousElementsByClassName(tab_li[cpt_li],'source_video_mov','DIV');
					if(tab_src_lecteur.length>0)
					{
						tab_emplacement_lecteur=getSousElementsByClassName(tab_li[cpt_li],'player_video_emplacement','DIV');
						if(tab_emplacement_lecteur.length>0)
							lance_lecteur(tab_src_lecteur[0],tab_emplacement_lecteur[0],'mov');
					}
					
					tab_src_lecteur=getSousElementsByClassName(tab_li[cpt_li],'source_video_wmv','DIV');
					if(tab_src_lecteur.length>0)
					{
						tab_emplacement_lecteur=getSousElementsByClassName(tab_li[cpt_li],'player_video_emplacement','DIV');
						if(tab_emplacement_lecteur.length>0)
							lance_lecteur(tab_src_lecteur[0],tab_emplacement_lecteur[0],'wmv');
					}
					
					tab_src_lecteur=getSousElementsByClassName(tab_li[cpt_li],'source_video_flv','DIV');
					if(tab_src_lecteur.length>0)
					{
						tab_id_lecteur=getSousElementsByClassName(tab_li[cpt_li],'id_video_flv','DIV');
						if(tab_id_lecteur.length>0)
							lance_lecteur_flv(tab_src_lecteur[0],tab_id_lecteur[0]);
					}
					
					tab_obj=tab_li[cpt_li].getElementsByTagName('OBJECT');
					newIMG_lecteur=document.createElement('IMG');
					newIMG_lecteur.src='../../images/v2home_edito_phodeo_video_fr.png';
					newIMG_lecteur.id='lien_lecteur_'+id;
					addClass(newIMG_lecteur,'lecteur_gd');
					if(full_screen_actif==1)
					{
						newIMG_lecteur.style.top=((hauteur_ecran_disponible()-hauteur_bas)/2)-43+"px";
						newIMG_lecteur.style.left=(largeur_ecran_disponible()/2)-43+'px';
					}
					ID('img_'+id).appendChild(newIMG_lecteur);

					ID('img_'+id).object=tab_obj[0];
					
					tab_flv=getSousElementsByClassName(tab_li[cpt_li],'flashcontent','DIV')
					if(tab_flv.length)
						ID('img_'+id).flv=tab_flv[0];
					
					
					ID('img_'+id).onclick=function()
					{
						tab_obj=this.getElementsByTagName('EMBED');
						if(tab_obj.length>0)
							return false;
						if(typeof(this.object)!='undefined')
						{
							newOBJECT=this.object.cloneNode(true);
							newOBJECT.style.display='block';
							newOBJECT.style.position='absolute';
							newOBJECT.style.top='0';
							newOBJECT.style.left='0';
							newOBJECT.style.zIndex='10';
							newOBJECT.style.backgroundColor='#fff';
							
							tab_param=newOBJECT.getElementsByTagName('PARAM');
							if(tab_param.length)
							{
								for(cpt_param=0;cpt_param<tab_param.length;cpt_param++)
								{
									if(tab_param[cpt_param].name=='autoplay')
										tab_param[cpt_param].value=true;
								}
							}
							
							if(full_screen_actif==1)
							{
								newOBJECT.style.height=hauteur_ecran_disponible()-hauteur_bas+'px';
								newOBJECT.style.width=largeur_ecran_disponible()+'px';
							}
							
							ID('img_'+id).appendChild(newOBJECT);
						}
						else
						{
							newFLV=this.flv.cloneNode(true);
							newFLV.style.display='block';
							newFLV.style.position='absolute';
							newFLV.style.top='0';
							newFLV.style.left='0';
							newFLV.style.zIndex='10';
							newFLV.style.backgroundColor='#fff';
							
							if(full_screen_actif==1)
							{
								newFLV.style.height=hauteur_ecran_disponible()-hauteur_bas+'px';
								newFLV.style.width=largeur_ecran_disponible()+'px';
							}
							
							ID('img_'+id).appendChild(newFLV);
						}
						return false;
					}
				}
			}
		}
	}
	
	tab_a=getSousElementsByClassName(ID(id),'sel','A');
	if(full_screen_actif==1)
	{
		li_sel=tab_a[0].parentNode;
//tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','IMG');
		tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','DIV');
		if(tab_img_fs.length)
			src_img=tab_img_fs[0].innerHTML;
		else
			src_img=tab_a[0].href;
	}
	else
		src_img=tab_a[0].href;
	
	tab_img=tab_a[0].getElementsByTagName('IMG');
	ID("legende_"+id).innerHTML='';
	texte_legende=tab_img[0].alt;
	tab_legende=texte_legende.split('|');
	if(tab_legende.length)
	{
		for(cpt_legende=0;cpt_legende<tab_legende.length;cpt_legende++)
		{
			newSpan=document.createElement('SPAN');
			newSpan.innerHTML=tab_legende[cpt_legende];
			if(cpt_legende==tab_legende.length-1)
				addClass(newSpan,'detail_legende_fin');
			else if(cpt_legende==tab_legende.length-2)
				addClass(newSpan,'detail_legende_mid');
			else
				addClass(newSpan,'detail_legende');
			ID("legende_"+id).appendChild(newSpan);
		}
	}
	//full_screen
	li_sel=tab_a[0].parentNode;
//tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','IMG')
	tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','DIV')
	if(tab_img_fs.length)
	{
		var newIMG_full_screen=document.createElement('IMG');
		addClass(newIMG_full_screen,'full_screen');
		newIMG_full_screen.src='../../images/full_screen.gif';
		newIMG_full_screen.id="fs_"+id;
//newIMG_full_screen.img_src=tab_img_fs[0].src;
		newIMG_full_screen.img_src=tab_img_fs[0].innerHTML;
		newIMG_full_screen.onclick=function()
		{
			full_screen(id);
		}
		ID("legende_"+id).appendChild(newIMG_full_screen);
	}
	if(full_screen_actif==1)
	{
		if(ID("fs_"+id))
		{
			ID("fs_"+id).onclick=function()
			{
				reduct_screen(id);
			}
		}
		else
		{
			var newIMG_full_screen=document.createElement('IMG');
			addClass(newIMG_full_screen,'full_screen');
			newIMG_full_screen.src='../../images/full_screen.gif';
			newIMG_full_screen.id="fs_"+id;
			newIMG_full_screen.onclick=function()
			{
				reduct_screen(id);
			}
			ID("legende_"+id).appendChild(newIMG_full_screen);
		}
	}
	var newIMG_tmp=document.createElement('IMG');
	newIMG_tmp.src=src_img;
	newIMG_tmp.style.visibility='hidden';
	ID(id).appendChild(newIMG_tmp);
	if(full_screen_actif==1)
		resize_img(newIMG_tmp,hauteur_ecran_disponible()-hauteur_bas);
	if(get_width(newIMG_tmp)>50)
		prepare_effet(newIMG_tmp,id,src_img);
	else
	{
		newIMG_tmp.onload=function()
		{prepare_effet(newIMG_tmp,id,src_img);}
	}
}
function prepare_effet(newIMG_tmp,id,src_img)
{
	margin_left=0;
	margin_top=0;
	if(get_width(newIMG_tmp)<get_width(ID(id)))
		margin_left=(get_width(ID(id))-get_width(newIMG_tmp))/2;
	if(get_height(newIMG_tmp)<(get_height(ID(id))-hauteur_bas))
		margin_top=((get_height(ID(id))-hauteur_bas)-get_height(newIMG_tmp));
	ID(id).removeChild(newIMG_tmp);
	depart=10;
	/*
	for(cpt=100;cpt>0;cpt-=100)
	{
		newIMG=document.createElement('IMG');
		newIMG.src=src_img;
		newIMG.style.left=margin_left+cpt-90-depart+"px";
		newIMG.style.top=margin_top+"px";
		if(ID('vague'+cpt))
		{
			newDIV=ID('vague'+cpt);
			newDIV.innerHTML='';
		}
		else
			newDIV=document.createElement('DIV');
		newDIV.id='vague'+cpt;
		newDIV.style.backgroundColor='#fff';
		newDIV.style.display='block';
		
		newDIV.style.opacity=cpt/100;
		if(full_screen_actif==1)
			resize_img(newDIV,hauteur_ecran_disponible()-hauteur_bas);
		else
			resize_img(newDIV,450);

		newDIV.style.left=(depart+90)-cpt+"px";
		newDIV.appendChild(newIMG);
		ID('img_'+id).appendChild(newDIV);
		
		if(full_screen_actif==1)
			resize_img(newIMG,hauteur_ecran_disponible()-hauteur_bas);
	}
	*/
	if(full_screen_actif==1)
		fin_effet(id,src_img,margin_left,margin_top);
	else
	{
		fin_effet(id,src_img,margin_left,margin_top);
		/*
		ID('vague100').style.width=depart+"px";
		if(get_width(newIMG))
			effet_img(depart,src_img,id,margin_left,margin_top);
		else
		{
			newIMG.onload=function()
			{
				effet_img(depart,src_img,id,margin_left,margin_top);
			}
		}
		*/
	}
}
var timeout_effet;
function effet_img(depart,src_img,id,margin_left,margin_top)
{
	depart+=40;
	for(cpt=90;cpt>0;cpt-=10)
	{
		ID('vague'+cpt).style.left=(depart+90)-cpt+"px";
		tab_img=ID('vague'+cpt).getElementsByTagName('IMG');
		tab_img[0].style.left=margin_left+cpt-90-depart+"px";
		tab_img[0].style.top=margin_top+"px";
	}
	ID('vague100').style.width=depart+"px";
	if(full_screen_actif==1)
		largeur_max=largeur_ecran_disponible();
	else
		largeur_max=633;
	if(depart<largeur_max)
		timeout_effet=setTimeout("effet_img("+depart+",'"+src_img+"','"+id+"',"+margin_left+","+margin_top+")",10);
	else
	{
		fin_effet(id,src_img,margin_left,margin_top);
		clearTimeout(timeout_effet);
	}
		
}
function fin_effet(id,src_img,margin_left,margin_top)
{
	if(ID('img_aff_old'+id))
		ID('img_'+id).removeChild(ID('img_aff_old'+id));
	ID('img_aff_'+id).id='img_aff_old'+id;
	var newIMG_fond=document.createElement('IMG');
	newIMG_fond.src=src_img;
	newIMG_fond.id='img_aff_'+id;
	
	newIMG_fond.style.position='absolute';
	newIMG_fond.style.left=margin_left+"px";
	newIMG_fond.style.top=margin_top+"px";

	ID('img_'+id).appendChild(newIMG_fond);
	
	if(full_screen_actif==0)
		effet_fondu(id,0.1);
	else
	{
		if(ID('img_aff_old'+id))
			ID('img_'+id).removeChild(ID('img_aff_old'+id));
	}
	if(full_screen_actif==1)
	{
		resize_img(newIMG_fond,hauteur_ecran_disponible()-hauteur_bas);
	}
	/*
	for(cpt=100;cpt>0;cpt-=100)
		ID('vague'+cpt).style.display='none';
	*/
}
var timeout_effet_fondu;
function effet_fondu(id,opacity)
{
	ID('img_aff_'+id).style.opacity=opacity;
	ID('img_aff_old'+id).style.opacity=1-opacity;
	ID('img_aff_'+id).style.filter="alpha(opacity="+opacity*100+")";
	ID('img_aff_old'+id).style.filter="alpha(opacity="+100-(opacity*100)+")";
	opacity+=0.05;
	time=(Math.abs(opacity-0.5)*50)+5;
	if(opacity<1)
		timeout_effet_fondu=setTimeout("effet_fondu('"+id+"',"+opacity+")",time);
	else
	{
		clearTimeout(timeout_effet_fondu);
		if(ID('img_aff_old'+id))
			ID('img_'+id).removeChild(ID('img_aff_old'+id));
	}	
}
function full_screen(id)
{
	full_screen_actif=1;
	addClass(ID(id),'galerie_full_screen');
	tab_a=getSousElementsByClassName(ID(id),'sel','A');
	li_sel=tab_a[0].parentNode;
//tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','IMG');
	tab_img_fs=getSousElementsByClassName(li_sel,'img_full_screen','DIV');
	if(tab_img_fs.length)
		src_img=tab_img_fs[0].innerHTML;
	else
		src_img=tab_a[0].href;

	
	if(ID('img_aff_'+id))
		ID('img_'+id).removeChild(ID('img_aff_'+id));
	//ID('img_'+id).style.height=hauteur_ecran_disponible()-hauteur_bas+'px';
	resize_img(ID('img_'+id),hauteur_ecran_disponible()-hauteur_bas);
	//ID('img_'+id).style.width='100%';
	
	
	if(ID('vague100'))
	{
		img_100=ID('vague100').getElementsByTagName('IMG');
		img_100[0].src=src_img;
		//img_100[0].style.height=hauteur_ecran_disponible()-hauteur_bas+'px';
		resize_img(img_100[0],hauteur_ecran_disponible()-hauteur_bas);
		//ID('vague100').style.height=hauteur_ecran_disponible()-hauteur_bas+'px';
		resize_img(ID('vague100'),hauteur_ecran_disponible()-hauteur_bas);
		//ID('vague100').style.width='100%';
	}
	var newIMG_fond=document.createElement('IMG');
	newIMG_fond.src=src_img;
	newIMG_fond.id='img_aff_'+id;
	newIMG_fond.style.visibility='hidden';
	ID('img_'+id).appendChild(newIMG_fond);
	if(get_width(newIMG_fond)>0)
	{
		resize_img(newIMG_fond,hauteur_ecran_disponible()-hauteur_bas);
		newIMG_fond.style.visibility='visible';
		if(get_width(newIMG_fond)<largeur_ecran_disponible())
			newIMG_fond.style.marginLeft=(largeur_ecran_disponible()-get_width(newIMG_fond))/2+"px";
	}
	else
	{
		newIMG_fond.onload=function()
		{
			resize_img(newIMG_fond,hauteur_ecran_disponible()-hauteur_bas);
			newIMG_fond.style.visibility='visible';
			if(get_width(newIMG_fond)<largeur_ecran_disponible())
				newIMG_fond.style.marginLeft=(largeur_ecran_disponible()-get_width(newIMG_fond))/2+"px";
		}
	}
	ID("fs_"+id).onclick=function()
	{
		reduct_screen(id);
	}
}
function reduct_screen(id)
{
	full_screen_actif=0;
	delClass(ID(id),'galerie_full_screen');
	tab_a=getSousElementsByClassName(ID(id),'sel','A');
	src_img=tab_a[0].href;
	
	if(ID('img_aff_'+id))
		ID('img_'+id).removeChild(ID('img_aff_'+id));
	
	ID('img_'+id).style.height='450px';
	ID('img_'+id).style.width='633px';
	
	if(ID('vague100'))
	{
		img_100=ID('vague100').getElementsByTagName('IMG');
		img_100[0].src=src_img;
		ID('vague100').style.height='450px';
		ID('vague100').style.width='633px';
	}
	var newIMG_fond=document.createElement('IMG');
	newIMG_fond.src=src_img;
	newIMG_fond.id='img_aff_'+id;
	ID('img_'+id).appendChild(newIMG_fond);

	if(get_width(newIMG_fond)<get_width(ID('img_'+id)))
		newIMG_fond.style.marginLeft=(get_width(ID('img_'+id))-get_width(newIMG_fond))/2+"px";
	if(get_height(newIMG_fond)<(get_height(ID(id))-hauteur_bas))
			newIMG_fond.style.marginTop=((get_height(ID(id))-hauteur_bas)-get_height(newIMG_fond))+"px";
	
	ID("fs_"+id).onclick=function()
	{
		full_screen(id);
	}
}


