function getid(id) {
	if ( document.getElementById ) {
		value = document.getElementById(id);
		}
	else if ( document.all ) {
		value = document.all[id];
		}
	else if ( document.layers ) {
		value = document.layers[id];
		}
	return value;
	}

function view(id) {
	if ( document.getElementById ) {
		document.getElementById(id).style.display = ( document.getElementById(id).style.display == "block" ) ? "none" : "block";
		}
	else if ( document.all ) {
		document.all[id].style.display = ( document.all[id].style.display == "block" ) ? "none" : "block";
		}
	else if ( document.layers ) {
		document.layers[id].display = ( document.layers[id].display == "block" ) ? "none" : "block";
		}
	}

function onlyhide(id) {
	if ( document.getElementById ) {
		document.getElementById(id).style.display = "none";
		}
	else if ( document.all ) {
		document.all[id].style.display = "none";
		}
	else if ( document.layers ) {
		document.layers[id].display = "none";
		}
	}

function onlyview(id) {
	if ( document.getElementById ) {
		document.getElementById(id).style.display = "block";
		}
	else if ( document.all ) {
		document.all[id].style.display = "block";
		}
	else if ( document.layers ) {
		document.layers[id].display = "block";
		}
	}

function selectcontact(value) {
	onlyhide("particulier");
	onlyhide("entreprise");
	onlyhide("etablissement");
	onlyhide("journaliste");
	onlyview(value);
	}

function changeimage(id, value) {
	var div = getid(id);
	div.src = value;
	}

function getvalue(id) {
	var div = getid(id);
	return div.value;
	}

function changevalue(id, value) {
	var div = getid(id);
	div.value = value;
	}

function getinnerhtml(id) {
	var div = getid(id);
	return div.innerHTML;
	}

function changeinnerhtml(id, value) {
	var div = getid(id);
	div.innerHTML = value;
	}

function showmenu(id) {
	for ( i=1; i<8; i++ ) {
		if ( i!=6 ) {
			onlyhide('menu'+i);
			onlyhide('backmenu'+i);
			}
		}
	view('menu'+id);
	view('backmenu'+id);
	}

function connexion() {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		return true;
		}
	xhr_object.open("POST", "/connexion.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	form = getinnerhtml("textlogin");
	formlogin = getvalue("formlogin");
	formpassword = getvalue("formpassword");
	var vars = "ajax=ajax&login="+formlogin+"&password="+formpassword;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			if ( xhr_object.responseText == 1 ) {
				window.location.replace(window.location);
				}
			else {
				changeinnerhtml("textlogin", xhr_object.responseText);
				window.setTimeout("changeinnerhtml('textlogin', form)", 2000);
				}
			}
		}
	return false;
	}

function connexion2() {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		return true;
		}
	xhr_object.open("POST", "/connexion.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	form = getinnerhtml("textlogin2");
	formlogin = getvalue("formlogin2");
	formpassword = getvalue("formpassword2");
	var vars = "ajax=ajax2&login="+formlogin+"&password="+formpassword;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			if ( xhr_object.responseText == 1 ) {
				window.location.replace(window.location);
				}
			else {
				changeinnerhtml("textlogin2", xhr_object.responseText);
				window.setTimeout("changeinnerhtml('textlogin2', form)", 2000);
				}
			}
		}
	return false;
	}

function addcart(form) {
	var p = form.product.value;
	var s = form.size.value;
	var c = form.color.value;
	var q = form.qte.value;
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		return true;
		}
	xhr_object.open("POST", "/cart.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "action=add&product="+p+"&size="+s+"&color="+c+"&qte="+q;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			if ( xhr_object.responseText != 0 ) {
				var response = xhr_object.responseText.split("|");
				changeinnerhtml("cart_nb", response[0]);
				changeinnerhtml("cart_total", response[1]);
				alert("Produit ajouté au panier");
				}
			}
		}
	return false;
	}

function submithis(form) {
	var str = form.q.value;
	if (str != "") {
		if ( form.w.value == "google" ) {
			str = "google-"+str;
			}
		var str = str.toLowerCase();
		var str = cleanString(str);
		newLocation = "/recherche/"+str+".html";
		document.location = newLocation;
		}
	return false;
	}

function replaceAll(str, search, repl) {
	while ( str.indexOf(search) != -1 ) {
		str = str.replace(search, repl);
		}
	return str;
	}

function vote(id) {
	for ( i=1; i<6; i++ ) {
		changeimage("vote"+i, "img/vote-off.gif");
		}
	for ( i=1; i<id+1; i++ ) {
		changeimage("vote"+i, "img/vote-on.gif");
		}
	}

function sendvote(note, page, id) {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre système de vote...");
		return;
		}
	xhr_object.open("POST", "/"+page, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "note="+note;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			changeinnerhtml(id, xhr_object.responseText);
			}
		}
	}

