window.onerror = function() { };
try {

var isIE = $.browser.msie && $.browser.version <= 8;

$(".left").attr("id", "sv-conteneur").addClass(isIE ? "sv-ie" : "sv-not-ie").html('\
    <div id="sv-fond" />\
    <div id="sv-animation">\
        <div id="sv-oiseau" />\
        <div id="sv-roses-floues" />\
        <div id="sv-roses-nettes" />\
        <div id="sv-coeurs" />\
        <div id="sv-titre" />\
    </div>\
');

function animationTitre() {
    $("#sv-titre").animate({
        top: 143
    }, {
        duration: 2000,
        easing: "easeOutBounce"
    });
}

function animationFond() {
    if (!isIE) {
        $("#sv-roses-floues").animate({
            opacity: 1
        }, {
            duration: 1000,
            easing: "linear"
        });
        setTimeout(function() {
            $("#sv-roses-nettes").animate({
                opacity: 0
            }, {
                duration: 1000,
                easing: "linear"
            });
        }, 500);

        $("#sv-oiseau").animate({
            opacity: 1,
            top: 108,
            left: 767
        }, {
            duration: 2000,
            easing: "easeOutCubic"
        });
    }
    else {
        $("#sv-oiseau").css({
            visibility: "visible"
        }).animate({
            top: 108,
            left: 767
        }, {
            duration: 2000,
            easing: "easeOutCubic"
        });
    }
}

function ajouterCoeur() {
    var div = $("<div />");
    var img = $('<img src="http://image.esecure-transaction.com/store/evenement/event_saint_valentin_12/Hearts/01.png" alt="" />').appendTo(div); // Il faut utiliser le CDN !!
    img.css({
        width: 0,
        height: 0
    });
    div.css({
        left: (Math.random() - 0.5) * 30
    }).appendTo("#sv-coeurs");

    div.animate({
        top: -125
    }, {
        duration: 3000,
        easing: "easeOutQuad"
    });

    var ratio1 = Math.min(Math.max(0.25, Math.random()), 1);
    var ratio2 = Math.max(0.1, Math.random() * ratio1);
    var angle = parseInt(Math.max(0.25, Math.random()) * 60 - 30);
    var rotate = "rotate("+(angle + 10)+"deg)";

    img.animate({
        marginLeft: -45 * ratio1 / 2,
        marginTop: -35 * ratio1 / 2,
        width: 45 * ratio1,
        height: 35 * ratio1
    }, {
        duration: 1000,
        easing: "easeInOutQuad",
        complete: function() {
            $(this).animate({
                marginLeft: -45 * ratio2 / 2,
                marginTop: -35 * ratio2 / 2,
                width: 45 * ratio2,
                height: 35 * ratio2
            }, {
                duration: 1500,
                easing: "easeInOutQuad",
                queue: false,
                complete: function() {
                    div.remove();
                }
            });
        }
    }).css("-webkit-transform", rotate).css("-moz-transform", rotate).css("transform", rotate).css({
        textIndent: angle + 10
    }).animate({
        textIndent: -angle + 10
    }, {
        duration: 2000,
        easing: "linear",
        queue: false,
        step: function(now, fx) {
            var rotate = 'rotate('+parseInt(now)+'deg)';
            $(this).css("-webkit-transform", rotate)
                .css("-moz-transform", rotate)
                .css("transform", rotate);
        }
    });

    if (!isIE) {
        img.css({
            opacity: 0
        })
        setTimeout(function() {
            img.animate({
                opacity: 1
            }, {
                duration: 250,
                easing: "linear",
                queue: false
            })
        }, 200);
    }

    setTimeout(ajouterCoeur, 750);
}

$(function() {
    setTimeout(animationTitre, 200);
    setTimeout(animationFond, 2200);
    setTimeout(ajouterCoeur, 4200);
});

}
catch (e) { }
