﻿/// <reference path="~/Scripts/IntelliSense/jquery-1.2.3-intellisense.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.js" />

/// <reference path="~/Scripts/ByteStorm/BSC.D.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.D.C.js" />


/// <reference path="~/Scripts/ByteStorm/BSC.D.JSON.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.D.Ws.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.D.Ws.I.js" />

/// <reference path="~/Scripts/ByteStorm/BSC.F.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.M.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.P.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.R.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.T.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.U.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.Ts.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.Ws.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.W.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.Cropper.js" />

(function()
{
    BSC.UI.Banner = function()
    {
        var lastReload = null;
        var timer = null;
        var fadeInTime = 800;
        var fadeInDelay = 400;
        var fadeOutTime = 800;
        var minShowTime = 3000;
        var maxShowTime = 22000;

        var rotate = function(p1)
        {
            var path = p1;
            if (lastReload == null) lastReload = new Date();
            if (((new Date()) - lastReload) < minShowTime) return;

            pageTracker._trackPageview("/banner/" + path);

            $("#banneriframe").fadeOut(fadeOutTime,
            function()
            {
                document.getElementById("banneriframe").src = document.getElementById("banneriframe").src;
                lastReload = new Date();
                //clearInterval(timer);
                //timer = setInterval(rotate, maxShowTime);
                setTimeout(function() { $("#banneriframe").fadeIn(fadeInTime); }, fadeInDelay);

            });
        };
        return {
            Rotate: rotate
        };
    } ();
})();