function getchrono(concours, user) {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre système de vote...");
		return;
		}
	xhr_object.open("POST", "/concours/"+concours+"/validation.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "getchrono=1&user="+user;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			changeinnerhtml("concours_validation", xhr_object.responseText);
			}
		}
	}

function setchrono(concours, user, valide) {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre système de vote...");
		return;
		}
	var voiture = getvalue('voiture');
	var message = getvalue('message');
	var time_minutes = getvalue('minutes');
	var time_secondes = getvalue('secondes');
	var time_centiemes = getvalue('centiemes');
	xhr_object.open("POST", "/concours/"+concours+"/validation.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = ( valide == 1 ) ? "setchrono=1&user="+user+"&voiture="+voiture+"&minutes="+time_minutes+"&secondes="+time_secondes+"&centiemes="+time_centiemes : "setchrono=1&user="+user+"&message="+message+"&delete=1";
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			changeinnerhtml("concours_validation", "");
			updatepage("/concours/"+concours+"/validation.html", "scroll_classement_content");
			getchrono(concours, xhr_object.responseText);
			initScrollLayers(1);
			}
		}
	}

function updatepage(url, div) {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre système de vote...");
		return;
		}
	xhr_object.open("POST", url, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "update=1";
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			changeinnerhtml(div, xhr_object.responseText);
			}
		}
	}

function sendallopass(id, site, doc, code, page) {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec cette option...");
		return;
		}
	changeinnerhtml(id, "<p class=\"confirm\">Envoi des données...</p>");
	xhr_object.open("POST", page, true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "SITE_ID="+site+"&DOC_ID="+doc+"&RECALL=1&CODE0="+code;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			changeinnerhtml(id, xhr_object.responseText);
			}
		}
	}

function showchat() {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre chat...");
		return;
		}
	xhr_object.open("POST", "/chat.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "chat=show";
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			if ( xhr_object.responseText == 1 ) {
				onlyview("chat");
				view2("showchat");
				view2("hidechat");
				getid("chat_connexion").style.left = "562px";
				getid("chat_connexion").style.width = "413px";
				updatechat();
				}
			else {
				onlyview("chat_error");
				}
			}
		}
	}

function hidechat() {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre chat...");
		return;
		}
	xhr_object.open("POST", "/chat.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "chat=hide";
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			view("chat");
			view2("showchat");
			view2("hidechat");
			getid("chat_connexion").style.left = "819px";
			getid("chat_connexion").style.width = "156px";
			}
		}
	}

function updatechat() {
	var time = 1000;
	var div = "chat_content";
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre chat...");
		return;
		}
	xhr_object.open("POST", "/chat.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var vars = "chat=update&div="+div;
	xhr_object.send(vars);
	xhr_object.onreadystatechange = function() {
		if ( xhr_object.readyState == 4 ) {
			if ( xhr_object.responseText != 0 ) {
				if ( changeinnerhtml ) {
					changeinnerhtml(div, xhr_object.responseText);
					getid("chat_content").style.top = 135-getid("chat_content").offsetHeight+"px";
					}
				window.setTimeout("updatechat()", time);
				}
			}
		}
	}

function addchat() {
	var xhr_object = null;
	if ( window.XMLHttpRequest )
		xhr_object = new XMLHttpRequest();
	else if ( window.ActiveXObject )
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else {
		alert("Votre navigateur n'est pas compatible avec notre chat...");
		return;
		}
	xhr_object.open("POST", "/chat.html", true);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	var add = getvalue("chat_add");
	if ( add != "<Votre message ici>" && add != '' ) {
		changevalue("chat_add", "");
		var vars = "chat=add&message="+add;
		xhr_object.send(vars);
		xhr_object.onreadystatechange = function() {
			if ( xhr_object.readyState == 4 ) {
				if ( xhr_object.responseText == 1 ) {
					updatechat();
					getid("chat_add").focus();
					getid("chat_content").style.top = 135-getid("chat_content").offsetHeight+"px";
					}
				}
			}
		}
	else {
		getid("chat_add").focus();
		}
	}

function cleanString(sStr) {
	var out = "";
	var spec = new Array("é", "è", "ê", "ë", "à", "â", "ä", "ù", "û", "ü", "ì", "î", "ï", "ò", "ô", "ö");
	var norm = new Array("e", "e", "e", "e", "a", "a", "a", "u", "u", "u", "i", "i", "i", "o", "o", "o");
	for ( var i=0; i<spec.length; i++ ) {
		sStr = replaceAll(sStr, spec[i], norm[i]);
		}
	for ( i=0; i<sStr.length; i++ ) {
		out += ( charcheck(sStr.charAt(i)) ) ? sStr.charAt(i) : "-";
		}
	out = escape(out);
	return out;
	}

