(function(B){var A=/([^&=]+)=?([^&]*)/g;var D=/\+/g;var C=function(E){return decodeURIComponent(E.replace(D," "));};B.parseParams=function(G){var I={},H;while(H=A.exec(G)){var F=C(H[1]),E=C(H[2]);if(F.substring(F.length-2)==="[]"){F=F.substring(0,F.length-2);(I[F]||(I[F]=[])).push(E);}else{I[F]=E;}}return I;};B.substitute=function(F,E){return F.replace(/\{(.+?)\}/g,function(H,G){return G in E?E[G]:H;});};})(jQuery);var TWP=window.TWP||{};(function(A){TWP.Overlay=function(G,E){var C=this;var D=this.config={top:"center",left:"center",fixed:false,speed:"fast",showOverlay:true,loadSpeed:100,overlayOpacity:0.7,overlayColor:"black"};var B=function(){A.extend(D,E);if(!G){G=A("
").css("width",100).css("height",100);}if(!C.overlay){C.id="overlay_"+new Date().getTime();C.contentWrapperId="wrapper_"+C.id;var H=A("
",{id:C.id}).addClass("simple-overlay modal-wrapper");H.append(A("
",{id:C.contentWrapperId}).addClass("content-wrapper photo-display"));A("body").prepend(H);C.overlay=H.overlay({mask:{color:D.overlayColor,loadSpeed:D.loadSpeed,opacity:D.overlayOpacity,zIndex:55554},top:D.top,left:D.left,onBeforeLoad:function(I){C.setBody(G);if(D.onBeforeLoad){D.onBeforeLoad(I);}},onLoad:D.onLoad?D.onLoad:function(){},onBeforeClose:D.onBeforeClose?D.onBeforeClose:function(){},onClose:D.onClose?D.onClose:function(){},load:D.showOverlay,fixed:D.fixed,speed:D.speed});TWP.currentOverlay=C.overlay;F();}else{C.show();}};var F=function(){if(D.callback){D.callback(C);}};this.show=function(){A("#"+C.id).overlay().load();};this.destroy=function(){if(C.overlay){var H=A("#"+C.id);H.overlay().close();H.remove();C.overlay=null;}};this.close=function(){var H=A("#"+C.id).overlay();if(H.isOpened()){H.close();}};this.setBody=function(I){var H=A("#"+this.contentWrapperId);H.html(typeof I=="string"?I:I[0].outerHTML?I[0].outerHTML:I[0]);};this.getBody=function(){return A("#"+this.contentWrapperId);};B.apply(this);return C;};}(jQuery));TWP=window.TWP||{};(function(A){TWP.OverlayHelper=function(F,D){var E=this.config={url:"",overlayConfig:{},overlay:null};this.initialize=function(){if(F){var G=this;this.resetConfigOnClick();A(F).bind("click",function(H){if(H){H.preventDefault();}G.resetConfigOnClick();A.extend(E.overlayConfig,D);C(null,E.overlayConfig);});}};this.resetConfigOnClick=function(){if(F){if(F.getAttribute("href")){E.url=F.getAttribute("href");}if(F.getAttribute("config")){E.overlayConfig=A.parseParams(F.getAttribute("config"));}}};var C=function(J,I){I=I?I:E.overlayConfig;E.url=J?J:E.url;var H=A(F);if(E.overlay){E.overlay.destroy();}if(H.hasClass("ajax-overlay")){var K=0,G=function(){if(K<5){A.ajax({url:E.url,success:B(I),error:G});K++;}else{B(I)("

Failed to download content after 5 tries

");}};G();}else{if(H.hasClass("iframe-overlay")){E.overlay=new TWP.Overlay(A("