﻿function ChangeCSSBgImg() {
if (!document.getElementById) return false;

var MyElement = "banner" //** Ici le ID de la div ou du TD qui va contenir l'image
var ImgPath = "/images/" //** Le chemin vers tes images

if (!document.getElementById(MyElement)) return false;

var random_images = new Array ();
random_images[0] = "fond_head.png"; //**ici tu remplis le nom de l'image
random_images[1] = "fond_head2.png";
random_images[2] = "fond_head3.png";
random_images[3] = "fond_head4.png";
random_images[4] = "fond_head5.png";
random_images[5] = "fond_head6.png";

var $header = document.getElementById(MyElement);
var $backgroundurl = $header.style.backgroundImage;
var ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")";

if ($backgroundurl != ImgURL) {
$header.style.backgroundImage = ImgURL; 
}

movement = setTimeout("ChangeCSSBgImg()",86400000);
}

/* random number generator */
function rand(n) {
    return ( Math.floor ( Math.random ( ) * n ) );
}

/* Custom onload function */

function addLoadEvent(func) {
    var oldonload = window.onload;
        if (typeof window.onload != 'function') {
        window.onload = func;
        } else {
        window.onload = function() {
    oldonload();
func();
}
}
}

/* trigger onload */

addLoadEvent(ChangeCSSBgImg); 

