dojo.provide('fallingtree.page');
dojo.declare('fallingtree.page', null, {
    constructor: function ( params ) {
        this.initSlideshow();
    },
    initSlideshow: function () {
        var listContainer = dojo.byId('slideshow_list');
        if (!listContainer) return;
        var query = dojo.query('li', listContainer);
        if (query.length < 2) return;
        dojo.addClass(listContainer, 'dynamic_slideshow');
        this._slideshowContainer = listContainer;
        window.setInterval(dojo.hitch(this, function(){
            this.rotateSlideshow({ container: listContainer });
        }), 5000);
    },
    rotateSlideshow: function(params) {
        var listContainer = params.container;
        var query = dojo.query('img', listContainer);
        var firstChild = query[0];
        dojo.style(firstChild, 'opacity', 0);
				dojo.removeClass(firstChild, 'hidden');
        var li = firstChild.parentNode;
        listContainer.removeChild(li);
        listContainer.appendChild(li);

        dojo.fadeIn({ 
            node: firstChild, 
            duration: 2000
        }).play();
    },
    openSmall: function(params) {
        var href = params.href;
        var strWindowFeatures = "titlebar=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes,width=900,height=500,top=300";
        var WindowObjectReference = window.open(href,
                                            "falling_tree_child", strWindowFeatures);
    }
});

/*
=back

=cut
*/
