var Gallery = new Class({	intPrevious: 0,	arrThumbnails: [],	arrImages: [],	objFx: {},	intPage: false,		initialize: function(strImages, strThumbnails)	{		this.arrImages = $(strImages).getElements( 'img' );		this.arrThumbnails = $(strThumbnails).getElements( 'img' );				this.arrThumbnails.each( function(eleThumb, intIndex) {			//if( intIndex != 0 ) eleThumb.setStyle('opacity', 0.5);			//eleThumb.addEvent('click', this.showImage.bind(this, intIndex));			//eleThumb.addEvent('mouseover', this.setStyle('border', '2px solid red'));						eleThumb.addEvents({				click:  this.showImage.bind(this, intIndex) ,				mouseover: function() {this.setStyle('opacity','.8')},				mouseout: function() {this.setStyle('opacity','1')}			});					}.bind(this) );	},		showImage: function(intIndex)	{		if(this.intPrevious != intIndex)		{			// interrupt any currently running transition effects			if( this.objFx.element ) {				this.objFx.cancel();				this.objFx.element.setStyle('display', 'none');			}						this.objFx = new Fx.Tween(				this.arrImages[this.intPrevious],				{					onComplete: function(intPrevious, intIndex)					{							this.arrImages[intPrevious].setStyle('display', 'none');						this.arrImages[intIndex].setStyles({							display: 'block',							opacity: 0						});						this.arrImages[intIndex].fade(0, 1);						//$('photoCredit').innerHTML = this.arrThumbnails[intIndex].className;					}.bind(this, [this.intPrevious, intIndex])				}			);			this.objFx.start('opacity', 0);			this.arrThumbnails[this.intPrevious].setStyle('opacity', 0.9);			this.arrThumbnails[this.intPrevious].setStyle('border', '4px solid #ffffff');			this.arrThumbnails[intIndex].setStyle('opacity', 1);			this.arrThumbnails[intIndex].setStyle('border', '4px solid #7d3019');			this.intPrevious = intIndex;		}	},		showNext: function()	{		intIndex = ((this.intPrevious + 1) < this.arrImages.length) ? this.intPrevious + 1 : 0;		this.showImage(intIndex);	},		showPrevious: function()	{		intIndex = (this.intPrevious != 0) ? this.intPrevious - 1 : this.arrImages.length - 1;		this.showImage(intIndex);	},		loadThumbnails: function()	{		arrImages = $unlink( this.arrThumbnails );		var arrSources = [];		this.arrThumbnails.each(function(eleImage) {			arrSources.push(eleImage.get('src'));		});		new Asset.images(arrSources, {			onComplete: function() {				var objChain = new Chain;				var eleImage = arrImages.shift();				objChain.chain(function() {					eleImage.set('tween', {						duration: 300					}).tween('opacity', 0, 1);					this.callChain.delay(100, this);				});				arrImages.each(function(eleImage) {					objChain.chain(function() {						eleImage.set('tween', {							duration: 300						}).tween('opacity', 0, 0.9);						this.callChain.delay(100, this);					});				});				objChain.callChain();			}		} );	}});			//image fadervar loadImages = function(strSelector, dur, del){	var arrImages = $(strSelector).getElements('img');	var arrSources = [];	arrImages.each(function(eleImage) {		arrSources.push(eleImage.get('src'));	});	new Asset.images(arrSources, {		onComplete: function() {			var objChain = new Chain;			arrImages.each(function(eleImage) {				objChain.chain(function() {					eleImage.set('tween', {						duration: dur					}).tween('opacity', .1, 1);					this.callChain.delay(del, this);				});			});			objChain.callChain();		}	} );}						window.addEvent("domready", function() {		////////////////////////////			//CAROUSEL		////////////////////////////				if( $('carousel') ) {				var wrapper = $('fp_box'); // The outer wrapper			var carousel = $('carousel'); // The inner wrapper			var items = $$('.soItem'); 			var item_width = 245; // width of box or multiply for boxes moved			//var items_moved = 1; 			var max_margin = (items.length * item_width) - (item_width * 1);				var animation = new Fx.Tween(carousel, {duration: 800, transition: Fx.Transitions.Quad.easeOut});						// The function to browse forward			function next_item(pos){				if(pos <= -max_margin){					//animation.start('left', 0);					//$('next').setStyle('background', 'url(http://www.foushee.com/z_img/nextOff.png)');					//alert('fin'+pos);				} else { 										var newposition = pos - (item_width * 1);					animation.start('left', newposition);				}			}						// Set up the 'next' and 'previous' buttons			$('next').addEvent('click', function(e){ 				e.stop();				var position = parseInt(carousel.getStyle('left'));				next_item(position);			});			 		}				//SUITES		if($('largePhoto')){			objGallery = new Gallery("largePhoto", "rightThumbs");			objGallery.loadThumbnails();		}						if($('galleryThumbs')){						thumbs = $('galleryThumbs').getElements('img');			thumbs.each( function(el) {				el.addEvents({					mouseover: function() {this.setStyle('border','4px solid #9b3b20')},					mouseout: function() { this.setStyle('border','4px solid #ffffff') }				});			});		}		//list links		if($('accList')) {						items = $('accList').getElements('li');			items.each( function(el) {				el.addEvents({					mouseenter: function() {						this.setStyle('background-color','#c0b9ae');					},					mouseleave: function() { 						this.setStyle('background-color','#ffffff');					},					click: function() { 						thelinkel = this.getElement('a');						thelink = thelinkel.href;						//alert(thelink);						location.href=thelink;					}				});						});					}		});
