Ext.namespace("Waps.ImageCycle")
Waps.ImageCycle = function(config){
    this.config = config;
    Ext.onReady(function(){
	if(this.config.Format == "1")
        this.fader(parseInt(this.config.Time));
	else
	this.marquee()
    }, this)
}
Waps.ImageCycle.prototype = {
    fader: function(Duration){
		var temp = "";
for (y in x)
        temp += x + ": " + x[y] + "\n";
//alert (temp);


        /*
		var x = Ext.query("li");
		console.log(x)
		*/
		//alert(this.config.UlId)
		 var x = Ext.query("ul#"+ this.config.UlId + " li");


if (x.length > 0 ) {
	  
		//alert(x.length);	 
			var fader = function(i){
				if (i == x.length) {
					
					Ext.get(x[i - 1]).hide();
					i = 0
					 
				} 
				
				
				if (i != 0)  {
					Ext.get(x[i - 1]).hide();
}

			/*
				//x[i].show();
				x.each(function(self){
				self.hide();
			})
					*/
				Ext.get(x[i]).fadeIn({
					endOpacity: 1, //can be any value between 0 and 1 (e.g. .5)
					easing: 'easeOut',
					duration: 1
				});
				fader.defer(Duration, this, [i + 1])
				
			//	fader.defer(2000, this, [i + 1])
			}
			for(var o=0; o<x.length; o++){
				//alert("j");
				Ext.get(x[o]).enableDisplayMode()
				Ext.get(x[o]).hide()
				}
			fader(0)
			 
			 
			 
		}

    },
    marquee : function(){
    	var temp = "";
		for (y in x)
         temp += x + ": " + x[y] + "\n";
		 var x = Ext.query("ul#"+ this.config.UlId + " li");
		 console.log(x)
    }
    
}
