(function(A){A.facebox=function(C,B){A.facebox.init();A.facebox.loading();if(A.isFunction(C)){C.call(A)}else{A.facebox.preReveal(C,B)}};A.facebox.settings={loading_image:"/images/blank.gif",close_image:"/images/blank.gif",image_types:["png","jpg","jpeg","gif"],facebox_html:'  <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="preLoading" style="display:none;"></div>               <div class="content">               </div>               <div class="footer">                 <a href="#" class="close">                   <img src="/images/blank.gif" title="close" class="close_image" />                 </a>               </div>             </td>             <td class="b"/>           </tr>           <tr>             <td class="bl"/><td class="b"/><td class="br"/>           </tr>         </tbody>       </table>     </div>   </div>'};A.facebox.loading=function(){if(A("#facebox").is(":visible")){A("#facebox").hide()}if(A("#facebox .loading").length==1){return true}A("#facebox .content").empty();A("#facebox .body").children().hide().end().append('<center><div class="loading"><img src="'+A.facebox.settings.loading_image+'"/></div></center>');A("#facebox").css({top:jQuery(document).scrollTop()+(A.facebox.getPageHeight()/2-A("#facebox").height()/2),left:jQuery(document).scrollLeft()+(A.facebox.getPageWidth()/2-A("#facebox").width()/2)}).fadeIn();A(document).bind("keydown.facebox",function(B){if(B.keyCode==27){A.facebox.close()}})};A.facebox.preReveal=function(D,C){if(D.indexOf("div class='image'")!=-1){A("#facebox .preLoading").append(D);var B=A("#facebox .preLoading div.image img").attr("src");A("#facebox .preLoading div.image").remove();A("#facebox .preLoading").image(B,function(){A("#facebox .preLoading").html(" ");A.facebox.reveal(D,C)})}else{A.facebox.reveal(D,C)}};A.facebox.reveal=function(F,B){if(B){A("#facebox .content").addClass(B)}A("#facebox .content").append(F);A("#facebox .loading").remove();A("#facebox .body").children().show();var G=A("#facebox .content div.image img");if(G.length==1){var C=75;var E=40;var D=81;A("#facebox").width(A("#facebox div table").width(E+G.outerWidth()).outerWidth());if(A("#facebox").height()>A(window).height()-C){G.height(A(window).height()-D-C);A("#facebox").width(A("#facebox div table").width(E+G.outerWidth()).outerWidth())}if(A("#facebox").width()>A(window).width()-C){G.width(A(window).width()-E-C);A("#facebox").width(A("#facebox div table").width(E+G.outerWidth()).outerWidth())}}A("#facebox").css({top:jQuery(document).scrollTop()+(A.facebox.getPageHeight()/2-A("#facebox").height()/2),left:jQuery(document).scrollLeft()+(A.facebox.getPageWidth()/2-A("#facebox").width()/2)}).fadeIn()};A.facebox.close=function(){A(document).trigger("close.facebox");return false};A(document).bind("close.facebox",function(){A(document).unbind("keydown.facebox");A("#facebox").fadeOut(function(){A("#facebox .content").removeClass().addClass("content")})});A.fn.facebox=function(C){A.facebox.init(C);var B=A.facebox.settings.image_types.join("|");B=new RegExp("."+B+"$","i");function D(){A.facebox.loading(true);var E=this.rel.match(/facebox\[\.(\w+)\]/);if(E){E=E[1]}if(this.href.match(/#/)){var F=window.location.href.split("#")[0];var G=this.href.replace(F,"");A.facebox.reveal(A(G).clone().show(),E)}else{if(this.href.match(B)){A.facebox.preReveal("<div class='image'><img src=\""+this.href+'" /></div>',E)}else{A.get(this.href,function(H){A.facebox.reveal(H,E)})}}return false}this.click(D);return this};A.facebox.init=function(C){if(A.facebox.settings.inited){return true}else{A.facebox.settings.inited=true}if(C){A.extend(A.facebox.settings,C)}A("body").append(A.facebox.settings.facebox_html);var B=[new Image(),new Image()];B[0].src=A.facebox.settings.close_image;B[1].src=A.facebox.settings.loading_image;A("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){B.push(new Image());B.slice(-1).src=A(this).css("background-image").replace(/url\((.+)\)/,"$1")});A("#facebox .close").click(A.facebox.close);A("#facebox .close_image").attr("src",A.facebox.settings.close_image)};A.facebox.getPageHeight=function(){var B;if(self.innerHeight){B=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){B=document.documentElement.clientHeight}else{if(document.body){B=document.body.clientHeight}}}return B};A.facebox.getPageWidth=function(){var B;if(self.innerWidth){B=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){B=document.documentElement.clientWidth}else{if(document.body){B=document.body.clientWidth}}}return B}})(jQuery);