// JavaScript Document/*  (c) Copyright 2006 Apple Computer, Inc. All rights reserved.  *//*////////////////////////////////////////////////////////////////////////  Methods to create and manipulate the slideshow     //////////////////////////////////////////////////////////////////////*/function Slideshow(imgCount,transition,playHandler) {	this.fadeHandler = null;	this.fadeTimer = 1;	this.transition = arguments[1];	this.imgCount =  imgCount != null ? imgCount : 0;	this.type = null;	this.playHandler = arguments[2];	this.playCounter = 0;	this.ready = false;	var me = this;		this.initialize = function initialize() {		this.clear();				// load the currently selected image plus next & previous into cache		this.currentImage = this.getCurrentImage(this.imgCount);		this.nextImage = this.getNextImage(this.imgCount);		this.previousImage = this.getPreviousImage(this.imgCount);		placeImage('slide',this.currentImage, 1);			if (document.getElementById('caption')) {			var captionText = reflect ? this.currentImage.caption : '';			document.getElementById('caption').appendChild(document.createTextNode(captionText));		}				if (document.getElementById('thumb' + this.imgCount)) {			document.getElementById('thumb' + this.imgCount).className = 'selectedthumb';		}		this.type = getType(this.currentImage.cache);				window.focus();			return true;	};		// clear old thumbnail picker selection borders, slide images, and captions	this.clear = function clear() {			var slides = document.getElementById('matte');		while (slides.hasChildNodes()) {			slides.removeChild(slides.lastChild);		}			var caption = document.getElementById('caption');		while (caption.hasChildNodes()) {			caption.removeChild(caption.lastChild);		}			 	 // clear the old selection border on the thumbnailPicker		if (document.getElementById('thumbnailPicker')) {			var thumbs = document.getElementById('thumbnailPicker').getElementsByTagName('img');			for (var k=0; k<thumbs.length; k++) {				if (thumbs[k].className == 'selectedthumb') {					thumbs[k].className = 'thumb';				}			}		}			};		this.currentSlide = function currentSlide() {		var theSlide = new Array;		theSlide['main'] = document.getElementById('slide');		theSlide['reflection'] = document.getElementById('slide_reflect');		return theSlide;	};		this.newSlide = function newSlide() {		var theSlide = new Array;		theSlide['main'] = document.getElementById('topslide');		theSlide['reflection'] = document.getElementById('topslide_reflect');		return theSlide;	};		this.moveNext = function moveNext() {		var prevImgCount = this.imgCount;		this.imgCount =  (this.imgCount + 1)%imgs.length;		this.currentImage = this.getCurrentImage(this.imgCount);		this.nextImage = this.getNextImage(this.imgCount);		this.previousImage = this.getPreviousImage(this.imgCount);		document.getElementById("thumb" + this.imgCount).className = 'selectedthumb';		document.getElementById("thumb" + prevImgCount).className = 'thumb';	};		// method to cache images & set counters for slideshow	this.movePrevious = function movePrevious() {		var prevImgCount = this.imgCount;		this.imgCount =  (this.imgCount - 1)%imgs.length;		if (this.imgCount < 0) {this.imgCount = imgs.length - 1; }		this.currentImage == this.getCurrentImage(this.imgCount);		this.nextImage = this.getNextImage(this.imgCount);		this.previousImage = this.getPreviousImage(this.imgCount);		document.getElementById("thumb" + this.imgCount).className = 'selectedthumb';		document.getElementById("thumb" + prevImgCount).className = 'thumb';	};			this.resetSlideshow = function resetSlideshow(i) {		if (this.fadeHandler == null) {			slideshow = new Slideshow(i, this.transition, this.playHandler);		}	};			// slideshow looping functions	this.getCurrentImage = function getCurrentImage(count) {		count = (count)%imgs.length;		if (count < 0) { count = imgs.length - 1; }				if (imgs[count].cache == null) {			imgs[count].cache = document.createElement('img');			imgs[count].cache.id = count;			imgs[count].reflection = document.createElement('img');			if (browser.supportsOnload) {				addEvent(imgs[count].cache, 'onload', function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].cache, 'onerror',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].cache, 'onabort',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].reflection, 'onload',  function() { me.currentReflectLoad(count) }, true);				addEvent(imgs[count].reflection, 'onerror', function() {  me.currentReflectLoad(count) }, true);				addEvent(imgs[count].reflection, 'onabort',  function() {  me.currentReflectLoad(count) }, true);			} else {				imgs[count].cacheReady = true;				imgs[count].reflectReady = true;			}			imgs[count].cache.src = imgs[count].src;			imgs[count].reflection.src = addTransformation(imgs[count].src, 'reflect');			imgs[count].cache.alt = imgs[count].caption;		}		return imgs[count];		};		this.currentImageLoad = function currentImageLoad(count) {		imgs[count].cacheReady = true; 	};	 this.currentReflectLoad = function currentImageLoad(count) {		imgs[count].reflectReady = true; 	};	this.getNextImage = function getNextImage(count) {		count = (count + 1)%imgs.length;		if (count < 0) { count = imgs.length - 1; }		if (imgs[count].cache == null) {			imgs[count].cache = document.createElement('img');			imgs[count].reflection = document.createElement('img');			if (browser.supportsOnload) {				addEvent(imgs[count].cache, 'onload',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].cache, 'onerror',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].cache, 'onabort',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].reflection, 'onload',  function() {  me.currentReflectLoad(count) }, true);				addEvent(imgs[count].reflection, 'onerror',  function() {  me.currentReflectLoad(count) }, true);				addEvent(imgs[count].reflection, 'onabort',  function() { me.currentReflectLoad(count) }, true);			} else {				imgs[count].cacheReady = true;				imgs[count].reflectReady = true;			}			imgs[count].cache.src = imgs[count].src;			imgs[count].reflection.src = addTransformation(imgs[count].src, 'reflect');			imgs[count].cache.alt = imgs[count].caption;		}		return imgs[count];		};		this.getPreviousImage = function getPreviousImage(count) {		count = (count - 1)%imgs.length;		if (count < 0) { count = imgs.length - 1; }		if (imgs[count].cache == null) {			imgs[count].cache = document.createElement('img');			imgs[count].reflection = document.createElement('img');			if (browser.supportsOnload) {				addEvent(imgs[count].cache, 'onload',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].cache, 'onerror',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].cache, 'onabort',  function() { me.currentImageLoad(count) }, true);				addEvent(imgs[count].reflection, 'onload',  function() {  me.currentReflectLoad(count) }, true);				addEvent(imgs[count].reflection, 'onerror',  function() {  me.currentReflectLoad(count) }, true);				addEvent(imgs[count].reflection, 'onabort',  function() {  me.currentReflectLoad(count) }, true);			} else {				imgs[count].cacheReady = true;				imgs[count].reflectReady = true;			}			imgs[count].cache.src = imgs[count].src;			imgs[count].reflection.src = addTransformation(imgs[count].src, 'reflect');				imgs[count].cache.alt = imgs[count].caption;		}		return imgs[count];		};		//  Begin playing the slideshow.	this.play = function play(startNow) {				clearInterval(this.playHandler);			this.playHandler = null;			this.fadeTimer = 0;					// do the first transition quickly so there is no lag, then start play			if ( startNow && this.currentImage.ready() ) { 				this.doTransition('next');			}						// set counter to 10 second default for load			me.playCounter = 15000;			this.ready = false;			if (this.type != 'none') {				this.playHandler = setInterval(this.playCountdown, 100);			} else {				this.playHandler = setInterval("slideshow.playCountdown()", 100);			}	};		this.playCountdown = function playCountdown() {			if (me.playCounter > 0) {			// poll to see if image has loaded & start 'real' count from there					if (!me.ready) {				if (me.currentImage.ready() ) {  					me.playCounter = slideTime;					me.ready = true;				}			}			me.playCounter = me.playCounter - 100;		} else {			me.doTransition();			me.playCounter = 15000;			me.ready = false;		}			};		// Allows user to skip forward and back in slideshow while playing.  Play counter & ready state is reset after transition.		this.skip = function skip(direction) {		if (this.fadeHandler != null) {				if (direction == 'prev') {						this.fadeTimer = 1;						this.playCounter = 10000;						this.ready = false;				} else {						this.playCounter = 10000;						this.ready = false;				}		 } else {					 			//this.pause();					this.doTransition(direction, null);					this.playCounter = 10000;					this.ready = false;		}  }			// Handles transitions (both effects & skip) in either direction. 	 	this.doTransition = function doTransition(direction, transition) {		var newimg;				transition = transition == null ? me.transition : transition;		newimg = direction == 'prev' ? me.previousImage : me.nextImage;		if (me.fadeHandler == null && imgs.length > 1) {			if (transition == 'dissolve') { 				me.snapfade(newimg,1000);			} else {				me.swap(newimg);			}			if (direction == 'prev') {				me.movePrevious();			} else {				me.moveNext();			}											if (document.getElementById('caption')) {				while (document.getElementById('caption').hasChildNodes()) {					document.getElementById('caption').removeChild(document.getElementById('caption').lastChild);				}							var captionText = reflect ? newimg.caption : '';				document.getElementById('caption').appendChild(document.createTextNode(captionText));			}					}	};			// Halts play of slideshow.  This is a temporary pause, and play will be resumed by 	// mousing off of any of the hover controls, unless the playHandler has been set to -1.		this.pause = function pause() {		if (this.fadeHandler != null) { 			if (this.fadeTimer > .65) {				this.fadeTimer = -1;			} else {				this.fadeTimer = 0; 			}		}				clearInterval(this.playHandler);		if (this.playHandler != -1) {			this.playHandler = null;		}			};				//  Regular image swap transition to new slide	this.swap = function swap(newimg)  {			var obj = this.currentSlide()['main'];			var newSlide = createSlide('topslide', newimg, .99);			try {				obj.parentNode.removeChild(me.currentSlide()['reflection']);				me.newSlide()['reflection'].setAttribute('id','slide_reflect');				obj.parentNode.removeChild(obj) ;				newSlide.setAttribute('id', 'slide');			} catch (e) {	this.pause(); }				return true;	};	//  Fade transition - initial 'snap' to new slide followed by a 	//  linear dissolve	this.snapfade = function snapfade(newimg,time)  {					//if any kind of opacity is supported		if(this.type != 'none') {						this.fadeTimer = .5;					var interval = time != null? Math.round(time/1000) : 1;			// create new image and place over original				createSlide('topslide', newimg, 0);									//set time variables & start the time				this.fadeHandler = setInterval(me.doFade, interval);								}		else  {			//if opacity is not supported, just do the image swap			swap(newimg);		}						return true;	};		/// looping function for fade	this.doFade = function doFade()  {		var repetitions = fadeSpeed;				//decrease the counter on a linear scale 		me.fadeTimer = me.fadeTimer - (1 / repetitions);		var opacity = me.fadeTimer;		var obj = me.currentSlide()['main'];		var newSlide = me.newSlide()['main'];		//set new opacity value on both elements & filter  		setOpacity(obj, opacity);		setOpacity (newSlide,(1 - opacity));		setOpacity(me.currentSlide()['reflection'], opacity);		setOpacity(me.newSlide()['reflection'], (1 - opacity));				// if the transition is interrupted, back out to the originalimage		if (me.fadeTimer <= -1 ) {						newSlide.parentNode.removeChild(me.newSlide()['reflection']);				setOpacity(document.getElementById(me.currentSlide()['reflection']), 1);				newSlide.parentNode.removeChild(newSlide) ;				setOpacity(obj, 1);								//reset the counter & clean up					me.fadeTimer = 1;					clearInterval(me.fadeHandler);					me.fadeHandler = null;					me.movePrevious();			//if the counter is at the bottom		} else if (me.fadeTimer <= (1 / repetitions)) {						obj.parentNode.removeChild(me.currentSlide()['reflection']);			setOpacity(me.newSlide()['reflection'], 1);			me.newSlide()['reflection'].setAttribute('id','slide_reflect');			obj.parentNode.removeChild(obj) ;			setOpacity(newSlide, 1);			newSlide.setAttribute('id', 'slide');						//reset the counter & clean up				me.fadeTimer = 1;				clearInterval(me.fadeHandler);				me.fadeHandler = null;		}	};		this.initialize();		}/*////////////////////////////////////////////////////////////////////////  Methods to manipulate the hover controls     //////////////////////////////////////////////////////////////////////*/function hoverControls(divId) {	this.timer = 1;	this.fadeHandler = null;	this.divId = divId;	this.start = null;	this.end = null	this.holdFade = false;	this.restartFade = false;	var me = this;	var type;			this.fade = function fade(opacStart, opacEnd, millisec) {		//speed for each fram		type = getType(document.getElementById(this.divId));		if (speed == null || speed == 0) {speed = 1}		var currentOpac = getOpacity(document.getElementById(this.divId));		this.start = opacStart != currentOpac ? opacStart : currentOpac;		this.end = opacEnd;		if (type == 'ie' && this.end == 0) this.end = 1;		var speed = Math.round(millisec/1000);		this.timer = this.start;		clearInterval(me.fadeHandler);		if (type != 'none') {			this.fadeHandler = setInterval(me.doFade,speed);		} else {			setOpacity(document.getElementById(this.divId), this.end);		}			};		//change the opacity for different browsers	this.doFade = function doFade() {		var opacStart = me.start;		var opacEnd = me.end;		var object = document.getElementById(me.divId); 		object.style.display = '';		if(opacStart > opacEnd) {			me.timer = me.timer - 2;			if ( me.timer <= opacEnd){ 				me.timer = opacEnd;				clearInterval(me.fadeHandler);				me.fadeHandler = null;			} 		} else { 				me.timer = me.timer + 2; 				if ( me.timer >= opacEnd){ 					me.timer = opacEnd;					clearInterval(me.fadeHandler);					me.fadeHandler = null;				}		}		setOpacity(object, parseInt(me.timer)/100);		//if (me.timer <= 0) {  object.style.display = 'none'; }	};	}/*////////////////////////////////////////////////////////////////////////  Custom Scroller code      //////////////////////////////////////////////////////////////////////*/function Scroller() {	var scrollW = parseInt(slideWidth); // Width of scrollbar	var speed = 4; // Scroll speed		// Browser detection		var dom = document.getElementById ? true:false;	var nn4 = !dom && document.layers ? true:false;	var ie4 = !dom && !nn4 && document.all ? true:false;		var mouseY; // Mouse Y position onclick	var mouseX; // Mouse X position onclick		var clickLeft = false; // If click on left-arrow	var clickRight = false; // If click on right-arrow	var clickDrag = false; // If click on dragger	var clickScrollbar = false; // If click in scrollbar		var timer = setTimeout("",500); // Repeat variable	var leftL; // Up-arrow X	var leftT; // Up-arrow Y	var rightL; // Down-arrow X	var rightT; // Down-arrow Y	var dragL; // Scrollbar X	var dragT; // Scrollbar Y	var rulerL; // Ruler X	var rulerT; // Ruler Y	var contentL; // Content layer Y;	var contentW; // Content height	var contentClipW; // Content clip height	var scrollLength; // Number of pixels scrollbar should move	var startX; // Keeps track of offset between mouse and span	var leftOffset; // Keeps track of offset between scrollbar container and window edge	var topOffset; // Keeps track of offset between scrollbar container and window edge	var leftH ; // Height of up-arrow	var leftW; // Width of up-arrow	var rightH; // Height of down-arrow	var rightW; // Width of down-arrow	var dragH; // Height of dragger	var dragW; // Width of scrollbar	var me = this;	var eventLoader = function eventLoader(){	if(ie4){			leftOffset = document.all.scrollbar.style.pixelLeft;		topOffset = document.all.scrollbar.style.pixelTop;		// Scrollbar X and Y variables		dragL = document.all.dragtool.style.pixelLeft;		dragT = document.all.dragtool.style.pixelTop;				// Ruler Y variable		rulerT = document.all.ruler.style.pixelTop;				rulerL = document.all.ruler.style.pixelLeft;				// Height of content layer and clip layer		contentW = parseInt(document.all.thumbStrip.scrollWidth);		contentClipW = parseInt(document.all.thumbnailPicker.style.width);				dragH = parseInt(document.all.dragtool.style.height); 		dragW =  parseInt(document.all.dragtool.style.width); 	}	else if(nn4){	  // Offsets to account for containing div 		leftOffset = document.scrollbar.left;		topOffset = document.scrollbar.top;			// Scrollbar X and Y variables		dragL = document.dragtool.left;		dragT = document.dragtool.top;				// Ruler Y variable		rulerT = document.ruler.top;		rulerL = document.ruler.left;		// Height of content layer and clip layer		contentW = document.thumbStrip.clip.right;		contentClipW = document.thumbnailPicker.clip.right;		dragH = document.dragtool.height; 		dragW =  document.dragtool.width; 			}	else if(dom){		// Offsets to account for containing div 		leftOffset = getActualPosition(document.getElementById("scrollbar"),'x');		topOffset = getActualPosition(document.getElementById("scrollbar"),'y');		// Scrollbar X and Y variables		dragL = parseInt(document.getElementById("dragtool").style.left);		dragT = parseInt(document.getElementById("dragtool").style.top);		// Ruler Y variable		rulerT = parseInt(document.getElementById("ruler").style.top);		rulerL = parseInt(document.getElementById("ruler").style.left);		// Height of content layer and clip layer		contentW = parseInt(document.getElementById("thumbStrip").offsetWidth);		contentClipW = parseInt(document.getElementById("thumbnailPicker").offsetWidth);		dragH = parseInt(document.getElementById("dragtool").style.height); 		dragW =  parseInt(document.getElementById("dragtool").style.width); 	}	// Number of pixels scrollbar should move	scrollLength = ((scrollW-dragW)/(contentW-contentClipW));	// Initializes event capturing	if(nn4){		document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP );	} 	window.onresize = me.resetPosition;	if (contentW < contentClipW) {		document.getElementById('scrollbar').style.display = 'none';	}	document.onmousedown = down;	document.onmousemove = move;	document.onmouseup = up;};	this.resetPosition = function resetPosition() {	if(ie4){		leftOffset = document.all.scrollbar.style.pixelLeft;		topOffset = document.all.scrollbar.style.pixelTop;	}	else if(nn4){	  // Offsets to account for containing div 		leftOffset = document.scrollbar.left;		topOffset = document.scrollbar.top;	}	else if(dom){		// Offsets to account for containing div 		leftOffset = getActualPosition(document.getElementById("scrollbar"),'x');		topOffset = getActualPosition(document.getElementById("scrollbar"),'y');	}};		// Mousedown	var down = function down(e) {	 			 		getMouse(e);			startX = (mouseX - dragL);			// If click on up-arrow			if(mouseX >= leftL && (mouseX <= (leftL + leftW)) && mouseY >= leftT && (mouseY <= (leftT + leftH))){				clickLeft = true;				return me.scrollLeft();			}				// Else if click on down-arrow			else if(mouseX >= rightL && (mouseX <= (rightL + rightW)) && mouseY >= rightT && (mouseY <= (rightT + rightH))){				clickRight = true;				return me.scrollRight();			}			// Else if click on drag marker in scrollbar			else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= dragT && (mouseY <= (dragT + dragH + 4))){				clickDrag = true;				//prevent picker from fading out while scroller is clicked				if (thumbnails) {					thumbnails.holdFade = true;				}				return false;			}					else if(mouseY >= dragT && (mouseY <= (dragT + dragH + 4)) && mouseX >= rulerL && (mouseX <= (rulerL + scrollW))){					clickScrollbar = true;					return me.clickJump();			}			// If no scrolling is to take place			else{				return true;			}		};				// Drag function		var move = function move(e){			if(clickDrag && contentW > contentClipW){				getMouse(e);				dragL = (mouseX - startX);				if(dragL < (rulerL))					dragL = rulerL;						if(dragL > (rulerL + scrollW - dragW))					dragL = (rulerL + scrollW - dragW);				contentL = ((dragL - rulerL)*(1/scrollLength));				contentL = eval('-' + contentL);						moveTo();								// So ie-pc doesn't select gifs					return false;			}		};				var up = function(e){			clearTimeout(timer);			// Resetting variables			clickLeft = false;			clickRight = false;			clickDrag = false;						// fade thumbnail picker if mouse is outside the hotzone, otherwise, leave on			if (thumbnails && thumbnails.holdFade) {				thumbnails.holdFade = false;				getMouse(e);				var zoneL = getActualPosition(document.getElementById('thumbnailZone'),'x');				var zoneR = zoneL + parseInt(document.getElementById('thumbnailZone').style.width);				var zoneT = getActualPosition(document.getElementById('thumbnailZone'),'y');				var zoneB = zoneT + parseInt(document.getElementById('thumbnailZone').style.height);				if ((mouseX + leftOffset) > zoneL && (mouseX + leftOffset) < zoneR && (mouseY + topOffset) > zoneT && (mouseY + topOffset) < zoneB ) {					//do nothing				} else {					thumbnails.fade(30,0,2000);					slideshow.play(false);				}			}			return true;		};				// Reads content layer top		var getL = function getL(){			if(ie4)				contentL = document.all.thumbStrip.style.pixelLeft;			else if(nn4)				contentL = document.thumbStrip.left;			else if(dom)				contentL = parseInt(document.getElementById("thumbStrip").style.left);		};				// Reads mouse X and Y coordinates		var getMouse = function getMouse(e){		 if (typeof leftOffset == 'undefined' || typeof rightOffset == 'undefined') {		 	me.resetPosition();		 }			if(ie4 || (typeof event != 'undefined')){				mouseY = event.clientY + document.body.scrollTop - topOffset;				mouseX = event.clientX + document.body.scrollLeft - leftOffset;			} else if(nn4 || dom){				mouseY = e.pageY - topOffset;				mouseX = e.pageX - leftOffset;			}		};				this.jumpTo = function jumpTo(slideCount, slidePosition) {					if (contentW > contentClipW) {				getL(); 								if (slidePosition == 'left') {					contentL = (-slideCount * thumbMatte);				} else if (slidePosition == 'right') {					contentL = (-slideCount * thumbMatte) + contentClipW;				} else {					contentL = Math.round((contentClipW/2) -( slideCount * thumbMatte) - (thumbMatte/2));				}								if (contentL < scrollW-contentW ) {						contentL = scrollW - contentW;					} else if (contentL > 0) {						contentL = 0;					}					dragL = parseInt(contentL * (scrollW - dragW))/((scrollW - contentW));				if (dragL < 0) { dragL = 0};								return moveTo();			} else {				return false;			}		}						// Moves the layer		var moveTo = function moveTo(){			if(ie4){				document.all.thumbStrip.style.left = contentL + 'px';				document.all.ruler.style.left = dragL + 'px';				document.all.dragtool.style.left = dragL + 'px';			}			else if(nn4){				document.thumbStrip.left = contentL + 'px';				document.ruler.left = dragL + 'px';				document.dragtool.left = dragL + 'px';			}			else if(dom){				document.getElementById("thumbStrip").style.left = contentL + "px";				document.getElementById("dragtool").style.left = dragL + "px";				document.getElementById("ruler").style.left = dragL + "px";			}		  return true;		};					this.clickJump = function clickJump() {			getL();			if(clickScrollbar && contentW > contentClipW){				dragL = mouseX-(dragW/2);				if (dragL < 0) dragL = 0;				if (dragL > (scrollW - dragW)) dragL = scrollW - dragW;				contentL = Math.round((dragL * (scrollW - contentW))/(scrollW - dragW));				moveTo();				return up();			}	};	 this.scrollLeft = function scrollLeft(){			getL();						if(clickLeft && contentW > contentClipW){				if(contentL < 0){							dragL = dragL - (speed*scrollLength);										if(dragL < (rulerL))						dragL = rulerL;											contentL = contentL + speed;					if(contentL > 0)						contentL = 0;										moveTo();					timer = setTimeout(me.scrollLeft,25);				}			}			return false;		};			// Scrolls right	this.scrollRight = function scrollRight(){		getL();		if(clickRight && contentW > contentClipW){						if(contentL > -(contentW - contentClipW)){								dragL = dragL + (speed*scrollLength);					if(dragL > (rulerL + scrollW - dragH))						dragL = (rulerL + scrollW - dragH);										contentL = contentL - speed;					if(contentL < -(contentW - contentClipW))						contentL = -(contentW - contentClipW);										moveTo();					timer = setTimeout(me.scrollRight,25);    								} 			}						return false;	};		this.getContentL = function getContentL() {		return contentL;	};		this.getContentW = function getContentW() {		return contentW;	};		this.getContentClipL = function getContentClipL() {		return contentClipL;	};		this.getContentClipW = function getContentClipW() {		return contentClipW;	}			// Load the initial event handlers		eventLoader();}/*////////////////////////////////////////////////////////////////////////  Utility methods for slide & image  manipulation       //////////////////////////////////////////////////////////////////////*/	// create a div to contain the slide & append the image to itfunction createSlide(slideId, slideImage,opacity) {	return placeImage(slideId, slideImage,opacity);}		// place an image object in the center of a specified parent slide function placeImage(slideId, slideImage, opacity) {	if (document.getElementById(slideId) != null) {		document.getElementById(slideId).removeAttribute("id");	}		// make image invisible while properties are being set	slideImage.cache.style.display = 'none';		slideImage.cache = document.getElementById('matte').appendChild(slideImage.cache);	slideImage.cache.style.position = 'absolute';	slideImage.cache.setAttribute('id',slideId);	// reset image to its originally specified dimensions & to top left	slideImage.cache.style.left = 0 + "px";	slideImage.cache.style.top = 0 + "px";	slideImage.cache.setAttribute('height', slideImage.displayHeight);	slideImage.cache.setAttribute('width', slideImage.displayWidth);			 	var type = typeof slideshow == 'undefined' ? getType(slideImage.cache) : slideshow.type;	slideImage.cache.style.left = Math.round((slideWidth - slideImage.displayWidth)/2) + 'px';	slideImage.cache.style.top = Math.round((slideHeight - slideImage.displayHeight)/2) + 'px';	slideImage.cache.style.borderBottom = '2px solid ' + matte;		//make image invisible while properties are being set	slideImage.reflection.style.display = 'none';	var reflectImage = document.getElementById('matte').appendChild(slideImage.reflection);	reflectImage.style.position = 'absolute';	reflectImage.setAttribute('id', slideId + '_reflect');	reflectImage.style.top = slideImage.displayHeight + Math.round((slideHeight - slideImage.displayHeight)/2) + 2 + 'px';	reflectImage.style.left = Math.round((slideWidth - slideImage.displayWidth)/2) + 'px';	reflectImage.setAttribute('width', slideImage.displayWidth) + 'px';	reflectImage.setAttribute('height', slideImage.reflectHeight + 'px');	if (opacity != null) { 		setOpacity(reflectImage, opacity);	} else {		reflectImage.style.display = '';	} 		// display image & return	if (opacity != null) { 		setOpacity(slideImage.cache, opacity);	} else {		slideImage.cache.style.display = '';	}	return slideImage.cache;}		// remove a slide & its reflected image from the DOMfunction removeSlide(slideId) {		var obj = document.getElementById(slideId);	var reflection = document.getElementById(slideId + "_reflect");	if (obj) { obj.parentNode.removeChild(obj); }	if (reflection) { reflection.parentNode.removeChild(reflection); }}		// reloads page to position the layers againfunction reloadPage(){	location.reload();}// create slide image objectfunction SlideImage(src, width, height, caption) {		this.src = src;	this.caption = caption;	this.width = width;	this.height = height;	var imageScale	if (slideWidth < width || slideHeight < height) {		imageScale = slideWidth/width < slideHeight/height ? slideWidth/width : slideHeight/height;	} else { 		imageScale = 1; 	}	this.displayWidth = width != null ? Math.round(width * imageScale) : displayWidth = 0;	this.displayHeight = height != null ? Math.round(height * imageScale) : displayHeight = 0;		this.reflectHeight = Math.round(.33 * height) > 100 ? (100 * imageScale) : Math.round(.33 * height * imageScale);		this.cacheReady = false;	this.reflectReady = false;	this.cache = null;	this.reflection = null;	this.ready = function() { return (this.cacheReady && this.reflectReady); };}/// set opacity on an objectfunction setOpacity(obj, value) {		if (value > 0) {			var type = typeof slideshow == 'undefined' ? getType(obj) : slideshow.type;			switch(type) {				case 'ie' : 					value = value >= 0.99 ? 100 : Math.round(value * 100);					if (typeof obj.filters == 'object' && obj.filters.alpha) { obj.filters.alpha.opacity = value ; }					else { 					 obj.style.filter = 'alpha(' + value + ')';					}					break;				case 'khtml' :					obj.style.KhtmlOpacity = value;					break;				case 'moz' :  //restrict max opacity to prevent flicker in firefox					obj.style.MozOpacity = (value >= 0.99 ? 0.99 : value);					break;				case 'none' :					break;				default : //restrict max opacity to prevent flicker in firefox					obj.style.opacity = (value >= 0.99 ? 0.99 : value);					}			obj.style.display = ''; 			} else {			obj.style.display = 'none'; 		}}/// get the actual opacity of an objectfunction getOpacity(obj) {		var type = typeof slideshow == 'undefined' ? getType(obj) : slideshow.type;		var opac;		switch(type) {			case 'ie' : 			 	if (typeof obj.filters == 'object' && obj.filters.alpha) { 					opac =  obj.filters.alpha.opacity; 				}				opac = (opac == null || typeof opac == 'undefined') ? 100 : opac;				break;			case 'khtml' :				opac = 	obj.style.KhtmlOpacity;				opac = opac == null || typeof opac == 'undefined' || opac == '' ? 100 : 100 * opac;				break			case 'moz' :  //restrict max opacity to prevent flicker in firefox				opac = obj.style.MozOpacity;				opac = opac == null || typeof opac == 'undefined' || opac == '' ? 100 : 100 * opac;				break;			case 'none' :				opac = 100;				break;			default : //restrict max opacity to prevent flicker in firefox				opac = obj.style.opacity;				opac = opac == null || typeof opac == 'undefined' || opac == '' ? 100 : 100 * opac;		}				return opac;}/// place an absolutely positioned object on the x & y axesfunction positionObject(obj, xpos, ypos) {	obj.style.left = parseInt(ypos) + 'px';	obj.style.top = parseInt(xpos) + 'px';}/// retrieve opacity style for browserfunction getType(obj)  {	var type;	if (typeof obj.style.opacity != 'undefined')  {			type = 'w3c';		}  else if (typeof obj.style.MozOpacity != 'undefined')  {			type = 'moz';		}  else if (typeof obj.style.KhtmlOpacity != 'undefined')  {			type = 'khtml'; }		else if (typeof obj.filters == 'object')	 {			type = (obj.filters.length > 0 && typeof obj.filters.alpha == 'object' && typeof obj.filters.alpha.opacity == 'number') ? 'ie' : 'none';  }		else  {			type = 'none';  }		return type;	}// retrieve the actual position of an objectfunction getActualPosition(obj, axis)  {	this.pos = (axis == 'x') ? obj.offsetLeft : obj.offsetTop;	this.tmp = obj.offsetParent;	while(this.tmp != null)	{		this.pos += (axis == 'x') ? this.tmp.offsetLeft : this.tmp.offsetTop;		this.tmp = this.tmp.offsetParent;	}	return this.pos;}// add a div to the DOM with the specified parametersfunction appendDiv(parentObj, divId, width, height, makeInvisible) {	var divObj = document.createElement('div');	if (width != null) { divObj.style.width = width + 'px';}	if (height != null) { divObj.style.height = height + 'px';}	if (makeInvisible) { divObj.style.display = 'none';} 	divObj = parentObj.appendChild(divObj);	if (divId != null) {		divObj.setAttribute('id',divId);	}	return divObj;}// add a span to the DOM with the specified parametersfunction appendSpan(parentObj, spanId, width, height) {	var spanObj = document.createElement('span');	if (width != null) { spanObj.style.width = width + 'px';}	if (height != null) { spanObj.style.height = height + 'px';}	spanObj = parentObj.appendChild(spanObj);	if (spanId != null) {		spanObj.setAttribute('id',spanId);	}	return spanObj;}function appendAnchor(parentObj, href,  anchorId) {	var divObj = document.createElement('a');	if (href != null) { divObj.href = href;}	divObj = parentObj.appendChild(divObj);	if (anchorId != null) {		divObj.setAttribute('id',anchorId);	}	return divObj;}function appendImage(parentObj, src, imgId, width, height, makeInvisible) {	var imgObj = document.createElement('img');	imgObj.src = src;	if (width != null) { imgObj.style.width = width + 'px';}	if (height != null) { imgObj.style.height = height + 'px';}	if (makeInvisible) { imgObj.style.display = 'none';} 	imgObj = parentObj.appendChild(imgObj);	if (imgId != null) {		imgObj.setAttribute('id',imgId);	}	return imgObj;}function addEvent(object, event, functionName, capture) {			 	if (object.addEventListener) { 	 event = event.length > 2 ? event.substring(2) : event; 	 capture = capture ? capture : false;	 object.addEventListener(event, functionName, capture);	} else if (object.attachEvent) {		object.attachEvent(event, functionName);	} else {		try {	  object.setAttribute(event, functionName);	  } catch (e)  {  }	}}function removeEvent(object, event, functionName, capture) {     if (object.removeEventListener) {      event = event.length > 2 ? event.substring(2) : event;      capture = capture ? capture : false;     object.removeEventListener(event, functionName, capture);    } else if (object.detachEvent) {        object.detatchEvent(event, functionName);    } else {        try {      object.removeAttribute(event);      } catch (e)  {  }    }}// utility methods to prevent mouseover flicker function isParent (container, containee) {  var isParent = false;  while (!isParent && containee) {  	isParent = container == containee;		containee = containee.parentNode;	 }	return isParent;}function checkMouseEnter (element, evt) {  if (evt.fromElement) {    return !isParent(element, evt.fromElement);  }  else if (evt.relatedTarget) {    return !isParent(element, evt.relatedTarget); 	}   else {  	return true;  }}function checkMouseLeave (element, evt) {  if (evt.toElement) {    return !isParent(element, evt.toElement);  }  else if (evt.relatedTarget) {  	return !isParent(element, evt.relatedTarget);  }   else {  	return true;  }}function getQueryStringValue(variable) {  var queryString = window.location.search.substring(1);  var keyPairs = queryString.split("&");  for (var i=0;i<keyPairs.length;i++) {    var keyPair = keyPairs[i].split("=");    if (keyPair[0] == variable) {      return keyPair[1];    }  }   return "";}// Browser Detect Lite  v2.1// http://www.dithered.com/javascript/browser_detect/index.html// modified by Chris Nott (chris@NOSPAMdithered.com - remove NOSPAM)//// modified by Michael Lovitt to include OmniWeb and Dreamcastfunction BrowserDetectLite() {	var ua = navigator.userAgent.toLowerCase(); 	this.ua = ua;	// browser name	this.isGecko     = (ua.indexOf('gecko') != -1);	this.isMozilla   = (this.isGecko && ua.indexOf("gecko/") + 14 == ua.length);	this.isFirefox = (this.isGecko && ua.indexOf("firefox") != -1);	this.isCamino = (this.isGecko && ua.indexOf("camino") != -1);	this.isSafari = (this.isGecko && ua.indexOf("safari") != -1);	this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );	this.isIE        = ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) ); 	this.isOpera     = (ua.indexOf("opera") != -1); 	this.isKonqueror = (ua.indexOf("konqueror") != -1); 	this.isIcab      = (ua.indexOf("icab") != -1); 	this.isAol       = (ua.indexOf("aol") != -1); 	this.isWebtv     = (ua.indexOf("webtv") != -1); 	this.isOmniweb   = (ua.indexOf("omniweb") != -1);	this.isDreamcast   = (ua.indexOf("dreamcast") != -1);		// spoofing and compatible browsers	this.isIECompatible = ( (ua.indexOf("msie") != -1) && !this.isIE);	this.isNSCompatible = ( (ua.indexOf("mozilla") != -1) && !this.isNS && !this.isMozilla);		// browser version	this.versionMinor = parseFloat(navigator.appVersion); 		// correct version number for NS6+ 	if (this.isNS && this.isGecko) {		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );	}		// correct version number for Firefox 	else if (this.isFirefox) {		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );	}			// correct version number for Safari	else if (this.isSafari) {		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );	}		// correct version number for IE4+ 	else if (this.isIE && this.versionMinor >= 4) {		this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );	}		// correct version number for Opera 	else if (this.isOpera) {		if (ua.indexOf('opera/') != -1) {			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );		}		else {			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );		}	}		// correct version number for Konqueror	else if (this.isKonqueror) {		this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );	}		// correct version number for iCab 	else if (this.isIcab) {		if (ua.indexOf('icab/') != -1) {			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );		}		else {			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );		}	}		// correct version number for WebTV	else if (this.isWebtv) {		this.versionMinor = parseFloat( ua.substring( ua.indexOf('webtv/') + 6 ) );	}		this.versionMajor = parseInt(this.versionMinor); 	this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );		// platform	this.isWin   = (ua.indexOf('win') != -1);	this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1) );	this.isMac   = (ua.indexOf('mac') != -1);	this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('linux') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)		// specific browser shortcuts	this.isNS4below = (this.isNS && this.versionMajor <= 4)	this.isNS4x = (this.isNS && this.versionMajor == 4);	this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);	this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);	this.isNS4up = (this.isNS && this.versionMinor >= 4);	this.isNS6x = (this.isNS && this.versionMajor == 6);	this.isNS6up = (this.isNS && this.versionMajor >= 6);	this.isNS7up = (this.isNS && this.versionMajor >= 7);		this.isIEWin = (this.isIE & this.isWin);	this.isIE4below = (this.isIE && this.versionMajor <= 4)	this.isIE4x = (this.isIE && this.versionMajor == 4);	this.isIE4up = (this.isIE && this.versionMajor >= 4);	this.isIE5x = (this.isIE && this.versionMajor == 5);	this.isIE55 = (this.isIE && this.versionMinor == 5.5);	this.isIE5up = (this.isIE && this.versionMajor >= 5);	this.isIE55up = (this.isIE && this.versionMinor >= 5.5);	this.isIE6x = (this.isIE && this.versionMajor == 6);	this.isIE6up = (this.isIE && this.versionMajor >= 6);		this.isSafariJaguar = (this.isSafari && this.versionMajor < 100);	this.isFirefox1up = (this.isFirefox && this.versionMinor >= 1);	this.isIE4xMac = (this.isIE4x && this.isMac);	this.isIE5xMac = (this.isIE5up && this.isMac);	this.supportsOnload = (!this.isOpera && !this.isIcab && !this.isIE4below && !this.isNS4below);}function getLanguage() {	var languageInfo;	languageInfo = navigator.language ? navigator.language : (navigator.userLanguage ? navigator.userLanguage : "");		if (languageInfo.indexOf('-') > -1) {		languageInfo = languageInfo.substr(0,2)	}	return languageInfo;	}function addTransformation(url, transform){  var queryString = url.split('?').length == 1 ? null : url.split('?')[1];  var newURL = url.split('?')[0];	if (transform == 'reflect' && !reflect) {		newURL = 'http://www.mac.com/i/ma/1/spacer.gif';	} else if (queryString == null) {  	newURL = newURL + '?transform=' + transform;  } else if (queryString.indexOf('transform') == -1) {   	newURL = newURL + '?' + queryString + '&transform=' + transform;  } else {  		newURL = newURL + '?';  	  var keyPairs = queryString.split('&');  		for (var i=0;i<keyPairs.length;i++) {    		var keyPair = keyPairs[i].split("=");    		if (keyPair[0] == 'transform') {    			newURL = newURL + 'transform=' + transform;    			newURL = i < keyPairs.length - 1? newURL + "&" : newURL;      	} else {      		newURL = newURL + keyPair[0];      		newURL = keyPair.length > 1 ? newURL + "=" + keyPair[1] : newURL;      		newURL = i < keyPairs.length -1 ? newURL + "&" : newURL;      	}      }   }    return newURL;}function setCookie(name, value) {    document.cookie = name + "=" + escape(value) + ";domain=" + domain + ";path=/";}function getCookie(name)  {    var cookies = document.cookie;    var key = name + "=";    var begin = cookies.indexOf("; " + key);    if (begin == -1) {        begin = cookies.indexOf(key);        if (begin != 0) return null;    } else {       begin += 2;    }    var end = document.cookie.indexOf(";", begin);    if (end == -1) {        end = cookies.length;    }    return unescape(cookies.substring(begin + key.length, end));}function goBack() {	// try going back to the referring page by using referrer or history	if (document.referrer && document.referrer != '') {		window.location.replace(document.referrer);	} else {		history.back();	}		// if there is nothing in document.referrer or history	// try loading the saved 'continue' URL from session cookie	if (getCookie('continue')) {		window.location.href = getCookie('continue');	}		// if all else fails, close the popup window so the user isn't stuck	window.close;}function alphaRules(){	/* set img filter for IE */	if (browser == null) { browser = new BrowserDetectLite();}	if (browser.isWin && browser.isIE) {			document.write("<style>img{ filter: alpha(opacity=100); }</style>");	} // end test for alpha }
