﻿// ---------------------------------------------------------------------------------------------------------
// *
// *							Affichage al?atoire pages dans l'iframe + image page d'accueil
// *
// ---------------------------------------------------------------------------------------------------------
var timerID = 0;
var al_pag = 0;

// temps d'attente en secondes entre chaque Flash Info
var temps_att = 8;

// pages du flash info
pages = new Array("1.html","2.html");

// image al?atoire DESACTIV? 
// images aleatoires de la page d'accueil, ex:
// img_acc = new Array("0316-noel.jpg","123.jpg","456.jpg","789.jpg");
// img_acc = new Array("04-02-solde.jpg");


// Lancement d'une page Flash Info au hasard + image d'accueil au hasard
function FlashInfo() {
// image al?atoire DESACTIV? 
// Image d'accueil al?atoire
//	var al_img = Math.floor(Math.random()*img_acc.length); // nb aleatoire entre 0 et nb d'images
//	window.document.images['im_accueil'].src="acc-aff/"+img_acc[al_img];


//	Page Aleatoire au chargement
	al_pag = Math.floor(Math.random()*pages.length); // nb aleatoire entre 0 et nb de pages
//	alert("nb pages : "+pages.length+"\nalea : "+alea+"\n"+"url: acc-actu/"+pages[alea]+".html");
	window.document.flashinfo.location = "acc-actu/"+pages[al_pag];

//	appelle le script de changement auto de flash info
	timerID = setTimeout("ChgtFlashInfo()",temps_att*1000);

}

// Change de page Flash info a intervalle regulier
function ChgtFlashInfo() {

//	alert("al_pages: "+al_pag+"\npage: "+pages[al_pag]+"\nnb pages: "+pages.length);

   if(timerID) {
      clearTimeout(timerID);
      clockID  = 0;
   }
	al_pag++;
	if (al_pag == pages.length) {
		al_pag = 0;
	}
	window.document.flashinfo.location = "acc-actu/"+pages[al_pag];
	timerID = setTimeout("ChgtFlashInfo()", temps_att*1000);

}



// ---------------------------------------------------------------------------------------------------------
// *
// *											Autres fonctions necessaires
// *
// ---------------------------------------------------------------------------------------------------------


// New Image pour les preloads
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

// RollOver
function changeImages() {
	d = document;
	if (d.images) {
		var img;
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			img = null;
			if (d.layers) {img = findElement(changeImages.arguments[i],0);}
			else {img = d.images[changeImages.arguments[i]];}
			if (img) {img.src = changeImages.arguments[i+1];}
		}
	}
}

// Popup
//	Fen?tre cliqu?e en Popup
function OpenPop(id) {
	url='/bou-pop.php?bou='+id;
	window.open(url,id,"width=680, height=260, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no, top=10, left=20");
} // end func OpenPop()