
var SlideShow = Class.create();

SlideShow.prototype = {

	initialize: function(id, n, count) {
		this.id = id;
		this.selected = n;
		this.count = count;

//		$$('#SlideShow_' + this.id + ' .SlideShow_window')[0].style.height = $('SlideShow_content_' + this.id).getHeight() + 'px';
		
		this.showSlide(this.selected);
	},
	
	
	showSlide: function(n)
	{
		try {
			//$('SlideShow_' + this.id + '_number_' + this.selected).removeClassName('on');
		}
		catch(e) {}

		this.selected = n;
		x = -1 * (n-1) * 600;
		duration = 0.2;
		new Effect.Move ('SlideShow_content_' + this.id, {x: x, y:0, mode:'absolute', duration: duration});
		
		$nextDisplay = 'block';
		
		if (this.selected >= this.count)
			$nextDisplay = 'none';
		$('slideshow_' + this.id + '_next_img').style.display = $nextDisplay;
		
		$prevDisplay = 'block';
		
		if (this.selected == 1)
			$prevDisplay = 'none';
		$('slideshow_' + this.id + '_prev_img').style.display = $prevDisplay;
		

		//$('SlideShow_' + this.id + '_number_' + this.selected).addClassName('on');
	},
	
	showNext: function()
	{
		if (this.selected < this.count)
		{
			this.showSlide(this.selected + 1);
		}
	},
	
	showPrevious : function()
	{
		if (this.selected > 1)
		{
			this.showSlide(this.selected - 1);
		}
	}			
}
