//<!--[CDATA[

window['css_rules'] = document.styleSheets[0].cssRules;
window['aig'] = new Array(428, 49);
window['rotate'] = 0;

window['opacity'] = 1;

if (!css_rules) {
	setRule(14, "display", "none");
}

function page(num) {

	var pdp = document.getElementById("pdp");
	
	pdp.style.position = "fixed";
	pdp.style.top = "";
	pdp.style.left = "7px";
	pdp.style.bottom = "-14px";
	pdp.style.width = "auto";
	
	var pIm = pdp.getElementsByTagName("a")[0].getElementsByTagName("img")[0];
	
	pIm.style.position = "static";
	pIm.style.top = "";
	pIm.style.width = "64px";
	
	
	
	if (num == null || num == "accueil" || num == "") {
		page_accueil();		
	}
	else {
		var pdp = document.getElementById("pdp");
		pdp.parentNode.removeChild(pdp);
		setRule(1, "position", "absolute");
		setRule(1, "top", "0px");
		setRule(1, "right", "0px");
		var img = document.getElementById("or");
		img.style.border="0";
		img.src = locate("img","logo","image","");
		var link = document.getElementById("link");
		if (num == "table_mat") {
			img.title = "Accueil";
			img.alt = "Accueil";
			link.href = "?page=accueil";
			pageOne();
		}
		else {
			if (!document.gal) {
				document.gal = new Array();
			}
			if (!document.gal[0]) {
				document.gal[0] = new Image();
				document.gal[1] = new Image();			
				document.gal[0].src = locate("img", "gal", "image", "");
				document.gal[1].src = locate("img", "hoverG", "image", "");
			}
		
			/*img.title = "Accueil";
			img.alt = "Accueil";
			link.href = "?page=table_mat";
			diapo(num);	*/	
		}
	}	
}

