﻿$(document).ready(function () {

    /* Get image dimensions */
    var imgLeft = $("div#footerimagecontainer #footerleft");
    var imgLeftSrc = $(imgLeft).attr("src");
    var imgRight = $("div#footerimagecontainer #footerright");
    var imgRightSrc = $(imgRight).attr("src");


    $("<img/>").attr("src", imgLeftSrc + "?" + Math.random()).load(function () {

        var left = this.width * -1 + 20;
        var top = this.height * -1;

        $("div#footerimagecontainer #footerleft").css({ "left": left + "px", "top": "0px" }).delay(1000).show().animate({ top: top + "px" }, 400, function () {
            $(this).animate({ top: (top + 10) + "px" }, 150, function () {
                $(this).animate({ top: (top + 5) + "px" }, 100);
            });
        });

    });

    $("<img/>").attr("src", imgRightSrc + "?" + Math.random()).load(function () {

        var left = this.width * -1 + 20;
        var top = this.height * -1;

        $("div#footerimagecontainer #footerright").css({ "right": left + "px", "top": "0px" }).delay(1200).show().animate({ top: top + "px" }, 400, function () {
            $(this).animate({ top: (top + 10) + "px" }, 150, function () {
                $(this).animate({ top: (top + 5) + "px" }, 100);
            });
        });

    });

    /*$("div#footerimagecontainer #footerleft").show().delay(1000).animate({ top: "0px" }, 400, function () {
    var l = this;

    $(l).animate({ top: "10px" }, 150, function () {
    $(l).animate({ top: "5px" }, 100);
    });
    });

    $("div#footerimagecontainer #footerright").show().delay(1200).animate({ top: "0px" }, 400, function () {
    var r = this;

    $(r).animate({ top: "10px" }, 150, function () {
    $(r).animate({ top: "5px" }, 100);
    });
    });*/
});
