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));		}.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', 1);	// opacity setting after default			//this.arrThumbnails[this.intPrevious].setStyle('opacity', 0.5);			//this.arrThumbnails[this.intPrevious].setStyle('border', '2px solid #ffffff');						this.arrThumbnails[intIndex].setStyle('opacity', 0.5);	// opacity setting after default			//this.arrThumbnails[intIndex].setStyle('opacity', 1);			//this.arrThumbnails[intIndex].setStyle('border', '2px solid #af8a3e');						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, 0.5);	// default opacity					this.callChain.delay(100, this);				});				arrImages.each(function(eleImage) {					objChain.chain(function() {						eleImage.set('tween', {							duration: 300						}).tween('opacity', 0, 1);	// default opacity						this.callChain.delay(100, this);					});				});				objChain.callChain();			}		} );	}});/*window.onload('domready', function(){	if($('subNav')){		$('subNav').tween('opacity', [.01, 1]);				if($('portfolioOtherViews')){			objGallery = new Gallery("portfolioImageBox", "portfolioOtherViews");			objGallery.loadThumbnails();		}	}});*/window.addEvent('domready', function() {									 	//HOMEPAGE SPOTLIGHT EFFECTS				 	if($('homeSpotlight')) {				loadImages( $('homeSpotlight') , 700, 75);		//new Fx.Reveal($('homeSpotlight')).reveal();				spotItems = $('homeSpotlight').getElements('.spotItem');		spotItems.each(function(el, i) {			el.addEvent( 'mouseenter', function(ev) {											   				this.getElement('.infoBox').set('tween', {  duration:100, transition: Fx.Transitions.Quart.easeIn});				this.getElement('.infoBox').tween('opacity', [.01, 1]);								this.getElement('.opacity').set('tween', {  duration:500, transition: Fx.Transitions.Quart.easeOut});				this.getElement('.opacity').tween('opacity', [.01, .5]);				//this.getElement('.opacity').tween('width', [0, 168]);											});			el.addEvent( 'mouseleave', function(ev) {											  				this.getElement('.infoBox').set('tween', {  duration:400, transition: Fx.Transitions.Quart.easeOut});				this.getElement('.infoBox').tween('opacity', [1, .01]);								this.getElement('.opacity').set('tween', {  duration:700, transition: Fx.Transitions.Quart.easeOut});				this.getElement('.opacity').tween('opacity', [.5, .01]);			});						//el.fireEvent('click', $('anElement'), 1000);		});									}									 									 									 	/*if($('portfolioNav')){		$('portfolioNav').tween('opacity', [.01, 1]);*/	if($('subNav')){		$('subNav').tween('opacity', [.01, 1]);				if($('portfolioOtherViews')){			objGallery = new Gallery("portfolioImageBox", "portfolioOtherViews");			objGallery.loadThumbnails();		}				if($('bioThumbs')){			objGallery = new Gallery("individualPhotoLarge", "bioThumbs");			objGallery.loadThumbnails();		}	}		if($('baselineLImg')){		var bl = $('baselineLeft');		bl.addEvent( 'mouseenter', function(ev) {			$('baselineLImg').tween('opacity', [0, 1]);  		});		bl.addEvent( 'mouseleave', function(ev) {			$('baselineLImg').tween('opacity', [1, 0]);  		});	}			/* DISABLED 02 19 2010 :: needed url for baseline functionality 		if( $('portfolioNavItems') ) {		portfItems = $('portfolioNavItems').getElements('a');		portfItems.each(function(el, i) {			el.addEvent( 'mouseover', function(ev) {				this.getElement('img').setStyle('visibility','visible');			});			el.addEvent( 'mouseout', function(ev) {				this.getElement('img').setStyle('visibility','hidden');			});		});	}				//PORTFOLIO AJAX	if($('portfolioNavItems')) {		pItems = $('portfolioNavItems').getElements('a');				pItems.each(function(el, i) {						el.addEvent( 'click', function(ev) {							ev.stop();				//window.location.href = this.href+'tacos';								var page = this.href;								//alert(page);								var poststr = "page="  + page + '&div=mainContent';							var portfolioRequest = new Request.HTML({					method: 'get',					url: '/_new/z_lib/ajax-portfolio.php',					response: 'text',					//data: { 'do' : '1' },					onSuccess: function(response) {						//Clear the text currently inside the results div.												//$('mainContent').tween('opacity', 0);						//$('mainContent').set('text', '');						//$('mainContent').tween('opacity', 1);						//$('mainContent').set('text', '');						//Inject the new DOM elements into the results div.						//$('mainContent').adopt(response);						//$('mainContent').tween('opacity', 1);												testCall(response);					},					//update: 'wrapper'				//}).send();				}).send(poststr);								//portfolioRequest.onSuccess(responseText);			});										});			}				*/											/*******************************		//AJAX NAV	//NOT ACTIVATED; need to resolve issue of updating multiple divs with one response.			supPages = $$('.subpages').getElements('a');	supPages.each(function(el, i) {			//sectionLink = el.getElement(':first-child');			el.addEvent( 'click', function(ev) {					ev.stop();			//window.location.href = this.href+'tacos';						var page = this.name;						alert(page);						var poststr = "page="  + page;					new Request.HTML({				method: 'get',				url: 'z_lib/ajax-test.php?page='+this.get('href'),								data: { 'do' : '1' },				update: 'mainContent'			}).send();			//}).send(poststr);		});	});	*************************************/							function testCall(response) {				$('mainContent').tween('opacity', 0);		$('mainContent').set('text', '');		$('mainContent').tween('opacity', 1);		$('mainContent').adopt(response);				}			var toggles = $$('.qaToggler');	var content = $$('.qaElement');				//QA ACCORDION	if(toggles) {								//var AccordionObject = new Accordion(toggles, content);						var AccordionObject = new Accordion(toggles, content, { 				alwaysHide: true,				show: -1,								onActive: function(toggler, element){					//toggler.setStyles({'color': '#EBD0A5','background-color': '#464646'});					//toggler.setStyles('background-color','#464646''color','#464646');					//toggler.setStyle('color','#b6341a');					//toggler.setStyle('background','url(/_new/z_img/gdiArrowDown.png) no-repeat 0px 6px');										arrowSpan = toggler.getElement('span');					arrowSpan.setStyle('background','url(/z_img/gdiArrowDown.png) no-repeat 0px 0px');									},			 				onBackground: function(toggler, element){					//toggler.setStyles({'color', '#FFFFE6','background-color': '#323232'});					//toggler.setStyles('background-color','#323232');					//toggler.setStyle('color','#333333');					//toggler.setStyle('background','url(/_new/z_img/gdiArrowRight.png)  no-repeat 0px 6px');										arrowSpan = toggler.getElement('span');					arrowSpan.setStyle('background','url(/z_img/gdiArrowRight.png)  no-repeat 0px 0px');				}							});						toggles.each( function(el){				el.addEvents({					mouseover: function() {						this.set('tween', {duration: 100});						this.tween('background-color','#ececec');					},					mouseout: function() {						this.set('tween', {duration: 250});						this.tween('background-color','#ffffff');					}				});			 });			 			 elItems = $$('.portfolioItem');			 			elItems.each( function(elc){				elc.addEvents({					mouseover: function() {						this.set('tween', {duration: 100});						this.tween('background-color','#eeeeee');					},					mouseout: function() {						this.set('tween', {duration: 250});						this.tween('background-color','#ffffff');					}				});			 });	}					});/////////////////////////////////////////////////////////////////////////////////////////////////////var loadImages = function(strSelector, myDuration, myDelay){	var arrImages = $(strSelector).getElements('img');		var arrSources = [];	arrImages.each(function(eleImage) {		arrSources.push(eleImage.get('src'));	});		arrImages.shuffle();	//arrSources.sort();	new Asset.images(arrSources, {		onComplete: function() {			var objChain = new Chain;			arrImages.each(function(eleImage) {				objChain.chain(function() {					eleImage.set('tween', {						duration: myDuration					}).tween('opacity', .01, 1);					this.callChain.delay(myDelay, this);				});			});			objChain.callChain();		}	} );}Array.implement({	shuffle:function() {	this.sort(function (x,y) { return Math.floor(Math.random()*3)-1; });	return this;	}});