function diapo(num) {


	if (!document.gal) {
		document.gal = new Array();
	}
	if (!document.gal[0]) {
		document.gal[0] = new Image();
		document.gal[1] = new Image();			
		document.gal[0].src = locate("img", "gal", "image", "");
		document.gal[1].src = locate("img", "hoverG", "image", "");
	}



	var rep = "part/"+num;
	//alert(rep);						
	var wid = 0;
	var xhr_object = null;
	var xhr_object1 = null;
	//var bkg = locate(rep, "pre", "image", "");
	var div2 = document.getElementById("all");
	
	
	var divImg = document.getElementById("preambuleImg");
	
	//divImg.style.cssFloat = "left";
	divImg.style.cssFloat = "left";
	
	var img = divImg.getElementsByTagName("img")[0];
	
	
	var blocSign = document.getElementById("sign");
	var signature = blocSign.getElementsByTagName("img")[0];
	
	
	var divTxt = document.getElementById("preambuleTxt");
	
	
	
	var divAbs = document.createElement("div");
	var gal = document.createElement("img");
	
	
	if (!document.loading) {
		document.loading = new Image();
		document.loading.src = "img/loading.gif";
	}
	gal.src = document.loading.src;
	gal.alt = gal.title = "Merci de patienter... Chargement en cours";
	
	
	
	var left = 0;
	var top = 0;
	var actualDiapo = null;
	
	
	divAbs.className = "gal";
	divAbs.appendChild(gal);
	//div2.appendChild(divAbs);
	
	/*img.style.border="0";
	img.src = bkg;
	img.title = "";
	img.alt = "";*/
	/*img.oncontextmenu = function() {
		return false;
	}*/
	
	//divImg.appendChild(img);
	/*var loupeCont = document.createElement("div");
	loupeCont.className = "loupe";*/
	var loupe = document.getElementById("loupe");
	//loupe.appendChild(document.createTextNode("pouet"));
	
	/*loupe.onclick = function() {
		window['rotate'] = (window['rotate']+90)%360;
		var rot = window['rotate'];
		setRule(9, "-moz-transform", "rotate("+rot+"deg)");
		setRule(9, "-webkit-transform", "rotate("+rot+"deg)");
		setRule(9, "-o-transform", "rotate("+rot+"deg)");
		
		setRule(11, "-moz-transform", "rotate("+rot+"deg)");
		setRule(11, "-webkit-transform", "rotate("+rot+"deg)");
		setRule(11, "-o-transform", "rotate("+rot+"deg)");
	};*/
	
	
	//div2.appendChild(divTxt);

	
	if(window.XMLHttpRequest) {// Firefox
		//xhr_object = new XMLHttpRequest();
		xhr_object1 = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {// Internet Explorer
		//xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		xhr_object1 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	/*if (xhr_object != null) {		
		xhr_object.open("GET", locate(rep, "pre", "image", "1"), true);		
		xhr_object.send(null);
	}
	else {	
		wid = page_x_style("410,547", img);
	}*/
	
	if (img.width == 0) {
		img.style.display = "none";
		var interval = null;
		interval = setInterval(function() {
			if (img.width > 0) {
				img.style.display = "inline";
				clearInterval(interval);
			}
		},
		50);
	}
	
	
	/*var xhr_menu = null;						
	if(window.XMLHttpRequest) {// Firefox
		xhr_menu = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {// Internet Explorer
		xhr_menu = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xhr_menu != null) {
		xhr_menu.open("GET", getList("part", "dir", "", "name"), true);
		xhr_menu.send(null);							
	}
	xhr_menu.onreadystatechange = function() {					
		if(xhr_menu.readyState == 4) {
			var cont = document.getElementById("big");
			//setRule(4, "padding-right", "100px");
			createMenu(xhr_menu.responseText.split(","), cont, rep.substring(5));
			cont.style.zIndex = 30;
		}
	}
	*/
	
	
	/*if (xhr_object1 != null) {		
		xhr_object1.open("GET", locate(rep, "pre", "", ""), true);		
		xhr_object1.send(null);
	}	
	
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			var rap = page_x_style(xhr_object.responseText, img, 0, 0.33*window.screen.availWidth);
		}
	};
	xhr_object1.onreadystatechange = function() {
		if(xhr_object1.readyState == 4) {*/
	/*var colonne = document.createElement("div");
	divTxt.appendChild(colonne);*/
	//divTxt.style.marginBottom = "55px";

	//document.getElementById("PP").getElementsByTagName("span")[0].style.color = "white";

	var colonne = document.getElementById("colonne");

	colonne.style.width = "10%";
	colonne.style.position = "absolute";
	colonne.style.right = "0px";

	colonne.style.zIndex = "0";

	colonne.style.background = "url('img/plaquette_f.png')";
	//colonne.style.backgroundPosition = "";

	/*var txtBrut = xhr_object1.responseText;			
	var txtBruts = txtBrut.split("<p>");
	txtBrut = txtBruts[0];
	var ind = txtBrut.indexOf("<html>");*/
	var surTxt = document.getElementById("surTxt");
	/*surTxt.className = "t1";
	while (ind != -1) {				
		surTxt.appendChild(document.createTextNode(txtBrut.substring(0,ind).replace(/<>/g,"<br/>")));
		//surTxt.appendChild(document.createElement("br"));
		txtBrut = txtBrut.substring(ind+6);
		ind2 = txtBrut.indexOf("</html>");
		txtHTML = txtBrut.substring(0, ind2);

		var spt = document.createElement("span");
		spt.innerHTML += txtHTML;
		surTxt.appendChild(spt);

		txtBrut = txtBrut.substring(ind2+7);
		ind = txtBrut.indexOf("<html>");
	}
	surTxt.innerHTML += txtBrut.replace(/<>/g,"<br/>");
	divTxt.appendChild(surTxt);*/




	//if (txtBruts.length > 1) {
		var ssTxt = document.getElementById("ssTxt");
		/*ssTxt.className = "t2";
		ssTxt.appendChild(divImg);
		divImg.style.position = "relative";
		var txtBrut = txtBruts[1];
		var ind = txtBrut.indexOf("<>");
		var ind2 = txtBrut.indexOf("<html>");

		var bal = (ind == -1 || (ind2 != -1 && ind2 < ind)) ? "html" : "<>";
		ind = (ind == -1 || ind2 != -1 && ind2 < ind) ? ind2 : ind;

		while (ind != -1) {
			ssTxt.appendChild(document.createTextNode(txtBrut.substring(0,ind)));
	

	
			if (bal == "<>") {
				ssTxt.appendChild(document.createElement("br"));
				txtBrut = txtBrut.substring(ind+2);
			}
			else {
				if (txtBrut.indexOf("</html>") == -1) {
					ssTxt.appendChild(document.createElement("br"));
		
					var err = document.createElement("span");
					err.className = "error";
					err.appendChild(document.createTextNode("Erreur dans la structure des données, balise </html> manquante dans le fichier texte de '" + num + "'."));
		
					ssTxt.appendChild(err);
					ssTxt.appendChild(document.createElement("br"));
					txtBrut = txtBrut.substring(ind+6);
				}
				else {
					var ind2 = txtBrut.indexOf("</html>");
					var htm = document.createElement("span");
			
					//alert(txtBrut.substring(ind+6,ind2));
			
					htm.innerHTML = txtBrut.substring(ind+6,ind2);
		
					ssTxt.appendChild(htm);
					txtBrut = txtBrut.substring(ind2+7);
				}
			}
	
			ind = txtBrut.indexOf("<>");
			var ind2 = txtBrut.indexOf("<html>");

			bal = (ind == -1 || (ind2 != -1 && ind2 < ind)) ? "html" : "<>";
			ind = (ind == -1 || (ind2 != -1 && ind2 < ind)) ? ind2 : ind;
		}						
		ssTxt.appendChild(document.createTextNode(txtBrut));
		divTxt.appendChild(ssTxt);
		*/
		ssTxt.insertBefore(divAbs, blocSign);
		divAbs.style.position = "static";

		/*ssTxt.appendChild(blocSign);*/
		//colonne.style.height = (ssTxt.offsetHeight + surTxt.offsetHeight) + "px";
	colonne.style.top = surTxt.offsetHeight + "px";
	colonne.style.backgroundPosition = "100% -" + colonne.style.top;
	colonne.style.backgroundRepeat = "repeat-y";

	var ligne = document.getElementById("ligne");
	ligne.style.position = "relative";
	ligne.style.height = "100px";
	//ligne.style.top = "100px";
	ligne.style.background = "url('img/plaquette_f.png')";
	//document.body.appendChild(ligne);


	var arrondi = document.getElementById("arrondi");
	arrondi.style.position = "absolute";
	arrondi.style.width = "100px";
	//colonne.appendChild(arrondi);
	arrondi.style.height = "100px";

	arrondi.style.background = "url('img/plaquette_f.png')";

	arrondi.style.left = "-100px";

	arrondi.style.backgroundRepeat = "no-repeat";
	//arrondi.style.backgroundPosition = "-" + (907 - colonne.offsetWidth - 100) + "px -" + surTxt.offsetHeight + "px";

	var rond = document.getElementById("rond");
	rond.style.height = "100px";
	//arrondi.appendChild(rond);

	rond.style.background = "url('img/plaquette.jpg')";
	rond.style.backgroundRepeat = "repeat-y";
	rond.style.borderTopRightRadius = "100px";



	var arrondi2 = document.getElementById("arrondi2");
	arrondi2.style.position = "absolute";
	arrondi2.style.width = "100px";
	//ligne.appendChild(arrondi2);
	arrondi2.style.height = "100px";

	//arrondi2.style.background = "url('img/plaquette_f.png')";
	arrondi2.style.background = "url('img/plaquette_f.png')";

	arrondi2.style.right = colonne.offsetWidth + "px";
	arrondi2.style.bottom = "100px";

	arrondi2.style.backgroundRepeat = "no-repeat";
	//arrondi.style.backgroundPosition = "-" + (907 - colonne.offsetWidth - 100) + "px -" + surTxt.offsetHeight + "px";

	var rond2 = document.getElementById("rond2");
	rond2.style.height = "100px";
	//arrondi2.appendChild(rond2);

	rond2.style.background = "url('img/plaquette.jpg')";
	rond2.style.backgroundRepeat = "repeat-y";
	rond2.style.borderBottomRightRadius = "100px";

	/*ligne.style.border = "1px solid red";*/

	var fin = document.getElementById("fin");
	//ligne.parentNode.appendChild(fin);

	fin.style.background = "url('img/plaquette_f.png')";

	redimArrondi(rond, arrondi, colonne, surTxt, ssTxt, ligne, rond2, arrondi2, 0, divAbs, fin);

	/*}
	else {
		div2.appendChild(divImg);
		div2.appendChild(divAbs);
	}*/


	var xhr_list = null;
	if(window.XMLHttpRequest) {// Firefox
		xhr_list = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {// Internet Explorer
		xhr_list = new ActiveXObject("Microsoft.XMLHTTP");
	}			
	if (xhr_list != null) {		
		xhr_list.open("GET", getList(rep+"/img", "file", "png", "name"), true);
		xhr_list.send(null);
	}
	xhr_list.onreadystatechange = function() {
		if(xhr_list.readyState == 4) {
			var photos = xhr_list.responseText;
			if (photos.indexOf("Erreur de listage : le répertoire n'existe pas") != -1) {
				divAbs.parentNode.removeChild(divAbs);
			}					
			photos = photos.split(",");
			var i = 0;
			document.preload = new Array();
			document.max = new Array();
			document.maxLoaded = new Array();
			var nbLoad = 0;				
			for (var x in photos) {						
				document.preload[i] = new Image();
				document.preload[i].onload = function() {
					nbLoad++;
					if (nbLoad == photos.length) {
						if (num.toLowerCase().indexOf("info") == -1) {
							gal.src = document.gal[0].src;
							gal.alt = gal.title = "Accéder à la galerie de photos";
							divAbs.onmouseover = function() {
								gal.src = document.gal[1].src;
							}
							divAbs.onmouseout = function() {
								gal.src = document.gal[0].src;
							}
						}
					}
				}
				var ind = photos[x].lastIndexOf("/");
				var num = photos[x].substring(ind+1, photos[x].length);
				ind = num.lastIndexOf(".");
				num = num.substring(0, ind);
				var loc = locate(rep+"/img", num, "image", "");
		
				//alert(loc);
		
				document.preload[i++].src = loc;
			}
	
			var xhr_def = null;
			if(window.XMLHttpRequest) {// Firefox
				xhr_def = new XMLHttpRequest();							
			}
			else if(window.ActiveXObject) {// Internet Explorer
				xhr_def = new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (xhr_def != null) {												
				xhr_def.open("GET", getList(rep+"/img", "file", "txt", "txt"), true);
				xhr_def.send(null);
			}
			//var hoverImg = false;					
			xhr_def.onreadystatechange = function() {
				if(xhr_def.readyState == 4) {
					var txt = xhr_def.responseText.split(";");							
					var textes = new Array(txt.length);							
					for (y in txt) {
						var texte = txt[y].split("\\");
						var sourc = "";
						var k = 0;
						while (sourc != texte[0] && k<document.preload.length) {									
							if (!textes[k]) {
								sourc = document.preload[k].src;
								var ind = sourc.lastIndexOf("num=");
								sourc = sourc.substring(ind+4, sourc.length);
								ind = sourc.indexOf("&");
								sourc = sourc.substring(0, ind);
							}
							if (sourc != texte[0]) {
								k++;
							}
						}								
						textes[k] = texte[1];
					}
					//alert(txt.length);
			
					gal.style.cssFloat = "left";
			
					gal.onclick = function() {
						img.style.display = "inline-block";
						gal.style.cssFloat = "none";
						//ssTxt.removeChild(divImg);
						//div2.insertBefore(divImg, divTxt);
						surTxt.style.padding = "5px 0px";
						var pn = divAbs.parentNode;
						

						document.documentElement.scrollTop = "0px";						
						document.body.scrollTop = "0px";

						
						if (pn.className == "t2") {
							pn.removeChild(divAbs);
							var diapoCont = document.createElement("div");
							diapoCont.style.textAlign = "center";
							diapoCont.style.marginBottom = "8px";
							diapoCont.id = "dCont";
							pn.insertBefore(diapoCont, pn.firstChild);
							diapoCont.appendChild(divAbs);
					
							pn.style.paddingTop = "0px";
							divAbs.style.borderRadius = "50px";
							divAbs.style.borderTopLeftRadius = "0px";
							divAbs.style.borderTopRightRadius = "0px";
					
							divAbs.style.background = "url('img/plaquette.jpg')";
					
					
					
	//							pn.insertBefore(divAbs, pn.firstChild);
							divAbs.style.position = "relative";
							divAbs.style.left = "0px";
							divAbs.style.right = "0px";
							divAbs.style.display = "inline-block";															
						}
										
			
						divAbs.onmouseover = function() {
							window['opacity'] = 1;								
							if (css_rules) {
								setRule(3, "opacity", "1");
								setRule(3, "-moz-opacity", "1");
							}
							else {
								setRule(3, "filter", "alpha(opacity=100)"); 
							}
							
							var divImg = document.getElementById("preambuleImg");
							
							var img = divImg.getElementsByTagName("img")[0];							
							
							//setRule(6, "float", "");
							/*if (!css_rules) {
								alert("ok");
							}*/
							
							/*if (!css_rules) {
								//alert(document.styleSheets[0].rules[6].cssText);							
								setRule(6, "cssFloat", "");
								setRule(6, "cssFloat", "none");
							}
							else {
								setRule(6, "float", "none");
							}*/
							divImg.style.cssFloat = "";
							divImg.style.cssFloat = "none";
							
							divImg.style.textAlign = "center";
							
							img.style.border = "20px solid #320300";
							img.style.background = "#320300";
							img.style.borderRadius = "10px";
							img.style.boxShadow = "5px 5px 20px black";
							
							
					
						};
						divAbs.onmouseout = function() {								
							if (css_rules) {
								setRule(3, "opacity", "0.99");
								setRule(3, "-moz-opacity", "0.99");
							}
							else {
								setRule(3, "filter", "alpha(opacity=99)"); 
							}
							window['opacity'] = 0.99;
							setTimeout("opacify()", 3000);
						};								
				
						gal.parentNode.removeChild(gal);
						var diapos = new Array();
						var first = 0;
						var last = 0;
						setRule(3, "cursor", "default");
						setRule(3, "bottom", "3px");
						setRule(3, "background-color", "#222222");
						setRule(5, "bottom", "15px");
						page_x_style(img.width+","+img.height, img, 120);
						var x;
						var totalWidth = 175;
						var arrBtn = document.createElement("img");
						var divBtn1 = document.createElement("div");
						divBtn1.className = "flG";
						arrBtn.src = locate("img", "off_btn", "image", "");
						divBtn1.appendChild(arrBtn);
						divAbs.appendChild(divBtn1);
				
						var avBtn = document.createElement("img");
						var num = "off_btn";
				
						var divBtn2 = document.createElement("div");
						divBtn2.className = "flD";
						divBtn2.height = 100;				
				
						divBtn2.appendChild(avBtn);
						divAbs.appendChild(divBtn2);
				
						var all = true;
						var temp;
						for (x = 0; x < document.preload.length; x++) {
							document.max[x] = new Image();
							//document.max[x].src = "";
							document.maxLoaded[x] = false;
							document.max[x].onload = function() {
								var x = 0;										
								for (var i=0; i<document.max.length; i++) {
									x = i;
									if (this.src==document.max[i].src) {
										i = document.max.length;												
									}
								}										
								if (this.src == document.max[x].src) {
									document.maxLoaded[x] = true;
									if (x == actualDiapo) {
										setRule(9, "background-image", "url(\""+document.max[actualDiapo].src+"\")");
									}
								}
							};
							/****  MOVED ****/
													
					
							diapos[x] = document.preload[x];
							diapos[x].id = "diapo_" + x;						
							var rap = 100/diapos[x].height;
							var sp = document.createElement("span");
							diapos[x].width = rap*diapos[x].width;
							diapos[x].height = 100;
							totalWidth+= diapos[x].width;
							sp.className = "info";
							sp.appendChild(diapos[x]);
							divAbs.appendChild(sp); /*****/
							if (totalWidth<window.screen.availWidth-350) {
								temp = totalWidth;
								diapos[x].className = "visible";
								last = x;
							}
							else {
								all = false;
								diapos[x].className = "invisible";
							}
					
							var diapo = document.getElementById("diapo_" + x);															
							var info = document.createElement("div");
							info.className = "pop";									
							sp.appendChild(info);
							//alert(textes[x]);
							info.innerHTML = textes[x];
					
							diapo.parentNode.onmouseout = function() {
								var popd = this.getElementsByTagName("div")[0];
								popd.className = "pop";
							};
					
							diapo.onmouseover = function() {				
								
								setTimeout(divAbs.onmouseover, 1);
								
								
								var popd = this.parentNode.getElementsByTagName("div")[0];
								if (window["popd"] && window["popd"] != popd) {
									window["popd"].className = "pop";
								};
								
								popd.className = "pop pop2";
								window["popd"] = popd;
					
								actualDiapo = this.id.substring(6);
								for (var i = first; i<last+1; i++) {
									if (diapos[i].className == "visibleOne") {
										diapos[i].className = "visible";
										diapos[i].onmousemove = null;
									}
								}	
								this.className = "visibleOne";
								/*this.onmousemove = function(event) {
									//alert(event.clientX + "," + event.clientY);
								}*/
								var pretxt = document.getElementById("preambuleTxt");
								var prel = document.preload[actualDiapo];
								
								var img = document.getElementById("preambuleImg").getElementsByTagName("img")[0];
								img.src = prel.src;
								
								
						
								setRule(9, "background-image", "url(\""+document.max[actualDiapo].src+"\")");
								page_x_style_big(prel.width + "," + prel.height, img, img.parentNode.parentNode);
								//setRule(6, "border", "4px #332222");
								//setRule(6, "border-style", "solid dotted none");
								left = (window.screen.availWidth-115-img.width)/2;
								top = (window.screen.availHeight-120-215-img.height)/2;
								if (left < 0) {
									left = 0;
								}
								if (top<0) {
									top = 0;
								}
								setRule(6, "text-align", "center");										
								setRule(6, "float", "none");
								setRule(6, "margin-top", "16px");
						
						
						
								
								
						
								var ssTxt = document.getElementById('ssTxt');
								ssTxt.style.overflow = "visible";
						
								var da = divAbs;
								if (divAbs.parentNode.id == "dCont") {
									da = da.parentNode;
								}
								
								var dainn = da.innerHTML;
								var diviminn = divImg.innerHTML;
								
								
								var sscn = ssTxt.childNodes;
								
								while (sscn.length > 2) {
									for (var i = 0; i < sscn.length; i++) {
										ssTxt.removeChild(sscn[i]);
									}
									ssTxt.appendChild(da);
									ssTxt.appendChild(divImg);
									sscn = ssTxt.childNodes;
								}
								//alert(document.getElementById("preambuleImg").innerHTML);
						
								if (!document.getElementById("bG")) {
									var bG = document.createElement("span");
									bG.id = "bG";
									//document.getElementsByTagName("body")[0].getElementsByTagName("div")[0].appendChild(bG);
							
									//alert(ssTxt.firstChild.id);
									da.appendChild(bG);
							
									var loupeSet = document.createElement("div");
									var imgls = document.createElement("img");
									imgls.src = locate("img", "set_LoupeCarree", "image", "");
									setLoupe("carrée");
									imgls.onmouseover = function() {
										this.src = this.src.replace("set", "setHover");
										if (!this.alt) {
											this.alt = this.title = "Utiliser la loupe " + getLoupe();
										}
									};
									imgls.onmouseout = function() {
										this.src = this.src.replace("setHover", "set");
									};
									imgls.onclick = function() {
										var gl = getLoupe();												
										var listr = new Array("border-radius", "-moz-border-radius", "-webkit-border-radius", "khtlm-border-radius");
										if (!gl ||(gl && gl == "carrée")) {
											for (var i = 0; i<listr.length; i++) {
												setRule(9, listr[i], "0%");
											}						
											setLoupe("ronde");
										}
										else {
											for (var i = 0; i<listr.length; i++) {
												setRule(9, listr[i], "50%");
											}
											setLoupe("carrée");
										}
										this.alt = this.title = "Utiliser la loupe " + getLoupe();
										if (gl == "ronde") {
											this.src = this.src.replace("Ronde", "Carree");
										}
										else {
											this.src = this.src.replace("Carree", "Ronde");
										}
									}
									loupeSet.appendChild(imgls);
									bG.appendChild(loupeSet);
							
								}
								else {
									var bG = document.getElementById("bG");
								}
								if (!document.getElementById("comp")) {
									var comp = document.createElement("div");
									comp.id = "comp";
									var compImg = document.createElement("img");
									if (getCompar().indexOf(this.src) != -1) {
										compImg.src = locate("img", "remove_Compare", "image", "");
									}
									else {
										compImg.src = locate("img", "add_Compare", "image", "");
									}
									comp.appendChild(compImg);
									bG.appendChild(comp);
								}
								else {
									var comp = document.getElementById("comp");
									var compImg = comp.firstChild;
								}
								if (getCompar().indexOf(this.src) != -1) {
									compImg.src = locate("img", "remove_Compare", "image", "");
									compImg.alt = "Retirer cette image sauvegardée";
									compImg.title = "Retirer cette image sauvegardée";
								}
								else {
									compImg.src = locate("img", "add_Compare", "image", "");
									compImg.alt = "Sauvegarder pour impression";
									compImg.title = "Sauvegarder pour impression";
								}
								if (getCompar().length > 0 && !document.getElementById("comparateur")) {
									var comparateur = document.createElement("div");
									comparateur.id = "comparateur";
							
							
									var comparImg = document.createElement("img");
									comparImg.src = locate("img", "compare", "image", "");
									comparImg.alt = "Visualiser/imprimer les images sauvegardées";
									comparImg.title = "Visualiser/imprimer les images sauvegardées";
									comparateur.appendChild(comparImg);
									bG.appendChild(comparateur);
									comparateur.onmouseover = function() {
										comparImg.src = comparImg.src.replace("compare", "hover_compare");
									}
									comparateur.onmouseout = function() {
										comparImg.src = comparImg.src.replace("hover_compare", "compare");
									}
									comparateur.onclick = function() {
										setRule(10, "display", "block");
										var compCont = document.getElementById("compCont");
										if (compCont.firstChild) {
											compCont.removeChild(compCont.firstChild);
										}
										var imgBoite = document.createElement("span");
										compCont.appendChild(imgBoite);
										var imgs = getCompar().split(";");
										for (var i=0; i < imgs.length; i++) {
											var previ = document.createElement("img");
											previ.src = imgs[i];
											previ.className = "previ";
											previ.width = 460;
											previ.height = 460;
											imgBoite.appendChild(previ);
											if (previ.src.indexOf("locate") == -1) {
												previ.style.display = "none";
											}
										}
									}
									document.getElementById("compCont").onclick = function() {
										setRule(10, "display", "none");
										var compCont = document.getElementById("compCont");
										if (compCont.firstChild) {
											compCont.removeChild(compCont.firstChild);
										}
									}
								}
								else if (document.getElementById("comparateur")) {
									var comparateur = document.getElementById("comparateur");
									var comparImg = comparateur.firstChild;
								}
								comp.onmouseover = function() {
									compImg.src = compImg.src.replace("_Compare", "Hover_Compare");
								}
								comp.onmouseout = function() {
									compImg.src = compImg.src.replace("Hover_Compare", "_Compare");
								}
						
								comp.onclick = function() {								
									if (compImg.src.indexOf("remove") == -1) {
										if (!document.getElementById("comparateur")) {
											var comparateur = document.createElement("div");
											comparateur.id = "comparateur";
											var comparImg = document.createElement("img");
											comparImg.src = locate("img", "compare", "image", "");
											comparImg.alt = "Visualiser/imprimer les images sauvegardées";
											comparImg.title = "Visualiser/imprimer les images sauvegardées";
											comparateur.appendChild(comparImg);
											bG.appendChild(comparateur);
											comparateur.onmouseover = function() {
												comparImg.src = comparImg.src.replace("compare", "hover_compare");
											}
											comparateur.onmouseout = function() {
												comparImg.src = comparImg.src.replace("hover_compare", "compare");
											}
											comparateur.onclick = function() {
												setRule(10, "display", "block");
												var compCont = document.getElementById("compCont");
												if (compCont.firstChild) {
													compCont.removeChild(compCont.firstChild);
												}
												var imgBoite = document.createElement("span");
												compCont.appendChild(imgBoite);
												var imgs = getCompar().split(";");
												for (var i=0; i < imgs.length; i++) {
													var previ = document.createElement("img");
													previ.src = imgs[i];
													previ.className = "previ";
													imgBoite.appendChild(previ);
													if (previ.src.indexOf("locate") == -1) {
														previ.style.display = "none";
													}
												}
										
											}
											document.getElementById("compCont").onclick = function() {
												setRule(10, "display", "none");
												//var compCont = document.getElementById("compCont");
												if (this.firstChild) {
													this.removeChild(this.firstChild);
												}
											}
										}												
										if (getCompar().indexOf(diapos[actualDiapo].src) == -1) {
											var comparStr = getCompar();
											setCompar(comparStr+diapos[actualDiapo].src+";");
										}
										compImg.src = compImg.src.replace("add", "remove");
										compImg.alt = "Retirer cette image sauvegardée";
										compImg.title = "Retirer cette image sauvegardée";
									}
									else {
										if (getCompar().indexOf(diapos[actualDiapo].src) != -1) {
											var comparStr = getCompar();
											setCompar(comparStr.replace(diapos[actualDiapo].src+";", ""));
										}												
										if (getCompar().length <= 0) {
											bG.removeChild(document.getElementById("comparateur"));
										}
										compImg.src = compImg.src.replace("remove", "add");
										compImg.alt = "Sauvegarder pour impression";
										compImg.title = "Sauvegarder pour impression";
									}
								}
							}
						}
						if (!all) {
							avBtn.className = "pointer";
							num = "av_btn";

						}
						avBtn.src = locate("img", num, "image", "");
						totalWidth = temp;								
						setRule(3, "right", ((window.screen.availWidth-35-totalWidth)/2) +"px");
						arrBtn.onmouseover = function() {
							if (first > 0) {
								arrBtn.src = locate("img", "arrHov", "image", "");
							}
						}
						arrBtn.onmouseout = function() {
							if (first > 0) {
								arrBtn.src = locate("img", "arr_btn", "image", "");
							}
						}
				
						avBtn.onmouseover = function() {
							if (last < diapos.length -1) {
								avBtn.src = locate("img", "avHov", "image", "");
							}
						}
						avBtn.onmouseout = function() {
							if (last < diapos.length -1) {
								avBtn.src = locate("img", "av_btn", "image", "");
							}
						}
				
				
				
						arrBtn.onclick = function() {
							if (first > 0) {
								totalWidth = totalWidth - diapos[last].width + diapos[first-1].width;
								diapos[last].className = "in"+diapos[last--].className;
								diapos[--first].className = diapos[first].className.substring(2);
								setRule(3, "right", ((window.screen.availWidth-35-totalWidth)/2) +"px");
								if (first == 0) {
									arrBtn.src = locate("img", "off_btn", "image", "");
									arrBtn.className = "";
								}
								if (last < diapos.length-1) {
									avBtn.src = locate("img", "av_btn", "image", "");
									avBtn.className = "pointer";
								}
							}
							divAbs.style.backgroundPosition = "-" + divAbs.offsetLeft + "px";
						};
				
						avBtn.onclick = function() {
							if (last < diapos.length -1) {
								totalWidth = totalWidth - diapos[first].width + diapos[last+1].width;	
								diapos[first].className = "in"+diapos[first++].className;
								diapos[++last].className = diapos[last].className.substring(2);
								setRule(3, "right", ((window.screen.availWidth-35-totalWidth)/2) +"px");
								if (last == diapos.length - 1) {
									avBtn.src = locate("img", "off_btn", "image", "");
									avBtn.className = "";
								}
								if (first > 0) {
									arrBtn.src = locate("img", "arr_btn", "image", "");
									arrBtn.className = "pointer";
								}
							}
							divAbs.style.backgroundPosition = "-" + divAbs.offsetLeft + "px";
						};
				
				
					}
			
					divImg.onmousemove = function(event) {
						//if (hoverImg) {
							//alert(event.clientX + "," + event.clientY);
						//}
						//calcul du x reel
						//loupe => bckg-position
				
						if (actualDiapo != null) {
							setRule(8, "display", "block");
							if (!event || event==null) {
								var event = window.event;
							}
							var evX = event.clientX;
							var evY = event.clientY;
					
							/*var xx = evX - left;
							var yy = evY - top -20;
							// MODIF
							*/
							var img = this.getElementsByTagName("img")[0];
					
							var st = document.body.scrollTop || document.documentElement.scrollTop;
							var sl = document.body.scrollLeft || document.documentElement.scrollLeft;
					
							var xx = evX + sl - (img.offsetLeft + this.offsetLeft +20);
							var yy = evY + st - (img.offsetTop + this.offsetTop + this.parentNode.offsetTop +20);
					
					
							var xx0 = xx + img.offsetLeft;
							var yy0 = yy;
							
							//alert(xx + " ; " + yy);

							var widImg = document.max[actualDiapo].width;
							var heiImg = document.max[actualDiapo].height;
					
					
					
							if (document.max[actualDiapo].src == "") {
								var s = document.preload[actualDiapo].src;
								var lio = s.indexOf("/img");
								s = s.substring(0, lio+4) + "/max" + s.substring(lio+4, s.length);
								document.max[actualDiapo].src = s;
							}
					
					
							if (document.maxLoaded[actualDiapo]) {
								setRule(12, "background-image", "none");
								setRule(9, "background-color", "#320300");
							}
							else {
								setRule(12, "background-image", "url(img/loading.gif)");
								setRule(9, "background-color", "transparent");
							}
							var rotate = window['rotate'];									
							var x1 = xx;
							var y1 = yy;
							if (rotate == 90) {										
								xx = y1;
								yy = img.height - x1;
							}
							else if (rotate == 180) {
								xx = img.width - x1;
								yy = img.height - y1;
							}
							else if (rotate == 270) {
								xx = img.width - y1;
								yy = x1;
							}
							//alert("("+ x1 + ","+y1+") ; (" + x +","+y+")");
							//alert(xx + "," +yy);
							//alert(100*xx/img.width + ","+100*yy/img.height);
							var posX = (xx/img.width);								
							posX -= (100/widImg);									
							if (posX > 1) {
								posX = 1;
							}
							posX = posX*widImg*6.25/100;
					
							var posY = (yy/img.height);
							posY -= 100/heiImg;
							if (posY > 1) {
								posY = 1;
							}
							posY = posY*heiImg*6.25/100;
							
							if (isNaN(posX)) {
								posX = 0;
							}
							if (isNaN(posY)) {
								posY = 0;
							}
							
							setRule(9, "background-position",  (-posX)+ "em " + (-posY)+"em");
							
							
							var exit = 0;
							if (xx<0 || xx>img.width || yy<0 || yy>img.height) {
								exit = 2000;
							}
							//alert(loupe.height + "," + loupe.width);
					
							/*setRule(8, "top", (evY-100)*(6.25/100)+"em");
							setRule(8, "left", (evX-100-exit)*(6.25/100)+"em");*/
					
							setRule(8, "top", (yy0-100)*(6.25/100)+"em");
							setRule(8, "left", (xx0-100-exit)*(6.25/100)+"em");
					
						}
						else {
							setRule(8, "display", "none");
						}
					}														
				}
			}															
		}			
	}

}


function setBandeauStyle(nb, tA) {
	setRule(1, "margin-top", nb);
	setRule(1, "text-align", tA);	
	
}

function page_acc_style(taille) {
	
	
	setRule(0, "background-position", "211px 0px");
	var hei = window.screen.availHeight;
	var styleObj;
	var nb = (0.5*(hei-215-taille))+"px";
	//setBandeauStyle(nb, "center");
	setRule(1, "margin", 0);
	setRule(1, "padding", 0);
}

function page_accueil() {

	var rep = "img";
	var num = "index";
	var taille = 0;
	
	document.body.style.minHeight = "500px";
	document.body.style.minWidth = "907px";
	
	var main = document.getElementById("main");
	main.style.background = "url('img/main.png')";
	main.style.backgroundRepeat = "no-repeat";
	main.style.position = "absolute";
	main.style.height = "100%";
	main.style.minHeight = "500px";
	main.style.width = "100%";
	main.style.minWidth = "907px";
	
	var telmob = document.createElement("div");
	var telfix = document.createElement("div");
	
	main.appendChild(telmob);
	main.appendChild(telfix);
	
	var entrez = document.createElement("a");
	entrez.appendChild(document.createTextNode("Entrez dans l'atelier !"));
	entrez.href = "?page=table_mat";
	main.appendChild(entrez);
	
	entrez.style.position = "absolute";
	entrez.style.display = "inline-block";
	
	entrez.style.background = "#320300";
	entrez.style.border = "3px solid white";
	entrez.style.padding = "8px";
	entrez.style.borderRadius = "120px";
	entrez.style.MozBorderRadius = "120px";
	entrez.style.OBorderRadius = "120px";
	entrez.style.KhtmlBorderRadius = "120px";
	
	entrez.title = "Cliquez pour entrer sur le site";
	
	entrez.style.left= "580px";
	entrez.style.top= "280px";
	
	telmob.style.position = "absolute";
	telmob.style.top = "424px";
	telmob.style.left = "607px";
	
	telmob.innerHTML = "06 37 58 42 74";
	telmob.style.cursor = "help";
	telmob.title = "Numéro de téléphone mobile";
	
	telmob.style.fontFamily = "Lindau, Ubuntu, sans-serif";
	telmob.style.fontSize = "0.9em";
	telmob.style.color = "white";
	
	telmob.style.whiteSpace = "nowrap";
	//telmob.style.letterSpacing = "-1px";
	
	telfix.style.position = "absolute";
	telfix.style.top = "461px";
	telfix.style.left = "746px";
	
	telfix.innerHTML = "04 76 91 92 49";
	telfix.style.cursor = "help";
	telfix.title = "Numéro de téléphone fixe";
	
	telfix.style.fontFamily = "Lindau, Ubuntu, sans-serif";
	telfix.style.fontSize = "0.9em";
	telfix.style.color = "white";
	
	telfix.style.whiteSpace = "nowrap";
	//telfix.style.letterSpacing = "-1px";	
	
	var xhr_object = null;
	if(window.XMLHttpRequest) {// Firefox
		xhr_object = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {// Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xhr_object != null) {		
		xhr_object.open("GET", locate(rep, num, "image", "1"), true);
		xhr_object.send(null);
	}
	else {	
		page_acc_style(547);
	}
	
	var div1 = document.getElementById("big");
		
	var img = document.getElementById("or");
	img.style.border="0";
	img.title = "Entrez dans l'atelier !";
	img.src = locate(rep, num, "image", "");
	img.alt = "Entrée de l'atelier";

	var link = document.getElementById("link");
	link.href = "?page=table_mat";

	/*link.appendChild(img);
	div1.appendChild(link);*/
	
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			page_acc_style(xhr_object.responseText.split(",")[1]);
		}
	}
}

function pageOne() {
	
	var wid = 0;
	var xhr_object = null;
	var xhr_object1 = null;	
	if(window.XMLHttpRequest) {// Firefox
		xhr_object = new XMLHttpRequest();
		xhr_object1 = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) {// Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		xhr_object1 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xhr_object != null) {		
		xhr_object.open("GET", locate("img", "AIG", "image", "1"), true);		
		xhr_object.send(null);
	}
	else {	
		wid = page_x_style("907,547", img);		
	}
	
	if (xhr_object1 != null) {
		xhr_object1.open("GET", getList("part", "dir", "", "name"), true);
		xhr_object1.send(null);
	}
	/*else {
		createMenu("Assises,Lampes,Proposition d_assemblage,Tables", div2);
	}*/
	var bkg = locate("img", "AIG", "image", "");	
	var div2 = document.getElementById("all");
	var img = document.createElement("img");
	img.style.border="0";
	img.src = bkg;
	img.title = "";
	img.alt = img.title;
	
	div2.appendChild(img);
	
	if (wid != 0) {
		pageOne_load(wid);
	}
	
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			var rap = page_x_style(xhr_object.responseText, img);		
			pageOne_load(rap);
		}
	}
	xhr_object1.onreadystatechange = function() {
		if(xhr_object1.readyState == 4) {			
			createMenu(xhr_object1.responseText.split(","), div2);
		}
	}
}

