/* 	Author: Neil Jenkins - http://www.nmjenkins.com
Version: 1.0 (2008-02-01)
Flickr.js*/
var FlickrAPI={initialise:function(_1){
this._baseSource="http://api.flickr.com/services/rest/?format=json&api_key="+_1+"&jsoncallback=FlickrAPI.callBackFunction";
},get:function(_2,_3,_4){
var _5=this._getUniqueKey();
var _6=this._baseSource+_5;
for(var _7 in _2){
_6+="&"+_7+"="+_2[_7];
}
FlickrAPI["callBackFunction"+_5]=function(_8){
if(_8.stat!="ok"){
throw new Error("FlickrAPI Error: "+_8.message+"\nSource was:"+_6);
}
delete FlickrAPI["callBackFunction"+_5];
$("FlickrAPIRequest"+_5).remove();
var _9=_4||[];
_9.unshift(_8);
_3.apply(null,_9);
};
new Asset.javascript(_6,{type:"text/javascript",id:"FlickrAPIRequest"+_5});
},_getUniqueKey:(function(){
var _a=0;
return function(){
return _a++;
};
})()};
//Preloader.js
var Preloader=new Class({initialize:function(){
this._currentlyLoading="";
this._loading=false;
this._imgQueue=[];
this._loadEvents={};
this._loadedImages={};
},addToQueue:function(_1){
if(this.isLoaded(_1)||this.isInQueue(_1)){
return;
}
this._imgQueue.push(_1);
if(!this._loading){
this._loadNext();
}
return this;
},addToFrontOfQueue:function(_2){
if(this.isLoaded(_2)){
return false;
}
if(this._currentlyLoading==_2){
return true;
}
this.removeFromQueue(_2);
this._imgQueue.unshift(_2);
if(!this._loading){
this._loadNext();
}
return true;
},removeFromQueue:function(_3){
this._imgQueue.remove(_3);
return this;
},addEventOnLoad:function(_4,fn){
this._loadEvents[_4]=fn;
return this;
},flushQueue:function(){
this._imgQueue=[];
return this;
},stopAllEvents:function(){
this._loadEvents={};
return this;
},isLoaded:function(_6){
return !!this._loadedImages[_6];
},isInQueue:function(_7){
return (this._currentlyLoading==_7||this._imgQueue.contains(_7));
},priorityLoadWithCallback:function(_8,fn){
this.addEventOnLoad(_8,fn);
if(!this.addToFrontOfQueue(_8)){
this._fireLoadEvent(_8);
return true;
}
return false;
},_fireLoadEvent:function(_a){
if(this._loadEvents[_a]){
this._loadEvents[_a].call(this._loadedImages[_a]);
}
this._loadEvents[_a]=null;
},_loadNext:function(){
if(this._imgQueue.length==0){
this._currentlyLoading="";
return this._loading=false;
}
this._loading=true;
this._currentlyLoading=this._imgQueue.shift();
var _b=new Element("img");
var _c=this;
_b.addEvent("load",function(){
_c._loadedImages[this.src]=this;
_c._currentlyLoading="";
_c._fireLoadEvent(this.src);
setTimeout(function(){
_c._loadNext();
},0);
this.removeEvent("load",arguments.callee);
});
_b.src=this._currentlyLoading;
}});
//HistoryManager.js
var HistoryManager=(function(){
var _1=new Class({initialize:function(){
this._currentLocation=this._getHash();
if(window.ie){
this.addState=this._addStateIE;
this._iframe=new Element("iframe",{src:"javascript:'<html></html>'",styles:{"position":"absolute","top":"-1000px"}}).inject(document.body).contentWindow;
$justForIE=function(_2){
this._getHash=function(){
return _2;
};
this._monitorDefault.call(this);
location.hash=_2;
}.bind(this);
var _3=function waitForIframeLoad(){
if(this._iframe&&this._iframe.document&&this._iframe.document.body){
if(!this._iframe.document.body.innerHTML){
this.addState(this._currentLocation,true);
}
$clear(_3);
}
}.periodical(50,this);
}else{
if(window.webkit419){
this._form=new Element("form",{method:"get"}).inject(document.body);
this._historyCounter=history.length;
this._stateHistory=[];
this._stateHistory[history.length]=this._getHash();
this.addState=this._addStateSafari;
this._monitorSafari.periodical(250,this);
}else{
if(window.opera&&navigator.appVersion.toFloat()<9.5){
this.addState=this._addStateDefault;
$justForOpera=this._monitorDefault.bind(this);
new Element("img",{src:"javascript:location.href='javascript:$justForOpera();';",style:"position: absolute; top: -1000px;"}).inject(document.body);
}else{
this.addState=this._addStateDefault;
this._monitorDefault.periodical(250,this);
}
}
}
},getCurrentLocation:function(){
return this._currentLocation;
},_getHash:function(){
return location.href.split("#")[1]||"";
},_addStateIE:function(_4,_5){
if(this._currentLocation==_4&&!_5){
return;
}
this._currentLocation=_4;
this._iframe.document.write("<html><body onload=\"top.$justForIE('",_4.replace("'","\\'"),"');\">Loaded</body></html>");
this._iframe.document.close();
},_addStateSafari:function(_6){
if(this._currentLocation==_6){
return;
}
this._form.setProperty("action","#"+_6).submit();
this._currentLocation=_6;
this._stateHistory[history.length]=this._getHash();
this._historyCounter=history.length;
},_monitorSafari:function(){
if(history.length!=this._historyCounter){
this._historyCounter=history.length;
this._currentLocation=this._stateHistory[history.length];
this.fireEvent("onHistoryChange",[this._currentLocation]);
}
},_addStateDefault:function(_7){
if(this._currentLocation==_7){
return;
}
location.hash="#"+_7;
this._currentLocation=_7;
},_monitorDefault:function(){
var _8=this._getHash();
if(_8!=this._currentLocation){
this._currentLocation=_8;
this.fireEvent("onHistoryChange",[_8]);
}
}});
_1.implement(new Events);
var _9;
return function(){
return _9?_9:_9=new _1();
};
})();
//PhotoGallery.js
FlickrAPI.initialise("37cf0d887930b73729a4293a706c221b");
var nsid="32533698@N07";
var noResize=false;
function elementFromTemplate(_1,_2){
var _3=$(_1).clone(false);
_3.removeAttribute("id");
var _4=$(_1).innerHTML;
if(window.opera){
_4=_4.replace(/url[^\)\$]*\$/gm,"url(\"$$");
}
for(property in _2){
var _5=new RegExp(property.escapeRegExp(),"g");
_4=_4.replace(_5,_2[property]);
}
_3.innerHTML=_4;
return _3;
};
window.addEvent("domready",function(){
new Gallery();
});
var Gallery=new Class({initialize:function(){
var _6=this;
this._galleryData={};
this._preloader=new Preloader();
this.albums=new Albums(this);
this.grid=new Grid(this);
this.displayPhoto=new DisplayPhoto(this);
this.filmstrip=new Filmstrip(this);
this.history=new HistoryManager();
this.history.addEvent("onHistoryChange",function(_7){
var _8=_7.split(":")[0]||"albums";
var _9=_7.split(":")[1];
var _a=_7.split(":")[2];
_6.changeMode(_8,_9,_a);
});
["albums","grid","filmstrip","single"].each(function(_b){
$$(".mode"+_b.capitalize()).addEvent("click",function(_c){
new Event(_c).stop();
this.blur();
_6.changeMode(_b);
});
});
this.history.fireEvent("onHistoryChange",[this.history.getCurrentLocation()]);
this.addEvent("modeChange",function(_d,_e,_f){
if(_d=="albums"){
return this.history.addState("");
}
this.history.addState(_d+":"+_e+(_f?(":"+_f):""));
}.bind(this));
},getAlbumList:function(_10){
if(this._galleryData.albumList){
return _10(this._galleryData.albumList);
}
FlickrAPI.get({method:"flickr.photosets.getList",user_id:nsid},function(_11){
this._galleryData.albumList=[];
_11.photosets.photoset.forEach(function(_12){
this._galleryData.albumList.push(_12.id);
this._galleryData["album"+_12.id]=this._galleryData["album"+_12.id]||{};
$extend(this._galleryData["album"+_12.id],{title:_12.title._content,description:_12.description._content,keyPhotoSrc:"http://farm"+_12.farm+".static.flickr.com/"+_12.server+"/"+_12.primary+"_"+_12.secret+".jpg",keyPhotoID:_12.primary,numberOfPhotos:parseInt(_12.photos)});
}.bind(this));
_10(this._galleryData.albumList);
}.bind(this));
},getAlbumData:function(_13,_14){
if(this._galleryData["album"+_13]){
return _14(this._galleryData["album"+_13]);
}
FlickrAPI.get({method:"flickr.photosets.getInfo",photoset_id:_13},function(_15){
var _16=_15.photoset;
this._galleryData["album"+_16.id]=this._galleryData["album"+_16.id]||{};
$extend(this._galleryData["album"+_16.id],{title:_16.title._content,description:_16.description._content,keyPhotoSrc:"http://farm"+_16.farm+".static.flickr.com/"+_16.server+"/"+_16.primary+"_"+_16.secret+".jpg",keyPhotoID:_16.primary,numberOfPhotos:parseInt(_16.photos)});
_14(this._galleryData["album"+_13]);
}.bind(this));
},getAlbumPhotos:function(_17,_18){
if(this._galleryData["album"+_17]&&this._galleryData["album"+_17].photos&&this._galleryData["album"+_17].photos._firstImage){
return _18(this._galleryData["album"+_17].photos);
}
FlickrAPI.get({method:"flickr.photosets.getPhotos",photoset_id:_17,extras:"original_format"},function(_19){
this._galleryData["album"+_17]=this._galleryData["album"+_17]||{};
var _1a=(this._galleryData["album"+_17].photos=this._galleryData["album"+_17].photos||{});
_19.photoset.photo.forEach(function(_1b,i){
_1a["photo"+_1b.id]=_1a["photo"+_1b.id]||{};
$extend(_1a["photo"+_1b.id],{id:_1b.id,title:_1b.title||"",srcBase:"http://farm"+_1b.farm+".static.flickr.com/"+_1b.server+"/"+_1b.id+"_"+_1b.secret,originalSrc:"http://farm"+_1b.farm+".static.flickr.com/"+_1b.server+"/"+_1b.id+"_"+_1b.originalsecret+"_o_d."+_1b.originalformat,next:(i==_19.photoset.photo.length-1)?null:_19.photoset.photo[i+1].id,previous:(i==0)?null:_19.photoset.photo[i-1].id});
});
_1a._firstImage=_19.photoset.photo[0].id;
_18(this._galleryData["album"+_17].photos);
}.bind(this));
},getImageData:function(_1d,_1e,_1f){
if(this._galleryData["album"+_1d]&&this._galleryData["album"+_1d].photos&&this._galleryData["album"+_1d].photos["photo"+_1e]&&$defined(this._galleryData["album"+_1d].photos["photo"+_1e].description)){
return _1f(this._galleryData["album"+_1d].photos["photo"+_1e]);
}
FlickrAPI.get({method:"flickr.photos.getInfo",photo_id:_1e},function(_20){
var _21=_20.photo;
var _22=this._galleryData["album"+_1d]=(this._galleryData["album"+_1d]||{});
_22=(_22.photos=_22.photos||{});
_22=(_22["photo"+_21.id]=_22["photo"+_21.id]||{});
$extend(_22,{id:_21.id,title:_21.title._content||" ",description:_21.description._content||" ",srcBase:"http://farm"+_21.farm+".static.flickr.com/"+_21.server+"/"+_21.id+"_"+_21.secret,originalSrc:"http://farm"+_21.farm+".static.flickr.com/"+_21.server+"/"+_21.id+"_"+_21.originalsecret+"_o_d."+_21.originalformat});
return _1f(this._galleryData["album"+_1d].photos["photo"+_1e]);
}.bind(this));
},getSizes:function(_23,_24,_25){
if(this._galleryData["album"+_23]&&this._galleryData["album"+_23].photos&&this._galleryData["album"+_23].photos["photo"+_24]&&this._galleryData["album"+_23].photos["photo"+_24].variants){
return _25(this._galleryData["album"+_23].photos["photo"+_24].variants);
}
FlickrAPI.get({method:"flickr.photos.getSizes",photo_id:_24},function(_26){
this._galleryData["album"+_23]=this._galleryData["album"+_23]||{};
this._galleryData["album"+_23].photos=this._galleryData["album"+_23].photos||{};
this._galleryData["album"+_23].photos["photo"+_24]=this._galleryData["album"+_23].photos["photo"+_24]||{};
var _27=(this._galleryData["album"+_23].photos["photo"+_24].variants=[]);
_26.sizes.size.forEach(function(_28){
_27.push({label:_28.label,width:parseInt(_28.width),height:parseInt(_28.height),src:_28.source});
});
_27.ratio=_27[_27.length-1].height/_27[_27.length-1].width;
return _25(_27);
}.bind(this));
},getContext:function(_29,_2a,_2b){
var _2c=this._galleryData["album"+_29].photos["photo"+_2a];
if(_2c.next){
return _2b({next:_2c.next,previous:_2c.previous});
}
FlickrAPI.get({method:"flickr.photosets.getContext",photo_id:_2a,photoset_id:_29},function(_2d){
_2c.next=_2d.nextphoto.id||null;
_2c.previous=_2d.prevphoto.id||null;
_2b({next:_2c.next,previous:_2c.previous});
});
},getFirst:function(_2e){
return this._galleryData["album"+_2e].photos._firstImage;
},changeMode:function(_2f,_30,_31){
if(this.mode==_2f){
if(this.displayPhoto._active){
this.displayPhoto.show(_30,_31);
}
return;
}
document.body.className=_2f.capitalize();
if(_2f!="albums"){
_30=_30||this.displayPhoto._currentAlbum||this.grid._currentAlbum;
}
if(_2f=="single"||_2f=="filmstrip"){
_31=_31||this.displayPhoto._currentPhoto||this.getFirst(_30);
}
this.fireEvent("modeChange",[_2f,_30,_31]);
$$(".modeSelector").removeClass("selected");
$$(".mode"+_2f.capitalize()).addClass("selected");
this.mode=_2f;
}});
Gallery.implement(new Events);
var Albums=new Class({initialize:function(_32){
this._gallery=_32;
this.title=document.title;
_32.addEvent("modeChange",function(_33){
if(_33!="albums"){
return;
}
if(!this.built){
this.build();
}
document.title=this.title;
}.bind(this));
},build:function(){
var _34=this._gallery;
this._gallery.getAlbumList(function(_35){
_35.forEach(function(_36,i){
_34.getAlbumData(_36,function(_38){
var _39=new elementFromTemplate("template_album",{$album_title:_38.title,$album_description:_38.description,$album_date:"",$album_linkHref:"#grid:"+_36,$album_numberOfPhotos:_38.numberOfPhotos,$album_keyImageSrc:_38.keyPhotoSrc});
_39.getElements("a").forEach(function(_3a){
if(_3a.href.split("#")[1]=="grid:"+_36){
_3a.addEvent("click",function(_3b){
new Event(_3b).stop();
this.blur();
_34.changeMode("grid",_36);
});
}
});
if(i%2){
_39.addClass("even");
}
_39.id="album"+_38.id;
$("albums").appendChild(_39);
FlickrAPI.get({method:"flickr.photos.getInfo",photo_id:_38.keyPhotoID},function(_3c){
var _3d=["January","February","March","April","May","June","July","August","September","October","November","December"];
_39.getElement("h4").innerHTML=_3d[_3c.photo.dates.taken.slice(5,7)-1]+" "+_3c.photo.dates.taken.slice(0,4);
});
});
});
});
this.built=true;
}});
var Grid=new Class({initialize:function(_3e){
this._gallery=_3e;
this._currentAlbum="";

this._preferences=new Hash.Cookie("PhotoGalleryPreferences",{duration:365,path:"/"});
this._preferences.set("thumbsSize",this._preferences.get("thumbsSize")||80);
_3e.addEvent("modeChange",function(_3f,_40){
$$(".thumbnails").setStyle("display","none");
if(_3f!="grid"){
return;
}
if(_3f=="grid"&&!$("grid"+_40)){
this.build(_40);
}else{
$("grid"+_40).removeAttribute("style");
}
this._currentAlbum=_40;
this._gallery.getAlbumData(_40,function(_41){
document.title=_41.title;
$("albumTitle").innerHTML=_41.title;
});
if(!this.sliderBuilt){
this._createSlider();
}
}.bind(this));
},build:function(_42){
var _43=new Element("div",{"id":"grid"+_42,"class":"grid thumbnails"}).inject("photos");
var _44=this._gallery;
this._gallery.getAlbumPhotos(_42,function(_45){
var _46=_45["photo"+_45._firstImage];
do{
var _47=new elementFromTemplate("template_thumbnail",{$thumbnail_linkHref:"#single:"+_42+":"+_46.id,$thumbnail_title:_46.title,$thumbnail_src:_46.srcBase+"_m.jpg"}).inject(_43);
_47.getElements("a").forEach(function(_48){
var _49=_46.id;
if(_48.href.split("#")[1]=="single:"+_42+":"+_46.id){
_48.addEvent("click",function(_4a){
new Event(_4a).stop();
this.blur();
_44.changeMode("single",_42,_49);
});
}
});
var img=_47.getElement("img");
img.addEvent("load",function(){
if(this.width>this.height){
this.addClass("landscape");
}else{
this.addClass("portrait");
}
});
}while(_46=_45["photo"+_46.next]);
});
},resizeThumbnails:function(_4c){
var _4d=$E(".thumbnail .imageBorder").getSize().size.x-$E(".thumbnail img").getSize().size.x;
var _4e=$E(".thumbnail .imageBorder").getSize().size.y-$E(".thumbnail img").getSize().size.y;
var css=new Stylesheet("main.css");
css.getRule(".thumbnail").style.width=_4c+"px";
css.getRule(".thumbnail").style.height=_4c+"px";
css.getRule(".landscape").style.width=_4c-(_4d||10)+"px";
css.getRule(".portrait").style.height=_4c-(_4e||10)+"px";
},_createSlider:function(){
var _50=this;
new Slider($("resizeSlider"),$("resizeHandle"),{steps:160,onChange:function(pos){
_50.resizeThumbnails(pos+80);
},onComplete:function(pos){
_50._preferences.set("thumbsSize",pos);
}}).set(parseInt(this._preferences.get("thumbsSize")));
this.sliderBuilt=true;
}});
var DisplayPhoto=new Class({initialize:function(_53){
this._gallery=_53;
this._preloader=_53._preloader;
this._displayPhoto=$E("#displayPhoto .imageBorder");
this._currentPhoto="";
this._currentAlbum="";
this._fadeout=new Fx.Style(this._displayPhoto,"opacity",{duration:400,transition:Fx.Transitions.Sine.easeInOut});
this._fadein=new Fx.Style(this._displayPhoto,"opacity",{duration:300,transition:Fx.Transitions.Sine.easeInOut});
var css=new Stylesheet("main.css").getRule("#displayPhoto");
this._margin={top:parseInt(css.style.marginTop),right:parseInt(css.style.marginRight),bottom:parseInt(css.style.marginBottom),left:parseInt(css.style.marginLeft)};
css.style.margin="0";
var _55=this;
$("nextPhoto").addEvent("click",function(_56){
new Event(_56).stop();
this.blur();
_55.next.call(_55);
});
$("previousPhoto").addEvent("click",function(_57){
new Event(_57).stop();
this.blur();
_55.previous.call(_55);
});
_53.addEvent("modeChange",function(_58,_59,_5a){
if(_58!="single"&&_58!="filmstrip"){
this.exit();
}else{
this.enter(_59,_5a);
}
}.bind(this));
document.addEvent("keypress",function(_5b){
this.keyPressed.call(this,_5b);
}.bind(this));
this.exit();
},enter:function(_5c,_5d){
this.findDisplayArea();
if(this._active){
return this.resizeDisplayImage();
}
var _5e=this;
function onResize(){
_5e._area=_5e.findDisplayArea();
_5e.resizeDisplayImage();
};
window.addEvent("resize",onResize);
this.addEvent("exit",function(){
window.removeEvent("resize",onResize);
});
this._active=true;
this._gallery.getAlbumData(_5c,function(_5f){
$("albumTitle").innerHTML=_5f.title;
});
this.show(_5c,_5d);
},exit:function(){
this._preloader.stopAllEvents().flushQueue();
this._displayPhoto.setStyle("opacity",0);
this._active=false;
this._currentPhoto="";
this._currentAlbum="";
$("loading").style.display="none";
this.fireEvent("exit");
},keyPressed:function(_60){
if(this._gallery.mode!="single"&&this._gallery.mode!="filmstrip"){
return;
}
_60=new Event(_60);
switch(_60.key){
case "up":
case "left":
case "j":
return this.previous();
case "down":
case "right":
case "k":
return this.next();
}
switch(_60.code){
case 63232:
case 63234:
return this.displayPhoto.previous();
case 63233:
case 63235:
return this.displayPhoto.next();
}
},getVariant:function(_61,_62,_63){
this._gallery.getSizes(_61,_62,function(_64){
var _65=this._area;
var _66=_64.ratio*_65.height>_65.width?"width":"height";
var i;
if(noResize){
for(i=_64.length-1;i>0;i--){
if(_64[i][_66]<=_65[_66]){
break;
}
}
}else{
for(i=0;i<_64.length-1;i++){
if(_64[i][_66]>=_65[_66]){
break;
}
}
}
if(_64[i].label=="Original"&&(_64[i].width>1024||_64[i].height>1024)){
i--;
}
_63(_64[i].src);
}.bind(this));
},findDisplayArea:function(){
var _68=this._margin.top;
var _69=Math.min($("controlBar").getCoordinates().top,$("displayTitle").getCoordinates().top);
return this._area={width:window.getWidth()-(this._margin.left+this._margin.right)-($("displayPhoto").getSize().size.x-$E("#displayPhoto img").getSize().size.x),height:_69-_68-($("displayPhoto").getSize().size.y-$E("#displayPhoto img").getSize().size.y)-this._margin.bottom,offsetTop:_68};
},resizeDisplayImage:function(){
if(!this._currentPhoto){
return;
}
var _6a=this._area;
var img=$E("#displayPhoto img");
this._gallery.getSizes(this._currentAlbum,this._currentPhoto,function(_6c){
img.style.width=Math.min(_6a.width,_6a.height/_6c.ratio,img.naturalWidth)+"px";
img.style.height=(parseFloat(img.style.width)*_6c.ratio)+"px";
$("displayPhoto").style.top=Math.max(_6a.offsetTop,_6a.offsetTop+((_6a.height-$("displayPhoto").getSize().size.y)/2))+"px";
});
},show:function(_6d,_6e){
if(this._currentPhoto==_6e){
return;
}
var _6f=$("loading");
var _70=this;
this.getVariant(_6d,_6e,function(src){
if(!this._preloader.priorityLoadWithCallback(src,switchPhotos)){
_6f.style.display="block";
}
}.bind(this));
function switchPhotos(){
_70._gallery.getImageData(_6d,_6e,function(_72){
_70._gallery.getContext(_6d,_6e,function(_73){
if(_73.next){
$("nextPhoto").style.visibility="visible";
_70.getVariant(_6d,_73.next,function(src){
_70._preloader.addToQueue(src);
});
}else{
$("nextPhoto").style.visibility="hidden";
}
if(_73.previous){
$("previousPhoto").style.visibility="visible";
_70.getVariant(_6d,_73.previous,function(src){
_70._preloader.addToQueue(src);
});
}else{
$("previousPhoto").style.visibility="hidden";
}
});
_70._fadeout.start(0).chain(function(){
_70._gallery.getAlbumData(_6d,function(_76){
document.title=_76.title+(_72.title.trim()?": "+_72.title:"");
});
$E("#displayPhoto img").replaceWith(this);
_70._currentAlbum=_6d;
_70._currentPhoto=_6e;
if(!this.naturalWidth){
this.naturalWidth=this.width;
}
$("photoTitle").innerHTML=(this.title=_72.title);
$("photoDescription").innerHTML=(this.alt=_72.description);
_70.findDisplayArea();
_70.resizeDisplayImage();
$$("#download a").each(function(_77){
switch(_77.id){
case "downloadSmall":
_77.href=_72.srcBase+"_d.jpg";
return;
case "downloadLarge":
_77.href=_72.srcBase+"_b_d.jpg";
return;
case "downloadOriginal":
_77.href=_72.originalSrc;
_77.style.display=_72.originalSrc.test(/undefined/)?"none":"";
return;
}
});
_6f.style.display="none";
_70._gallery.fireEvent("photoChange",[_6d,_6e]);
_70._fadein.start(1);
_70._gallery.history.addState(_70._gallery.mode+":"+_6d+":"+_6e);
}.bind(this));
}.bind(this));
};
},next:function(){
this.fireEvent("next");
this._gallery.getContext(this._currentAlbum,this._currentPhoto,function(_78){
if(!_78.next){
return this._gallery.changeMode("grid",this._currentAlbum);
}
this.show(this._currentAlbum,_78.next);
}.bind(this));
},previous:function(){
this.fireEvent("previous");
this._gallery.getContext(this._currentAlbum,this._currentPhoto,function(_79){
if(!_79.previous){
this._gallery.changeMode("grid",this._currentAlbum);
}
this.show(this._currentAlbum,_79.previous);
}.bind(this));
}});
DisplayPhoto.implement(new Events);
var Filmstrip=new Class({initialize:function(_7a){
this._gallery=_7a;
this._visible=false;
this._strip=$("strip");
a=this._scroll=new Fx.Scroll("strip",{duration:750,transition:Fx.Transitions.Quad.easeInOut});
_7a.addEvent("photoChange",function(_7b,_7c){
this.updateSelected(_7b,_7c);
}.bind(this));
_7a.addEvent("modeChange",function(_7d,_7e){
if(_7d!="filmstrip"){
return;
}
$$("div[id^=stripContainer]").setStyle("display","none");
if(!$("stripContainer"+_7e)){
this.build(_7e);
}else{
$("stripContainer"+_7e).setStyle("display","block");
}
}.bind(this));
},build:function(_7f){
var _80=new Element("div",{id:"stripContainer"+_7f}).inject("strip");
var _81=this._gallery;
this._gallery.getAlbumPhotos(_7f,function(_82){
var _83=_82["photo"+_82._firstImage];
do{
new elementFromTemplate("template_stripThumbnail",{$thumbnail_title:_83.title,$thumbnail_src:_83.srcBase+"_m.jpg",$thumbnail_id:"stripThumbnail"+_7f+_83.id}).addEvent("click",function(_84){
new Event(_84).stop();
this.blur();
_81.displayPhoto.show(_7f,this.href.split(":")[2]);
}).inject(_80).setProperty("href","filmstrip:"+_7f+":"+_83.id);
}while(_83=_82["photo"+_83.next]);
_81.displayPhoto.findDisplayArea();
_81.displayPhoto.resizeDisplayImage();
});
},updateSelected:function(_85,_86){
if(!$("stripThumbnail"+_85+_86)){
return;
}
if(this._currentlySelected){
this._currentlySelected.removeClass("selected");
}
this._currentlySelected=$("stripThumbnail"+_85+_86).addClass("selected");
var _87=this._currentlySelected.getPosition().x+(this._currentlySelected.getSize().size.x/2)+this._strip.getStyle("border-left-width").toInt()-(this._strip.getSize().size.x/2);
this._scroll.scrollTo(_87,false);
}});
//Stylesheet.js
var Stylesheet = new Class({

	initialize: function (filename) {
		for (var i = 0; i < document.styleSheets.length; i++) {
			if (document.styleSheets[i].href.substring(document.styleSheets[i].href.lastIndexOf('/') + 1) == filename)
				this.sheet = document.styleSheets[i];
		}
		if (!this.sheet) {
			var s = new Element('style').inject(document.head);
			this.sheet = document.styleSheets[document.styleSheets.length - 1];
		}
		this.cssRules = this.sheet.cssRules || this.sheet.rules;
	},
	
	insertRule: function (selector, rules, position) {
		position = position || this.cssRules.length;
		if (this.sheet.insertRule)
			this.sheet.insertRule(selector + ' {' + rules + '}', position);
		else
			this.sheet.addRule(selector, rules, position);
		return this.cssRules[position];
	},
	
	getRule: function (selector) {
		return this.cssRules[this.getRuleIndex(selector)] || false;
	},
	
	getRuleIndex: function (selector) {
		selector = selector.toLowerCase();
		for (var i = this.cssRules.length - 1; i >= 0; i--) {
			if (this.cssRules[i].selectorText.toLowerCase() == selector)
				return i;
		}
		return false;
	},
	
	deleteRule: function (index) {
		if (typeof(index) == 'string') index = this.getRuleIndex(index);
		if (index === false) return this;

		if (this.sheet.deleteRule)
			this.sheet.deleteRule(index);
		else
			this.sheet.removeRule(index);
		return this;
	}
});
//--------------Ladda Google Analytics----------------

window.addEvent('domready',function(){

var a=_gat._getTracker("UA-778473-3");
a._initData();
a._trackPageview();

});