﻿var currentOverlay;
var otherOverlay;
var overlayIdx = 0;
var overlayCount = 3;
$(document).ready(function() {
    var flashContent = $("div #flashClientDemo");
    flashContent.append("<div class='demooverlay' style='top:-" + (flashContent.height() - 36) + "px;' id='overlaya'></div>");
    flashContent.append("<div class='demooverlay' style='top:-" + (flashContent.height() - 36) + "px;' id='overlayb'></div>");

    currentOverlay = $("#overlayb");
    otherOverlay = $("#overlaya");
    changeOverlay();
});
function changeOverlay() {
    otherOverlay.css("background-image", "url(images/overlay" + overlayIdx + ".png?v=2)");
    $(currentOverlay).fadeTo(1000, 0);
    $(otherOverlay).fadeTo(1000, 1);
    var temp = currentOverlay;
    currentOverlay = otherOverlay;
    otherOverlay = temp;
    overlayIdx = (overlayIdx + 1) % overlayCount;
    setTimeout('changeOverlay()', 5000);
}