<!--
//**************************************************************************************************
// Swap Background
// alizesonline.com - Gilles Gomez - 2008
//**************************************************************************************************

var $dom=(document.getElementById)?true:false;								// DOM compatible
var $nbOfImages=0;
var $imgIndex=0;
var $imgPath=false;
var $newStyle=false;
var $blockObject=false;

//**************************************************************************************************
// Global Variables to be modified if necessary
//**************************************************************************************************

var $tempo=3;												// Time between 2 images (seconds)
var $blockName="topBanner";										// Name of the CSS block
var $imgDir="imagesDesign";										// Directory with the images
var $imgNames=new Array("simplonHomeBanner2.jpg","simplonHomeBanner3.jpg","simplonHomeBanner1.jpg");	// Name of the images


//**************************************************************************************************
//**************************************************************************************************
// Do not modify anything below
//**************************************************************************************************


$nbOfImages=$imgNames.length;										// # of images in the array

$loadImage=new Array;
for(i=0;i<$nbOfImages;i++){										// Preload the images
	$loadImage[i]=new Image();
	$loadImage[i].src=$imgDir+"/"+$imgNames[i];
}


//**************************************************************************************************
// Main function
//**************************************************************************************************
function swapBg(){
	if(!$blockObject) $blockObject=createObject($blockName);					// Creation of the block object
	$imgPath=$imgDir+"/"+$imgNames[$imgIndex];							// Full path of the new background image
	$blockObject.style.backgroundImage="url("+ $imgPath +")";					// Replacement of the background image
	
	$imgIndex++;											// Index increment
	if($imgIndex>($nbOfImages-1)) $imgIndex=0;							// Loop											// Incrémentation du N° d'image
	$swapBgTime=window.setTimeout("swapBg()",$tempo*1000);						// Tempo
}


//**************************************************************************************************
// This function creates the object with a name
//**************************************************************************************************
function createObject(n){
	if($dom) $obj=document.getElementById(n);
	else{
		$obj=false;
		window.alert("Ce site n&eacute;cessite un navigateur r&eacute;cent: Explorer 6 ou Firefox 1.5");
	}
	return $obj;
}
//-->
