﻿LOC.gRub = 7; // rubrique suppliers
LOC.gSsRub = 0; //ssrub Welcome / Bienvenue
LOC.gSsSsRub = undefined; //pas de ssSsrub pour Welcome
var popinsLinks = undefined; //pas de popins pour Welcome;

// Diaporama en background
LOC.initDiapo = function(){
	if(document.getElementById("diaporama")){
		var pathDiapo = gSite + "disability/suppliers/Img/welcome/";
		var imgDiapo_arr = ["fond1.jpg", "fond2.jpg", "fond3.jpg"];
		document.getElementById("diaporama").innerHTML = 
		'<a href="#" class="diapoStop">Stop the slideshow</a>';
		//preload des images
		var preload = new Array();
		for(var i=0; i<imgDiapo_arr.length; i++){
			preload[i] = new Image(10,10);
			preload[i].src = pathDiapo + imgDiapo_arr[i];
		}
		var currDiapo = 0;
		var diapoLink = document.getElementById("diaporama").getElementsByTagName("a")[0];
		var interDiapo;
		//diapoLink.on = false;
		
		diapoLink.onclick = function(){
			if(this.on == false){
				this.on = true;
				LOC.diaporama();
				interDiapo = setInterval(LOC.diaporama, 3000);
				this.className = "diapoStop";
				this.innerHTML = 'Stop the slideshow';
			}
			else{
				this.on = false;
				clearInterval(interDiapo);
				this.className = "diapoPlay";
				this.innerHTML = 'Play the slideshow';
			}
			return false;
		}
		
		LOC.diaporama = function(){
			currDiapo ++;
			if(currDiapo >= imgDiapo_arr.length) currDiapo = 0;
			//document.getElementById("content").style.backgroundImage = "url(" + pathDiapo + imgDiapo_arr[currDiapo] + ")";
			document.getElementById("diapo").firstChild.src = pathDiapo + imgDiapo_arr[currDiapo];
		}
		
		diapoLink.on = true;
		//LOC.diaporama();
		interDiapo = setInterval(LOC.diaporama, 3000);
		this.innerHTML = '<img src="/_en/_ww/html/suppliers/Img/welcome/stop.gif" alt="Stop the slideshow" /> Stop the slideshow';
	}
}
//onload events
//addEvent(window, "load", LOC.initDiapo);
addDOMLoadEvent(LOC.initDiapo);
