function GalleryControl(a){this.Y=a;if(a){a.use("node","cookie","anim-base");}}GalleryControl.prototype.display=function(g){var e=this.Y,b=new e.Anim({node:"#gallery_items",duration:1,to:{opacity:0},from:{opacity:1}}),c,a,d,f=e.one("#gallery_items");if(g==="gridView"){if(!f.hasClass("thumb_view")){e.one("#switch_button").removeClass("swap");c=g;a="display";d="thumb_view";}}else{if(g==="listView"){if(!f.hasClass("display")){e.one("#switch_button").addClass("swap");c=g;a="thumb_view";d="display";}}else{return;}}if(e.Lang.isValue(c)){b.on("end",function(h){var j=h.target.get("node"),i=new e.Anim({node:"#gallery_items",duration:1,to:{opacity:1},from:{opacity:0}});j.replaceClass(a,d);i.run();});b.run();this.setCookie(g);}};GalleryControl.prototype.toggleView=function(){var a=this.Y,b=a.one("#gallery_items");if(b.hasClass("thumb_view")){this.display("listView");}else{this.display("gridView");}};GalleryControl.prototype.setCookie=function(b){var a=new Date(),c=this.Y;a.setDate(a.getDate()+365);c.Cookie.set("layout",b,{expires:a});};GalleryControl.prototype.toString=function(){return"[object GalleryControl ("+this.valueOf()+")]";};GalleryControl.prototype.valueOf=function(){var a=parseInt("-1");if(this.Y){a=this.Y.all("#gallery_items li").size();}return a;};GalleryControl.TOGGLE_DELAY_MICROSECONDS=200;