function styleImg(img, menuSize) {
	if (window.screen.availHeight-64*(menuSize + 1) < 200) {
		img.width = 32;
		img.height = 32;
	}
	
	img.onmouseout=function() {
		var source = this.src;
		var ind = source.indexOf("btnHover");
		if(ind != -1) {
			this.src = source.substring(0,ind)+"btn"+source.substring(ind+8);
		}
	};
	
	img.onmouseover=function() {
		var source = this.src;
		var ind = source.indexOf("btn_");
		if(ind != -1) {
			this.src = source.substring(0,ind)+"btnHover"+source.substring(ind+3);
		}
	};
}

function createMenu(arrayDir, conteneur, noText) {
	var divMenu = document.createElement("div");
	divMenu.id = "menu";
	arrayDir[arrayDir.length] = "img";
	//arrayDir[arrayDir.length] = "mp3";
	for (x in arrayDir) {	
		var a = document.createElement("a");
		var div = document.createElement("div");
		var img = document.createElement("img");
		var name = arrayDir[x].substring(5);
		
		var nn = name.toLowerCase();
		if (arrayDir[x] == "img") {
			nn = "contact";
		}
		/*else if (arrayDir[x] == "mp3") {
			nn = "zic";
		}*/
		div.id = "part_"+nn;
		div.className = "partMenu";
		if (noText!=name) {
			img.src = locate(arrayDir[x], "btn_", "image", "");
		}
		else {
			img.src = locate(arrayDir[x], "btnActual", "image", "");
		}
		
		if (window.screen.availHeight-64*(arrayDir.length + 1) < 200) {
			img.width = 32;
			img.height = 32;
		}
		a.appendChild(img);
		if (noText==name) {
			a.href = "#";
		}
		else if (name != "") {
			a.href = "?page="+name;
		}
		else if (arrayDir[x] == "img") {
			a.href = "mailto:lateliergzam@orange.fr";
		}
		/*else {
			a.href = "#";
			a.onclick = function() {
				window.open("musique.php", "musique");
			}
		}*/
		img.onmouseout=function() {
			var source = this.src;
			var ind = source.indexOf("btnHover");
			if(ind != -1) {
				this.src = source.substring(0,ind)+"btn"+source.substring(ind+8);
			}
		}
		img.onmouseover=function() {
			var source = this.src;
			var ind = source.indexOf("btn_");
			if(ind != -1) {
				this.src = source.substring(0,ind)+"btnHover"+source.substring(ind+3);
			}
		}
		div.appendChild(a);		
		var t;
		if (noText==name) {
			t = "Vous êtes ici !";
		}
		else if (name != "") {
			while (name.indexOf("_") != -1) {
				name = name.replace("*", "'"); 
			}
			t = "Accéder à la page '" + replaceUs(name) + "'";
		}
		else if (arrayDir[x] == "img") {
			t = "lateliergzam@orange.fr";
		}
		else {
			t = "Et paroles !";
		}
		a.alt = t;
		a.title = t;
		if (name == "" && arrayDir[x] == "img") { name = "Contact";} else if(name == ""){ name="Musique";}
		if (!noText) {
			div.appendChild(document.createTextNode(replaceUs(name)));
		}
		
		divMenu.appendChild(div);
	}
	conteneur.appendChild(divMenu);
	ordreMenu();
}

