function SlideMe(parameters) {
	var _this_ = this;
	
	_this_.sliderId = parameters.sliderId;
	_this_.scrollerId = parameters.scrollerId;
	_this_.arr_img = new Array();
	//console.log(parameters.itemClass);
	_this_.itemClass = parameters.itemClass;
	$('#'+_this_.sliderId+' .'+parameters.itemClass).each(function(key, img){
		_this_.arr_img.push(img.id);
	});
	//console.log(_this_.arr_img);
	_this_.ini = true;
	_this_.currentIndex = 0;
	_this_.nextIndex = 1;
	_this_.prevIndex = (_this_.arr_img.length - 1);
	_this_.duration = parameters.duration;
	_this_.pauseTime = parameters.pauseTime;
	_this_.effect = parameters.effect;
	_this_.mainSlide = parameters.mainSlide;
	_this_.imgWidth = parameters.imgWidth;
	_this_.playing = false;
	var timerId = parameters.sliderId+'_timer';
	_this_.remote = parameters.remote;
	
	if (!_this_.mainSlide) {
		var mainEnd = $('#'+_this_.arr_img[_this_.arr_img.length - 1]).clone().prependTo('#'+_this_.scrollerId);
		mainEnd.attr('id', _this_.scrollerId+'_mainEnd');
		
		var mainStart = $('#'+_this_.arr_img[0]).clone().appendTo('#'+_this_.scrollerId);
		mainStart.attr('id', _this_.scrollerId+'_mainStart');
		
		_this_.arr_img.unshift(_this_.scrollerId+'_mainEnd');
		_this_.arr_img.push(_this_.scrollerId+'_mainStart');
		$('#'+_this_.scrollerId).css('width', (_this_.arr_img.length*_this_.imgWidth)+'px');
		$('#'+_this_.sliderId).scrollTo( $('#'+_this_.arr_img[1]), 1 );
	}

	switch (_this_.effect) {
		case 'slide':
			$('#'+_this_.scrollerId).css('width', (_this_.arr_img.length*_this_.imgWidth)+'px');
			break;
		case 'fade':
			$('#'+_this_.arr_img[0]).css('display', 'block');
			//alert('src : '+$('#'+_this_.arr_img[0]).attr('src'));
			$('#'+_this_.sliderId).css('backgroundImage', 'url('+$('#'+_this_.arr_img[1]).attr('src')+')');
			break;
	}
	
	this.play = function() {
		//console.log('PLAY');
		$(document).everyTime(_this_.pauseTime, timerId, function(i) {
			_this_.next();
		});
		_this_.playing = true;
	}
	
	this.stop = function() {
		//console.log('STOP');
		$(document).stopTime(timerId);
		_this_.playing = false;
	}
	
	this.goto = function(imgNum) {
		//console.log('GOTO');
		if (_this_.playing) {
			_this_.stop();
		}
		if (_this_.remote) {
			$('.goto').each(function(key, element) {
				$(element).removeClass('gotoSelected');
			});
			imgNum > _this_.arr_img.length ? numGoto = 1 : numGoto = imgNum;
			$('#goto'+numGoto).addClass('gotoSelected');
		}
		var currentIndex = _this_.currentIndex;
		//console.log('currentIndex : '+currentIndex);
		
		var arr_img = new Array();
		$.each(_this_.arr_img, function(key, value){
			arr_img.push(value);
		});
		if (!_this_.mainSlide) {
			arr_img.shift();
			arr_img.pop();
		}
		//console.log('arr_img : '+arr_img);
		
		if (imgNum > arr_img.length || imgNum < 1) {
			if (imgNum > arr_img.length) {
				//console.log('imgNum('+imgNum+') > arr_img.length('+arr_img.length+')');
				var imgIndex = 0;
			}
			if (imgNum < 1) {
				//console.log('imgNum('+imgNum+') < 1');
				var imgIndex = (arr_img.length - 1);
			}
		}
		else { var imgIndex = imgNum - 1; }
		//console.log('imgNum : '+imgNum+"\n"+'imgIndex : '+imgIndex);
		
		switch (_this_.effect) {
			case 'slide':
				//console.log('scrollTo : '+'#'+arr_img[imgIndex]+"\n");
				$('#'+_this_.sliderId).scrollTo( $('#'+arr_img[imgIndex]), _this_.duration );
				break;
			case 'fade':
				//console.log('le background devient : '+_this_.arr_img[imgIndex]+"\n");
				//console.log(DOMAINE_NAME+'/images/slideshow/'+_this_.arr_img[imgIndex]+'.jpg');
				$('#'+_this_.sliderId).css('backgroundImage', 'url('+$('#'+_this_.arr_img[imgIndex]).attr('src')+')');
				//$('#'+_this_.sliderId).css('backgroundImage', 'url(http://'+DOMAINE_NAME+'/images/slideshow/'+_this_.arr_img[imgIndex]+'.jpg)');
				
				//console.log('on fade  : '+_this_.arr_img[currentIndex]+"\n");
				$('#'+_this_.arr_img[currentIndex]).fadeOut("slow", function() {
					//console.log('on display none  : '+_this_.arr_img[currentIndex]+"\n");
					//$('#'+_this_.arr_img[currentIndex]).css('display', 'none');
					$('#'+_this_.sliderId+' .'+_this_.itemClass).css('display', 'none');
					//console.log('on display block  : '+_this_.arr_img[imgIndex]+"\n");
					$('#'+_this_.arr_img[imgIndex]).css('display', 'block');
				});

				break;
		}
		_this_.currentIndex = imgIndex;
		if (parameters.autoplay) {
			this.play();
		}
	}
	
	this.next = function(){
		//console.log('NEXT');
		var currentIndex = _this_.currentIndex;
		//console.log('currentIndex : '+currentIndex);
		
		this.goto((currentIndex + 2));
	}
	
	this.prev = function(){
		//console.log('PREV');
		var currentIndex = _this_.currentIndex;
		//console.log('currentIndex : '+currentIndex);
		
		this.goto((currentIndex));
	}
	
	if (parameters.autoplay) {
		this.play();
	}
}
