var a = {};

Ext.onReady(function(){
	a.animate = false;
});



a.OnClickMenu = function (id, link){
	if (Ext.get('gridImages').hasActiveFx()){return false;}
	a.animate = true;
	Ext.Ajax.request({
		url:'/',
		params:{task:'getImages', id:id},
		method:'post',
		success:function(o){
			
			
			
			var res= Ext.decode(o.responseText);
			
			Ext.get('gridImages2').update(res.html);
			
		}
		
	});
	var z = 0;
	var task = {
		    run: function(){
		       z=z+1;
		       if (z==1){
		    	   var imgs = Ext.get('gridImages').fadeOut({
	    				duration:1,
	    				endOpacity: 0,
	    				callback:function(){
		    		  var t= Ext.get('gridImages').select('table', true);
		    		   Ext.get(t.elements[0]).setStyle('display', 'none');
		    	   }
	    			});
		    	   
		    	   
		    	   //.select('.gidimg');
		    	  /* imgs.fadeOut({
	    				duration:2,
	    				endOpacity: 0
	    			});
	    			
		    	   
		    		for (i=0; i<imgs.elements.length;i++){
		    			Ext.get(imgs.elements[i]).fadeOut({
		    				duration:2,
		    				endOpacity: 0
		    			});
		    		}
		    		*/
		       }
		       else if (z==2){
		    		var before = Ext.get('gridImages2').dom.innerHTML;
		    		Ext.get('gridImages').update(before);
		    		Ext.get('gridImages').fadeIn({
	    				duration:1,
	    			    callback:function(){
	    					Ext.get('gridImages').stopFx();
	    				}
	    				
		    		});
		    		/*.select('.gidimg', true);
		    		for (i=0; i<imgs.elements.length;i++){
		    			var el = Ext.get(imgs.elements[i]);
		    			el.fadeIn({
		    				duration:3,
		    				callback:function(){
		    				//el.setStyle('display', "normal");
		    			}
		    		});*/
		    			Ext.TaskMgr.stopAll();
		       }
		       
		       
		    },
		    interval: 1600 //1 second
		};
	Ext.TaskMgr.start(task);
	Ext.get('mainLinktoCatalog').dom.href=link;
   
	
	

}
