        	/*
        	Gallery rotator class
        	parameters:
        		boundary element
        		increase/decrease size/top position step in pixels
        		width/height of full image
        		width/height of maximized image
        	*/
        	var GalleryRotator=new Class({
        		Implements:[Events],
        		timer:500,
        		initialize:function(el,step,dimension,maxdimension)
        		{
        			this.step=step;
        			this.dimension=dimension;
        			this.maxdimension=maxdimension;
        			
        			this.sortArr=[];//maping array of order of elements
        			
        			this.imgs=el.getElements('img');
        			this.els=el.getElements('li');
        			this.overlays=el.getElements('div.overlay');
        			this.clicker=el.getElement('div.clicker');
        			var i=0;
        			var len=this.els.length;
        			
        			var aobjs=[];
        			for(i=0;i<len;i++)
        			{
        				aobjs[i*2]=this.els[i];
        				aobjs[i*2+1]=this.imgs[i];
        			}
        			
        			this.ElFx=new Fx.Elements(aobjs,{
        				duration:this.timer,
        				onComplete:this.Finished.bind(this),//function to run when animation ends
        				onStart:this.Started.bind(this)//function to run when animation starts
        			});
        			aobjs=null;
        			//building intiial mapping array
        			for(i=0;i<len;i++)
        			{
        				this.sortArr[i]=i;
        			}
        			this.posEls();
        			
        			this.doclick=true;
        			//attaching events
					this.clicker.addEvent('click',this.Rotate.bind(this));
					this.clicker.addEvent('mousewheel',this.Rotate.bind(this));
					el.addEvent('mousewheel',this.Rotate.bind(this));
        		},
        		posEls:function()
        		{
        			//this function positiones elements according its order in mapping array
        			var len=this.sortArr.length;
        			var aobj={};
        			for(i=0;i<len;i++)
        			{
        				var el=this.sortArr[i];
        				var op=0.5;
        				if(i==0) op=1;
        				var op2=1-(i/6);
        				if(op2<=0) op2=0.1;
        				
        				this.overlays[el].setStyles({'display':'none'});
        				
        				this.els[el].set('opacity',op).setStyles({
        					'top':-1*(i*this.step),
        					'z-index':(len-i),
        					'visibility':'visible'
        				});
        				
        				this.imgs[el].setStyles({
        					'width':Math.round(this.dimension.w*op2)+'px',
        					'height':Math.round(this.dimension.h*op2)+'px'
        				});
        			}
        			this.overlays[this.sortArr[0]].setStyles({'display':'block'});
        		},
        		Finished:function()
        		{
        			//rotate mapping array
        			var tmpEl=this.sortArr.shift();
        			this.sortArr.include(tmpEl);
        			this.posEls.delay(50,this);//we have to run it in delay because MSIE sux
					this.doclick=true;//enable events
        		},
        		Started:function()
        		{
        			//at first we hide the text overlay of first element
        			this.overlays[this.sortArr[0]].setStyles({'display':'none'});
        		},
        		Rotate:function(e)
        		{
        			e=new Event(e);
        			e.stop();
        			if(this.doclick==true)
        			{
        				this.doclick=false;//disable events when animating
	        			var aobj={};
	        			var len=this.sortArr.length;
	        			
	        			//lets build the animation object for elements
	        			for(i=0;i<len;i++)
	        			{
	        				var el=this.sortArr[i];
	        				var op=0;//first element becomes full transparent
	        				if(i==1) op=1;//new first element becomes opaque
	        				if(i>1) op=0.5;//other elements stays half transparent
	        				
	        				var op2=1-((i-1)/6);
	        				aobj[el*2]={'top':(-1*((i)*this.step)+this.step),'opacity':op};//we change opacity of object, and its top position
	        				if(i==0)
	        				{
	        					aobj[el*2+1]={'width':this.maxdimension.w,'height':this.maxdimension.h};
	        				}
	        				else
	        				{
	        					if(op2<=0) op2=0.1;
	        					aobj[el*2+1]={'width':Math.round(this.dimension.w*op2),'height':Math.round(this.dimension.h*op2)};
	        				}
	        			}
	        			this.ElFx.start(aobj);
        			}
        		}
        	});