function ordreMenu() {

	var pre = document.getElementById("part_pre-sentation");
	var aut = document.getElementById("part_autres");
	var inf = document.getElementById("part_informations");
	var cnt = document.getElementById("part_contact");
	
	var divMenu = cnt.parentNode;


	if (pre) {
		var nn = pre.nodeName;	
		divMenu.removeChild(pre);
		divMenu.insertBefore(pre, divMenu.getElementsByTagName(nn)[0]);
	}	
	if (inf) {
		divMenu.removeChild(inf);
		divMenu.appendChild(inf);
		divMenu.removeChild(cnt);
		divMenu.appendChild(cnt);
		if (aut) {
			divMenu.insertBefore(aut, inf);
		}
	}
	else {
		divMenu.removeChild(cnt);
		divMenu.appendChild(cnt);
		if (aut) {
			divMenu.insertBefore(aut, cnt);
		}
	}
	
	
}

function replaceUs(word) {
	
	word = word.replace(/a_/g, "à");
	word = word.replace(/a^/g, "â");
	word = word.replace(/a~/g, "ä");
	
	word = word.replace(/c~/g, "ç");
	
	word = word.replace(/e-/g, "é");
	word = word.replace(/e^/g, "ê");
	word = word.replace(/e_/g, "è");
	word = word.replace(/e~/g, "ë");
	
	word = word.replace(/i^/g, "î");
	word = word.replace(/i~/g, "ï");
	
	word = word.replace(/o^/g, "ô");
	word = word.replace(/o~/g, "ö");
	
	word = word.replace(/u_/g, "ù");
	word = word.replace(/u^/g, "û");
	word = word.replace(/u~/g, "ü");
	
	word = word.replace(/y~/g, "ÿ");
	
	return word.charAt(0).toUpperCase() + word.substring(1);
}