function charcheck(keychar) {
	ret = ( ("abcdefghijklmnopqrstuvwxyz0123456789").indexOf(keychar) > -1 ) ? true : false;
	return ret;
	}

function updatecheck(id, num, hide, value) {
	if ( num == 1 ) {
		document.getElementById(id+"1").style["background"] = "url('img/selected-on.gif') no-repeat 3px 1px";
		document.getElementById(id+"2").style["background"] = "url('img/selected-off.gif') no-repeat 3px 1px";
		}
	else {
		document.getElementById(id+"1").style["background"] = "url('img/selected-off.gif') no-repeat 3px 1px";
		document.getElementById(id+"2").style["background"] = "url('img/selected-on.gif') no-repeat 3px 1px";
		}
	changevalue(hide, value);
	}

function screenshot(img, titre) {
	w = open("", "image", "width=400, height=400, toolbar=no, scrollbars=no, resizable=no");
	w.document.write("<html><head><title>"+titre+"</title>");
	w.document.write("<sc"+"ript type='text/javas"+"cript'>");
	w.document.write("	function checksize() {");
	w.document.write("		if ( document.images['img'].complete ) {");
	w.document.write("			var height = document.images[0].height+35;");
	w.document.write("			var width = document.images[0].width+5;");
	w.document.write("			if ( height>screen.height ) {");
	w.document.write("				var width = (width*(screen.height-35))/height;");
	w.document.write("				var height = screen.height-35;");
	w.document.write("				document.images[0].height = height;");
	w.document.write("				}");
	w.document.write("			if ( width>screen.width-5 ) {");
	w.document.write("				var height = (height*(screen.width-5))/width;");
	w.document.write("				var width = screen.width-5;");
	w.document.write("				document.images[0].width = width;");
	w.document.write("				}");
	w.document.write("			var top = (screen.height-height)/2;");
	w.document.write("			var left = (screen.width-width)/2;");
	w.document.write("			window.moveTo(left, top);");
	w.document.write("			window.resizeTo(width, height);");
	w.document.write("			window.focus();");
	w.document.write("			}");
	w.document.write("		else {");
	w.document.write("			setTimeout('checksize()', 250)");
	w.document.write("			}");
	w.document.write("		}");
	w.document.write("	</"+"script>");
	w.document.write("</head>");
	w.document.write("<body onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0 bgcolor='#111111'>");
	w.document.write("<a href='javascript:self.close()'><img src='/"+img+"' border=0 name='img' alt='"+titre+"' title='"+titre+"' /></a>");
	w.document.write("");
	w.document.write("</body></html>");
	w.document.close();
	}

var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='img/login-browse.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for ( var i=0;i<x.length;i++ ) {
		if ( x[i].type == 'file' ) {
			if ( x[i].parentNode.className != 'fileinputs' ) continue;
			x[i].className = 'file';
			var clone = fakeFileUpload.cloneNode(true);
			x[i].parentNode.appendChild(clone);
			x[i].relatedElement = clone.getElementsByTagName('input')[0];
			x[i].relatedElement.className = 'double';
			x[i].onchange = x[i].onmouseout = function () {
				this.relatedElement.value = this.value;
				}
			}
		}
	}

function controlplayer2() {
	var main_path = ""+parent.frames['main'].location+"";
	var main_url = main_path.split("/");
	var main_var1 = main_url[3];
	var main_var2 = main_url[4];
	var player_path = ""+parent.frames['player'].location+"";
	var player_url = player_path.split("/");
	var player_var1 = player_url[3];
	var player_var2 = player_url[4];
	if ( main_var1 == "" || main_var1 == "homepage.html" || main_var1 == "videos" ) {
		if ( player_var1 != "player.html" ) {
			parent.frames['player'].location = "player.html";
			}
		}
	else {
		if ( player_var1 == "player.html" ) {
			parent.frames['player'].location = "player/play.html";
			parent.frames['player'].document.swfplayer.TGotoFrame("_level0/main/player/controles/js", 2);
			}
		}
	}

function controlplayer(play) {
	if ( parent.frames['player'].document.swfplayer ) {
		var play = ( play == 1 ) ? 1 : 0;
		var path = ""+parent.frames['main'].location+"";
		var url = path.split("/");
		var var1 = url[3];
		var var2 = url[4];
		if ( var1 == "" || var1 == "homepage.html" || var1 == "videos" ) {
			if ( play == 1 ) {
				parent.frames['player'].document.swfplayer.TGotoFrame("_level0/main/player/controles/js", 2);
				var play = 0;
				}
			}
		else {
			if ( play == 0 ) {
				parent.frames['player'].document.swfplayer.TGotoFrame("_level0/main/player/controles/js", 1);
				var play = 1;
				}
			}
		}
	window.setTimeout("controlplayer("+play+")", 2000);
	}

