var slideshow = {
	len: 0,
	current:0,
	timer: 1000,
	
	init: function(_timer) {
		var _this = this;
		this.len = $('#slideshow-auto li').length;
		this.timer = _timer;
		
		$('#slideshow-auto li:first').fadeIn(1000);
		
		if(this.len > 1) {
			this.interval = setInterval(function() {
				_this.next();
			}, this.timer);
		}
	},
	
	
	next: function() {
		var id = this.current+1;
		if(id < 0) { id = this.len - 1 }
		else if(id >= this.len) { id = 0; }
		//console.debug('play '+ id);
		
		$('#slideshow-auto li:eq('+ this.current +')').fadeOut(500);
		$('#slideshow-auto li:eq('+ id +')').fadeIn(1000);
		this.current = id;
	},
	
};

$(document).ready(function(e) {
	slideshow.init(7000);
});
