pages.home=function(){this.content=null;this.name="home";this.totalPhotos=this.currentPhoto=0;this.rightButton=this.leftButton=this.images=this.updateInterval=null;this.tmp=Math.random();var a=this;this.goPhoto=function(b){if(b<0)b=0;if(b>a.totalPhotos-1)b=a.totalPhotos-1;a.currentPhoto=b;b==0?a.leftButton.animate({"margin-left":-100},{duration:300,queue:false}):a.leftButton.animate({"margin-left":0},{duration:300,queue:false});b==a.totalPhotos-1?a.rightButton.animate({"margin-right":-100},{duration:300,
queue:false}):a.rightButton.animate({"margin-right":0},{duration:300,queue:false});a.leftButton.find(".text").html(Math.max(1,b)+"/"+a.totalPhotos);a.rightButton.find(".text").html(Math.min(a.totalPhotos,b+2)+"/"+a.totalPhotos);a.content.animate({_currentPhoto:a.currentPhoto},{duration:400,queue:false})};this.onUpdate=function(){a.images.css("margin-left",-a.content.attr("_currentPhoto")*animation.stageWidth);a.leftButton.find(".thumbs img").eq(0).css("margin-top",(-a.content.attr("_currentPhoto")+
1)*54);a.rightButton.find(".thumbs img").eq(0).css("margin-top",(-a.content.attr("_currentPhoto")-1)*54)};this.transitionIn=function(){animation.menuDown();this.images=this.content.find(".images");this.totalPhotos=this.images.find(".image").length;this.content.attr("_currentPhoto",0);this.updateInterval=setInterval(this.onUpdate,30);$(window).bind("resize",this.onUpdate);this.content.find(".leftButtons").add(this.content.find(".rightButtons")).hover(function(){$(this).css("opacity",1)},function(){$(this).css("opacity",
0.7)}).mouseout();this.leftButton=this.content.find(".leftButtons");this.rightButton=this.content.find(".rightButtons");this.leftButton.click(function(){a.goPhoto(a.currentPhoto-1)});this.rightButton.click(function(){a.goPhoto(a.currentPhoto+1)});$(".stage .pages").append(this.content);isSimple?this.content.animate({_size:1},{duration:0,queue:false}):this.content.animate({_size:1},{duration:1E3,queue:false});this.goPhoto(0);setTimeout(this.transitionInCompleted,1E3)};this.transitionInCompleted=function(){};
this.load=function(){this.content=$('<div _page="home" _size="0" class="defaultPage"></div>');animation.currentZ++;this.content.css("z-index",animation.currentZ);var b=this;$.getJSON("home/home",function(c){b.content.html(c.html);b.onLoad()})};this.onLoad=function(){};this.transitionOut=function(){isSimple?this.content.animate({_size:2},{duration:0,queue:false}):this.content.animate({_size:2},{duration:1E3,queue:false});$(window).unbind("resize",this.onUpdate);clearInterval(this.updateInterval);var b=
this;setTimeout(function(){b.content.remove()},1E3)}};