function playergoto(frame) {
	if ( parent.frames['player'].document.swfplayer ) {
		parent.frames['player'].document.swfplayer.TGotoFrame("_level0/main/player/controles/list", frame);
		}
	}

/*****************************************************
 * ypSlideOutMenu
 * 3/04/2001
 *
 * a nice little script to create exclusive, slide-out
 * menus for ns4, ns6, mozilla, opera, ie4, ie5 on
 * mac and win32. I've got no linux or unix to test on but
 * it should(?) work...
 *
 * --youngpup--
 *****************************************************/

ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 400
ypSlideOutMenu.hideDelay = 400
ypSlideOutMenu.minCPUResolution = 10

// constructor
function ypSlideOutMenu(id, dir, left, top, width, height)
{
	this.ie  = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0

	if (this.ie || this.ns4 || this.dom) {
		this.id			 = id
		this.dir		 = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType	 = dir == "right" || dir == "down" ? "-" : "+"
		this.dim		 = this.orientation == "h" ? width : height
		this.hideTimer	 = false
		this.aniTimer	 = false
		this.open		 = false
		this.over		 = false
		this.startTime	 = 0

		// global reference to this object
		this.gRef = "ypSlideOutMenu_"+id
		eval(this.gRef+"=this")

		// add this menu object to an internal list of all menus
		ypSlideOutMenu.Registry[id] = this

		var d = document
		var strCSS  = '<style type="text/css">';
			strCSS += 'ul.menu { display: block; } '
			strCSS += '#'+this.id+'_div, #'+this.id+' {'
			strCSS += '	position: absolute;'
			strCSS += '	width: '+width+'px;'
			strCSS += '	height: '+height+'px;'
			strCSS += '	clip: rect(0 '+width+'px '+height+'px 0);'
			strCSS += '	}'
			strCSS += '#'+this.id+'_div {'
			strCSS += '	display: block;'
			strCSS += '	left: '+left+'px;'
			strCSS += '	top: '+top+'px;'
			strCSS += '	width: '+width+'px;'
			strCSS += '	height: '+height+'px;'
			strCSS += '	overflow: hidden;'
			strCSS += '	}'
			strCSS += '</style>'

		d.write(strCSS)

		this.load()
	}
}

ypSlideOutMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "_div"
	var lyrId2 = this.id
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	var temp

	if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
	else {
		this.container	= obj1
		this.menu		= obj2
		this.style		= this.ns4 ? this.menu : this.menu.style
		this.homePos	= eval("0" + this.dirType + this.dim)
		this.outPos		= 0
		this.accelConst	= (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen

		// set event handlers.
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")

		//set initial state
		this.endSlide()
	}
}

ypSlideOutMenu.showMenu = function(id)
{
	var reg = ypSlideOutMenu.Registry
	var obj = ypSlideOutMenu.Registry[id]

	if (obj.container) {
		obj.over = true

		// close other menus.
		for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu)

		// if this menu is scheduled to close, cancel it.
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }

		// if this menu is closed, open it.
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
}

ypSlideOutMenu.hideMenu = function(id)
{
	// schedules the menu to close after <hideDelay> ms, which
	// gives the user time to cancel the action if they accidentally moused out
	var obj = ypSlideOutMenu.Registry[id]
	if (obj.container) {
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
	}
}

ypSlideOutMenu.hide = function(id)
{
	var obj = ypSlideOutMenu.Registry[id]
	obj.over = false

	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)

	// flag that this scheduled event has occured.
	obj.hideTimer = 0

	// if this menu is open, close it.
	if (obj.open && !obj.aniTimer) obj.startSlide(false)
}

ypSlideOutMenu.prototype.startSlide = function(open) {
	this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime()
	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}

ypSlideOutMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-")		d = -d
		else if (this.open && this.dirType == "+")	d = -d
		else if (!this.open && this.dirType == "-")	d = -this.dim + d
		else										d = this.dim + d

		this.moveTo(d)
	}
}

ypSlideOutMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	if ((this.open && !this.over) || (!this.open && this.over)) {
		this.startSlide(this.over)
	}
}

ypSlideOutMenu.prototype.setVisibility = function(bShow) {
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
	if ( this.id == "menutop" ) {
		if ( s.visibility == "visible" ) { menucache() } else { menumontre() }
		}
}
ypSlideOutMenu.prototype.moveTo = function(p) {
	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
ypSlideOutMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}

// events
ypSlideOutMenu.prototype.onactivate		= function() { }
ypSlideOutMenu.prototype.ondeactivate	= function() { }

// hop !
// new ypSlideOutMenu("menutop", "down", 0, 100, 758, 295)


