DefaultPhotoSource.prototype=new PhotoSource();DefaultPhotoSource.constructor=DefaultPhotoSource;function DefaultPhotoSource(){this.add(new Photo("photos/full/1_www.tommipirnes.com.jpg","photos/thumbs/1.jpg",500,331,{"fi":"Leikkimässä Jhunjhunun sivukaduilla. Jhunjhunu, Intia 2006","en":"Playing in the back streets of Jhunjhunu. Jhunjhunu, India 2006"}));
this.add(new Photo("photos/full/2_www.tommipirnes.com.jpg","photos/thumbs/2.jpg",500,336,{"fi":"Laurie. New York City 2004","en":"Laurie. New York City 2004"}));this.add(new Photo("photos/full/3_www.tommipirnes.com.jpg","photos/thumbs/3.jpg",500,332,{"fi":"Juuri auringonlaskun jälkeen. Ranakpur, Intia 2006","en":"Just after sunset. Ranakpur, India 2006"}));
this.add(new Photo("photos/full/4_www.tommipirnes.com.jpg","photos/thumbs/4.jpg",297,444,{"fi":"D-juna. New York City 2004","en":"D-train. New York City 2004"}));this.add(new Photo("photos/full/5_www.tommipirnes.com.jpg","photos/thumbs/5.jpg",299,444,{"fi":"Bodhipuun alla.  Bodhgaya, Intia 2006","en":"Under the bodhi tree. Bodhgaya, India 2006"}));
this.add(new Photo("photos/full/6_www.tommipirnes.com.jpg","photos/thumbs/6.jpg",296,444,{"fi":"Krakova, Puola 2002","en":"Krakow, Poland 2002"}));this.add(new Photo("photos/full/7_www.tommipirnes.com.jpg","photos/thumbs/7.jpg",297,444,{"fi":"Kissa ja viiniköynnös. Skiathos, Kreikka 2001","en":"The cat and the vine. Skiathos, Greece 2001"}));
this.add(new Photo("photos/full/8_www.tommipirnes.com.jpg","photos/thumbs/8.jpg",500,331,{"fi":"Sofiasta Thessalonikiin. (Maisema junan ikkunasta) 2002","en":"From Sofia to Thessaloniki. (View from the train window) 2002"}));this.add(new Photo("photos/full/9_www.tommipirnes.com.jpg","photos/thumbs/9.jpg",500,334,{"fi":"Shiva patsas. Haryanan osavaltio. Intia 2006","en":"Shiva statue. Haryana state. India 2006"}));
this.add(new Photo("photos/full/10_www.tommipirnes.com.jpg","photos/thumbs/10.jpg",296,444,{"fi":"Läntisen 13. kadun ja 9. avenuen kulma. New York City 2004","en":"On the corner of west 13th St. and 9th Av. New York City 2004"}));this.add(new Photo("photos/full/11_www.tommipirnes.com.jpg","photos/thumbs/11.jpg",169,444,{"fi":"World Trade Center. New York City 2004","en":"World Trade Center. New York City 2004"}));
this.add(new Photo("photos/full/12_www.tommipirnes.com.jpg","photos/thumbs/12.jpg",294,444,{"fi":"Tiger Woods. New York City 2004","en":"Tiger Woods. New York City 2004"}));this.add(new Photo("photos/full/13_www.tommipirnes.com.jpg","photos/thumbs/13.jpg",296,444,{"fi":"Brooklyn Bridgen alla. New York City 2004","en":"Under the Brooklyn Bridge. New York City 2004"}));
this.add(new Photo("photos/full/14_www.tommipirnes.com.jpg","photos/thumbs/14.jpg",293,444,{"fi":"Pelastus. Mumbai, Intia 2006","en":"The rescue. Mumbai, India 2006"}));this.add(new Photo("photos/full/15_www.tommipirnes.com.jpg","photos/thumbs/15.jpg",500,333,{"fi":"Vapaapäivä työmaalla. Riika, Latvia 2003","en":"Day off from the worksite. Riga, Latvia 2003"}));
this.add(new Photo("photos/full/16_www.tommipirnes.com.jpg","photos/thumbs/16.jpg",298,444,{"fi":"Kylpijät. Varanasi, Intia 2006","en":"The bathers. Varanasi, India 2006"}));this.add(new Photo("photos/full/17_www.tommipirnes.com.jpg","photos/thumbs/17.jpg",500,335,{"fi":"Kankaan kuivausta Gangesin rannalla. Varanasi, Intia 2006","en":"Drying cloth on the banks of the Ganges. Varanasi, India 2006"}));
this.add(new Photo("photos/full/18_www.tommipirnes.com.jpg","photos/thumbs/18.jpg",500,335,{"fi":"Kulkukoiria. Varanasi, Intia 2006","en":"Stray dogs. Varanasi, India 2006"}));this.add(new Photo("photos/full/19_www.tommipirnes.com.jpg","photos/thumbs/19.jpg",500,334,{"fi":"Katolla. Vilna, Liettua. 2004","en":"On the rooftop. Vilnius, Lithuania 2004"}));
this.add(new Photo("photos/full/20_www.tommipirnes.com.jpg","photos/thumbs/20.jpg",500,334,{"fi":"Leipomon takana. Venetsia, Italia 2002","en":"Behind the bakery. Venice, Italy 2002"}));this.add(new Photo("photos/full/21_www.tommipirnes.com.jpg","photos/thumbs/21.jpg",500,335,{"fi":"Leijapoika. Darjeeling, Intia 2006","en":"The kite flyer. Darjeeling, India 2006"}));
this.add(new Photo("photos/full/22_www.tommipirnes.com.jpg","photos/thumbs/22.jpg",500,334,{"fi":"Eläintieteellinen museo. Pietari, Venäjä 2002","en":"The Museum of Natural History. St. Petersburg, Russia 2002"}));this.add(new Photo("photos/full/23_www.tommipirnes.com.jpg","photos/thumbs/23.jpg",500,333,{"fi":"Yksikätinen Vapaudenpatsas. New York City 2004","en":"The one armed Statue of Liberty. New York City 2004"}));
this.add(new Photo("photos/full/24_www.tommipirnes.com.jpg","photos/thumbs/24.jpg",500,334,{"fi":"Etelä-Bronx, New York City 2004","en":"South Bronx, New York City 2004"}));this.add(new Photo("photos/full/25_www.tommipirnes.com.jpg","photos/thumbs/25.jpg",500,334,{"fi":"Hattukauppias. New York City 2004","en":"Hat seller. New York City 2004"}));
this.add(new Photo("photos/full/26_www.tommipirnes.com.jpg","photos/thumbs/26.jpg",500,334,{"fi":"Central Park. New York City 2004","en":"Central Park. New York City 2004"}));this.add(new Photo("photos/full/27_www.tommipirnes.com.jpg","photos/thumbs/27.jpg",296,444,{"fi":"Auschwitz I. Oswiecim, Puola 2002","en":"Auschwitz I. Oswiecim, Poland 2002"}));
this.add(new Photo("photos/full/28_www.tommipirnes.com.jpg","photos/thumbs/28.jpg",500,333,{"fi":"Murhattuja ihmisiä valokuvissaan. Auschwitz-Birkenau, Oswiecim, Puola 2002","en":"Murdered people in their own photographs. Auschwitz-Birkenau, Poland 2002"}));this.add(new Photo("photos/full/29_www.tommipirnes.com.jpg","photos/thumbs/29.jpg",292,444,{"fi":"Vuoristopurossa pesty mekko kuivumassa teepensaalla. Darjeeling, Intia 2006","en":"A dress washed in a mountain stream drying on a tea bush. Darjeeling, India 2006"}));
this.add(new Photo("photos/full/30_www.tommipirnes.com.jpg","photos/thumbs/30.jpg",500,331,{"fi":"Taj Mahal. Agra, Intia 2006","en":"Taj Mahal. Agra, India 2006"}));this.add(new Photo("photos/full/31_www.tommipirnes.com.jpg","photos/thumbs/31.jpg",299,444,{"fi":"Jaipur, Intia 2006","en":"Jaipur, India 2006"}));
this.add(new Photo("photos/full/32_www.tommipirnes.com.jpg","photos/thumbs/32.jpg",500,330,{"fi":"Diwalin jälkeen. Delhi, Intia 2006","en":"After Diwali. Delhi, India 2006"}));this.add(new Photo("photos/full/33_www.tommipirnes.com.jpg","photos/thumbs/33.jpg",500,335,{"fi":"Perhosia ja Mahabodhi Temppeli. Bodhgaya, Intia 2006","en":"Butterflies and the Mahabodhi Temple. Bodhgaya, India 2006"}));
this.add(new Photo("photos/full/34_www.tommipirnes.com.jpg","photos/thumbs/34.jpg",500,331,{"fi":"Jodhpur, Intia 2006","en":"Jodhpur, India 2006"}));this.add(new Photo("photos/full/35_www.tommipirnes.com.jpg","photos/thumbs/35.jpg",500,334,{"fi":"Tuomiokirkon rappusilla. Turku 2004","en":"On the steps of the Turku Cathedral. Turku 2004"}));
this.add(new Photo("photos/full/36_www.tommipirnes.com.jpg","photos/thumbs/36.jpg",500,332,{"fi":"Kolme miestä. Maharashtran osavaltio. (Maisema junan ikkunasta) Intia 2006","en":"Three men. Maharashtra state. (View from the train window) India 2006"}));this.add(new Photo("photos/full/37_www.tommipirnes.com.jpg","photos/thumbs/37.jpg",500,333,{"fi":"Akvaario. Mumbai, Intia 2006","en":"Aquarium. Mumbai, India 2006"}));
this.add(new Photo("photos/full/38_www.tommipirnes.com.jpg","photos/thumbs/38.jpg",500,333,{"fi":"Karni Mata temppeli. Deshnoke, Intia 2006","en":"Karni Mata temple. Deshnoke, India 2006"}));this.add(new Photo("photos/full/39_www.tommipirnes.com.jpg","photos/thumbs/39.jpg",500,334,{"fi":"Siligurin juna-asemalla. Siliguri, Intia 2006","en":"At the Siliguri train station. Siliguri, India 2006"}));
this.add(new Photo("photos/full/40_www.tommipirnes.com.jpg","photos/thumbs/40.jpg",294,444,{"fi":"Kouluaamu. Kourseong, Intia 2006","en":"School morning. Kourseong, India 2006"}));}var Logger={debugMode:true,debug:function(a){if(window.console&&window.console.firebug&&Logger.debugMode){console.debug(a+" ["+new Date()+"]");
}}};function Photo(c,e,d,a,b){this.url=c;this.thumbUrl=e;this.caption=b;this.width=d;this.height=a;this.loaded=false;}Photo.prototype.getUrl=function(){return this.url;};Photo.prototype.getThumbUrl=function(){return this.thumbUrl;};Photo.prototype.getCaption=function(a){return this.caption[a];};Photo.prototype.getWidth=function(){return this.width;
};Photo.prototype.getHeight=function(){return this.height;};Photo.prototype.isPortrait=function(){return !this.isLandscape();};Photo.prototype.isLandscape=function(){return this.width>this.height;};Photo.prototype.setLoaded=function(a){this.loaded=a;};Photo.prototype.isLoaded=function(){return this.loaded;
};function PhotoSource(){this.photos=new Array();}PhotoSource.prototype.size=function(){return this.photos.length;};PhotoSource.prototype.add=function(a){this.photos.push(a);};PhotoSource.prototype.get=function(a){if(a>=0&&a<this.size()){return this.photos[a];}return null;};PhotoSource.prototype.setLoaded=function(a){if(a>0&&a<this.photos.length){this.photos[a].setLoaded(true);
}Logger.debug(this.getLoadingProgress());};PhotoSource.prototype.getLoadingProgress=function(){var b=0;for(var a=0;a<this.photos.length;a++){if(this.photos[a].isLoaded()){b++;}}return b/(this.photos.length-1);};function ProgressBar(b,c){this.photoSource=b;this.callback=c;this.FADE_TIME=500;this.POLL_TIME=500;
this._getProgressBarText().html("Loading slideshow...");var a=this;this.pollTimer=window.setInterval(function(){a.poll();},this.POLL_TIME);this._getContainer().animate({opacity:"1.0"},this.FADE_TIME);}ProgressBar.prototype._getContainer=function(){return $("#progressBar");};ProgressBar.prototype._getProgressBar=function(){return $("#progressBar-progress");
};ProgressBar.prototype._getProgressBarText=function(){return $("#progressBar-text");};ProgressBar.prototype.poll=function(){var b=this.photoSource.getLoadingProgress();var c=this._getProgressBar();Logger.debug(c);c.css("width",Math.ceil(b*100)+"%");Logger.debug(c.width());if(b==1){window.clearInterval(this.pollTimer);
this.pollTimer=null;this._getContainer().animate({opacity:"0"},this.FADE_TIME);var a=this;window.setTimeout(function(){a._getContainer().css("display","none");a.callback();},this.FADE_TIME);}};function SlideShow(b,a){this.timer=null;this.thumbReel=null;this.listeners=new Array();this.photoSource=b;this.divId=a;
this.selectedPhoto=-1;this.init();this.changing=false;this.running=false;this.LOOP=true;this.SPEED_MS=4500;this.SLIDE_OUT_SPEED_MS=200;this.SLIDE_IN_SPEED_MS=200;}SlideShow.prototype.init=function(){var a=this._getPhotoContainer().height();for(var e=0;e<this.photoSource.size();e++){var c=this.photoSource.get(e);
var d='<div class="photo" id="photo'+e+'">';d+='<img src="';if(e>=0){d+=c.getUrl();}d+='" height="'+c.getHeight();d+='" width="'+c.getWidth();d+='" alt="" title="';d+=c.getCaption(locale);if(c.isLandscape()){d+='" style="margin-top: ';d+=Math.floor((a/2)-(c.getHeight()/2));d+="px;";}d+='" /></div>';this._getPhotoContainer().append(d);
var b=this;$("#photo"+e+" > img").load(function(){var f=parseInt(this.parentNode.id.substring("photo".length));b.photoSource.setLoaded(f);});}var b=this;this._getControlPanelControlButton("back").click(function(f){b.stop();b.previousSlide();});this._getControlPanelControlButton("play").click(function(f){b.start();
});this._getControlPanelControlButton("pause").click(function(f){b.stop();});this._getControlPanelControlButton("forward").click(function(f){b.stop();b.nextSlide(false);});};SlideShow.prototype._getPhotoContainer=function(){return $("#"+this.divId);};SlideShow.prototype._getControlPanel=function(){return $("#"+this.divId+"-controlPanel");
};SlideShow.prototype._getControlPanelControls=function(){return $("#"+this.divId+"-controlPanel-controls");};SlideShow.prototype._getControlPanelControlButton=function(a){return $("#"+this.divId+"-controlPanel-controls-"+a);};SlideShow.prototype._getControlPanelCaption=function(){return $("#"+this.divId+"-controlPanel-caption");
};SlideShow.prototype._getControlPanelIndex=function(){return $("#"+this.divId+"-controlPanel-index");};SlideShow.prototype._getAllImgs=function(){return $("#"+this.divId+" div.photo img");};SlideShow.prototype.getSelectedPhoto=function(){return this.selectedPhoto;};SlideShow.prototype.isRunning=function(){return this.running;
};SlideShow.prototype.start=function(){if(!this.isRunning()){this.running=true;this._getControlPanelControlButton("play").addClass("active");this._getControlPanelControlButton("pause").removeClass("active");Logger.debug("starting slideshow...");hideSelectedPage();var a=this;a.nextSlide();}};SlideShow.prototype.stop=function(){if(this.isRunning()){this.running=false;
this._getControlPanelControlButton("play").removeClass("active");this._getControlPanelControlButton("pause").addClass("active");Logger.debug("stopping slideshow...");window.clearInterval(this.timer);this.timer=null;}};SlideShow.prototype.hide=function(){this.stop();if(this.selectedPhoto>=0){$("#photo"+(this.selectedPhoto)).animate({left:"-1000px"},this.SLIDE_OUT_SPEED_MS,"swing");
}};SlideShow.prototype.nextSlide=function(){if(this.selectedPhoto<this._getAllImgs().length-1){this.show(this.selectedPhoto+1);}else{if(this.LOOP){this.show(0);}}if(arguments.length==0){if(this.timer==null){var a=this;this.timer=window.setInterval(function(){a.nextSlide();},this.SPEED_MS);}}};SlideShow.prototype.previousSlide=function(){if(this.selectedPhoto>0){this.show(this.selectedPhoto-1);
}else{if(this.LOOP){this.show(this.photoSource.size());}}};SlideShow.prototype.show=function(b){if(this.changing){Logger.debug("already changing");return;}hideSelectedPage();b=parseInt(b);if(b<this._getAllImgs().length){this.changing=true;if(this.selectedPhoto>=0){$("#photo"+(this.selectedPhoto)).animate({left:"-1000px"},this.SLIDE_OUT_SPEED_MS,"swing");
}var d=this.photoSource.get(b);var a=this;$("#photo"+b).css("left","1010px");window.setTimeout(function(){$("#photo"+b).animate({left:"0px"},a.SLIDE_IN_SPEED_MS,"swing");a._getControlPanelIndex().html((b+1)+"/"+a.photoSource.size());a._getControlPanelCaption().html(d.getCaption(locale));},this.SLIDE_OUT_SPEED_MS);
this.selectedPhoto=b;for(var c=0;c<this.listeners.length;c++){this.listeners[c].slideChanged();}var a=this;window.setTimeout(function(){a.changing=false;},(this.SLIDE_OUT_SPEED_MS+this.SLIDE_IN_SPEED_MS));}};SlideShow.prototype.addListener=function(a){this.listeners.push(a);};SlideShow.prototype.registerThumbReel=function(a){this.thumbReel=a;
};function SlideShowThumbReelMediator(a,b){this.slideShow=a;this.thumbReel=b;this.slideShow.addListener(this);this.thumbReel.addListener(this);}SlideShowThumbReelMediator.prototype.slideChanged=function(){this.thumbReel.select(this.slideShow.getSelectedPhoto());};SlideShowThumbReelMediator.prototype.userActionPerformed=function(){this.slideShow.stop();
};SlideShowThumbReelMediator.prototype.userSelectionPerformed=function(a){this.slideShow.stop();this.slideShow.show(a);};function ThumbReel(b,a){this.MOVE_SPEED_MS=400;this.THUMB_WIDTH_PX=57;this.THUMBS_PER_PAGE=10;this.photoSource=b;this.divId=a;this.init();this.pageWidthPx=this.THUMB_WIDTH_PX*this.THUMBS_PER_PAGE+4*this.THUMBS_PER_PAGE+18*this.THUMBS_PER_PAGE+188;
this.currentSelection=null;this.visibleRangeMin=0;this.visibleRangeMax=this.THUMBS_PER_PAGE-1;this.listeners=new Array();this.moving=false;}ThumbReel.prototype._getThumbsContainer=function(){return $("#"+this.divId+"-thumbs");};ThumbReel.prototype._getAllThumbs=function(){return $("#"+this.divId+"-thumbs > div.thumbnail");
};ThumbReel.prototype._getPrevButton=function(){return $("#"+this.divId+"-prev");};ThumbReel.prototype._getNextButton=function(){return $("#"+this.divId+"-next");};ThumbReel.prototype.init=function(){for(var d=0;d<this.photoSource.size();d++){var b=this.photoSource.get(d);var c='<div class="thumbnail">';
c+='<img id="thumbnail';c+=d;c+='" src="';c+=b.getThumbUrl();c+='" width="';c+=this.THUMB_WIDTH_PX;c+='" height="';c+=this.THUMB_WIDTH_PX;c+='" alt="" title="';c+=b.getCaption(locale);if(((d+1)%this.THUMBS_PER_PAGE)==0&&d>0){c+='" class="last-of-set';}c+='" /></div>';this._getThumbsContainer().append(c);
var a=this;$("#thumbnail"+d).click(function(f){var e=parseInt(this.id.substring("thumbnail".length));if(e!=a.currentSelection){a._notifyListeners("userSelection",this.id.substring("thumbnail".length));}});}var a=this;this._getPrevButton().click(function(e){a.move(-1);a._notifyListeners();});this._getPrevButton().addClass("disabled");
this._getNextButton().click(function(e){a.move(1);a._notifyListeners();});if(this.photoSource.size()<this.THUMBS_PER_PAGE){this._getNextButton().addClass("disabled");}};ThumbReel.prototype._notifyListeners=function(){if(arguments.length==0){for(var a=0;a<this.listeners.length;a++){this.listeners[a].userActionPerformed();
}}else{for(var a=0;a<this.listeners.length;a++){this.listeners[a].userSelectionPerformed(arguments[1]);}}};ThumbReel.prototype.move=function(d){if(this.moving){return;}var e=d*-this.pageWidthPx;if(this.visibleRangeMin<=0&&e>0){this.moving=false;return;}if(this.visibleRangeMax>=this.photoSource.size()-1&&e<0){this.moving=false;
return;}var c=this._getThumbsContainer().position().left;var b=c+e;this.visibleRangeMin+=d*this.THUMBS_PER_PAGE;this.visibleRangeMax+=d*this.THUMBS_PER_PAGE;if(this.visibleRangeMin>0){this._getPrevButton().removeClass("disabled");}else{this._getPrevButton().addClass("disabled");}if(this.visibleRangeMax>=this.photoSource.size()-1){this._getNextButton().addClass("disabled");
}else{this._getNextButton().removeClass("disabled");}this._getThumbsContainer().animate({left:b},this.MOVE_SPEED_MS,"swing");this.moving=true;var a=this;window.setTimeout(function(){a.moving=false;},this.MOVE_SPEED_MS);};ThumbReel.prototype.selectNext=function(){if(this.currentSelection!=null){this.select(this.currentSelection+1);
}};ThumbReel.prototype.select=function(b){if(b==this.currentSelection){return;}this._removeSelection();var a=this._getAllThumbs();if(b>=0&&b<a.length){a[b].className+=" selected";this.currentSelection=b;if(b>this.visibleRangeMax){var c=Math.floor((b-this.visibleRangeMin)/this.THUMBS_PER_PAGE);this.move(c);
}else{if(b<this.visibleRangeMin){var c=Math.floor((this.visibleRangeMax-b)/this.THUMBS_PER_PAGE);this.move(-c);}}}};ThumbReel.prototype._removeSelection=function(){if(this.currentSelection!=null){var a=this._getAllThumbs();for(var b=0;b<a.length;b++){if(a[b].className.indexOf("selected")){a[b].className=a[b].className.replace("selected","");
}}this.currentSelection=null;}};ThumbReel.prototype.getCurrentSelection=function(){return this.currentSelection;};ThumbReel.prototype.addListener=function(a){this.listeners.push(a);};var slideShow=null;var thumbReel=null;var mediator=null;var selectedPage=null;var HIDE_OR_SHOW_PAGE_SPEED=200;$(document).ready(function(){var c=new DefaultPhotoSource();
thumbReel=new ThumbReel(c,"photoReel");slideShow=new SlideShow(c,"slideShow");mediator=new SlideShowThumbReelMediator(slideShow,thumbReel);if(document.location.href.indexOf("#")!=-1){var a=document.location.href.substring(document.location.href.indexOf("#"));showPage(a);}var b=new ProgressBar(c,function(){if(selectedPage==null){slideShow.start();
}});$("#nav-information").click(function(d){showPage("#information");d.preventDefault();});$("#nav-inquiry").click(function(d){showPage("#inquiry");d.preventDefault();});$("h1").click(function(d){hideSelectedPage();slideShow.start();});});function showPage(a){if(selectedPage!=a){hideSelectedPage();slideShow.hide();
$(a).css("left","1000px");$(a).css("display","block");$(a).animate({left:"250px"},HIDE_OR_SHOW_PAGE_SPEED,"swing");selectedPage=a;}}function hideSelectedPage(){if(selectedPage!=null){$(selectedPage).animate({left:"-600px"},HIDE_OR_SHOW_PAGE_SPEED,"swing");selectedPage=null;}}function sendInquiryForm(){var a={action:"send",ajax:"true",name:$("#inquiry-form #name").attr("value"),email:$("#inquiry-form #email").attr("value"),message:$("#inquiry-form #message").attr("value")};
$.post("index.php",a,function(b){Logger.debug(b);if(b=="Ok"){$("#inquiry-form").css("display","none");$("#inquiry-result").html("Your message was successfully sent.");}else{$("#inquiry-result").html("An error occured, please try again later.");$("#inquiry-form").css("opacity","1");}},"text");$("#inquiry-form").css("opacity","0.6");
return false;}