function navigateur()
{//alert(navigator.appName+"\n"+navigator.appVersion)
	if(navigator.appName.indexOf("Internet Explorer")!=-1 && navigator.appVersion.indexOf("Windows")!=-1)
	{return "Internet Explorer"}
	if(navigator.appName.indexOf("Netscape")!=-1 && navigator.appVersion.indexOf("Windows")!=-1)
	{return "Firefox"}
	if(navigator.appName.indexOf("Netscape")!=-1 && navigator.appVersion.indexOf("Macintosh")!=-1)
	{
		if(navigator.appName.indexOf("Netscape")!=-1 && navigator.appVersion.indexOf("Safari")!=-1)
		{
			return "Safari"
		}
		else
		{
			return "Firefox"
		}
	}
}

function afficher(objet)
{
	e=event
	switch(navigateur())
	{
		case "Safari":
			x=e.clientX+document.body.scrollLeft
			//y=window.innerHeight-e.clientY+document.body.scrollTop-5
			y=e.clientY+document.body.scrollTop-5
		break
		case "Internet Explorer":
			x=e.x+document.body.scrollLeft-5
			y=e.y+document.body.scrollTop-5
		break
		case "Firefox":
			x=e.clientX+document.body.scrollLeft-5
			y=e.clientY+document.body.scrollTop-5
		break
	}

	objet.style.pixelLeft=x
	objet.style.pixelTop=y
	objet.style.left=x+"px"
	objet.style.top=y+"px"

	objet.x_off=x+2
	objet.y_off=y+2
	objet.style.display="block"
}

//***********************************************************************************
//renvoi la position x d'un objet
function posLeft(MyObject)
{
	if(MyObject.offsetParent)
	{
		return(MyObject.offsetLeft+posLeft(MyObject.offsetParent))
	}
    else
	{
		return(MyObject.offsetLeft)
	}
} 

//***********************************************************************************
//renvoi la position y d'un objet
function posTop(MyObject)
{
	if(MyObject.offsetParent)
	{
		return(MyObject.offsetTop+posTop(MyObject.offsetParent))
	}
	else
	{
		return(MyObject.offsetLeft)
	}
}

//***********************************************************************************
function init_menu_deroulant()
{
	menu=document.getElementsByTagName("div")
	for(cpt=0;cpt<menu.length;cpt++)
	{
		if(menu[cpt].className=="wm_menu_deroulant")
		{
			t_a=new Array()
			t_div=new Array()
			
			for(cpt_node=0;cpt_node<menu[cpt].childNodes.length;cpt_node++)
			{
				obj=menu[cpt].childNodes[cpt_node]
				if(obj.tagName=="A"){t_a.push(obj)}
				if(obj.tagName=="DIV"){t_div.push(obj)}
			}
			for(cpt_a in t_a)
			{
				menu=t_a[cpt_a]
				menu.id="a"+cpt+"_"+cpt_a
				s_menu=t_div[cpt_a]
				s_menu.menu=menu
				menu.s_menu=s_menu
				menu.onmouseover=function()
				{
					if(this.time_out){clearTimeout(this.time_out);this.time_out=false}
					posx=posLeft(this)
					posy=posTop(this)
					switch(navigateur())
					{
						case "Safari":
							this.s_menu.style.pixelLeft=posx
							this.s_menu.style.pixelTop=posy
						break
						case "Internet Explorer":
							this.s_menu.style.pixelLeft=posx
							this.s_menu.style.pixelTop=posy//+this.offsetHeight+2
						break
						case "Firefox":
							this.s_menu.style.left=posx+"px"
							this.s_menu.style.top=posy+"px"
						break
					}
					this.s_menu.style.display='block'
				}
				menu.onmouseout=function()
				{
					this.time_out=setTimeout("document.getElementById('"+this.id+"').s_menu.style.display='none'",50)
				}
				s_menu.onmouseover=function()
				{
					if(this.menu.time_out){clearTimeout(this.menu.time_out);this.menu.time_out=false}
					posx=posLeft(this.menu)
					posy=posTop(this.menu)
					switch(navigateur())
					{
						case "Safari":
							this.style.pixelLeft=posx
							this.style.pixelTop=posy
						break
						case "Internet Explorer":
							this.style.pixelLeft=posx
							this.style.pixelTop=posy//+this.menu.offsetHeight+2
						break
						case "Firefox":
							this.style.left=posx+"px"
							this.style.top=posy+"px"
						break
					}
					this.style.display='block'
				}
				s_menu.onmouseout=function()
				{
					this.menu.time_out=setTimeout("document.getElementById('"+this.menu.id+"').s_menu.style.display='none'",50)
				}
			}
		}
	}
}