// +------------------------------------------------------------------------+
// | Affichage des image en plein écran
// +------------------------------------------------------------------------+
// | Javascript
// |
// | @author		 		Xuan Nguyen <xuxu.fr@gmail.com>
// | @version 				1.91
// | Last update			2007/11/02
// |
// | Licensed under the Creative Commons Attribution 3 License - http://creativecommons.org/licenses/by-sa/3.0/
// +------------------------------------------------------------------------+

//Valeur de rel pour signifier que ce lien va être soumis au splash
var rel_value = 'splash';
//Distance en pixel entre le haut de l'image et le top.
var margin_top = 40;
//Distance en pixel entre la droite de l'image et le right si l'image dépasse du body initial.
var margin_right = 40;
//Distance en pixel entre le bas de l'image et le bottom si l'image dépasse du body initial.
var margin_bottom = 40;
//Distance en pixel entre la gauche de l'image et le right si l'image dépasse du body initial.
var margin_left = 40;
// Tableau comprenant les groupes d'images
var splash_groups = new Array();
// Tableau comprenant les liens splashed
var splash_as = new Array();
// Tableau comprenant les ids des liens
var splash_ids = new Array();
// Tableau comprenant les titles des liens
var splash_titles = new Array();
//Variable contenant le timeout
var slide_timeout;
//Variable contenant le timeout de la disparition de la notification de play/pause
var slide_timeout_notification;
//Durée timeout pour le slide
var slide_timeout_value = 4000;
//Groupe courant
var current_group;
//Position actuelle de l'image dans le groupe
var current_position;
//Flag is true si slide
var is_sliding = false;
//Flag is true si splash prend la place de lightbox
var lightbox_replace = true;
//Flag is true si background à la place de la couleur du fond
var set_bg = false;
//z-index minimum des éléments
var z_index_mini = 100000;
//Objets à cacher
var objects_2_hide = new Array();
//Activer l'autostart
var splash_auto_start = false;
//Indice de l'image de départ
var splash_auto_start_rank = 0;
//Groupe de l'image de départ
var splash_auto_start_group = 'splash';


// -----------------------------------------------------------------------------------
//  Affiche l'image concernée en plein écran
function splash_image(a) {
	//On cache les éléments embed et object
    hide_and_show('hidden');
    //On récupère l'indice
	obj_body = document.getElementsByTagName('body').item(0);
	//Ini la variable current_group le groupe de cette image si celle ci est groupée
	rel_attr = new String(a.getAttribute('rel'));
	val = rel_attr.replace(rel_value+'|', '');
	splash_id = (a.getAttribute('class')) ? new String(a.getAttribute('class').match(new RegExp(/splash[0-9]+$/))) : '';
	if (val != rel_value && splash_groups[val].length > 0) {
		current_group = val;
		current_position = in_array(splash_groups[val], splash_id);
	}
	else {
		current_group = current_position = '';
	}
	if (!document.getElementById('splash_screen')) {
		//Création du fond
		obj_splash_screen = document.createElement('a');
		obj_splash_screen.setAttribute('id', 'splash_screen');
		obj_splash_screen.setAttribute('title', 'Fermer');
       	obj_splash_screen.style.zIndex = z_index_mini;
		array_page_size = getPageSize();
		obj_splash_screen.style.width = '100%';
		obj_splash_screen.style.height = array_page_size[1]+'px';
		obj_splash_screen.onclick = function() { splash_bye(); return false; }
		if (set_bg) { obj_splash_screen.setAttribute('class', 'bg'); }
		obj_body.appendChild(obj_splash_screen);
       	obj_splash_screen.style.zIndex = z_index_mini;

		//Création du container image et du loading
		obj_content = document.createElement('div');
		obj_content.setAttribute('id', 'image_content');
		obj_content.style.width = '200px';
		obj_content.style.height = '200px';
		obj_content.className = 'ajax-loading';
		obj_body.appendChild(obj_content);
       	obj_content.style.zIndex = z_index_mini+1;

		//Positionnement
		array_page_scroll = getPageScroll();
		array_page_size = getPageSize();
		obj_content.style.top = array_page_scroll[1]+margin_top+'px';
		obj_content.style.left = array_page_size[0]/2-(parseInt(obj_content.style.width)/2)+'px';
	}
	else {
		obj_splash_screen = document.getElementById('splash_screen');
		obj_content = document.getElementById('image_content');
		obj_content.removeChild(document.getElementById('splash_img'));
		obj_content.className = 'ajax-loading';
	}

	//Supprime le title_content
	if (document.getElementById('title_content')) {
		obj_title = document.getElementById('title_content');
		//Supprime la navigation si elle existe
		if (document.getElementById('splash_previous')) {
			obj_title.removeChild(document.getElementById('splash_previous'));
			obj_title.removeChild(document.getElementById('splash_next'));
			if (document.getElementById('splash_notification')) { obj_content.removeChild(document.getElementById('splash_notification')); }
			what = (is_sliding) ? 'splash_pause' : 'splash_play';
			obj_title.removeChild(document.getElementById(what));
		}
		obj_content.removeChild(obj_title);
	}

	//Charge l'image
	ini_image(a);
}

