var jpo = {

    timer: null,

    init: function () {

        jpo.go(); // Permet de lancer instantanément la première fois l'anim

        jpo.play(); // A partir d'ici c'est en boucle

    },

    go: function () {
		$('#PersoJpo').css({ 'bottom' : '-98px' });
		$('#VenezJpo').css({ 'display' : 'none' });
		$('#DateJpo, #DateJpo2, #DateJpo3').css({ 'left' : '325px', 'color' : '#1f7e8c' });
		$('#HeureJpo, #HeureJpo2, #HeureJpo3').css({ 'bottom' : '-100px' });
		/*$('#dateJpo2').css({ 'left' : '325px', 'color' : '#1f7e8c' });
		$('#HeureJpo2').css({ 'bottom' : '-100px' });*/

        window.setTimeout(function() {
			$('#PersoJpo').stop().animate({ 'bottom' : '0' }, 'fast');
		}, 100);
		
		window.setTimeout(function() {
			$('#VenezJpo').fadeIn();
		}, 500);

		
		window.setTimeout(function() {
			$('#DateJpo').stop().animate({ 'left' : '105px' }, 'fast');
		}, 800);
		
		window.setTimeout(function() {
			$('#HeureJpo').stop().animate({ 'bottom' : '10px' }, 'fast');
		}, 900);
		
		
		window.setTimeout(function() {
			$('#DateJpo2').stop().animate({ 'left' : '325px' }, 'fast');
			$('#HeureJpo2').stop().animate({ 'bottom' : '-100px' }, 'fast');
		}, 200); 
		
		
		window.setTimeout(function() {
			$('#DateJpo').fadeTo('fast', 0.5);
		}, 1500);
		
		window.setTimeout(function() {
			$('#DateJpo').fadeTo('fast', 1);
		}, 1600);
		
		window.setTimeout(function() {
			$('#DateJpo').fadeTo('fast', 0.5);
		}, 1700);
		
		window.setTimeout(function() {
			$('#DateJpo').fadeTo('fast', 1);
		}, 1800);
		
		window.setTimeout(function() {
			$('#DateJpo').stop().animate({ 'left' : '325px' }, 'fast');
			$('#HeureJpo').stop().animate({ 'bottom' : '-100px' }, 'fast');
		}, 4000);  
		
		window.setTimeout(function() {
			$('#DateJpo2').stop().animate({ 'left' : '105px' }, 'fast');
		}, 5000);
		
		window.setTimeout(function() {
			$('#HeureJpo2').stop().animate({ 'bottom' : '10px' }, 'fast');
		}, 5100);
		
		window.setTimeout(function() {
			$('#DateJpo2').fadeTo('fast', 0.5);
		}, 5700);
		
		window.setTimeout(function() {
			$('#DateJpo2').fadeTo('fast', 1);
		}, 5800);
		
		window.setTimeout(function() {
			$('#DateJpo2').fadeTo('fast', 0.5);
		}, 5900);
		
		window.setTimeout(function() {
			$('#DateJpo2').fadeTo('fast', 1);
		}, 6000);
		
		window.setTimeout(function() {
			$('#DateJpo2').stop().animate({ 'left' : '325px' }, 'fast');
			$('#HeureJpo2').stop().animate({ 'bottom' : '-100px' }, 'fast');
		}, 8000);
		
		window.setTimeout(function() {
			$('#DateJpo3').stop().animate({ 'left' : '105px' }, 'fast');
		}, 9000);
		
		window.setTimeout(function() {
			$('#HeureJpo3').stop().animate({ 'bottom' : '10px' }, 'fast');
		}, 9100);
		
		window.setTimeout(function() {
			$('#DateJpo3').fadeTo('fast', 0.5);
		}, 9700);
		
		window.setTimeout(function() {
			$('#DateJpo3').fadeTo('fast', 1);
		}, 9800);
		
		window.setTimeout(function() {
			$('#DateJpo3').fadeTo('fast', 0.5);
		}, 9900);
		
		window.setTimeout(function() {
			$('#DateJpo3').fadeTo('fast', 1);
		}, 10000);
		
		window.setTimeout(function() {
			$('#PersoJpo').stop().animate({ 'bottom' : '-98px' }, 'fast');
			$('#VenezJpo').fadeOut();
			
			$('#DateJpo3').stop().animate({ 'left' : '325px' }, 'fast');
			$('#HeureJpo3').stop().animate({ 'bottom' : '-100px' }, 'fast');
		}, 12000);

    },

    play: function () {
        window.clearInterval(jpo.timer);
        jpo.timer = window.setInterval('jpo.go()', 13000);
    }

}

function openJpoUrl() {
	window.location="nous-rencontrer.php";	
}

$(document).ready(function () {
    jpo.init();
	$('#VenezJpo').click(function(){openJpoUrl();});
	$('#DateJpo').click(function(){openJpoUrl();});
	$('#HeureJpo').click(function(){openJpoUrl();});
	$('#DateJpo2').click(function(){openJpoUrl();});
	$('#HeureJpo2').click(function(){openJpoUrl();});
	$('#DateJpo3').click(function(){openJpoUrl();});
	$('#HeureJpo3').click(function(){openJpoUrl();});
});