//***********************************************************************************
function init_rollover()
{//une meilleur solution: utiliser des balise A pour tous les rollovers et utiliser css
	t_img=document.getElementsByTagName("IMG")
	
	for(cpt=0;cpt<t_img.length;cpt++)
	{
		image=t_img[cpt]
		if(image.src.substring(image.src.length-8,image.src.length-4)=="_out")
		{
			image.style.cursor="hand"
			image.onmouseover=function()
			{
				src=this.src
				l=src.length
				this.src=src.substring(0,l-7)+"over"+src.substring(l-4,l)
			}

			image.onmouseout=function()
			{
				src=this.src
				l=src.length
				this.src=src.substring(0,l-8)+"out"+src.substring(l-4,l)
			}
		}
	}

	liste_tag=new Array("TR","TD","P","DIV","SPAN")
	for(cpt_tag in liste_tag)
	{
		t_obj=document.getElementsByTagName(liste_tag[cpt_tag])
		for(cpt=0;cpt<t_obj.length;cpt++)
		{
			obj=t_obj[cpt]
			if(obj.className.substring(obj.className.length-4,obj.className.length)=="_out")
			{
				obj.onmouseover=function()
				{
					n=this.className
					if(n.substring(n.length-4,n.length)=="_out")
					{
						this.className=n.substring(0,n.length-4)+"_over"
					}
				}

				obj.onmouseout=function()
				{
					n=this.className
					if(n.substring(n.length-5,n.length)=="_over")
					{
						this.className=n.substring(0,n.length-5)+"_out"
					}
				}
			}
		}
	}
}

//****************************************************************************
function infos_fenetre()
{
	infos=new Array()
	switch(navigateur())
	{
		case "Internet Explorer":
			infos["largeur"]=document.body.offsetWidth
			infos["hauteur"]=document.body.offsetHeight
			infos["xoffset"]=document.body.scrollLeft
			infos["yoffset"]=document.body.scrollTop
		break
		case "Firefox":
			infos["largeur"]=window.innerWidth
			infos["hauteur"]=window.innerHeight
			infos["xoffset"]=window.pageXOffset
			infos["yoffset"]=window.pageYOffset
		break
		case "Safari":
			infos["largeur"]=window.innerWidth
			infos["hauteur"]=window.innerHeight
			infos["xoffset"]=window.pageXOffset
			infos["yoffset"]=window.pageYOffset
		break
	}
	return infos
}
//****************************************************************************
//creation d'image zoomable par clic
//les images de la page doivent verifier les conditions suivantes:
// alt="zoom:url image2" ou "zoom"=>dans ce cas, la même image est ouverte.