// -----------------------------------------------------------------------------------
//  Charge l'image
function ini_image(a) {
	//Objet image pour récupérer la taille de l'image
	img = new Image();
	img.src = a.href;

	//Si l'image n'est pas encore chargée
	if (!img.complete) {
		img.onload = function() {
			image_display(a);
		}
	}
	//Si l'image a déjà été chargée une fois
	else {
		image_display(a);
	}
}

// -----------------------------------------------------------------------------------
// Affiche l'image
function image_display(a) {
	obj_body = document.getElementsByTagName('body').item(0);
	obj_content = document.getElementById('image_content');
	obj_splash_screen = document.getElementById('splash_screen');

	//Création image
	obj_image = document.createElement('img');
	obj_image.setAttribute('id', 'splash_img');
	obj_image.onclick = function() { splash_bye(); return false; }
	obj_content.appendChild(obj_image);
    obj_image.style.zIndex = z_index_mini+2;

	//Resize du container de l'image
	obj_content.style.width = img.width+'px';
	obj_content.style.height = img.height+'px';

	//Replacement du container de l'image
	array_page_scroll = getPageScroll();
	array_page_size = getPageSize();
	obj_content.style.top = array_page_scroll[1]+margin_top+'px';
	obj_content.style.left = array_page_size[0]/2-(parseInt(img.width)/2)+'px';

	//On affiche l'image
	obj_content = document.getElementById('image_content');
	obj_content.className = '';
	obj_image.setAttribute('src', a.href);
	obj_image.style.display = 'block';

	//Création container title
	obj_close = document.createElement('a');
	obj_close.setAttribute('id', 'splash_close');
	obj_close.onclick = function() { splash_bye(); return false; }
	obj_content.appendChild(obj_close);
    obj_close.style.zIndex = z_index_mini+3;

	//Création container title
	obj_title = document.createElement('div');
	obj_title.setAttribute('id', 'title_content');
	obj_content.appendChild(obj_title);
    obj_title.style.zIndex = z_index_mini+4;

	//Libellé position
	str_position = (current_group != '') ? 'Image '+(current_position+1)+' sur '+splash_groups[current_group].length+' :' : '';
	obj_text = document.createTextNode(str_position);
	obj_title.appendChild(obj_text);

	//Description
	obj_description = document.createElement('div');
	obj_description.setAttribute('id', 'splash_description');
	obj_title.appendChild(obj_description);
    obj_description.style.zIndex = z_index_mini+5;
	splash_id = (a.getAttribute('class')) ? new String(a.getAttribute('class').match(new RegExp(/splash[0-9]+$/))) : '';
	obj_text = document.createTextNode(splash_titles[splash_id]);
	obj_description.appendChild(obj_text);
	//obj_description.appendChild('');

	//Resize le fond si l'image est trop grande
	array_page_size = getPageSize();
	total_width = margin_left+parseInt(obj_content.style.width)+margin_right;
	if (total_width > array_page_size[0]) { obj_splash_screen.style.width = total_width+'px'; obj_content.style.left = margin_left+'px'; obj_title.style.left = margin_left+'px'; };
	total_height = margin_top+parseInt(obj_content.style.top)+parseInt(obj_image.height)+parseInt(obj_title.offsetHeight)+margin_bottom;
	if (total_height > array_page_size[1]) { obj_splash_screen.style.height = total_height+'px'; };

	//Initialise la navigation si l'image fait partie d'un groupe
	ini_nav(a);
}

// -----------------------------------------------------------------------------------
//  Affiche la navigation si l'image fait partie d'un groupe
function ini_nav(a) {
	clearTimeout(slide_timeout);
	obj_title = document.getElementById('title_content');

	//Check si l'image fait partie d'un groupe
	rel_attr = new String(a.getAttribute('rel'));
	val = rel_attr.replace(rel_value+'|', '');

	if (splash_groups[val] && document.getElementById('splash_img')) {
		//Création de l'objet splash_previous
		obj_previous = document.createElement('a');
		obj_previous.setAttribute('id', 'splash_previous');
		obj_previous.setAttribute('title', 'Jump to the previous image');
		obj_previous.onmouseover = function() { obj_previous.className = 'over'; }
		obj_previous.onmouseout = function() { obj_previous.className = ''; }
		obj_previous.onclick = function() { splash_previous(); }
		obj_title.appendChild(obj_previous);
        obj_previous.style.zIndex = z_index_mini+6;

		//Création de l'objet splash_next
		obj_next = document.createElement('a');
		obj_next.setAttribute('id', 'splash_next');
		obj_next.setAttribute('title', 'Jump to the next image');
		obj_next.onmouseover = function() { obj_next.className = 'over'; }
		obj_next.onmouseout = function() { obj_next.className = ''; }
		obj_next.onclick = function() { splash_next(); }
		obj_title.appendChild(obj_next);
        obj_next.style.zIndex = z_index_mini+6;

		//Création de l'objet slide_play
		var obj_play = document.createElement('a');
		if (!is_sliding) {
			obj_play.setAttribute('id', 'splash_play');
			obj_play.setAttribute('title', 'Start the slide');
		}
		else {
			obj_play.setAttribute('id', 'splash_pause');
			obj_play.setAttribute('title', 'Pause the slide');
		}
		obj_play.onclick = function() { splash_pause(); }
		obj_play.onmouseover = function() { obj_play.className = 'over'; }
		obj_play.onmouseout = function() { obj_play.className = ''; }
		obj_title.appendChild(obj_play);
        obj_play.style.zIndex = z_index_mini+6;

		//
		if (is_sliding) { slide_timeout = window.setTimeout(splash_next, slide_timeout_value); }
	}
}