function pageOne_load(rapport) {
	var x, y;
	x = Math.round(aig[0]*rapport);
	y = Math.round(aig[1]*rapport);
	setRule(2, "position", "absolute");
	setRule(2, "top", y-15+"px");
	setRule(2, "left", x+15+"px");
	setRule(2, "text-align", "left");
}

function page_x_style(taille, obj, defH, defW) {
	/*if (!document.styleSheets[0].cssRules) {
		document.styleSheets[0].rules[0].style.backgroundColor = "#0f0f0f";
	}
	else {
		document.styleSheets[0].cssRules[0].style.setProperty("background-color", "#0f0f0f", null);
	}*/
	//setRule(0, "background-color", "#0f0f0f");
	if (defH == undefined) {
		defH = 0;
	}
	if (defW == undefined) {
		defW = 0;
	}	
	var wid, hei;
	taille = taille.split(",");
	wid = taille[0];
	hei = taille[1];
	var widS = window.screen.availWidth-35-defW;
	var heiS = window.screen.availHeight-215-defH;
	var rap = 0;
	if (wid/hei > widS/heiS) {
		obj.width = rap = widS;
		obj.height = widS*hei/wid;		
	}
	else {
		obj.height = heiS;
		obj.width = rap = heiS*wid/hei;
	}
	return rap/wid;
}