function zoomer(img)
{
//format de alt=> zoom:url:x:y
	clearTimeout(document.id_timeout_ease_zoom)
	if(img.data)
	{
		data=img.data
	}
	else
	{
		data=img.alt.split(":")
	}
	img2=img.zoom
	img2.origine=img
	img2.autre_img=false
	if(data[1]){img.src_zoom=data[1];img2.autre_img=true}
	if(data[2]){img.posx=data[2]}
	if(data[3]){img.posy=data[3]}

	
	switch(navigateur())
	{
		case "Internet Explorer":
			img2.parentNode.style.visibility="hidden"
			img2.parentNode.style.display="inline"
		break
		case "Firefox":
			img2.parentNode.style.visibility="hidden"
			img2.parentNode.style.display="inline"
		break
		case "Safari":
			img2.parentNode.style.visibility="hide"
			img2.parentNode.style.display="inline"
		break
	}
	fenetre=infos_fenetre()
	lscreen=fenetre["largeur"]
	hscreen=fenetre["hauteur"]
	xoffset=fenetre["xoffset"]
	yoffset=fenetre["yoffset"]
	
	img2.onclick=function()
	{
		clearTimeout(document.id_timeout_ease_zoom)
		this.parentNode.style.display="none"
		this.src=""
	}

	img2.onload=function()
	{
		if(!this.autre_img)
		{
			l=this.origine.reel.width
			h=this.origine.reel.height
		}
		else
		{
			tempo_l=this.style.width
			tempo_h=this.style.height
			this.style.width='auto'
			this.style.height='auto'
			l=this.width
			h=this.height
			this.style.width=tempo_l
			this.style.height=tempo_h
		}
		switch(navigateur())
		{
			case "Internet Explorer":
				if(this.origine.posx)
				{
					this.parentNode.style.pixelLeft=this.origine.posx
				}
				else
				{
					this.parentNode.x_end=xoffset+(lscreen-l)/2
				}
				if(this.origine.posy)
				{
					this.parentNode.style.pixelTop=this.origine.posy+100
				}
				else
				{
					this.parentNode.y_end=(yoffset+(hscreen-h)/2)+100
				}
				this.parentNode.style.pixelTop=posTop(this.origine)
				this.parentNode.style.pixelLeft=posLeft(this.origine)
				this.width=this.origine.width
				this.height=this.origine.height
				this.l_end=l
				this.h_end=h
				this.parentNode.style.visibility="visible"
				ease_zoom(5)
//				if(this.origine.posx){this.parentNode.style.pixelLeft=this.origine.posx}
//				else{this.parentNode.style.pixelLeft=xoffset+(lscreen-l)/2}
//				if(this.origine.posy){this.parentNode.style.pixelTop=this.origine.posy+100}
//				else{this.parentNode.style.pixelTop=(yoffset+(hscreen-h)/2)+100}
//				this.parentNode.style.visibility="visible"
			break
			case "Firefox":
				x=xoffset+(lscreen-l)/2
				y=yoffset+(hscreen-h)/2
				if(this.origine.posx){this.parentNode.style.left=this.origine.posx+"px"}
				else{this.parentNode.style.left=x+"px"}
				if(this.origine.posy){this.parentNode.style.top=this.origine.posy+"px"}
				else{this.parentNode.style.top=y+"px"}
				this.parentNode.style.visibility="visible"
			break
			case "Safari":
				if(this.origine.posx){this.parentNode.style.pixelLeft=this.origine.posx}
				else{this.parentNode.style.pixelLeft=xoffset+(lscreen-l)/2}
				if(this.origine.posy){this.parentNode.style.pixelTop=this.origine.posy}
				else{this.parentNode.style.pixelTop=yoffset+(hscreen-h)/2}
				//this.style.visibility="visible"
			break
		}
	}

	if(img.src_zoom && img.src_zoom!="")
	{
		l=img.src_zoom.length
		ext=img.src_zoom.substring(l-4,l)
		switch(ext)
		{
			case ".jpg":
			case ".gif":
			case ".png":
			break
			default:
				ext=".jpg"
			break
		}
		tempo=img.src.split("/")
		tempo.pop()
		img2.src=tempo.join("/")+"/"+img.src_zoom+ext
		document.getElementById('wm_loader_image').src=img2.src
	}
	else
	{
		img2.src=img.src
	}
}

