var Sliderlist = Class.create();

Sliderlist.prototype = {
	initialize: function(objId) {
		this.selected = 1;
		this.max = 12;
		this.featureMax = 8;
		this.currentlySwapping = false;
		this.scrollingActive = true;
		this.numScrolls = 0;
		this.movieExists = true;
	},

	swap: function(num) {

		if (num == this.selected || this.currentlySwapping) return false;

		if (this.getFlashMovie() != null) {
			if (num == 1) setTimeout("s.playMovie();",600);
			else this.pauseMovie();
		}

		this.disableSwap();
		$$('#item'+this.selected+' .folio')[0].removeClassName('active');
		$$('#item'+num+' .folio')[0].addClassName('active');

		setTimeout('new Effect.Morph("item'+num+'",{duration: 0.6,style: {width: "420px"}});',10);
		setTimeout('new Effect.Morph("item'+this.selected+'", {duration: 0.6,style: {width: "20px"},afterFinish: s.enableSwap});',10);

		this.selected = num;
	},

	scrollNext: function() {
		if (!this.scrollingActive || this.numScrolls >= this.featureMax) return false;

		this.numScrolls++;

		if (this.selected < this.featureMax) this.swap(this.selected+1);
		else this.swap(2);
	},

	disableSwap: function() {
		this.currentlySwapping = true;
	},

	enableSwap: function() {
		s.currentlySwapping = false;
	},

	getFlashMovie: function() {
		if (!this.movieExists) return null;


		movieName = "feature-flash";
		var isIE = navigator.appName.indexOf('Microsoft') != -1;

		return (isIE) ? window[movieName] : document[movieName];
	},

	destroyMovie: function () {
		this.movieExists = false;
		setTimeout("$ID('slider-banner').removeChild($ID('feature-movie-container'))",10);
	},

	playMovie: function () {
		this.getFlashMovie().playMovie();
	},

	pauseMovie: function () {
		this.getFlashMovie().pauseMovie();
	}

}