$(document).ready(function(){
              
              var offresEmploiBox = {
                items : $('div#offresEmploi div.offreEmploi'),
                currentIndex : 0,
                
                next : function() {                
                  this.change(this.currentIndex == this.items.length - 1 ? 0 : this.currentIndex + 1);                
                },
                
                previous : function() {
                  this.change(this.currentIndex == 0 ? this.items.length - 1 : this.currentIndex - 1);
                },
                
                random : function() {
                  this.change(Math.floor(Math.random() * this.items.length));
                },
                
                change: function(value) {
				  var currentIndex = this.currentIndex;
				  this.items.fadeOut();
                  this.currentIndex = value;
                  this.items.eq(currentIndex).fadeIn();
                }
              };
              
              offresEmploiBox.random();            
              
              $('#previousItem').click(function() { offresEmploiBox.previous();});
              $('#nextItem').click(function() { offresEmploiBox.next();});

			  
			  
			  
			  
			  smallBoxWindow = $('#references div.boxContent');
              size = $('#referencesImage').width() - smallBoxWindow.width();
			  
			  (cycle = function() {
					$('#referencesImage').animate({left: '-=' + size},20000).animate({left: '+=' + size},20000,cycle);
			  })();
			  
			  
			  
});