function ease_zoom(f)
{
	img=document.getElementById("wm_image_zoom")
	switch(navigateur())
	{
		case "Internet Explorer":
			dx=img.parentNode.x_end-parseInt(img.parentNode.style.pixelLeft)
			dy=img.parentNode.y_end-parseInt(img.parentNode.style.pixelTop)
			img.parentNode.style.pixelLeft+=dx/f
			img.parentNode.style.pixelTop+=dy/f

			dl=img.l_end-img.width
			dh=img.h_end-img.height
			img.width+=dl/f
			img.height+=dh/f
		break
		case "Firefox":
			x=xoffset+(lscreen-l)/2
			y=yoffset+(hscreen-h)/2
			if(this.origine.posx){this.parentNode.style.left=this.origine.posx+"px"}
			else{this.parentNode.style.left=x+"px"}
			if(this.origine.posy){this.parentNode.style.top=this.origine.posy+"px"}
			else{this.parentNode.style.top=y+"px"}
			this.parentNode.style.visibility="visible"
		break
		case "Safari":
			if(this.origine.posx){this.parentNode.style.pixelLeft=this.origine.posx}
			else{this.parentNode.style.pixelLeft=xoffset+(lscreen-l)/2}
			if(this.origine.posy){this.parentNode.style.pixelTop=this.origine.posy}
			else{this.parentNode.style.pixelTop=yoffset+(hscreen-h)/2}
			//this.style.visibility="visible"
		break
	}
	document.id_timeout_ease_zoom=setTimeout("ease_zoom("+f+")",20)
}

function init_zoom()
{
	clearTimeout(document.id_timeout_ease_zoom)
	obj=document.getElementById("wm_image_zoom")
	if(obj){obj.parentNode.style.display="none"}
	obj=document.createElement("div");
	obj.innerHTML="<input type=button value='x Fermer' style='position:absolute;font-family:arial;border:1px solid black;color:white;background:black' onclick=clearTimeout(document.id_timeout_ease_zoom);this.parentNode.style.display='none'><img id=wm_image_zoom><img id=wm_loader_image style='display:none'>";
	obj.style.position='absolute'
	obj.style.display='none'
	document.body.appendChild(obj)
	image_zoom=document.getElementById("wm_image_zoom")
	
	t=document.getElementsByTagName("img")
	
	for(cpt=0;cpt<t.length;cpt++)
	{
		if(t[cpt].alt.substring(0,4)=="zoom")
		{
			t[cpt].zoom=image_zoom
			t[cpt].style.cursor="hand"
			t[cpt].cursor="hand"
			t[cpt].zoom.style.cursor="hand"
			t[cpt].onclick=function(){zoomer(this)}
			obj=document.createElement("img")
			obj.style.visibility="hidden"
			obj.style.position="absolute"
			obj.style.pixelTop=0
			obj.style.top=0
			obj.src=t[cpt].src
			t[cpt].reel=obj
			document.body.appendChild(obj)
		}
	}
}

//diaporama: serie de fiche (block html)
//definir un conteneur html avec un id et passer ce conteneur comme parametre o
new_diaporama=function(o)
{
	o.className="wm_diaporama"
	o.style.overflow="hidden"
	
	o.fiches=new Array()
	o.add_fiche=function(contenu)
	{
		f=document.createElement("div")
		f.className="wm_fiche_diapo"
		f.style.overflow="hidden"
		f.innerHTML=contenu
		
		this.appendChild(f)
		this.fiches.push(f)

		f.style.height=this.offsetHeight+"px"
	}

	o.id_timeout_play_sequence=false
	o.play_status=false
	o.play_temporisation=1000
	o.id_current_fiche=0
	o.play_sequence=function()
	{
		switch(this.play_status)
		{
			case "wait":
				this.play_status="scroll"
				this.id_timeout_play_sequence=setTimeout("document.getElementById('"+this.id+"').play_sequence()",this.play_temporisation)
			break
			case "scroll":
				dscroll=Math.round(((this.id_current_fiche+1)*this.offsetHeight-this.scrollTop)/10)
				if(dscroll==0)
				{
					this.id_current_fiche++
					if(this.id_current_fiche==this.fiches.length)
					{
						this.id_current_fiche=0
						this.scrollTop=0
					}
					this.scrollTop=this.id_current_fiche*this.offsetHeight
					this.play_status="wait"
				}
				else
				{
					if(dscroll>8){dscroll=8}
					this.scrollTop+=dscroll
				}
				this.id_timeout_play_sequence=setTimeout("document.getElementById('"+this.id+"').play_sequence()",0)
			break
		}
	}
	o.play=function(id_fiche_debut,tempo_seconde)
	{
		if(this.id_timeout_play){clearTimeout(this.id_timeout_play_sequence)}
		while(id_fiche_debut>=this.fiches.length){id_fiche_debut-=this.fiches.length}
		
		//on position sur la fiche de début
		this.scrollTop=id_fiche_debut*this.offsetHeight
		this.id_current_fiche=id_fiche_debut

		//on dupplique la fiche 0 à la fin pour boucler
		f=document.createElement("div")
		f.className="wm_fiche_diapo"
		f.innerHTML=this.fiches[0].innerHTML
		this.appendChild(f)
		if(f.offsetHeight<this.offsetHeight){f.style.height=this.offsetHeight+"px"}

		//initialisation de la sequence et lancement
		this.play_temporisation=Math.round(tempo_seconde*1000)
		this.play_status="wait"
		this.play_sequence()
	}

	o.scroll=function(v,nb_pas)
	{
		this.scrollTop+=v
		nb_pas--
		if(nb_pas>0){setTimeout("document.getElementById('"+this.id+"').scroll("+v+","+nb_pas+")",0)}
	}
}

