// Slideshow for Younilife.com homepage - 22/05/2010, AW //

slideshow = {
	
	start_delay: 5000,
	slide_speed: 500,
	interval: 7500,
	total: 0,
	current: 0,
	width:520,
	
	urls: new Array(),
	titles: new Array(),
	
	init: function() {
		setTimeout('slideshow.start()', this.start_delay);
	},
	
	next: function() {
		$('#slideshow' + this.current).animate({left:(0-this.width)}, this.slide_speed);
		++this.current;
		if (this.current == this.total)
			this.current = 0;
		$('#slideshow' + this.current).css({left:this.width});
		$('#slideshow' + this.current).animate({left:(0)}, this.slide_speed);
		$('#slideshow_link').attr('title', this.titles[this.current]);
		$('#slideshow_link').attr('href', this.urls[this.current]);
	},
	
	start: function() {
		if (slideshow.total > 1) {
			this.next();
			setInterval('slideshow.next()', this.interval);
		}
	}
	
};
