window.addEvent('domready', function(){
	$$('#accueil a').addEvent ('mouseenter', function (){
		
		IndexOver ();
	});
	$$('#accueil a').addEvent ('mouseleave', function (){
		
		stopTimerIndex ();
	});
	$$('#plan a').addEvent ('mouseenter', function (){
		
		AccesOver ();
	});
	$$('#plan a').addEvent ('mouseleave', function (){
		
		stopTimerAcces ();
	});
	$$('#presentation a').addEvent ('mouseenter', function (){
		
		TouriOver ();
	});
	$$('#presentation a').addEvent ('mouseleave', function (){
		
		stopTimerTouri ();
	});
	$$('#tarifs a').addEvent ('mouseenter', function (){
		
		TarifsOver ();
	});
	$$('#tarifs a').addEvent ('mouseleave', function (){
		
		stopTimerTarifs ();
	});
	$$('#album a').addEvent ('mouseenter', function (){
		
		AlbumOver ();
	});
	$$('#album a').addEvent ('mouseleave', function (){
		
		stopTimerAlbum  ();
	});


});



















var nbindexPixels = 0;
var curtonindex;
var timeroverindex;
var timeroutindex;
var isindexend;
function IndexOver (){
	clearInterval (timeroutindex);
	clearInterval (timeroverindex);
	curtonindex =  $$('#accueil a');
	if (isaccesend == false)
		stopTimerAcces ();
	timeroverindex = setInterval("indexmove()",100);
	isindexend = false;

	
}
function indexmove(){
	
		curtonindex.setStyle( 'background-position', "0 "+ nbindexPixels+"px");
		
		nbindexPixels-= 40;
	
	
	
	if (nbindexPixels<=  -200){
		clearInterval(timeroverindex);
		clearInterval(timeroutindex);
		curtonindex.setStyle( 'background-position',"0 -160px");
		nbindexPixels= 0;
	}
}
function indexremove(){
	curtonindex.setStyle( 'background-position',"0 "+ nbindexPixels+"px");
		
		nbindexPixels+= 40;
	
	
	
	if (nbindexPixels== 40){
		clearInterval(timeroutindex);
		clearInterval (timeroverindex);
		curtonindex.setStyle( 'background-position', "0 0");
		nbindexPixels= 0;
		isindexend = true;
	}

}
function stopTimerIndex (){
	isindexend = true;
	clearInterval (timeroverindex);
	clearInterval (timeroutindex);
	curtonindex =  $$('#accueil a');
	curtonindex.setStyle('background-position', "0 -160px");
	nbindexPixels= -160;
	timeroutindex = setInterval("indexremove()",100);
	
}


var nbaccesPixels = 0;
var curtonacces;
var timeroveracces;
var timeroutacces;
var isaccesend;
function AccesOver (){
	clearInterval (timeroutacces);
	clearInterval (timeroveracces);
	curtonacces = $$('#plan a');
	if (isindexend == false)
		stopTimerIndex ();
	if (isaccesend == false)
		stopTimerTouri ();
	timeroveracces = setInterval("accesmove()",100);
	isaccesend = false;

	
}
function accesmove(){
	
		curtonacces.setStyle('background-position', "0 "+ nbaccesPixels+"px");
		
		nbaccesPixels-= 40;
	
	
	
	if (nbaccesPixels<=  -200){
		clearInterval(timeroveracces);
		clearInterval(timeroutacces);
		curtonacces.setStyle('background-position', "0 -160px");
		nbaccesPixels= 0;
	}
}
function accesremove(){
	curtonacces.setStyle('background-position', "0 "+ nbaccesPixels+"px");
		
		nbaccesPixels+= 40;
	
	
	
	if (nbaccesPixels== 40){
		clearInterval(timeroutacces);
		clearInterval (timeroveracces);
		curtonacces.setStyle('background-position', "0 0");
		nbaccesPixels= 0;
		isaccesend = true;
	}

}
function stopTimerAcces (){
	isaccesend = true;
	clearInterval (timeroveracces);
	clearInterval (timeroutacces);
	curtonacces = $$('#plan a');
	curtonacces.setStyle('background-position', "0 -160px");
	nbaccesPixels= -160;
	timeroutacces = setInterval("accesremove()",100);
	
}