///////////////////////////////////////////////////////////////////////////////////////
//galerie d'images: serie d'images avec des petites vignettes de selection et une grande image de visualisation
//o_thumbs=> un div permettant d'afficher les vignettes (en vertical)
//o_bigimage=> un div permettant d'afficher la grande image
function new_galerie_images(o_thumbs,o_bigimage,infos_images,tempo,orientation)
{
	if(orientation==undefined){orientation="horizontale"}
	if(orientation!="horizontale"){orientation="verticale"}

	if(tempo==undefined){tempo=2000}
	l_thumbs=o_thumbs.offsetWidth
	h_thumbs=o_thumbs.offsetHeight
	l_big=o_bigimage.offsetWidth
	h_big=o_bigimage.offsetHeight
	id_galerie=o_thumbs.id
	o_bigimage.style.overflow="hidden"

	//creation du code des vignettes
	infos_images=infos_images.split("<>")
	l_img_defaut=l_big
	h_img_defaut=h_big
	commentaires=new Array()
	code_img=""
	for(cpt=0;cpt<infos_images.length;cpt++)
	{
		infos=infos_images[cpt].split(";")
		if(cpt==0)
		{
			url_img_defaut=infos[0]
			if(infos[1] && infos[2]){l_img_defaut=infos[1];h_img_defaut=infos[2]}
			commentaire=""
			if(infos[3]){commentaire=unescape(infos[3])}
		}
		if(orientation=="verticale")
		{
			dimension="width:"+l_thumbs+"px"
			code_img+="<tr>"
			alert(dimension)
		}
		else
		{
			dimension="height:"+h_thumbs+"px"
		}
		code_img+="<td><IMG id="+id_galerie+"_img_"+cpt+" SRC='"+infos[0]+"' BORDER=0 style='"+dimension+";margin:0px' onclick=g=document.getElementById('"+id_galerie+"');g.stop_galerie();g.id_current_img=parseInt(this.id.split('_').pop());change_img(g.bigimage,this,20)></td>"
		if(orientation=="vertivale"){code+="</tr>"}
	}
	///////////////////////////////////////////
	if(infos_images.length>1)
	{//si plusieurs vignettes
		o_thumbs.onmouseover=function(){ease_opacity(document.getElementById(this.id+'_boutons'),10)}
		o_thumbs.onmouseout=function(){ease_opacity(document.getElementById(this.id+'_boutons'),-10)}

		if(orientation=="verticale")
		{
			code_click_bt_thumbs_arriere="o=document.getElementById('"+id_galerie+"_thumbs');o.dest=false;ease_scroll(o,-200,0)"
			code_click_bt_thumbs_avant="o=document.getElementById('"+id_galerie+"_thumbs');o.dest=false;ease_scroll(o,200,0)"
		}
		if(orientation=="horizontale")
		{
			code_click_bt_thumbs_arriere="o=document.getElementById('"+id_galerie+"_thumbs');o.dest=false;ease_scroll(o,0,-200)"
			code_click_bt_thumbs_avant="o=document.getElementById('"+id_galerie+"_thumbs');o.dest=false;ease_scroll(o,0,200)"
		}

		code="<table border=0 cellpadding=0 cellspacing=0 id="+id_galerie+"_boutons style='position:absolute;height:"+h_thumbs+"px;filter:alpha(opacity=0);opacity: 0;-moz-opacity:0'><tr><td valign=top><img id="+id_galerie+"_haut SRC='images/boutons/std/fleche_haut.gif' style='width:20px;height:20px;margin:0px' BORDER=0 onclick="+code_click_bt_thumbs_arriere+"></td></tr><tr><td style='vertical-align:bottom'><img id="+id_galerie+"_bas SRC='images/boutons/std/fleche_bas.gif' style='width:20px;height:20px;margin:0px' BORDER=0 onclick="+code_click_bt_thumbs_avant+"></td></tr></table>"
		code+="<div id="+id_galerie+"_thumbs style='overflow:hidden;width:"+l_thumbs+"px;height:"+h_thumbs+"px;margin:0px'><table border=0 cellspacing=0 cellpadding=0>"+code_img+"</table></div>"
		code+="<table border=0 cellpadding=0 cellspacing=0 id="+id_galerie+"_big onmouseover=ease_opacity(document.getElementById('"+id_galerie+"_cmd'),10) onmouseout=ease_opacity(document.getElementById('"+id_galerie+"_cmd'),-10)><tr><td style='width:"+l_big+"px;height:"+h_big+"px;text-align:center;vertical-align:middle'><div id="+id_galerie+"_cmd style='position:absolute;filter:alpha(opacity=0);opacity: 0;-moz-opacity:0'><img SRC='images/boutons/std/prev.gif' id='"+id_galerie+"_bt_prev' style='width:20px;height:20px;margin:0px' BORDER=0 onclick=this.galerie.prev_image()><img SRC='images/boutons/std/next.gif' id='"+id_galerie+"_bt_next' style='width:20px;height:20px;margin:0px' BORDER=0 onclick=this.galerie.next_image()><img SRC='images/boutons/std/play.gif' id='"+id_galerie+"_bt_play' style='width:20px;height:20px;margin:0px' BORDER=0 onclick=this.galerie.play("+tempo+")><img SRC='images/boutons/std/stop.gif' id='"+id_galerie+"_bt_stop' style='width:20px;height:20px;margin:0px' BORDER=0 onclick=this.galerie.stop_galerie()></div><img id="+id_galerie+"_bigimage src='"+url_img_defaut+"' style='width:"+l_img_defaut+"px;height:"+h_img_defaut+"px;filter:alpha(opacity=100);opacity:1;-moz-opacity:1;margin:0px'><p style='width:100%;text-align:center' id="+id_galerie+"_comment_bigimage>"+commentaire+"</p></td></tr></table>"
		document.write(code)

		id=0
		while(i=document.getElementById(id_galerie+"_img_"+id))
		{
			infos=infos_images[id].split(";")
			if(infos[3]){i.commentaire=infos[3]}else{i.commentaire=""}
			if(infos[1] && infos[2] && infos[1]!="" && infos[2]!="")
			{
				l=parseInt(infos[1])
				h=parseInt(infos[2])
				if(l>l_big){h=h/l*l_big;l=l_big}
				if(h>h_big){l=l/h*h_big;h=h_big}
				i.l=l
				i.h=h
			}
			else
			{
				i.l=l_big
				i.h=h_big
			}
			id++
		}

		//o_thumbs.appendChild(document.getElementById(id_galerie+"_boutons"))

		o_thumbs.appendChild(document.getElementById(id_galerie+"_thumbs"))
		
		o_thumbs.thumbs=document.getElementById(id_galerie+"_thumbs")
		document.getElementById(id_galerie+'_bas').thumbs=o_thumbs.thumbs
		document.getElementById(id_galerie+'_haut').thumbs=o_thumbs.thumbs
		document.getElementById(id_galerie+'_bt_stop').galerie=o_thumbs
		document.getElementById(id_galerie+'_bt_play').galerie=o_thumbs
		document.getElementById(id_galerie+'_bt_next').galerie=o_thumbs
		document.getElementById(id_galerie+'_bt_prev').galerie=o_thumbs

		o_bigimage.appendChild(document.getElementById(id_galerie+"_big"))
		o_thumbs.bigimage=document.getElementById(id_galerie+'_bigimage')
		o_thumbs.bigimage.commentaire=document.getElementById(id_galerie+"_comment_bigimage")

		o_thumbs.next_image=function()
		{
			this.stop_galerie()
			this.id_current_img++
			if(!document.getElementById(this.id+'_img_'+this.id_current_img)){this.id_current_img=0}
			change_img(this.bigimage,document.getElementById(this.id+'_img_'+this.id_current_img),20)
		}
		
		o_thumbs.prev_image=function()
		{
			this.stop_galerie()
			this.id_current_img--
			if(!document.getElementById(this.id+'_img_'+this.id_current_img))
			{
				id=0
				while(document.getElementById(this.id+'_img_'+id)){id++}
				this.id_current_img=id-1
			}
			change_img(this.bigimage,document.getElementById(this.id+'_img_'+this.id_current_img),20)
		}

		o_thumbs.play=function(tempo)
		{
			this.next_image()
			this.id_timeoutplay=setTimeout("document.getElementById('"+this.id+"').play("+tempo+")",tempo)
		}
		o_thumbs.stop_galerie=function()
		{
			clearTimeout(this.id_timeoutplay)
			this.id_timeoutplay=false
		}
		o_thumbs.thumbs.scroll=function(sens)
		{
			if(this.id_timeout)
			{
				clearTimeout(this.id_timeout)
				this.id_timeout=false
			}
			if(sens=='up' || sens=='down')
			{
				id_current_img=false
				for(cpt in this.childNodes)
				{
					if(this.childNodes[cpt].tagName=="IMG" && this.childNodes[cpt].src)
					{
						switch(sens)
						{
							case "down":
								if(!id_current_img && this.childNodes[cpt].offsetTop-this.scrollTop>0)
								{
									id_current_img=cpt
								}
								else
								{
									d=this.childNodes[cpt].offsetTop-this.scrollTop
									if(d>0 && d<this.childNodes[id_current_img].offsetTop){id_current_img=cpt}
								}
							break
							case "up":
								if(!id_current_img && this.childNodes[cpt].offsetTop-this.scrollTop<=0)
								{
									id_current_img=cpt
								}
								else
								{
									d=this.scrollTop-this.childNodes[cpt].offsetTop
									if(d>0 && d>this.childNodes[id_current_img].offsetTop){id_current_img=cpt}
								}
							break
						}
					}
				}
				sens=id_current_img
			}
			dest=this.childNodes[sens].offsetTop
			if(dest-this.scrollTop>this.offsetHeight-this.scrollTop){dest=this.offsetHeight}
			d=Math.round((dest-this.scrollTop)/10)
			
			if(d!=0)
			{
				this.scrollTop+=d
				this.id_timeout=setTimeout("document.getElementById('"+this.id+"').scroll("+sens+")",0)
			}
			else
			{
				this.scrollTop=dest
				this.firstChild.style.pixelTop=this.scrollTop
			}
		}
	}
	else//si une seule vignette
	{
		o_thumbs.style.display="none"
		code="<table border=0 cellpadding=0 cellspacing=0 style='height:"+h_big+"px'><tr><td style='vertical-align:middle'><img id="+id_galerie+"_bigimage src='"+url_img_defaut+"' style='width:"+l_img_defaut+"px;height:"+h_img_defaut+"px;margin:0px' alt='zoom'><p style='width:100%;text-align:center' id="+id_galerie+"_comment_bigimage>"+commentaire+"</p></td></tr></table>"
		o_bigimage.innerHTML=code
	}
}

