/* javascript by alex boussinet <alex.boussinet at gmail dot com> 2009 */
var cycle = 1;
function init_page() {
    for (var i=0; i<arguments.length; i++)
        $('<img />').attr('src', arguments[i]).load(function () {
            var preloader = $('#preloader');
            if ($('img', preloader).length == 0) {
                $('#slideshow').css('backgroundImage', 'url('+$(this).attr('src')+')');
                setInterval(function () {
                    var images = $('#preloader img');
                    if (images.length < 2) return;
                    $('#slideshow').fadeOut('normal', function() {
                        $('.box, .content').css('backgroundColor', 'transparent');
                        $(this).css('backgroundImage', 'url('+$(images[cycle++]).attr('src')+')').fadeIn('slow');
                        cycle %= images.length;
                    });
                }, 10000);
            }
            preloader.append(this);
        });
}
function domReady(){
    this.n=typeof this.n == 'undefined' ? 0 : this.n + 1;
    if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null||document.body != null))
        init_page('img/visuelsite01.jpg', 'img/visuelsite02.jpg', 'img/visuelsite03.jpg');
    else if (this.n < 60)
        setTimeout('domReady()', 250);
};
domReady();
