DRHorton.community = DRHorton.community || {};
DRHorton.community.elements = DRHorton.community.elements || {};


DRHorton.community.elements.SimpleSlideShow = function(jqObj){
    this.jqObj = jqObj;
    this.slideshowObj = {};
    if(typeof this.jqObj != "undefined")
        this.init();
};

DRHorton.community.elements.SimpleSlideShow.inherits(DRHorton.events.EventDispatcher);

DRHorton.community.elements.SimpleSlideShow.methods({
        
    init : function(){
        this.jqObj.hide();
        this.render();
    },
    
    render : function(){
        var images = [],
            _this = this
        ;
    
        images = this.jqObj.attr("data-community-simple-slideshow-images").split("|");
        
                        
        this.slideshowObj = new DRHorton.slideshows.SimpleSlideShow({
            selector: "#" + this.jqObj.attr("id"),
            interval: parseInt(this.jqObj.attr("data-community-simple-slideshow-interval")) * 1000,
            images: images,
            centerType: "fill"
        });
        this.slideshowObj.addEventListener(DRHorton.slideshows.SimpleSlideShow.CREATION_COMPLETE, function() { _this.onRenderComplete(); } )
    },
    
    onRenderComplete : function(){
        this.dispatchEvent(new DRHorton.events.Event(DRHorton.community.elements.SimpleSlideShow.CREATION_COMPLETE));
        this.jqObj.show();
    }
    
    
});

DRHorton.community.elements.SimpleSlideShow.CREATION_COMPLETE = "DRHorton.community.elements.SimpleSlideShow.CREATION_COMPLETE";
