function cont_valider(){
var flag=0;
	for(i=1;i<6;i++){

		document.getElementById("c"+i).style.background="#cccccc";
			if(document.getElementById("c"+i).value==""){
				document.getElementById("c"+i).style.background="#ff8888";
				flag=1;
			}
	}
	
	if(flag==1){
		alert("Les éléments marqués en rouge requièrent une attention particulière");
	}
	else{
		document.forme_contact.submit();
	}
}

function cont_annuler(){

	for(i=1;i<6;i++){

		document.getElementById("c"+i).style.background="#cccccc";
			
	}

	document.forme_contact.reset();
}

//_________________________________________________________________________________________

function test_resa(){
	if(document.getElementById("date").value!=""){
	flag=0;
		for(i=1;i<10;i++){
			id=document.getElementById("c"+i);
			id.style.background="#ffffff";
				if(id.value==""){
					id.style.background="#ffa1a1";
					flag=1;
				}
		}
		
		if(document.getElementById("c9").value<1){
			alert("Attention vous devez préciser le nombre d'adultes ! \n\r There must be at least one adult !");
			flag=1;
		}
		
		if(flag==0){
			document.forme_resa.submit();
		}
		else{
			alert("Tous les champs doivent être remplis \n Please complete all Fields");
		}
	}
	else{
		alert("Choisissez une date d'arrivée dans le calendrier.\r\nSelect a Date in the Calendar to the left."); 
	}
}

//_________________________________________________________________________________________

function voir(n){
	document.getElementById('photo').src=n;
	document.getElementById('cont_photo').style.display="block";
	document.getElementById('fader').style.display="block";
}

function cache(){
	document.getElementById('cont_photo').style.display="none";
	document.getElementById('fader').style.display="none";
	document.getElementById('photo').src="pics/progress.gif";
}

function diaporama(){

	this.cont_diapo=document.getElementById('cont_diapo');
	this.tactile=0;
	this.mode='init';
	this.buffer=0
	
	this.n=0;
	this.oldn=0;
	this.delay=0;
	this.url='';
	
	this.promo=3;
	
	this.sequence= new Array();
	this.sequence_l=0;
	
	id=new Array();
	id[0]=this;
	
	s='';
	s+='<img src="" id="diapo_pic_1" style="position:absolute;top:0px;left:0px;z-index:1;opacity:0;filter:alpha(opacity:0);" onClick="diapo.go()" onLoad="diapo.complete()">' ;
	s+='<img src="" id="diapo_pic_2" style="position:absolute;top:0px;left:0px;z-index:2;opacity:0;filter:alpha(opacity:0);" onClick="diapo.go()" onLoad="diapo.complete()">' ;
	s+='<div id="diapo_tactile" style="width:100%;height:100%;background:#000000;opacity:0;filter:alpha(opacity:0);z-index:5;" onClick="alert(\'ok\')"></div>';
	
	this.cont_diapo.innerHTML=s;
	
	this.pic1=document.getElementById('diapo_pic_1');
	this.pic2=document.getElementById('diapo_pic_2');
	
	this.alpha=new Array();
	this.alpha[0]=0;
	this.alpha[1]=0;
	
	this.pics=new Array();
	this.pics[0]=document.getElementById('diapo_pic_1');
	this.pics[1]=document.getElementById('diapo_pic_2');
	
	//_______________________________________
	
	this.moteur=function(){
		switch(this.mode){
		
			case('init'):
				this.mode='run000';
				this.pic1.style.opacity="0";
				this.pic1.style.filter="alpha(opacity:0)";
				this.pic2.style.opacity="0";
				this.pic2.style.filter="alpha(opacity:0)";
				this.n=Math.round(Math.random()*(this.sequence_l-1));
			break;
			
			case('run000'):
				
				
				this.n+=1;
				
					if(this.n>this.sequence_l){
						this.n=0;
					}
				
				/*this.promo+=1;
				
					if(this.promo==5){
						this.n=0;
						this.promo=0;
					}
				
					if(this.n==this.oldn){
						this.mode='run000';
					}
					else{
						this.mode='run001';
						this.oldn=this.n;
					}*/
				this.mode='run001';
			break;
			
			case('run001'):
			
				this.buffer=1-this.buffer;
				this.pics[this.buffer].style.opacity='0';
				this.pics[this.buffer].style.filter='alpha(opacity:0)';
				this.pics[this.buffer].style.zIndex='3';
				this.buffer=1-this.buffer;
				this.pics[this.buffer].style.zIndex='2';
				this.buffer=1-this.buffer;
				this.mode='run002';
			break;
			
			case('run002'):
				this.mode='w';
				this.delay=this.sequence[(this.n*3)+1];
				this.delay*=1000;
				this.alpha[this.buffer]=0;
				this.url=this.sequence[(this.n*3)+2];
				nom='diapo/'+this.sequence[this.n*3];
				this.pics[this.buffer].src=nom;
			break;
			
			
			case('run003'):
				
				this.alpha[this.buffer]+=10;
					if(this.alpha[this.buffer] > 100){
						this.alpha[this.buffer]=100;
						this.mode='run004';
					}
				this.pics[this.buffer].style.opacity=''+this.alpha[this.buffer]/100;
				this.pics[this.buffer].style.filter='alpha(opacity:'+this.alpha[this.buffer]+')';
			break;
			
			case('run004'):
			
				this.delay-=33;
					if(this.delay<0){
						this.mode='run000';
					}
			break;
			
		}
	}
	
	//_______________________________________
	
	this.charge=function(chaine){
	
		this.sequence=chaine.split('$');
		this.sequence_l=this.sequence.length/3;
		this.sequence_l-=1;
		this.timer=window.setInterval('id[0].moteur()',33);
	}
	
	//_______________________________________
	
	this.off=function(){
		window.clearInterval(this.timer);
	}
	
	//_______________________________________
	
	this.complete=function(){
			
			this.mode='run003';
			
	}

	//_______________________________________
	
	this.go=function(){
		if(this.url !=''){
			window.location.replace(this.url);
		}
	}
}

//_______________________________________

	function test_date(){
		if(document.getElementById("date").value==""){
			alert("Choisissez une date d'arrivée dans le calendrier.\r\nSelect a Date in the Calendar to the left.");
		}
	}

	
	
	