﻿var FactList = function(){
    this.lists=Array();
    this.visible=null;
    this.current=0;
    this.add=function(el){
        this.lists.push(el);
        if (this.lists.length==1){
            this.visible=this.lists[this.current];
        }
    };
    this.show=function(){
        this.visible.slideOut('b');
        this.current=(this.current>=this.lists.length-1)?0:this.current+1;
        this.visible=this.lists[this.current];
        this.visible.slideIn();
    };
}

Ext.onReady(function(){
    var imgs = Ext.DomQuery.select("img[class='fact-list']");
    var fl = new FactList();
    for(var a=0;a<imgs.length;a++){
        fl.add(Ext.Element.get(imgs[a]));
    }
    var a = Ext.DomQuery.selectNode("a[class='fact']");
    a.onclick=function(){
        fl.show();
        return false;
    }
})
