function spotlight(){
	
	if(!$('spotlight'))
	return;
	
	var init = 0;
	var covers = [];
	var coversEl = [];
	var marge = 0;
	var Fxiz = [];
	var Pmax = 284;
	var Pcur = 50;
	var Pmin = 0;


	var imgz = [];
	
	var Eh2 = new Element('h2');
	Eh2.injectInside($('spotlight'));
	var Ep = new Element('p');
	Ep.injectAfter(Eh2);
	
	var Aprev = $('spotlight_prev').addEvent('click',function(){ lauchSpot(SgetPrev()) });
	var Anext = $('spotlight_next').addEvent('click',function(){ lauchSpot(SgetNext()) });	
	
	$$('#spotlight li').each(function(el,i){
		var titre = el.getChildren()[1];
		var excerpt = el.getChildren()[2];
		
		if (typeof(excerpt) != 'undefined') {
			covers[i] = [el.getProperty('rel'), el.getProperty('title'), excerpt];
			
			coversEl[i] = el;
			excerpt.remove();
			titre.remove();
			
			Fxiz[i] = new Fx.Styles(el, {
				duration: 350,
				wait: false,
				transition: Fx.Transitions.Cubic.easeOut
			}).set({
				'margin-left': marge
			});
			imgz[i] = new Fx.Styles(el.getChildren()[0], {
				duration: 350,
				wait: false,
				transition: Fx.Transitions.Cubic.easeOut
			});
			
			marge = marge + Pcur;
			
			el.addEvent('click', function(e){
				lauchSpot(i)
			});
		}
		
			
	});
		
	
	lauchSpot(0);
	if(coversEl[1])
	coversEl[1].setStyle('z-index','2');
	
	
	function SgetNext()
	{
		var res;
		coversEl.each(function(cover,pos){
			
			if(cover.getStyle('margin-left').toInt()==Pmax)
			{
				res = pos;
			}		
			
		});
		return(res);
	}	
	
	
	function SgetPrev(){
		var res;
		coversEl.each(function(cover,pos){
			
			if(cover.getStyle('margin-left').toInt()==Pmin)
			{
				res = pos;
			}		
			
		});
		return(res);
	}	
	
	function lauchSpot(i){
		if((coversEl[i].getStyle('margin-left').toInt()==Pcur) && (init==1))
		{
			window.location.href=covers[i][0];
					return;
		}		
		if(coversEl[i].getStyle('margin-left').toInt()>Pcur)
			var dif = -Pcur;
		else
			var dif = Pcur;
		//Eh2.setHTML(covers[i][1]);
		var desc = covers[i][2].clone();
		Ep.setHTML('');
		desc.injectInside(Ep);
		
		Eh2.addEvent('click',function(e){window.location.href=covers[i][0]});
		Ep.addEvent('click',function(e){window.location.href=covers[i][0]});
		Fxiz.each(function(fx,j){	
	
			if(j==i)
			{
			imgz[j].start({'width':463,'height':250});
			coversEl[j].setStyle('z-index','1000');
			fx.start({'width':463,'height':250,'margin-top':0,'margin-left':[coversEl[j].getStyle('margin-left').toInt(),Pcur]});
			}
			else
			{		
				
				if(dif<0)
				{
					
					if(coversEl[j].getStyle('margin-left').toInt()==Pcur)
					{
						imgz[j].start({'width':278,'height':150});
			
						fx.start({'width':278,'height':150,'margin-top':35,'margin-left':[coversEl[j].getStyle('margin-left').toInt(),Pmin]})
						coversEl[j].setStyle('z-index','1');
					}
					else
					{
						imgz[j].start({'width':278,'height':150});
			
						fx.start({'width':278,'height':150,'margin-top':35,'margin-left':[coversEl[j].getStyle('margin-left').toInt(),Pmax]})
						coversEl[j].setStyle('z-index','0');
					}
					
				}
				else
				{
					
					if(coversEl[j].getStyle('margin-left').toInt()==Pcur)
					{
						imgz[j].start({'width':278,'height':150});
			
						fx.start({'width':278,'height':150,'margin-top':35,'margin-left':[coversEl[j].getStyle('margin-left').toInt(),Pmax]})
						coversEl[j].setStyle('z-index','1');
					}
					else
					{
						imgz[j].start({'width':278,'height':150});
			
						fx.start({'width':278,'height':150,'margin-top':35,'margin-left':[coversEl[j].getStyle('margin-left').toInt(),Pmin]});
						coversEl[j].setStyle('z-index','0');
					}
					
					
				}
				
			}
				
			
			
			
			
		});
	
		init = 1;
	}
	
}