var nbtouriPixels = 0;
var curtontouri;
var timerovertouri;
var timerouttouri;
var istouriend;
function TouriOver (){
	clearInterval (timerouttouri);
	clearInterval (timerovertouri);
	curtontouri = $$('#presentation a');
	if (isaccesend== false)
		stopTimerAcces ();
	if (istarifsend == false)
		stopTimerTarifs ();
	timerovertouri = setInterval("tourimove()",100);
	istouriend = false;

	
}
function tourimove(){
	
		curtontouri.setStyle('background-position', "0 "+ nbtouriPixels+"px");
		
		nbtouriPixels-= 40;
	
	
	
	if (nbtouriPixels<=  -200){
		clearInterval(timerovertouri);
		clearInterval(timerouttouri);
		curtontouri.setStyle('background-position', "0 -160px");
		nbtouriPixels= 0;
	}
}
function touriremove(){
	curtontouri.setStyle('background-position',"0 "+ nbtouriPixels+"px");
		
		nbtouriPixels+= 40;
	
	
	
	if (nbtouriPixels== 40){
		clearInterval(timerouttouri);
		clearInterval (timerovertouri);
		curtontouri.setStyle('background-position', "0 0");
		nbtouriPixels= 0;
		istouriend = true;
	}

}
function stopTimerTouri (){
	istouriend = true;
	clearInterval (timerovertouri);
	clearInterval (timerouttouri);
	curtontouri = $$('#presentation a');
	curtontouri.setStyle('background-position', "0 -160px");
	nbtouriPixels= -160;
	timerouttouri = setInterval("touriremove()",100);
	
}
var nbtarifsPixels = 0;
var curtontarifs;
var timerovertarifs;
var timerouttarifs;
var istarifsend;
function TarifsOver (){
	clearInterval (timerouttarifs);
	clearInterval (timerovertarifs);
	curtontarifs = $$('#tarifs a');
	if (istouriend== false)
		stopTimerTouri ();
	if (isalbumend == false)
		stopTimerAlbum ();
	timerovertarifs = setInterval("tarifsmove()",100);
	istarifsend = false;

	
}
function tarifsmove(){
	
		curtontarifs.setStyle('background-position', "0 "+ nbtarifsPixels+"px");
		
		nbtarifsPixels-= 40;
	
	
	
	if (nbtarifsPixels<=  -200){
		clearInterval(timerovertarifs);
		clearInterval(timerouttarifs);
		curtontarifs.setStyle('background-position', "0 -160px");
		nbtarifsPixels= 0;
	}
}
function tarifsremove(){
	curtontarifs.setStyle('background-position', "0 "+ nbtarifsPixels+"px");
		
		nbtarifsPixels+= 40;
	
	
	
	if (nbtarifsPixels== 40){
		clearInterval(timerouttarifs);
		clearInterval (timerovertarifs);
		curtontarifs.setStyle('background-position', "0 0");
		nbtarifsPixels= 0;
		istarifsend = true;
	}

}
function stopTimerTarifs (){
	istarifsend = true;
	clearInterval (timerovertarifs);
	clearInterval (timerouttarifs);
	curtontarifs = $$('#tarifs a');
	curtontarifs.setStyle('background-position', "0 -160px");
	nbtarifsPixels= -160;
	timerouttarifs = setInterval("tarifsremove()",100);
	
}
var nbalbumPixels = 0;
var curtonalbum;
var timeroveralbum;
var timeroutalbum;
var isalbumend;
function AlbumOver (){
	clearInterval (timeroutalbum);
	clearInterval (timeroveralbum);
	curtonalbum = $$('#album a');
	if (istouriend== false)
		stopTimerTouri ();
	timeroveralbum = setInterval("albummove()",100);
	isalbumend = false;

	
}
function albummove(){
	
		curtonalbum.setStyle('background-position', "0 "+ nbalbumPixels+"px");
		
		nbalbumPixels-= 40;
	
	
	
	if (nbalbumPixels<=  -200){
		clearInterval(timeroveralbum);
		clearInterval(timeroutalbum);
		curtonalbum.setStyle('background-position', "0 -160px");
		nbalbumPixels= 0;
	}
}
function albumremove(){
	curtonalbum.setStyle('background-position', "0 "+ nbalbumPixels+"px");
		
		nbalbumPixels+= 40;
	
	
	
	if (nbalbumPixels== 40){
		clearInterval(timeroutalbum);
		clearInterval (timeroveralbum);
		curtonalbum.setStyle('background-position', "0 0");
		nbalbumPixels= 0;
		isalbumend = true;
	}

}
function stopTimerAlbum (){
	isalbumend = true;
	clearInterval (timeroveralbum);
	clearInterval (timeroutalbum);
	curtonalbum = $$('#album a');
	curtonalbum.setStyle('background-position', "0 -160px");
	nbalbumPixels= -160;
	timeroutalbum = setInterval("albumremove()",100);
	
}
var showtimer;
var preshow;
function startshow(){
	showtimer = setInterval ("loadnext()", 5000);

	
}
var prevbool = false;
var nbimg = 1;
var currimg;
function loadnext (){
	currimg = document.getElementById ("Album");
	if (currimg.style.backgroundImage == ""){
		currimg.style.backgroundImage = "url(Files/Images/Album000.jpg)";
		
	}
	

	var nextimg = new Image ();
	var btpause = document.getElementById ("btpause");
	if ((nbimg +1) < 10){
		nextimg.src = "Files/Images/Album00"+(nbimg + 1)+".jpg";
	}else{
		nextimg.src = "Files/Images/Album0"+(nbimg + 1)+".jpg";
	}

		if (nbimg < 10){
			currimg.style.backgroundImage = "url(Files/Images/Album00"+nbimg+".jpg) ";
		}else if (nbimg < 22){
			currimg.style.backgroundImage = "url(Files/Images/Album0"+nbimg+".jpg)";
		}else{
			currimg.style.backgroundImage = "url(Files/Images/Album000.jpg)";
			pause (btpause);
		}

		
		

	
		
	nbimg++;
	

	
}
var isplaying = true;
function pause (img){
	if (img.src.indexOf("pause.jpg") > 0){
		
		img.src = "Files/Images/play.jpg";
		clearInterval (showtimer);
		isplaying = false;
	}else if (img.src.indexOf("play.jpg") > 0){
		img.src = "Files/Images/pause.jpg";
		if (nbimg < 1){
			loadnext ();
			
			showtimer = setInterval ("loadnext()", 5000);
			isplaying = true;
		}else{
			nbimg = 0;
			loadnext ();
			showtimer = setInterval ("loadnext()", 5000);
			isplaying = true;
		}
	}
}

