dojo.require("dojox.image.SlideShow");dojo.require("dojo.data.ItemFileReadStore");dojo.addOnLoad(function(){var d=function(){var e=new dojox.image.SlideShow({},dojo.byId("slideshow"));var f=new dojo.data.ItemFileReadStore({url:"index.php?option=com_zenfolio&task=loadGallery&id="+dojo.byId("initialGallery").value+"&format=raw"});e.setDataStore(f,{query:{},count:20},{imageLargeAttr:"large"})};var a=function(e){var f=function(){var g={};g.content="";g.buildNav=function(){var l=dojo.byId("imagesNav");var j=dijit.byId("slideshow");total=this.content.items.length;for(var k=1;k<=total;k++){var h=document.createElement("li");h.innerHTML=k;h.number=k-1;dojo.connect(h,"onclick",function(i){j.showImage(this.number);g.updateCaption(this.number);g.stripClass(l,"activeImage");dojo.addClass(this,"activeImage")});l.appendChild(h)}};g.updateCaption=function(h){dojo.byId("imageCaption").innerHTML=this.content.items[h].content};g.reset=function(){g.content="";g.clearList(dojo.byId("imagesNav"));g.stripClass(dojo.byId("galleryMainNav"),"activeCategory");dojo.addClass(dojo.byId("gallery"+e),"activeCategory")};g.clearList=function(h){while(h.hasChildNodes()){h.removeChild(h.lastChild)}};g.stripClass=function(i,j){var h=i.getElementsByTagName("li");dojo.forEach(h,function(k){dojo.removeClass(k,j)})};return g};dojo.xhrGet({url:"index.php?option=com_zenfolio&task=loadGallery&id="+e+"&type=captions&format=raw",load:function(i){var h=dojo.fromJson(i);var j=f();j.reset();j.content=h;j.buildNav();dojo.byId("imageCaption").innerHTML=h.items[0].content;var g=dojo.byId("imagesNav").firstChild;dojo.addClass(g,"activeImage")}})};var b=function(){var f=function(i){var g=dijit.byId("slideshow");var h=new dojo.data.ItemFileReadStore({url:"index.php?option=com_zenfolio&task=loadGallery&id="+i+"&format=raw"});g.setDataStore(h,{query:{},count:20},{imageLargeAttr:"large"});a(i)};var e=dojo.query("#galleryMainNav li a");dojo.forEach(e,function(g){dojo.connect(g,"onclick",function(){var h=this.parentNode.id;h=h.substring(7);f(h)})})};d();var c=dojo.byId("initialGallery").value;a(c);b()});
