﻿var finAttente = false;
var timer = null;
function afficheAccueil () {
	if (timer) {
		clearTimeout(timer);
	}
	if (finAttente) {
		$('div.contener').show();
		$('img.imagefond').show();
		$('div.attente').hide();
		$('body').css('background-image', 'url(./design/images/body.png)');
	} else {
		finAttente = true;
	}
}

(function() {
    $(document).ready(function() {
        //animation accueuil
        /*$('div.mediaspace').hide();*/
		timer = setTimeout('afficheAccueil()', 5000);
        $('img.imagefond').hide().load(function() {
			if (finAttente) {
				$(this).show();//fadeIn(2000);
				/*$('div.mediaspace').fadeIn(2000);*/
				$('div.contener').show();
				$('div.attente').hide();
				$('body').css('background-image', 'url(./design/images/body.png)');
			} else {
				finAttente = true;
			}
        }).error(function() {
            // notify the user that the image could not be loaded
        }).attr('src', './design/images/accueil.png');
        /*var img = new Image();
        $(img).load(function() {
        $(this).hide();
        $('div.content').append(this);
        $(this).fadeIn(1000);
        var img = new Image();
        $(img).load(function() {
        $(this).hide();
        $('div.content').append(this);
        $(this).css('width', '50px').css('height', '35px').css('left', '47%').css('bottom', '157px').fadeIn();
        $(this).animate({ width: '600px', bottom: '20px', left: '25%', height: '425px' }, 1000, 'swing', function() {
        $('div.mediaspace').fadeIn();
        });
        }).error(function() { }).addClass('tv').attr('src', './design/images/tv.png');
        }).error(function() {
        // notify the user that the image could not be loaded
        }).addClass('imagefond').attr('src', './design/images/fond_formaroc.png');*/
    });
})();