	var curPhoto=-1;
	var numPhotos=0;
	var photos;
	var cache=false;
	var loading;
	var curOpacity=0;
	var tm=false;
	var regions=new Array();
	var photo_fadeDir=0;

	var inactiveCycles=0;
	var slideShowActive=0;
	var startSlideShowAfter=250;  // cycles (each cycle is 20ms)
	var cyclesPerSlide=250;

	regions[0]=0;
	regions[1]=0;
	regions[2]=0;
	regions[3]=0;
	regions[4]=0;
	regions[5]=0;
	regions[6]=0;

	loading=0;
	photos=new Array();

	function photo_Update(dir) {
		if ((numPhotos>0)&&(loading==0)) {
		// only bother changing if the rest of page is loaded...
			
			loading=1;
			o=document.getElementById("back"); if (o) o.style.display="none";
			o=document.getElementById("next"); if (o) o.style.display="none";

			curPhoto+=dir;
			if (curPhoto>=numPhotos) curPhoto=0;
			else if (curPhoto<0) curPhoto=numPhotos-1;

			cache=new Image();
			cache.src=photos[curPhoto].image;
			cache.onload=function() {
				o=document.getElementById("left");
				if (o) o.style.backgroundImage='url('+photos[curPhoto].image+')';
				o=document.getElementById("quote");
				if (o) o.innerHTML='<p>'+photos[curPhoto].desc+'</p>';
				o=document.getElementById("quoteCredit");
				//if (o) o.innerHTML='Photo by '+photos[curPhoto].author+' | ';
				if (o) o.innerHTML=(curPhoto+1)+' of '+numPhotos;

				o=document.getElementById("back"); if (o) o.style.display="block";
				o=document.getElementById("next"); if (o) o.style.display="block";

				loading=0;
			}

			//photoTM=window.setTimeout("photo_UpdatePart2()",5000);
		}
	}
	function photo_SetCurrent(a,b) { 
		curPhoto=a;
		numPhotos=b;
	}
	function photo_Fader() {

		var prevOpacity;
		prevOpacity=curOpacity;
		curOpacity=curOpacity+(photo_fadeDir*0.05);
		if (curOpacity>1) curOpacity=1;
		else if (curOpacity<0) curOpacity=0;

		if (curOpacity!=prevOpacity) {
			o=document.getElementById("leftBottom");
			o.style.opacity=curOpacity;
			o.style.filter = 'alpha(opacity='+(curOpacity*100)+')';
		}
	}
	function photo_MonitorRegions() {
		var numActive;

		numActive=0;
		for (i=0;i<7;i++) {
			if (regions[i]) numActive++;
		}
		if ((numActive>0)&&(curOpacity<1.0)) photo_fadeDir=1;
		else if ((numActive==0)&&(curOpacity>0.0)) photo_fadeDir=-1;

		if (numActive>0) {
			inactiveCycles=0;
			slideShowActive=0;
		}
		else {
			if (loading==0) {
				inactiveCycles++;
				if (inactiveCycles>startSlideShowAfter) {
					if (!slideShowActive) {
						slideShowActive=1;
						photo_Update(1);
					}
					else if (((inactiveCycles-startSlideShowAfter)%cyclesPerSlide)==0) {
						photo_Update(1);
					}
				}
			}
		}
		photo_Fader();

		tm=window.setTimeout("photo_MonitorRegions()",20);
	}
	function photo_SetRegion(num,mode) { regions[num]=mode; }