///////////////////////////////////////////////////////////////////////////////////////
//permet l'apparition ou la disparition progressive d'un objet => pas donne la vitesse et le sens : >0 apparition <0 disparition
function ease_opacity(o,pas)//pas de 1à100
{
	if(o.id_timeout)
	{
		clearTimeout(o.id_timeout)
		o.id_timeout=false
	}
	fin=false
	switch(navigateur())
	{
		case "Internet Explorer":
			v=o.filters.alpha.opacity
			v+=pas
			if(pas>0 && v>100){v=100;fin=true}
			if(pas<0 && v<0){v=0;fin=true}
			o.filters.alpha.opacity=v
		break
		case "Firefox":
			if(o.style.MozOpacity==""){o.style.MozOpacity=0}
			v=parseFloat(o.style.MozOpacity)
			v+=pas/100
			if(pas>0 && v>1){v=1;fin=true}
			if(pas<0 && v<0){v=0;fin=true}	
			o.style.MozOpacity=v
		break
		case "Safari":
			if(o.style.opacity==""){o.style.opacity=0}
			v=parseFloat(o.style.opacity)
			v+=pas/100
			if(pas>0 && v>1){v=1;fin=true}
			if(pas<0 && v<0){v=0;fin=true}
			o.style.opacity=v
		break
	}
	if(!fin){o.id_timeout=setTimeout("ease_opacity(document.getElementById('"+o.id+"'),"+pas+")",40)}
}
/////////////////////////////////////////////////////////////////////////////////
//utilise la fonction ease_opacity pour faire une transition en fondu de l'image d'origine de o vers src
//pas donne la vitesse de transition (>0)
function change_img(o,new_img,pas)
{
	fin_fadeout=false
	if(o.src==new_img.src){return}

	if(pas>0)
	{
		pas=-pas
		ease_opacity(o,pas)
	}
	else
	{
		if(o.commentaire)
		{
			if(new_img.commentaire){o.commentaire.innerHTML=unescape(new_img.commentaire)}else{o.commentaire.innerHTML=''}
		}
		switch(navigateur())
		{
			case "Internet Explorer":
				if(o.filters.alpha.opacity==0)
				{
					o.src=new_img.src
					o.style.width=new_img.l
					o.style.height=new_img.h
					pas=-pas
					ease_opacity(o,pas)
					fin_fadeout=true
				}
			break
			case "Firefox":
				if(o.style.MozOpacity==0)
				{
					o.src=new_img.src
					o.style.width=new_img.l
					o.style.height=new_img.h
					pas=-pas
					ease_opacity(o,pas)
					fin_fadeout=true
				}
			break
			case "Safari":
				if(o.style.opacity==0)
				{
					o.src=new_img.src
					o.style.width=new_img.l
					o.style.height=new_img.h
					pas=-pas
					
					ease_opacity(o,pas)
					fin_fadeout=true
				}
			break
		}
	}
	if(!fin_fadeout){setTimeout("change_img(document.getElementById('"+o.id+"'),document.getElementById('"+new_img.id+"'),"+pas+")",500)}
}

//permet de scroller un div o de pas pixel (positif ou négatif) avec effet ease
function ease_scroll(o,pasy,pasx)
{
	if(o.id_timeout)
	{
		clearTimeout(o.id_timeout)
		o.id_timeout=false
	}
	if(typeof(o.desty)=="undefined" || !o.desty)
	{
		o.desty=o.scrollTop+pasy
		o.scrollposy=o.scrollTop
		o.destx=o.scrollLeft+pasx
		o.scrollposx=o.scrollLeft
	}

	dvy=(o.desty-o.scrollposy)/10
	dvx=(o.destx-o.scrollposx)/10

	if(Math.abs(dvy)<.1 && Math.abs(dvx)<.1)
	{
		o.scrollTop=o.desty
		o.desty=false
		o.scrollLeft=o.destx
		o.destx=false
	}
	else
	{
		o.scrollposy+=dvy
		o.scrollTop=Math.round(o.scrollposy)
		o.scrollposx+=dvx
		o.scrollLeft=Math.round(o.scrollposx)
	}
	if(typeof(o.desty)=="number" || typeof(o.destx)=="number"){o.id_timeout=setTimeout("ease_scroll(document.getElementById('"+o.id+"'),"+pasy+","+pasx+")",0)}
}