function page_x_style_big(taille, obj, cont) {

	/*if (defH == undefined) {
		defH = 0;
	}
	if (defW == undefined) {
		defW = 0;
	}	*/
	var wid, hei;
	taille = taille.split(",");
	wid = taille[0];
	hei = taille[1];
	var widS = 0.9*cont.offsetWidth;
	var heiS = 0.7*window.screen.availHeight;
	var rap = 0;
	if (wid/hei > widS/heiS) {
		obj.width = rap = widS;
		obj.height = widS*hei/wid;		
	}
	else {
		obj.height = heiS;
		obj.width = rap = heiS*wid/hei;
	}
	return rap/wid;
}


function setLoupe(valeur) {
	setCookie("loupe", valeur, 15);
}

function getLoupe() {
	return getCookie("loupe");
}

function setCompar(valeur) {
	setCookie("compar", valeur, 15);
}

function getCompar() {
	return getCookie("compar");
}

function cleanCompar() {
	setCookie("compar", "", -1);
	var bG = document.getElementById("bG");
	bG.removeChild(document.getElementById("comparateur"));
	var comp = document.getElementById("comp");
	var compImg = comp.firstChild;
	compImg.src = compImg.src.replace("remove", "add");
	setRule(10, "display", "none");
	var compCont = document.getElementById("compCont");
	if (compCont.firstChild) {
		compCont.removeChild(compCont.firstChild);
	}
}

