(function(F){F.facebox=function(M,L){F.facebox.loading();if(M.ajax){G(M.ajax);}else{if(M.image){C(M.image);}else{if(M.div){J(M.div);}else{if(F.isFunction(M)){M.call(F);}else{F.facebox.reveal(M,L);}}}}};F.extend(F.facebox,{settings:{opacity:0.7,overlay:true,loadingImage:"/home/_assets/scripts/facebox/loading.gif",closeImage:"/home/_assets/scripts/facebox/closelabel.gif",imageTypes:["png","jpg","jpeg","gif"],faceboxHtml:'    <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">                     <img src="/home/_assets/scripts/facebox/closelabel.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>'},loading:function(){K();if(F("#facebox .loading").length==1){return true;}E();F("#facebox .content").empty();F("#facebox .body").children().hide().end().append('<div class="loading"><img src="'+F.facebox.settings.loadingImage+'"/></div>');F("#facebox").css({top:H()[1]+(I()/10),left:385.5}).show();F(document).bind("keydown.facebox",function(L){if(L.keyCode==27){F.facebox.close();}return true;});F(document).trigger("loading.facebox");},reveal:function(M,L){F(document).trigger("beforeReveal.facebox");if(L){F("#facebox .content").addClass(L);}F("#facebox .content").append(M);F("#facebox .loading").remove();F("#facebox .body").children().fadeIn("normal");F("#facebox").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){K(L);function M(){F.facebox.loading(true);var N=this.rel.match(/facebox\[?\.(\w+)\]?/);if(N){N=N[1];}J(this.href,N);return false;}return this.click(M);};function K(N){if(F.facebox.settings.inited){return true;}else{F.facebox.settings.inited=true;}F(document).trigger("init.facebox");D();var L=F.facebox.settings.imageTypes.join("|");F.facebox.settings.imageTypesRegexp=new RegExp("."+L+"$","i");if(N){F.extend(F.facebox.settings,N);}F("body").append(F.facebox.settings.faceboxHtml);var M=[new Image(),new Image()];M[0].src=F.facebox.settings.closeImage;M[1].src=F.facebox.settings.loadingImage;F("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){M.push(new Image());M.slice(-1).src=F(this).css("background-image").replace(/url\((.+)\)/,"$1");});F("#facebox .close").click(F.facebox.close);F("#facebox .close_image").attr("src",F.facebox.settings.closeImage);}function H(){var M,L;if(self.pageYOffset){L=self.pageYOffset;M=self.pageXOffset;}else{if(document.documentElement&&document.documentElement.scrollTop){L=document.documentElement.scrollTop;M=document.documentElement.scrollLeft;}else{if(document.body){L=document.body.scrollTop;M=document.body.scrollLeft;}}}return new Array(M,L);}function I(){var L;if(self.innerHeight){L=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){L=document.documentElement.clientHeight;}else{if(document.body){L=document.body.clientHeight;}}}return L;}function D(){var L=F.facebox.settings;L.loadingImage=L.loading_image||L.loadingImage;L.closeImage=L.close_image||L.closeImage;L.imageTypes=L.image_types||L.imageTypes;L.faceboxHtml=L.facebox_html||L.faceboxHtml;}function J(M,L){if(M.match(/#/)){var N=window.location.href.split("#")[0];var O=M.replace(N,"");F.facebox.reveal(F(O).clone().show(),L);}else{if(M.match(F.facebox.settings.imageTypesRegexp)){C(M,L);}else{G(M,L);}}}function C(M,L){var N=new Image();N.onload=function(){F.facebox.reveal('<div class="image"><img src="'+N.src+'" /></div>',L);};N.src=M;}function G(M,L){F.get(M,function(N){F.facebox.reveal(N,L);});}function B(){return F.facebox.settings.overlay==false||F.facebox.settings.opacity===null;}function E(){if(B()){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).click(function(){F(document).trigger("close.facebox");}).fadeIn(200);return false;}function A(){if(B()){return ;}F("#facebox_overlay").fadeOut(200,function(){F("#facebox_overlay").removeClass("facebox_overlayBG");F("#facebox_overlay").addClass("facebox_hide");F("#facebox_overlay").remove();});return false;}F(document).bind("close.facebox",function(){F(document).unbind("keydown.facebox");F("#facebox").fadeOut(function(){F("#facebox .content").removeClass().addClass("content");A();F("#facebox .loading").remove();});});})(jQuery);