﻿//////////////////////
// COPYRIGHT 2008 DUCK POND, INC. ALL RIGHTS RESERVED.
//////////////////////

Type.registerNamespace("SecretFeather.WebControls");

SecretFeather.WebControls.ContentRotator = function(contentItems,durations)
{
    this._ContentItems = contentItems;
    this._Durations = durations;
    this._CurrentIndex = 0;
    
    if(this._ContentItems.length > 0)
    {
        // initial delay
        var _this = this;        
        window.setTimeout(
            function(){_this.TransitionToNextContent();},
            this._Durations[0] * 1000);
    }
    
};

SecretFeather.WebControls.ContentRotator.prototype =
{
    TransitionToNextContent : function()
    {
        // hide the current
        this._ContentItems[this._CurrentIndex].style.display = "none";        
    
        // switch to next
        this._CurrentIndex += 1;
        if(this._CurrentIndex >= this._ContentItems.length)
        {
            this._CurrentIndex = 0;
        }
        
        // show the next
        this._ContentItems[this._CurrentIndex].style.display = "";
        
        // set time for the next change
        var _this = this;
        window.setTimeout(
            function(){_this.TransitionToNextContent()},
            this._Durations[this._CurrentIndex] * 1000);
    }
};


/*
.transparent_class {
	filter:alpha(opacity=50);
	-moz-opacity:0.5;
	-khtml-opacity: 0.5;
	opacity: 0.5;
}
*/


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();