// -----------------------------------------------------------------------------------
// To previous image
function splash_previous() {
	current_position = (current_position-1 < 0) ? splash_groups[current_group].length-1 : current_position-1;
	splash_image(splash_as[splash_groups[current_group][current_position]]);
}

// -----------------------------------------------------------------------------------
// To next image
function splash_next() {
	current_position = (current_position+1 == splash_groups[current_group].length) ? 0 : current_position+1;
	splash_image(splash_as[splash_groups[current_group][current_position]]);
}

// -----------------------------------------------------------------------------------
// Pause the slide (ou pas)
function splash_pause() {
	if (!is_sliding) {
		is_sliding = true;
		document.getElementById('splash_play').setAttribute('id', 'splash_pause');
		document.getElementById('splash_pause').setAttribute('title', 'Pause the slide');
		current_position = (current_position == splash_groups[current_group].length) ? 0 : current_position;
		slide_timeout = window.setTimeout(splash_next, slide_timeout_value/4);
	}
	else {
		is_sliding = false;
		document.getElementById('splash_pause').setAttribute('id', 'splash_play');
		document.getElementById('splash_play').setAttribute('title', 'Start the slide');
		clearTimeout(slide_timeout);
	}
}

// -----------------------------------------------------------------------------------
// Notification d'action
function notification() {
	clearTimeout(slide_timeout_notification);
	obj_content = document.getElementById('image_content');
	if (!document.getElementById('splash_notification')) {
		//Création du petit icone playing/paused
		obj_slide = document.createElement('a');
		obj_slide.setAttribute('id', 'splash_notification');
		obj_slide.setAttribute('title', 'Sliding (ou pas)');
		obj_content.appendChild(obj_slide);
        obj_slide.style.zIndex = z_index_mini+6;
		obj_slide.style.top = (parseInt(obj_content.style.height)/2)-25+'px'; //25 car largeur de l'image play/pause divisée par 2
		obj_slide.style.left = (parseInt(obj_content.style.width)/2)-25+'px'; //25 car hauteur de l'image play/pause divisée par 2
		obj_slide.style.width = '50px'; // 50 largeur de l'image play/pause
		obj_slide.style.height = '50px'; // 50 hauteur de l'image play/pause
	}
	else {
		obj_slide = document.getElementById('splash_notification');
	}
	if (is_sliding) {
		obj_slide.className = 'playing';
	}
	else {
		obj_slide.className = 'paused';
		slide_timeout_notification = setTimeout(splash_notification_bye, 2000);
	}
}

// -----------------------------------------------------------------------------------
// Slide notification
function splash_notification_bye() {
	if (document.getElementById('image_content')) {
		obj_content = document.getElementById('image_content');
		obj_content.removeChild(document.getElementById('splash_notification'));
	}
	clearTimeout(slide_timeout_notification);
}

// -----------------------------------------------------------------------------------
// Au revoir Splash
function splash_bye() {
	clearTimeout(slide_timeout);
	clearTimeout(slide_timeout_notification);
	is_sliding = false;
	obj_body = document.getElementsByTagName('body').item(0);
	obj_body.removeChild(document.getElementById('splash_screen'));
	obj_body.removeChild(document.getElementById('image_content'));
	if (document.getElementById('title_content')) { obj_content.removeChild(document.getElementById('title_content')); }
	//On réaffiche les éléments embed et object
    hide_and_show('visible');
}

