(function(f){f.facebox=function(m,l){f.facebox.loading();f.facebox.content_klass=l;if(m.ajax){g(m.ajax)}else{if(m.image){e(m.image)}else{if(m.images){i(m.images,m.initial)}else{if(m.div){k(m.div)}else{if(f.isFunction(m)){m.call(f)}else{f.facebox.reveal(m)}}}}}};f.extend(f.facebox,{settings:{opacity:0,overlay:true,modal:false,imageTypes:["png","jpg","jpeg","gif"]},html:function(){return'<div id="facebox" style="display:none;">   <div class="popup">     <table>       <tbody>         <tr>           <td class="tl"/><td class="b"/><td class="tr"/>         </tr>         <tr>           <td class="b"/>           <td class="body">             <div class="content">             </div>             <div class="footer">               <a href="#" class="close"></a>            </div>           </td>           <td class="b"/>         </tr>         <tr>           <td class="bl"/><td class="b"/><td class="br"/>         </tr>       </tbody>     </table>   </div> </div>'},loading:function(){j();if(f(".loading",f("#facebox"))[0]){return}d();f.facebox.wait();if(!f.facebox.settings.modal){f(document).bind("keydown.facebox",function(l){if(l.keyCode==27){f.facebox.close()}})}f(document).trigger("loading.facebox")},wait:function(){var l=f("#facebox");f(".content",l).empty();f(".body",l).children().hide().end().append('<div class="loading"></div>');l.show();f.facebox.centralize();f(document).trigger("reveal.facebox").trigger("afterReveal.facebox")},centralize:function(){f("#facebox").css({top:f(window).scrollTop()+(f(window).height()/5),left:f(window).width()/2-(f("#facebox table").width()/2)})},reveal:function(m){f(document).trigger("beforeReveal.facebox");var l=f("#facebox");f(".content",l).attr("class",(f.facebox.content_klass||"")+" content").html(m);f(".loading",l).remove();f(".body",l).children().fadeIn("normal");l.css("left",f(window).width()/2-(f("#facebox table").width()/2));f(document).trigger("reveal.facebox").trigger("afterReveal.facebox")},close:function(){f(document).trigger("close.facebox");return false}});f.fn.facebox=function(l){var m=f(this);if(!m[0]){return m}if(l){f.extend(f.facebox.settings,l)}if(!f.facebox.settings.noAutoload){j()}m.bind("click.facebox",function(){f.facebox.loading();var n=this.rel.match(/facebox\[?\.(\w+)\]?/);f.facebox.content_klass=n?n[1]:"";k(this.href);return false});return m};function j(){if(f.facebox.settings.inited){return}else{f.facebox.settings.inited=true}f(document).trigger("init.facebox");h();var l=f.facebox.settings.imageTypes.join("|");f.facebox.settings.imageTypesRegexp=new RegExp(".("+l+")$","i");f("body").append(f.facebox.html());if(!f.facebox.settings.noAutoload){a()}f("#facebox .close").click(f.facebox.close)}function a(){f("#facebox").find(".b:first, .loading, .close , .bl, .br, .tl, .tr").each(function(){var l=new Image();l.src=f(this).css("background-image").replace(/url\((.+)\)/,"/(false|true|and|or|xor|__FILE__|exception|__LINE__|array|as|break|case|class|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|for|foreach|function|global|if|include|include_once|isset|list|new|print|require|require_once|return|static|switch|unset|use|var|while|__FUNCTION__|__CLASS__|__METHOD__|final|php_user_filter|interface|implements|extends|public|private|protected|abstract|clone|try|catch|throw|this)([ \.\"\'\{\(;&<])/g")})}function h(){var l=f.facebox.settings;l.imageTypes=l.image_types||l.imageTypes;l.faceboxHtml=l.facebox_html||l.faceboxHtml}function k(l){if(l.match(/#/)){var m=window.location.href.split("#")[0];var n=l.replace(m,"");if(n=="#"){return}f.facebox.reveal(f(n).html(),f.facebox.content_klass)}else{if(l.match(f.facebox.settings.imageTypesRegexp)){e(l)}else{g(l)}}}function i(p,n){var m=f.inArray(n||0,p);if(m==-1){m=0}f("#facebox div.footer").append(f('<div class="navigation"><a class="prev"/><div class="counter"></div><a class="next"/></div>'));var l=f("#facebox .navigation");f(document).bind("afterClose.facebox",function(){l.remove()});function o(q){m=(m+q+p.length)%p.length;e(p[m]);l.find(".counter").html(m+1+" / "+p.length)}o(0);f(".prev",l).click(function(){o(-1)});f(".next",l).click(function(){o(1)});f(document).bind("keydown.facebox",function(q){if(q.keyCode==39){o(1)}if(q.keyCode==37){o(-1)}})}function e(l){f("#facebox .content").empty();f.facebox.loading();var m=new Image();m.onload=function(){f.facebox.reveal('<div class="image"><img src="'+m.src+'" /></div>',f.facebox.content_klass)};m.src=l}function g(l){f.get(l,function(m){f.facebox.reveal(m)})}function c(){return f.facebox.settings.overlay==false||f.facebox.settings.opacity===null}function d(){if(c()){return}if(f("#facebox_overlay").length==0){f("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')}f("#facebox_overlay").hide().addClass("facebox_overlayBG").css("opacity",f.facebox.settings.opacity).fadeIn(200);if(!f.facebox.settings.modal){f("#facebox_overlay").click(function(){f(document).trigger("close.facebox")})}}function b(){if(c()){return}f("#facebox_overlay").fadeOut(200,function(){f("#facebox_overlay").removeClass("facebox_overlayBG").addClass("facebox_hide").remove()})}f(document).bind("close.facebox",function(){f(document).unbind("keydown.facebox");f("#facebox").fadeOut(function(){f("#facebox .content").removeClass().addClass("content");b();f("#facebox .loading").remove()});f(document).trigger("afterClose.facebox")})})(jQuery);