function next(){

	loadnext ();
}

function prev(){
	if (nbimg != 1){
		nbimg --;
		if (nbimg < 10 && nbimg != -1){
			currimg.style.backgroundImage = "url(Files/Images/Album00"+(nbimg - 1)+".jpg)";
		}else if (nbimg < 22 && nbimg != -1){
			currimg.style.backgroundImage = "url(Files/Images/Album0"+(nbimg - 1)+".jpg)";
		}else{
		
		}
	}
}












var slidetimer;
var reslidetimer;
function putslide(){
		slidetimer = setInterval("slide()",50);
	
}
function timereslide(){
	reslidetimer = setInterval ("reslide()",50);

}
var iteration = 0;
var trcurrimg;

function slide(){
	trcurrimg = document.getElementById ("trans");
	if (iteration == 0){
		trcurrimg.src = "Files/Images/AlbumTran.png";
	}else if (iteration < 10){

		trcurrimg.src = "Files/Images/AlbumTran"+(iteration)+"0.png";
	}else if (iteration == 10){
		trcurrimg.src = "Files/Images/AlbumTran00.png";
	}
	if (iteration == 10){
		clearInterval (slidetimer);
		setTimeout ("setopac()", 800);
		
		iteration = 0;
		
	}
	iteration++;
}
var reiteration = 9;
function reslide (){



	trcurrimg.src = "Files/Images/AlbumTran"+(reiteration)+"0.png";
	if (reiteration == 0){
		clearInterval (reslidetimer);
		trcurrimg.src = "Files/Images/AlbumTran.png";
		reiteration = 9;

		if (nbimg == 2)
			preshow = setTimeout ("putslide()", 1000);
		else 
			preshow = setTimeout ("putslide()", 1900);
	}
	reiteration --;
}
	
function setopac(){
	trcurrimg.src = "Files/Images/AlbumTran00.png";
	timereslide ();
}







function showmenu(){
	if (document.getElementById){
		var menu=document.getElementById("menulant");
		menu.style.visibility="visible";
	}
}
function hidemenu(){
	if (document.getElementById){
		var menu=document.getElementById("menulant");
		menu.style.visibility="hidden";
	}
}
function setBlock(divobj){
	if (document.getElementById){
		var link = document.getElementById(divobj);
		link.style.display = "block";
	}
}
function setNone(divobj){
	if (document.getElementById){
		var link = document.getElementById(divobj);
		link.style.display = "none";
	}
}
function GoClic(IDvisite){
	window.location.href="../Stats/Result.php?IDvisite="+IDvisite;
}
function OverSet(tr){
	tr.className="Surb";
}
function UnoverSet(tr,classs){
	tr.className=classs;
}


/*
Fonctionne que sous firefox essyaer document.body.scrollTop pour ie
function GoToScroll(){
	 if (document.getElementById){
		var link=document.getElementById("acclink");
		var menu=document.getElementById("menulant");
		menu.style.zIndex=2;
		menu.style.top=window.pageYOffset+"px";
		link.style.position="absolute";
		link.style.top=window.pageYOffset+"px";
		setTimeout("GoToScroll()",500);
		document.title=window.pageYOffset;
	}
}

*/

function AskForDel(form){
	var Answer=window.confirm("Voulez-vous vraiment supprimer ce paragraphe?");
	if (Answer==true){
		form.submit();
	}
	
}


