var sliderwidth = "300px";
var slideheight = "300px";
var topslider_imgs = '<nobr>' + featured_topimages.join("") + '</nobr>';
var	botslider_imgs = '<nobr>' + featured_botimages.join("") + '</nobr>';
var whatson_imgs = '<nobr>' + whatson_images.join("") + '</nobr>';
var imagewidth = 91;
var featured_pos = 7;
var whatson_pos = 0; 
var sliderspeed = 3;
var Slideshow = Class.create();
	Slideshow.prototype  = {
	initialize: function ()
	{
		this.topslider = $('featured_gallery_top');
		this.botslider = $('featured_gallery_bottom');
		this.topslider.innerHTML =  topslider_imgs;
		this.botslider.innerHTML = botslider_imgs;
		
		this.whatson = $('preview_images');
		this.whatson_txt = $('preview_caption');
		this.whatson_txt.innerHTML = whatson_caption[0];
		this.whatson.innerHTML = whatson_imgs;
	},
	featured_slideleft: function () {
		if (featured_pos < featured_topimages.length)
		{
			this.swapGalleryBtn();
			$('gallery_slideshow_btn').href = '#';
			new Effect.MoveBy(this.topslider, 0, -90);
			new Effect.MoveBy(this.botslider, 0, -90);
			setTimeout("swapGalleryBtnBack()", 500);
			featured_pos++; 
			
		} else {
			this.swapGalleryBtn();
			$('gallery_slideshow_btn').href = '#';
			featured_pos = 7
			feat_length = (featured_topimages.length - 7) * 90;
			new Effect.MoveBy(this.topslider, 0, feat_length);
			new Effect.MoveBy(this.botslider, 0, feat_length);
			setTimeout("swapGalleryBtnBack()", 500);
		}
	}, 
	featured_slideright: function () {
		if (featured_pos > featured_topimages.length - 1)
		{
			alert(featured_pos);
			new Effect.MoveBy(this.topslider, 0, -90);
			new Effect.MoveBy(this.botslider, 0, -90);
			featured_pos++;
		} else {
			alert("w00p");
			featured_pos = 7;
			feat_length = (featured_topimages.length * 90) - 90;
			new Effect.MoveBy(this.topslider, 0, feat_length);
			new Effect.MoveBy(this.botslider, 0, feat_length);
		}
	},
	whatson_slideleft: function ()
	{
		if (whatson_pos < whatson_images.length - 1 )
		{
			this.swapTvBtn();
			$('tv_slideshow_btn').href = '#';
			new Effect.MoveBy(this.whatson, 0, -150);
			whatson_pos++;
			this.whatson_txt.innerHTML = whatson_caption[whatson_pos];
			setTimeout("swapTvBtnBack()", 500);
		} else {
			this.swapTvBtn();
			$('tv_slideshow_btn').href = '#';
			whatson_pos = 0;
			backlength = (whatson_images.length * 150) - 150;
			new Effect.MoveBy(this.whatson, 0, backlength);
			this.whatson_txt.innerHTML = whatson_caption[whatson_pos];
			setTimeout("swapTvBtnBack()", 500);
		}
	},
	swapGalleryBtn: function ()
	{
		$('gallery_slideshow_arrow').src = '/CreateTV.nsf/faded_arrow_right.gif';
		
	},
	swapTvBtn: function ()
	{
		$('tv_slideshow_arrow').src = '/CreateTV.nsf/faded_tv_arrow_right.gif';
	}
	
	
};
function swapGalleryBtnBack()
{
	$('gallery_slideshow_arrow').src = '/CreateTV.nsf/white_arrow_right.gif';
	$('gallery_slideshow_btn').href = 'javascript:gallery.featured_slideleft()';
}
function swapTvBtnBack()
{
	$('tv_slideshow_arrow').src = '/CreateTV.nsf/arrow_right_btn.gif';
	$('tv_slideshow_btn').href = 'javascript:gallery.whatson_slideleft()';
}
