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';	$('social').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'){		var _bio_en = '<p style="float:left;width:350px;">Based in Osaka, Japan and born in Washington, D.C., Stirling Elmendorf has spent nearly half his life overseas, living in Honduras, Ecuador, India, Mozambique, Rwanda and Japan.  Growing up with a professional photographer mother was a source of influence and inspiration.<br/><br/>Travel has taken Stirling to incredibly populous and equally remote locations on the planet.  His photographic catalog includes much of the United States and Hawaii, Mexico, Japan, Hong Kong, China, Thailand, Cambodia, Australia, New Zealand and Belize.<br/><br/>His fine art work has been displayed in galleries in Washington DC and San Francisco and his photographs published in the New York Times, National Geographic Traveler Magazine and numerous books on architecture, conservation and the environment.  He is a Canon CPS professional member.<br/><br/>Regardless of what project he undertakes, Stirling infuses his images with dynamism, creativity and power.</p><p style="float: left;width: 370px;position: absolute;left: 400px; font-size:11px;">1976年アメリカ合衆国ワシントンD.C.に生まれる。<br/>国際開発援助の仕事をする父親と写真家の母とホンジュラス、<br/>エクアドル、インドにて生活。<br/>幼少期から写真家である母の影響を強く受け育つ。<br/>大学でマルチメディアを学び、卒業後、モザンビーク、ルワンダ<br/>に渡る。<br/><br/> 子供の頃から日本の文化に興味を持ち、2001年来日。<br/>３年間を過ごす。日本のビジュアルインパクトに魅せられ写真家<br/>としての活動を始める。<br/>帰国後、本格的に写真家として活動。<br/>『ニューヨークタイムズ』、『ナショナルジオグラフィック トラベラー<br/>マガジン』等、建築、自然、環境保護、多数の本に掲載される。<br/><br/>音楽家としての顔も持ち、ドキュメンタリー番組『ナショナルジオ<br/>グラフィック』『ディスカバリーチャンネル』の背景音楽の作曲に参加。<br/><br/>2012年日本人女性と結婚し再来日。<br/>ビジネスパートナーの妻と共に日本を活動のベースに置く。</p>';		setTimeout(function(){$('infoPane').innerHTML =_bio_en;},1000);			}else{		setTimeout(function(){$('infoPane').innerHTML = 'stirling elmendorf<br/><br/>email: stirlinge@gmail.com<br/><br/>phone: +81.080.4687.9900<br/><br/><br/><br/>エルメンドルフ久美子<br/><br/>email: kumiko.elmendorf@gmail.com<br/><br/>phone: 090.2388.5622';},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;		}	});	if(imgSrc.indexOf('bio.jpg')>-1){		$('image2').style.opacity = 1;	}else{		$('image2').style.opacity = 1;	}}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'});	}}
