function auto(container, interval, arrows, hoover_stop, preview){
	var action = true;
	var timer = new Array();
	
	function click_next(){
		if(action){
			action = false;
			var parent = $(container);

			var curr = parent.children('.sliders').children('.active');
			var next = curr.next(".slider");
			
			var cu_p = parent.find('#preview').children('div.active');
			var n_p = cu_p.next('.preview_dot');
			parent.find('#preview').find('shape').remove();

			if(n_p.length != 0){
				n_p.addClass('active').prev('.preview_dot').removeClass('active');
			}else{
				cu_p.removeClass('active').parent().children('div:first').addClass('active');
			}
			
			if ($.browser.msie && $.browser.version.substr(0,1)<7) {
				//DD_belatedPNG.fixPNG(parent.children('.sliders').children('.active').html());
				parent.find('#preview').children('div.active').css('behavior', '');
				DD_belatedPNG.fix('.active');
			}

			curr.fadeOut(1000);
			curr.children(".panel").fadeOut(1000);
			curr.removeClass("active");
			if(next.length != 0){
				next.fadeIn(1000, function() {
					curr.children(".panel").fadeIn();
					next.addClass("active");
					action = true;
				});
			}else{
				parent.children('.sliders').children(".slider:first").fadeIn(1000,  function() {
					curr.children(".panel").fadeIn();
					parent.children('.sliders').children(".slider:first").addClass("active");
					action = true;
				});
			}
		}
	}

	function click_prev(){
		if(action){
			action = false;
			var parent = $(container);

			var curr = parent.children('.sliders').children('div.active');
			var prev = curr.prev(".slider");

			var cu_p = parent.find('#preview').children('.active');
			var n_p = cu_p.prev('.preview_dot');
			parent.find('#preview').find('shape').remove();
			
			if(n_p.length != 0){
				n_p.addClass('active').next('.preview_dot').removeClass('active');
			}else{
				cu_p.removeClass('active').parent().children('div:last').addClass('active');
			}
			
			if ($.browser.msie && $.browser.version.substr(0,1)<7) {
				//DD_belatedPNG.fixPNG(parent.children('.sliders').children('.active').html());
				parent.find('#preview').children('div.active').css('behavior', '');
				DD_belatedPNG.fix('.active');
			}

			curr.fadeOut(1000);
			curr.children(".panel").fadeOut(1000);
			curr.removeClass("active");
			if(prev.length != 0){
				prev.fadeIn("slow",  function() {
					curr.children(".panel").fadeIn();
					prev.addClass("active");
					action = true;
				});
			}else{
				parent.children('.sliders').children(".slider:last").fadeIn("slow",  function() {
					curr.children(".panel").fadeIn();
					parent.children('.sliders').children(".slider:last").addClass("active");
					action = true;
				});
			}
		}
	}

	var prev, arr_t, arr_f;
		
	if(preview){
		prev = $('<div id="preview"></div>');
		var size = $(container).children('.sliders').children(".slider").size();
		$(container).append(prev);
		for(x = 0; x < size; x++){
			var number = x.toString().length == 1 && (x+1) != 10 ? '0'+(x+1) : (x+1);
			var dot = $('<div id="'+x+'" class="preview_dot"><div>'+number+'</div></div>');
			dot.click(function(){
				if(action){
					action = false;
					var parent = $(container);
					
					var curr = parent.find('.sliders > .active');
					var next = parent.find('.slider:eq('+this.id+')');
	
					var cu_p = parent.find('#preview').children('.active');
					var n_p = parent.find('.preview_dot:eq('+this.id+')');
	
					cu_p.removeClass('active');
					n_p.addClass('active');
					parent.find('#preview').find('shape').remove();
					
					if ($.browser.msie && $.browser.version.substr(0,1)<7) {
						//DD_belatedPNG.fixPNG(parent.children('.sliders').children('.active').html());
						parent.find('#preview').children('div.active').css('behavior', '');
						DD_belatedPNG.fix('.active');
					}
					
					curr.fadeOut(1000);
					curr.children(".panel").fadeOut(1000);
					curr.removeClass("active");
					next.fadeIn(1000, function() {
						curr.children(".panel").fadeIn();
						next.addClass("active");
						action = true;
					});
				}
			});
			if(x == 0){
				prev.append(dot.addClass('active'));
			}else{
				prev.append(dot);
			}
			
		}
	}
	
	if(arrows != 0) {
		arr_t = $('<div id="arrows"><div id="slide_right" class="slider_right slider_arrow"></div><div id="slide_left" class="slider_left slider_arrow"></div></div>');
		$(container).prepend(arr_t);

		$(container).children('#arrows').children("#slide_right").bind("click", click_next).next().bind("click", click_prev);
	}

	if($(container).children('.sliders').children().length != 1 && interval != 0){
		//set the interval to call after every $interval secs
		timer[$(container).attr('id')] = setInterval(click_next,interval); 

		if(hoover_stop){
			//adjust the behaviour on mouseover and mouseouver
			$(container).mouseover(function() {
				clearInterval(timer[$(container).attr('id')]);
				
				if(preview && !prev.is(":visible")){
					//prev.show();
				}
			}).mouseout(function(){
				clearInterval(timer[$(container).attr('id')]);
				timer[$(container).attr('id')] = setInterval(click_next,interval);
				
				if(preview && prev.is(":visible")){
					//prev.hide();
				}
			});
		}else{
			$(container).mouseover(function() {
				if(preview && !prev.is(":visible")){
					//prev.show();
				}
			}).mouseout(function(){
				if(preview && prev.is(":visible")){
					//prev.hide();
				}
			});
		}
	}else{
		if(preview){
			//adjust the behaviour on mouseover and mouseouver
			$(container).mouseover(function() {
				if(!prev.is(":visible")){
					//prev.show();
					}
			}).mouseout(function(){
				if(prev.is(":visible")){
					//prev.hide();
					}
			});
		}
	}
}
