

(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);


$.fn.pause = function(duration) {
    $(this).animate({ dummy: 1 }, duration);
    return this;
};
$(document).ready(function() {
$("#slice1").css({top:-900});
$("#slice2").css({left:-900});
$("#slice3").css({top:-500});
function showFirst() {
$("#slice1").css({top:-900},{left:0});
$("#slice2").css({left:-900},{top:0});
$("#slice3").css({top:-900},{left:0});


  $('#slice1').animate({top:0},{duration:500,complete: showSecond});
}

function showSecond() {
  $("#slice1").delay(2000).animate({top:-900}, {duration: 1000,
    complete:showThird});
}

function showThird() {
  $("#slice2").animate({left:0},{duration: 1000,
    complete:showfour});}

function showfour() {

  $("#slice2").delay(2000).animate({left:-900},{duration: 1000,
    complete:showfive});}

function showfive() {
  $("#slice3").animate({top:0},{duration: 1000,
    complete:showsix});}
  
function showsix() {
  $("#slice3").delay(2000).animate({top:-500},{duration: 1000,
    complete:showFirst});}
  
function showseven() {
  $('#bleu').pause(1000).animate({opacity:1},{duration: 1500,
    complete:showheight});}

function showheight() {
  $("#bleu-txt").animate({opacity:1},{duration: 1500,
    complete:shownine});}
    
function shownine() {
  $("#bleu-perso").animate({opacity:1},{duration: 1500,
    complete:showten});}
  
function showten() {
  $("#blanc").pause(1000).animate({opacity:1},{duration: 1500,
    complete:showthirteen});}
    
    
function showthirteen() {
  $("#blanc-txt").animate({opacity:1},{duration: 1500,
    complete:showfiveteen});}

    
function showfiveteen() {
  $('#vert').pause(1000).animate({opacity:1},{duration: 1500,
    complete:showsixteen});}
    
function showsixteen() {
  $("#vert-txt").animate({opacity:1},{duration: 1500,
    complete:showseventeen});}

function showseventeen() {
  $("#vert-perso").animate({"left":"0"},{duration: 1500,easing:'easeOutBounce',
    complete:showheighteen});}

function showheighteen() {
  $('#orange').pause(1000).animate({opacity:1},{duration: 1500,
    complete:shownineteen});}

function shownineteen() {
  $("#orange-txt").animate({opacity:1},{duration: 1500,
    complete:showtwenty});}

function showtwenty() {
  $("#orange-perso").animate({opacity:1},{duration: 1500,
    complete:function(){$('#replay').fadeIn("slow")}
    });}

function startAnimation() {
showFirst();
}
replay();
startAnimation();
$(".colorbox").colorbox({open:false,current:"Page {current} sur {total}"});
var timer = setTimeout(function(){
$.fn.colorbox({href:'video2.html'}); }, 12000); 
function replay() {
$('#replay').click(function() {
$("#replay").fadeOut();
startAnimation();
});
}
});
