

$(function(){

	var currentpos = 	0;
	var img_width = 	654;
	var desc_width = 	954;
	
	var img_slides = 	$('.img-slide');
	var desc_slides = 	$('.desc-slide');
	var nb_slide = 		img_slides.length;	
	
	
	$('#img-mask').css('overflow', 'hidden');
	$('#desc-mask').css('overflow', 'hidden');
	
	
	img_slides.wrapAll('<div id="img_container" ></div>');
	$('#img_container').css('width', img_width * nb_slide );
	
	desc_slides.wrapAll('<div id="desc_container"></div>');
	$('#desc_container').css('width', desc_width * nb_slide );
	
	
	//Control BTN OverStates
	$('#next').bind('mouseover',  function(){
  		$('#next').animate({backgroundPosition : '0px -105px'}, 150)
	});
	
	$('#next').bind('mouseleave',  function(){
  		$('#next').animate({backgroundPosition : '0px -70px'}, 150)
	});
	
	
	
	$('#prev').bind('mouseover',  function(){
  		$('#prev').animate({backgroundPosition : '0px -35px'}, 150)
	});
	
	$('#prev').bind('mouseleave',  function(){
  		$('#prev').animate({backgroundPosition : '0px 0px'}, 150)
	});
	
	
	$('.ctrl-btn').bind('mouseup',  function(){  		
		($(this).attr('id')=='prev')	?  currentpos-- : currentpos++;
		manageSlide();		
	});

	
	
	function manageSlide(){
		
		
		
		if(currentpos  < 0)				currentpos = nb_slide - 1;
		if(currentpos  > nb_slide-1)  	currentpos = 0;
		
		$('#img_container').animate({'marginLeft' : -(currentpos * img_width) }, 500)
		$('#desc_container').animate({'marginLeft' : -(currentpos * desc_width) }, 500)
		
	}
	
	$('.info-231').bind('mouseover',  function(){
		
		$(this).children().children().children().children("div.film-image-over").animate({opacity: .6}, 150)
	});
	
	$('.info-231').bind('mouseleave',  function(){
  		$(this).children().children().children().children('div.film-image-over').animate({opacity: 0}, 150)
	});
	

});

