var _lightbox = '#000000';var _section = '';var _currentImage = 0;var _nrOfImages = 0;var _opened = false;var _imageloader = null;var setAspect;var pageType;var isIE = (document.all) ? true : false;var isMac = (navigator.userAgent.indexOf("Mac") != -1) ? true : false;var doc, dom, ie, ie4, ie5x, moz, mac, win, lin, old, saf, ie5mac, ie5xwin, op;doc = document;nav = navigator;na = nav.appVersion;nua = nav.userAgent;if ( !doc.layers ){	dom = ( doc.getElementById );	op = ( nua.indexOf( 'Opera' ) != -1 );	konq = ( nua.indexOf( 'Konqueror' ) != -1 );	saf = ( nua.indexOf( 'Safari' ) != -1 );	moz = ( nua.indexOf( 'Gecko' ) != -1 && !saf && !konq);	ie = ( doc.all && !op );}var mozVer;if(moz){	mozVer='';	fv=nua.split('Firefox');	if(fv){		mozVer=fv[1].substring(1,2);	}}var ieVer;if(isIE){	fv=nua.split('MSIE');	if(fv){		ieVer=fv[1].substring(1,2);	}}// Returns array with page width, height and window width, height// Core code from - quirksmode.org// Edit for Firefox by pHaezPosition.getPageSize = function(){  var xScroll, yScroll;  if (window.innerHeight && window.scrollMaxY) {      xScroll = document.body.scrollWidth;    yScroll = window.innerHeight + window.scrollMaxY;  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac    xScroll = document.body.scrollWidth;    yScroll = document.body.scrollHeight;  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari    xScroll = document.body.offsetWidth;    yScroll = document.body.offsetHeight;  }  var windowWidth, windowHeight;  if (self.innerHeight) { // all except Explorer    windowWidth = self.innerWidth;    windowHeight = self.innerHeight;  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode    windowWidth = document.documentElement.clientWidth;    windowHeight = document.documentElement.clientHeight;  } else if (document.body) { // other Explorers    windowWidth = document.body.clientWidth;    windowHeight = document.body.clientHeight;  }   // for small pages with total height less then height of the viewport  pageHeight = Math.max(windowHeight, yScroll);  // for small pages with total width less then width of the viewport  pageWidth = Math.max(windowWidth, xScroll);  return { page: { width: pageWidth, height: pageHeight }, window: { width: windowWidth, height: windowHeight } };}function resize(){	var p = Position.getPageSize();	$('panel').style.marginTop = (p.page.height - 635)/2 + 'px';	$('title').style.top = (pageHeight+528)/2 + 'px';	$('subnav').style.top = (pageHeight+548)/2 + 'px';	$('copyright').style.top = (pageHeight+640)/2 + 'px';	if(_opened){		if(setAspect == 'wide'){			setFooter('updateWide');		}else{			setFooter('updateThin');		}	}else{		setFooter('init');	}}function setFooter(arg){	if(arg=='init'){		if(isMac){			//$('copyright').style.left = (pageWidth-180)/2 + 'px';			$('copyright').style.left = (pageWidth-50)/2 + 'px';		}else{			if(isIE){				$('copyright').style.left = (pageWidth-65)/2 + 'px';			}else if(mozVer<2){				$('copyright').style.left = (pageWidth-65)/2 + 'px';			}else{				$('copyright').style.left = (pageWidth-145)/2 + 'px';			}					}	}	if(arg=='updateWide'){		if(isMac){			$('copyright').style.left = (pageWidth+190)/2 + 'px';		}else{			if(isIE){				$('copyright').style.left = (pageWidth+175)/2 + 'px';			}else if(mozVer<2){				$('copyright').style.left = (pageWidth+175)/2 + 'px';			}else{				$('copyright').style.left = (pageWidth+95)/2 + 'px';			}		}	}	if(arg=='updateThin'){		if(isMac){			$('copyright').style.left = (pageWidth-90)/2 + 'px';		}else{			if(isIE){				$('copyright').style.left = (pageWidth-105)/2 + 'px';			}else if(mozVer<2){				$('copyright').style.left = (pageWidth-105)/2 + 'px';			}else{				$('copyright').style.left = (pageWidth-183)/2 + 'px';			}		}	}	}function introLoad(arg,page){	if(_opened) return;	new Effect.Fade('intro-contents',{duration:0.7});	new Effect.Fade('nav',{duration:0.4}); 	new Effect.Fade('subnav',{duration:0.4});	new Effect.Fade('copyright',{duration:0.4});	new Effect.Appear('title',{queue:'end'});	new Effect.Scale('panel',136.3, { 	duration:1.2, queue:'end', scaleContent: false, scaleX: true, scaleY: false, 	scaleMode: {originalHeight: 635, originalWidth: 653},	afterUpdate:function(effect){	  Element.setStyle('intro', {	    paddingLeft: ((effect.position)*23 + 23) + 'px',	    paddingRight: ((effect.position)*23 + 23) + 'px'	  });	  Element.setStyle('subnav', {	    paddingTop: ((effect.position)*23 + 20) + 'px'	  });	},	afterFinish:function() { 		Element.remove('intro-contents');		setFooter('updateWide');		new Effect.Appear('nav',{queue:'end'});		new Effect.Appear('main',{queue:'end'});		new Effect.Appear('subnav',{queue:'end'});		new Effect.Appear('copyright',{queue:'end'});		_opened = true;		setAspect = 'wide';		if(arg=='info'){			fetchSection(page);		}else{			//getRandCollection();			Element.addClassName('architecture','active');			fetchSection('architecture');		}	}	});}function getRandCollection(){	s=['architecture','interiors','details','people','food','travel','nature','bricolage','bio','contact'];	n=(Math.ceil(Math.random()*8)-1);	getCollection(s[n]);}function getCollection(section){	if(!_opened) introLoad();	_section = section;	['architecture','interiors','details','people','food','travel','nature','bricolage','bio','contact'].each(function(e){		Element.removeClassName(e,'active');	});	Element.addClassName(section,'active');	fetchSection(section);	setTimeout(function(){$('infoPane').innerHTML = '';},1000);	if(!pageType || pageType == 'info'){		new Effect.Appear('arrow-left',{duration:0.4});		new Effect.Appear('arrow-right',{duration:0.4});		pageType = 'collection';	}}function getInfo(page){	if(!_opened){		introLoad('info',page);	}else{		fetchSection(page);	}	['architecture','interiors','details','people','food','travel','nature','bricolage','bio','contact'].each(function(e){	  Element.removeClassName(e,'active');	});	Element.addClassName(page,'active');		if(page=='bio'){		setTimeout(function(){$('infoPane').innerHTML ='Based in the San Francisco Bay Area and born in Washington, D.C., Stirling Elmendorf has spent nearly half his life overseas. Growing up with a professional photographer mom was a source of influence and inspiration.<br/><br/>Travel has taken Stirling to incredibly populous and equally remote locations on the planet. As a self-taught photographer with a sharp eye fixed on the pulse of composition and a healthy obsession with technical perfection, the range of subject matter is no way limited by any preconceived notions of "what can and can\'t be shot..."<br/><br/>His clientele is as diverse as his body of work. Many influential organizations and individuals enjoy a working relationship with this conscientious, creative and diplomatic photographer.<br/><br/>Regardless of where a project is destined to end up, Stirling infuses his images with dynamism, creativity and power.';},1000);			}else{		setTimeout(function(){$('infoPane').innerHTML = 'email: se@stirlingelmendorf.com<br/><br/>phone: 415.300.7750';},1000);			}	if(!pageType || pageType == 'collection'){		new Effect.Fade('arrow-left',{duration:0.4});		new Effect.Fade('arrow-right',{duration:0.4});		new Effect.Fade('counter',{duration:0.4});		pageType = 'info';	}}function fetchSection(section){	thisCollection=[];	for(var i=0;i<collection.img.length;i++){		if(section==collection.img[i].section){			thisCollection.push(collection.img[i]);		}	}	respondCollection(thisCollection);}function respondCollection(collection){	if(thisCollection.length>0){		imgSrc = 'img/' +thisCollection[0].section+ '/' +thisCollection[0].src;		loadPhoto(imgSrc);		thisNum=0;	}else{		alert('No images for this collection yet.')	}}function loadPhoto(imgSrc){	//imgLoad = new Image();	new Effect.Fade('s1',{ 		duration:0.4,		afterFinish:function(){			w=0,h=0;		    var	imgLoad = new Image();			imgLoad.onload = function(){				$('image2').src = imgLoad.src;				w=imgLoad.width;h=imgLoad.height;				imgLoader();			}			imgLoad.src = imgSrc;		}	});}function imgLoader(){	imgLoad = '';	new Effect.Appear('s2',{duration:0.5,queue:'end'});	scalePanel();}function prevImage() {	l = thisCollection.length - 1;	thisNum = thisNum-1;	if(thisNum<0){thisNum=l;}	imgSrc = 'img/' +thisCollection[thisNum].section+ '/' +thisCollection[thisNum].src;	loadPhoto(imgSrc);}function nextImage() {	l = thisCollection.length - 1;		thisNum = thisNum+1;	if(thisNum>l){thisNum=0;}	imgSrc = 'img/' +thisCollection[thisNum].section+ '/' +thisCollection[thisNum].src;	loadPhoto(imgSrc);}function scalePanel(){	if(h>w){		if(setAspect=='tall'){			new Effect.Fade('s2',{duration:0.5,queue:'end'});			new Effect.Appear('s1',{duration:0.5,queue:'end'});			setTimeout(function(){showCounter();},1000);		}else{			if(saf){				new Effect.Fade('title',{duration:0.5,queue:'end'});			}			new Effect.Fade('copyright',{duration:0.4});			new Effect.Fade('counter',{duration:0.4});			new Effect.Fade('arrow-left',{duration:0.4});			new Effect.Fade('arrow-right',{duration:0.4});			new Effect.Scale('panel',69, { 				duration:1.2, queue:'end', scaleContent: false, scaleX: true, scaleY: false, 				scaleMode: {originalHeight: 637, originalWidth: 892},				afterFinish:function(){					setFooter('updateThin');					$('arrow-left').style.width = '250px';					$('arrow-right').style.width = '250px';					$('arrow-right').style.left = '300px';					new Effect.Fade('s2',{duration:0.5,queue:'end'});					new Effect.Appear('s1',{duration:0.5,queue:'end'});					new Effect.Appear('arrow-left',{duration:0.4});					new Effect.Appear('arrow-right',{duration:0.4});					setAspect = 'tall';					if(saf){						new Effect.Appear('title',{duration:0.5,queue:'end'});					}					new Effect.Appear('copyright',{duration:0.5,queue:'end'});					setTimeout(function(){showCounter();},1000);				}			});		}	}else{		if(setAspect=='wide'){			new Effect.Fade('s2',{duration:0.5,queue:'end'});			new Effect.Appear('s1',{duration:0.5,queue:'end'});			setTimeout(function(){showCounter();},1000);		}else{			if(saf){				new Effect.Fade('title',{duration:0.5,queue:'end'});			}			new Effect.Fade('copyright',{duration:0.4});			new Effect.Fade('counter',{duration:0.4});			new Effect.Fade('arrow-left',{duration:0.4});			new Effect.Fade('arrow-right',{duration:0.4});			new Effect.Scale('panel',146, { 				duration:1.2, queue:'end', scaleContent: false, scaleX: true, scaleY: false, 				scaleMode: {originalHeight: 637, originalWidth: 609},				afterFinish:function(){					setFooter('updateWide');					$('arrow-left').style.width = '430px';					$('arrow-right').style.width = '430px';					$('arrow-right').style.left = '400px';					new Effect.Fade('s2',{duration:0.5,queue:'end'});					new Effect.Appear('s1',{duration:0.5,queue:'end'});					new Effect.Appear('arrow-left',{duration:0.4});					new Effect.Appear('arrow-right',{duration:0.4});					setAspect = 'wide';					if(saf){						new Effect.Appear('title',{duration:0.5,queue:'end'});					}					new Effect.Appear('copyright',{duration:0.5,queue:'end'});					setTimeout(function(){showCounter();},1000);				}			});		}	}}function showCounter(){	$('curNum').innerHTML = thisNum+1;	$('totNum').innerHTML = thisCollection.length;	if(setAspect=='wide'){		$('counter').style.left = '230px';	}else{		$('counter').style.left = '-40px';	}	if(pageType=='info'){}else{		new Effect.Appear('counter',{duration:0.5,queue:'end'});	}}