function getCookie(nom) {
	var cook = document.cookie +"";
	//alert(cook);
	var deb = cook.indexOf(nom + "=");
	if (deb >= 0) {
		deb += nom.length + 1;		
		var fin = cook.indexOf(";",deb);
		if (fin < 0) {
			fin = cook.length;
		}
		return (unescape(cook.substring(deb,fin)));
	}
	return "";
}

function setCookie(nom, valeur, jours) {
	var expDate = new Date();
	expDate.setTime(expDate.getTime() + (jours * 24 * 3600 * 1000));
	document.cookie = nom + "=" + escape(valeur) + ";expires=" + expDate.toGMTString();
}


function setRule(numRule, nameStyle, value) {
	var styleObj = null;
	if (!css_rules) {
		styleObj = document.styleSheets[0].rules[numRule];
		var ind = nameStyle.lastIndexOf("-");
		//alert(ind);
		if (ind  != -1 && ind!=0) {
			nameStyle = nameStyle.substring(0,ind) + nameStyle.charAt(ind+1).toUpperCase() + nameStyle.substring(ind+2);
		}
		//alert(numRule + "."+nameStyle+" : "+value);
		eval("styleObj.style."+nameStyle+" = value;");
		
		
	}
	else {		
		styleObj = document.styleSheets[0].cssRules[numRule];
		styleObj.style.setProperty(nameStyle, value, null);
		//alert(nameStyle+", "+value+", "+null);
	}
}