// -----------------------------------------------------------------------------------
// Check la touche clavier enfoncé
function key_check(e) {
	if (document.getElementById('splash_img')) {
		clearTimeout(slide_timeout);
		what = (e == null) ? event.keyCode : e.which;
		if (in_array(new Array(27, 38, 46, 88), what) >= 0) { //Esc, Suppr, flèche haut, x
			splash_bye();
			return false;
		}
		if (splash_groups[current_group]) {
			if (in_array(new Array(13, 32, 40), what) >= 0) { //Entrée, espace, flèche bas
				splash_pause();
				notification();
				return false;
			}
			if (in_array(new Array(33, 37, 109), what) >= 0) { // Page Up , flèche gauche, -
				splash_previous();
				return false;
			}
			if (in_array(new Array(34, 39, 107), what) >= 0) { // Page Down, flèche droite, +
				splash_next();
				return false;
			}
		}
	}
}

// -----------------------------------------------------------------------------------
// Cache/Affiche les éléments de type Embed/object
function hide_and_show(todo){
	for (i=0; i<objects_2_hide.length; i++) { objects_2_hide[i].style.visibility = todo; }
}

// -----------------------------------------------------------------------------------
// Initialise les liens concernés
function ini_splash_images() {
    //On récupère les objets à cacher
	objs = document.getElementsByTagName('object');
	for (i=0; i<objs.length; i++) {
	    if (objs[i].style.visibility == 'visible' || objs[i].style.visibility == '') { objects_2_hide[objects_2_hide.length] = objs[i]; }
    }
	objs = document.getElementsByTagName('embed');
	for (i=0; i<objs.length; i++) {
	    if (objs[i].style.visibility == 'visible' || objs[i].style.visibility == '') { objects_2_hide[objects_2_hide.length] = objs[i]; }
    }

	splash_groups = new Array();
	splash_as = new Array();
	splash_titles = new Array();
	as = document.getElementsByTagName('a');
	for (i=0; i<as.length; i++) {
		a = as[i];
		rel_attr = new String(a.getAttribute('rel'));
		if (rel_attr.match('splash.image')) { rel_attr = rel_attr.replace('splash.image', 'splash'); a.setAttribute('rel', rel_attr); }
		if (lightbox_replace && rel_attr.match('lightbox')) {
            rel_attr = rel_attr.replace('lightbox', 'splash');
            rel_attr = rel_attr.replace('splash[', 'splash|');
            rel_attr = rel_attr.replace(/]$/, '');
            a.setAttribute('rel', rel_attr);
        }
		rel_attr = new String(a.getAttribute('rel'));
		if (rel_attr.match('splash')) {
			splash_id = 'splash'+i;
			klass = (a.getAttribute('class')) ? a.getAttribute('class')+' '+splash_id : splash_id;
			a.setAttribute('class', klass);
			a.onclick = function () { splash_image(this); return false; }
			val = rel_attr.replace(rel_value+'|', '');
			if (val != rel_value) {
				var array = (!splash_groups[val] || typeof splash_groups[val] != 'object') ? new Array() : splash_groups[val];
				array.push(splash_id);
				splash_groups[val] = array;
			}
			splash_as[splash_id] = a;
			var array = (typeof splash_ids[val] == 'object') ? splash_ids[val] : new Array();
			array.push(splash_id);
			splash_ids[val] = array;
			splash_titles[splash_id] = (a.getAttribute('title')) ? a.getAttribute('title') : 'Image '+i;
		}
	}
	// -----------------------------------------------------------------------------------
	// On lance le check de la touche clavier enfoncée
	document.onkeydown = key_check;
	if (splash_auto_start) { splash_image(splash_as[splash_ids[splash_auto_start_group][splash_auto_start_rank]]); }
}

// -----------------------------------------------------------------------------------
//
// Fonctions annexes
//
// -----------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
// Code by Lokesh Dhakar
function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}

// -----------------------------------------------------------------------------------
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Code by Lokesh Dhakar
// Edit for Firefox by pHaez
//
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

// -----------------------------------------------------------------------------------
// Core code from - quirksmode.org
function addEvent(obj, evType, fn, useCapture){
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, useCapture);
		return true;
	}
	else if (obj.attachEvent){
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else {
		alert("Handler could not be attached");
	}
}

// -----------------------------------------------------------------------------------
//  Check si val est présent dans le tableau ar
// Last update 2007-04-03
// Code by Xuan NGUYEN
function in_array (ar, val) {
	if (ar.length == 0) { return -1; }
	for (i=0; i<ar.length; i++) { if (ar[i] == val) { return i; } }
	return -1;
}

// +------------------------------------------------------------------------+
// + isie()
// +------------------------------------------------------------------------+
function isie() {
	if (navigator.appName == 'Microsoft Internet Explorer') {
		var reg_exp = new RegExp('MSIE [0-9]*.[0-9]*', 'gi');
		var str = new String(navigator.appVersion);
		var result = new String(str.match(reg_exp));
		var array_version = result.split(' ');
		var version = array_version[1];
		return version;
	}
	else {
		return false;
	}
}

//Lance l'ini au chargement de la page
addEvent(window, 'load', ini_splash_images);
