text: var transitionDelay="500",packeryContainer,pckry,navbarAccordion;$(document).ready(function(){navbarAccordion=function(a){console.log("Accordion initiated: "+a);$(a+" ul").hide();$(a+" a").on("click",function(b){var c=$(this);if("javascript:void(0);"==c.attr("href")){b.preventDefault(),console.log("ACCORDION"),console.log("Accordion header click");var d=$(this).next();return console.log(d),$(a+" ul").slideUp("500"),$(this).next().slideDown("500"),!1}console.log(c.parent().parent().parent().prop("tagName")),$(a+" .active").removeClass("active"),c.addClass("active"),c.parent().parent().prev().addClass("active"),"LI"!=c.parent().parent().parent().prop("tagName")&&$(a+" ul").slideUp("500"),menu_hide()})},navbarAccordion(".nav"),$(".navbar-brand").on("click",function(){$(".navbar-nav .active").removeClass("active"),$(".navbar-nav ul").slideUp("500"),menu_hide()})});var menu_hide=function(){$(window).width()<768&&$(".navbar-collapse").is(":visible")&&$(".navbar-toggle").click()},preload_pictures=function(a,b){for(var c=0,d=0,e=a.length;e>d;d++){var f=a[d].replace(/ /g,"%20"),g=new Image;g.onload=function(){var d=this,e='url("'+d.src+'")';$("#carousel-slides").length>0&&$.each($("#carousel-slides li"),function(a,b){var c=$(b);if("undefined"!=typeof c.find("img").attr("src"))var f=c.find("img").attr("src").replace(/ /g,"%20");if("images/blank.gif"!=f){if(f===d.src){c.find("img").css({width:"100%",height:"100%"});var g=d.height>d.width?"portrait-photo":"landscape-photo";c.css({"background-image":e}).addClass(g),c.addClass("no-after")}}else c.find("img").css({width:"100%",height:"100%"})}),++c==a.length&&b&&(console.log("*** All images have been preloaded. ***"),b())},g.onerror=function(){},g.src=f}},showPage=function(){$("html, body").animate({scrollTop:0},"slow"),$(".preloader").stop().delay(200).fadeOut(transitionDelay),$(".page").stop().delay(200).animate({opacity:1},transitionDelay,function(){console.log("page transition complete")})},popupDatShit=function(a,b,c,d){console.log("Popping this shit right here: "+a);var e=screen.width/2-c/2,f=screen.height/2-d/2;window.open(a,b,"height="+d+",width="+c+",left="+e+",top="+f+",toolbar=0,menubar=0,scrollbar=0")},carouselControls=!1,$carousel,currentMouseState,carouselIsDragged=!1,carouselTapX,carouselTapY,carouselWidth,carouselHeight,carouselXPos,carouselYPos,carouselXEnd,carouselYEnd,carouselHoverPad=200,Homepage=Backbone.Collection.extend({url:"/home.php"}),homepageDump,HomepageView=Backbone.View.extend({el:".page",render:function(){var a=this,b=new Homepage;$(".preloader").fadeIn(transitionDelay),a.$el.fadeOut(transitionDelay,function(){$(this).css({display:"block",opacity:0}),b.fetch({success:function(b){homepageDump=b.toJSON(),console.log("*** Home page successfully fetched");var c=_.template($("#homepage-template").html(),{homepage:b.models});a.$el.html(c)}})})}}),Gallery=Backbone.Collection.extend({url:"/gallery.php"}),GalleryView=Backbone.View.extend({el:".page",render:function(a){var b=this;$(".preloader").fadeIn(transitionDelay),b.$el.fadeOut(transitionDelay,function(){if($(this).css({display:"block",opacity:0}),a.gid)var c=new Gallery({gid:a.gid});c.fetch({data:"gid="+a.gid,success:function(c){console.log("*** Gallery page successfully fetched");var d=_.template($("#gallery-template").html(),{gallery:c.models,gid:a.gid});console.log(c),b.$el.html(d)}})})}}),GalleryStream=Backbone.Collection.extend({url:"/gallerystream.php"}),slideOptions,gallerystreamDump,GalleryStreamView=Backbone.View.extend({el:".page",events:{swipe:"onSwipe"},onSwipe:function(){},silent:!0,render:function(a){var b=this;slideOptions=a,$(".preloader").fadeIn(transitionDelay),b.$el.fadeOut(transitionDelay,function(){$(this).css({display:"block",opacity:0});var c=new GalleryStream({gid:a.gid,id:a.sid});c.fetch(a.sli?{data:"gid="+a.gid+"&sid="+a.sid,success:function(){console.log("*** Gallery Stream page successfully fetched");var d=_.template($("#gallerystream-template").html(),{gallerystream:c.models,gid:a.gid,sid:a.sid,sli:a.sli});gallerystreamDump=c.toJSON(),b.$el.html(d)}}:{data:"gid="+a.gid+"&sid="+a.sid,success:function(){console.log("*** Gallery Stream page successfully fetched");var d=_.template($("#gallerystream-template").html(),{gallerystream:c.models,gid:a.gid,sid:a.sid});gallerystreamDump=c.toJSON(),b.$el.html(d)}})})}}),StaticPage=Backbone.Collection.extend({url:"/page.php"}),StaticPageView=Backbone.View.extend({el:".page",events:{swipe:"onSwipe"},onSwipe:function(){},silent:!0,render:function(a){var b=this;staticpageOptions=a,$(".preloader").fadeIn(transitionDelay),b.$el.fadeOut(transitionDelay,function(){$(this).css({display:"block",opacity:0});var c=new StaticPage({pid:a.pid});c.fetch({data:"pid="+a.pid,success:function(a){console.log("*** Static page successfully fetched");var c=_.template($("#staticpage-template").html(),{staticpage:a.models});b.$el.html(c)}})})}}),ExternalPage=Backbone.Collection.extend({url:"/external.php"}),ExternalPageView=Backbone.View.extend({el:".page",events:{swipe:"onSwipe"},onSwipe:function(){},silent:!0,render:function(a){var b=this;externalpageOptions=a,$(".preloader").fadeIn(transitionDelay),b.$el.fadeOut(transitionDelay,function(){$(this).css({display:"block",opacity:0});var c=new ExternalPage({xuri:a.xuri});c.fetch({data:"xurl="+a.xuri,success:function(a){console.log("*** Static page successfully fetched");var c=_.template($("#externalpage-template").html(),{externalpage:a.models});b.$el.html(c)}})})}}),Slideshow=Backbone.Collection.extend({url:"/slideshow.php"}),SlideshowView=Backbone.View.extend({el:".page",render:function(a){var b=this;$(".preloader").fadeIn(transitionDelay),b.$el.fadeOut(transitionDelay,function(){if($(this).css({display:"block",opacity:0}),a.sid)var c=new Slideshow({sid:a.sid});var c=new Slideshow({sid:a.sid});c.fetch({data:"sid="+a.sid,success:function(c){console.log("*** Slideshow page successfully fetched");var d=_.template($("#slideshow-template").html(),{slideshow:c.models,sid:a.sid});console.log(c),b.$el.html(d)}})})}}),SlideshowStream=Backbone.Collection.extend({url:"/slideshow.php"}),slideshowstreamDump,SlideshowStreamView=Backbone.View.extend({el:".page",events:{swipe:"onSwipe"},onSwipe:function(){},silent:!0,render:function(a){var b=this;slideOptions=a,$(".preloader").fadeIn(transitionDelay),b.$el.fadeOut(transitionDelay,function(){$(this).css({display:"block",opacity:0});var c=new SlideshowStream({sid:a.sid});c.fetch(a.sli?{data:"sid="+a.sid,success:function(){console.log("*** Slideshow Stream page successfully fetched");var d=_.template($("#slideshowstream-template").html(),{slideshowstream:c.models,sid:a.sid,sli:a.sli});slideshowstreamDump=c.toJSON(),b.$el.html(d)}}:{data:"sid="+a.sid,success:function(){console.log("*** Slideshow Stream page successfully fetched");var d=_.template($("#slideshowstream-template").html(),{slideshowstream:c.models,sid:a.sid});slideshowstreamDump=c.toJSON(),b.$el.html(d)}})})}}),PageRouter=Backbone.Router.extend({routes:{"":"home",home:"home","gallery/:gid":"getGallery","gallery/:gid/:sid/:slide":"getGalleryStream","page/:pid":"getStaticPage","ext/:xuri":"getExternalPage","slideshow/:sid":"getSlideshow","slideshow/:sid/:slide":"getSlideshowStream"}}),homepageView=new HomepageView,galleryView=new GalleryView,gallerystreamView=new GalleryStreamView,staticpageView=new StaticPageView,externalpageView=new ExternalPageView,slideshowView=new SlideshowView,slideshowstreamView=new SlideshowStreamView,pageRoute=new PageRouter;pageRoute.on("route:home",function(){console.log("*** Home page loaded"),homepageView.render()}),pageRoute.on("route:getGallery",function(a){console.log("*** Gallery page loaded"),console.log("Get Gallery id "+a),galleryView.render({gid:a})}),pageRoute.on("route:getGalleryStream",function(a,b,c){console.log("*** Gallery Stream page loaded"),console.log("Get Gallery id "+a+" --- Get Slideshow id "+b+" --- And Slide number "+c),gallerystreamView.render({gid:a,sid:b,sli:c})}),pageRoute.on("route:getStaticPage",function(a){console.log("*** Static page loaded"),console.log("Get Static Page id "+a),staticpageView.render({pid:a})}),pageRoute.on("route:getExternalPage",function(a){console.log("*** External page loaded"),console.log("Get External Page URL "+a),externalpageView.render({xuri:a})}),pageRoute.on("route:getSlideshow",function(a){console.log("*** Slideshow page loaded"),console.log("Get Slideshow id "+a),slideshowView.render({sid:a})}),pageRoute.on("route:getSlideshowStream",function(a,b){console.log("*** Slideshow Stream page loaded"),console.log("Get Slideshow id "+a+" --- And Slide number "+b),slideshowstreamView.render({sid:a,sli:b})}),Backbone.history.start();