function opacify() {
	if (window['opacity'] < 1 && window['opacity'] > 0.06) {
		if (css_rules) {
			setRule(3, "opacity", "" + (window['opacity'] - 0.01));
			setRule(3, "-moz-opacity", "" + (window['opacity'] - 0.01));
		}
		else {
			setRule(3, "filter", "alpha(opacity=" + (100*window['opacity'] - 1) + ")"); 
		}
		window['opacity'] -= 0.01;
		setTimeout("opacify()", 100);
	}
}

function redimPlan(plan, obw) {
	var bw = document.body.offsetWidth;
	if (obw != bw) {
		var w = bw/2;
		var h = Math.round(w*480/640);
		w = Math.round(w);
	
		plan.width = w;
		plan.height = h;
	}
	setTimeout(function() {redimPlan(plan, bw)}, 500);
}


			
function redimArrondi(rond, arrondi, colonne, surTxt, ssTxt, ligne, rond2, arrondi2, bh, divAbs, fin) {
	//colonne.style.height = (ssTxt.offsetHeight + surTxt.offsetHeight) + "px";
	
	colonne.style.height = (ligne.offsetTop - surTxt.offsetHeight) + "px";
	
	//alert(ligne.offsetTop);
	ligne.style.backgroundPosition = "100% -" + ligne.offsetTop + "px";
	
	//alert(document.body.offsetHeight);
	
	colonne.style.top = surTxt.offsetHeight + "px";
	colonne.style.backgroundPosition = "100% -" + colonne.style.top;
	
	//if (ligne.offsetHeight + ligne.offsetTop != document.body.offsetHeight) {
		//ligne.style.top = (document.body.offsetHeight - ligne.offsetHeight) + "px";
		//alert(ligne.offsetTop + " ; "  + document.body.offsetHeight);
	//}
	
	/*if (document.body.offsetHeight != bh) {
		document.body.removeChild(ligne);
		document.body.appendChild(ligne);
		var bh = document.body.offsetHeight;
	}*/
	
	//document.body.style.height = (ligne.offsetTop + ligne.offsetHeight) + "px";

	arrondi.style.backgroundPosition = "-" + (907 - colonne.offsetWidth - 100) + "px -" + surTxt.offsetHeight + "px";
	//rond.style.backgroundPosition = "-" + (document.body.offsetWidth - rond.offsetWidth - colonne.offsetWidth) + "px 0px";
	
	rond.style.backgroundPosition = "-" + (document.body.offsetWidth - rond.offsetWidth - colonne.offsetWidth) + "px 0px";
	//ligne.style.top = (document.body.offsetHeight) + "px";
	
	//alert(arrondi2.offsetTop);
	
	arrondi2.style.right = colonne.offsetWidth + "px";
	
	arrondi2.style.backgroundPosition = "-" + (907 - colonne.offsetWidth - 100) + "px -" + (ligne.offsetTop - arrondi2.offsetHeight) + "px";
	rond2.style.backgroundPosition = "-" + (document.body.offsetWidth - rond2.offsetWidth - colonne.offsetWidth) + "px 0px";
	
	divAbs.style.backgroundPosition = "-" + divAbs.offsetLeft + "px top";
	
	if (window.screen.availHeight > fin.offsetHeight + fin.offsetTop) {
		fin.style.height = (window.screen.availHeight - (fin.offsetTop)) + "px";
	}
		fin.style.backgroundPosition = "100% -" + fin.offsetTop + "px";
	
	
	setTimeout(function() { redimArrondi(rond, arrondi, colonne, surTxt, ssTxt, ligne, rond2, arrondi2, bh, divAbs, fin)}, 1000);
}

function locate(rep, num, ext, taille) {	
	var txt = ("./locate.php?rep="+rep+"&num="+num+"&ext="+ext+"&taille="+taille);	
	return txt;
}

function getList(rep, type, ext, retour) {
	var txt = ("./getList.php?rep="+rep+"&type="+type+"&ext="+ext+"&retour="+retour);
	return txt;
}

//]]-->

