﻿$(document).ready(function () {

    tranTime = 4000;

    // hide all images
    $(".logoAnimation img").hide();

    //Get the first image and display it (set it to full opacity)
    $(".logoAnimation img:first").show();
    $(".logoAnimation img:first").attr("shown", "true");

    // to resolve chrome bug
    if ($.browser.msie != true) {

        $(window).focus(function () {
            clearInterval(timer);
            timer = setInterval('gallery()', tranTime);
        });

        $(window).blur(function () {
            clearInterval(timer);
        });

    }

    var timer = setInterval('gallery()', tranTime);

});


function gallery() {

    //alert("test");

    $('.logoAnimation img').each(function () {
        if ($(this).attr("shown") == "true") {
            $(this).attr("shown", "false");
            $(this).fadeOut('slow');
        }
        else {
            $(this).attr("shown", "true");
            $(this).fadeIn('slow');
        }
    });

}
