
			Effect.BlindFromRight = function(element) {
				element = $(element);
				if (element.className != "noanim" && element.className != "nopanel") {
					element.setStyle({opacity: 0.0});
					element.setStyle({left: 580});
					var elementDimensions = element.getDimensions();
					var originalLeft = element.left;
					return new Effect.Parallel([
						new Effect.Move(element, {x: (elementDimensions.width*-1), y: 0, sync: true}),
						new Effect.Opacity(element, { sync: true, to: 1.0 }),
						new Effect.Scale(element, 100, Object.extend({
							scaleContent: false,
							scaleY: false,
							scaleFrom: 0,
							scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
							restoreAfterFinish: true,
							afterSetup: function(effect) {
								effect.element.makeClipping();
								effect.element.setStyle({left:  860, right:  860});
								effect.element.setStyle({width: '0px'});
								effect.element.show();
							},
							afterFinishInternal: function(effect) {
								effect.element.undoClipping();
								effect.element.down().setStyle({overflow: 'auto'});
							}
						}, arguments[1] || {}))
					],
					Object.extend({
						duration: 0.75
					}));
				}
			}
			
			Effect.DivSwap = function(element,container){
				container = $(container);
				var nodeList = container.childNodes;

				if(Element.visible(element)==false){
					for(i=0;i<nodeList.length;i++){
						if(nodeList.item(i).nodeName=="DIV" && nodeList.item(i).id!=element){
							if(Element.visible(nodeList.item(i))==true){
								Effect.Fade(nodeList.item(i),{duration: 0.1, queue:{position:'end',scope:container}})
							}
						}
					}							
					Effect.Appear(element,{duration: 0.5, queue:{position:'end',scope:container}})
				}
				return false;
			}
			
			PageFlipper = Class.create();
			PageFlipper.prototype = {
				initialize: function(el) {
					this.pages = document.getElementsByClassName('page');
					try
					{
						this.navElement = $(el);
					}
					catch (e)
					{
						this.navElement = null;
					}
					if (this.pages.length)
						this.showPage(0);
				},
				showPage: function(idx) {
					/*for (var i = 0; i < this.pages.length; i++) {
						idx == i ? this.pages[i].show() : this.pages[i].hide();
					}*/
					for(i=0;i<this.pages.length;i++){
						if(Element.visible(this.pages[i])==true){
							Effect.Fade(this.pages[i],{duration: 0.1, queue:{position:'end',scope:'global'}})
						}
					}							
					Effect.Appear(this.pages[idx],{duration: 0.5, queue:{position:'end',scope:'global'}})
				},
				pageNavigation: function(element) {
					this.eventMouseAction = this.showPage.bindAsEventListener(this);
					if (this.navElement != null)
					{
						if (this.pages.length > 1) {
							for (i = 0; i < this.pages.length; i++) {
								var tempElement = $(document.createElement("DIV"));
								tempElement.addClassName("page-nav");
								tempElement.addClassName("n"+i);
								tempElement.innerHTML = '<a href="javascript:pf.showPage(' + i + ');" class="' + this.navElement.className + '">' + (i+1) + '</a>';
								Element.makePositioned(tempElement);
								this.navElement.appendChild(tempElement);
							}					
						}
					}
				}
			}
			var pf;

			var Popup = Class.create();
			Popup.prototype = {
				initialize: function() {
					if (!document.getElementsByTagName){ return; }
					var anchors = document.getElementsByTagName('a');
			
					// loop through all anchor tags
					for (var i=0; i<anchors.length; i++) {
						var anchor = anchors[i];
						
						var relAttribute = String(anchor.getAttribute('rel'));
						
						// use the string.match() method to catch 'lightbox' references in the rel attribute
						if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('popup'))) {
							anchor.onclick = function () { myPopup.Start(this); return false; }
						}
					}
				},
				Start: function(popupLink) {
					if (!document.getElementsByTagName){ return; }
					var props = popupLink.getAttribute('rel').substring(5,popupLink.getAttribute('rel').length);
					var properties = [];
					if (props.charAt(0) == '[')
						var properties = eval(props);
					window.open(popupLink.getAttribute('href'),"Popup","width="+properties[0]+",height="+properties[1],"menubar=no,toolbar=no,location=no,directories=no,personalbar=no,scrollbars=no,dependent=no");
					return;
				}
			}
			var myPopup;
			
			var Slideshow = Class.create();
			Slideshow.prototype = {
				slow: false,
				initialize: function(_container,_doSlow) {
					this.container = $(_container);
					this.photos = this.container.descendants();
					this.currentPhoto = 0;
					this.slow = _doSlow;
					if (this.photos.length > 1)
						this.start();
				},
				start: function() {
					for (var i = 1; i < this.photos.length; i++)
						this.photos[i].hide();
					this.interval = setInterval(this.flip.bind(this),this.slow?5000:3000);
				},
				flip: function() {
					var lphoto = this.currentPhoto;
					if (this.currentPhoto == (this.photos.length-1))
					{
						this.currentPhoto = 0;
						for (var i = 1; i < this.photos.length-1; i++)
							this.photos[i].hide();
						new Effect.Fade(this.photos[this.photos.length-1],{duration: 0.5});
					}
					else
					{
						this.currentPhoto++;
						new Effect.Appear(this.photos[this.currentPhoto],{duration: 0.5});
					}
				}
			}
			
			var Flip = Class.create();
			Flip.prototype = {
				initialize: function(_container) {
					this.container = $(_container);
					this.slides = this.container.descendants();
					this.currentSlide = 0;
					if (this.slides.length > 1)
						this.start();
				},
				start: function() {
					for (var i = 1; i < this.slides.length; i++)
						this.slides[i].hide();
				},
				flip: function(_idx) {
					if (_idx != this.currentSlide)
					{
						if (_idx > 0)
						{
							new Effect.Fade(this.slides[this.currentSlide],{duration: 0.5});
							new Effect.Appear(this.slides[_idx],{duration: 0.5});
							this.currentSlide = _idx;
						}
						else if (_idx == 0)
						{
							this.slides[0].show();
							for (var i = 1; i < this.slides.length; i++)
								new Effect.Fade(this.slides[i],{duration: 0.5});
							this.currentSlide = 0;
						}
					}
				}
			}
			var fp;
			
			Event.observe(window, "load", function() {
				pf = new PageFlipper('pagenav');
				pf.pageNavigation();				
				setTimeout(function() {
					new Effect.BlindFromRight('panel')
				}, 500);
				myPopup = new Popup();
				if (location.search.indexOf('sent') != -1)
					alert('Thank you.\n\nThe form has been submitted.');
				if (document.getElementById('photocontainer'))
					new Slideshow('photocontainer',false);
				if (document.getElementById('flipcontainer'))
					fp = new Flip('flipcontainer');
			});