
var def_alea=1;
var foto_for = 1;
var foto_sec = 1;


var vit_deb = new Date().getTime();
var tabjr=new Array("Dim","Lun","Mar","Mer","Jeu","Ven","Sam");
var tabmois=new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet", "Août","Sept","Octobre","Nov","Dec");

for (b=1 ; b <= nbre_galerie ; b++) {nbre_photo += noms[b][1];};

			  
function reaffiche() {
var dt = new Date();
var heures = dt.getHours();
if (heures <= 9) heures = "0" + heures;
var minutes = dt.getMinutes();
if (minutes <= 9) minutes = "0" + minutes;
var secondes = dt.getSeconds();
if (secondes <= 9) secondes = "0" + secondes;
var jour=dt.getDay();
var nu=dt.getDate();
var mois=dt.getMonth();
var an = dt.getFullYear();

if (cpt_foto >= vit_alea) {new_photo(); };
 cpt_foto = cpt_foto + 1 ;
 document.getElementById("heure").innerHTML = tabjr[jour] + " " + nu + " "+ tabmois[mois] + " " + an +"<br>" + heures + ":" + minutes + ":" + secondes ;
setTimeout("reaffiche()",1000);
}

function affichage_for() {
 foto_for = foto_for + 1;
if (foto_for >= 4) {foto_for=1 };
window.document.fond_dev_for1.src= "image/formation0"+foto_for+".jpg" ;

setTimeout("affichage_for()",1300);
}

function affichage_sec() {
 foto_sec = foto_sec + 1;
if (foto_sec >= 7) {foto_sec=1 };
window.document.fond_dev_sec1.src= "image/dev_sec_0"+foto_sec+".jpg" ;

setTimeout("affichage_sec()",1500);
}



function new_photo() {

photos=Math.ceil(Math.random() * nbre_galerie) ;
while ( (noms[photos][3]) != 1 ){ 
  photos=Math.ceil(Math.random() * nbre_galerie) ;
}

foto = Math.ceil(Math.random() * (noms[photos][1]));
if (foto < 100) photo_aleatoire = "0" + foto;
if (foto < 10) photo_aleatoire = "0" + photo_aleatoire;
cpt_foto =0 
 if ( cot_gal == 1 && def_alea==1 ) {

document.getElementById("photo_alea").innerHTML = '<a href="#" onClick="agrand_photo(photos,foto,0);"  ><img src="/photo92/'+noms[photos][0]+ '/image/photo_' + photo_aleatoire +'.jpg"  border="0" title="'+ noms[photos][4] +'" align="middle" /></a>' ;}
}


function aff_new_photo() {


 if ( cot_gal == 1 ) {


aff_vit = vit_alea +' secondes';
if (vit_alea <10 && def_alea == 1 ) {document.getElementById("photo_alea1").style.visibility = 'visible';} else {document.getElementById("photo_alea1").style.visibility = 'hidden';aff_vit="maximum";};

	
if (vit_alea >2 && def_alea == 1 ) {document.getElementById("photo_alea3").style.visibility = 'visible';} else {document.getElementById("photo_alea3").style.visibility = 'hidden';aff_vit="minimum";};
        
		 
if (def_alea == 0) {document.getElementById("photo_alea2").innerHTML = '<a href="#" onClick = "def_alea = 1 ;aff_new_photo();" title="démarrage des photos aléatoires" ><img src="/icone/play_20_3.gif" width="20" height="20" border="0"/></a>';aff_vit='arrêté';} else {document.getElementById("photo_alea2").innerHTML = '<a href="#" onClick = "def_alea = 0 ;aff_new_photo();" title="stop" ><img src="/icone/stop_20_3.gif" width="20" height="20" border="0"/></a>';};

document.getElementById("photo_alea4").innerHTML = '<div align="center">défilement <br />' + aff_vit + '</div>';

};
};


function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}

var control = 0;

function flash() {
 if (control == 0){affmess=message;}
  else{
      affmess =' Cliquez ici pour visiter la galerie : " '+ noms [control][4] + '" - Bonne visite';
    };
	 window.status=affmess;
  setTimeout("flash();",50);
}



function agrand_photo(photos,foto,commune) {
	
	window.open('/aff_photo92.php?rep=' + (photos) +'&num=' + foto  + '&ville=' + commune , '_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width=770, height=700');

	
};

function aff_titre(titre) {
   document.write ('<br><table border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#0A347C"><div align="center" class="Style7">'); 
	document.write ('&nbsp;&nbsp;' + titre + '&nbsp;&nbsp;');
   document.write ('</div></td></tr></table><br>'); 	

};
//news
function aff_photo_alea(photos,alignement) {
var foto = Math.ceil(Math.random() * (noms[photos][1]));
if (foto < 100) photo_aleatoire = "0" + foto;
if (foto < 10) photo_aleatoire = "0" + photo_aleatoire;
document.write ('<a href="photo92.php?rep=' + (photos)  + '&num=0&ville=0" onMouseOver = "control= '+ photos + ';return true;" onMouseOut ="control=0;return true;" target="_parent"><img src="photo92/'+noms[photos][0]+ '/image/photo_' + photo_aleatoire +'.jpg"  border="0" title="'+ noms[photos][4] +'" '+alignement+' /></a>');
};