/*
 * Facebox (for jQuery)
 * version: 1.2 (05/05/2008)
 * @requires jQuery v1.2 or later
 *
 * Examples at http://famspam.com/facebox/
 *
 * Licensed under the MIT:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
 */
(function(C){C.facebox=function(M,L){C.facebox.loading();if(M.ajax){F(M.ajax)}else{if(M.image){B(M.image)}else{if(M.div){J(M.div)}else{if(C.isFunction(M)){M.call(C)}else{C.facebox.reveal(M,L)}}}}};C.extend(C.facebox,{settings:{opacity:0.95,overlay:true,loadingImage:"/facebox/loading.gif",closeImage:"/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="/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(C("#facebox .loading").length==1){return true}D();C("#facebox .content").empty();C("#facebox .body").children().hide().end().append('<div class="loading"><img src="'+C.facebox.settings.loadingImage+'"/></div>');C("#facebox").css({top:H()[1]+(I()/10),left:385.5}).show();C(document).bind("keydown.facebox",function(L){if(L.keyCode==27){C.facebox.close()}return true});C(document).trigger("loading.facebox")},reveal:function(M,L){C(document).trigger("beforeReveal.facebox");if(L){C("#facebox .content").addClass(L)}C("#facebox .content").append(M);C("#facebox .loading").remove();C("#facebox .body").children().fadeIn("normal");C("#facebox").css("left",C(window).width()/2-(C("#facebox table").width()/2));C(document).trigger("reveal.facebox").trigger("afterReveal.facebox")},close:function(){C(document).trigger("close.facebox");return false}});C.fn.facebox=function(L){K(L);function M(){C.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(M){if(C.facebox.settings.inited){return true}else{C.facebox.settings.inited=true}C(document).trigger("init.facebox");E();var N=C.facebox.settings.imageTypes.join("|");C.facebox.settings.imageTypesRegexp=new RegExp("."+N+"$","i");if(M){C.extend(C.facebox.settings,M)}C("body").append(C.facebox.settings.faceboxHtml);var L=[new Image(),new Image()];L[0].src=C.facebox.settings.closeImage;L[1].src=C.facebox.settings.loadingImage;C("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){L.push(new Image());L.slice(-1).src=C(this).css("background-image").replace(/url\((.+)\)/,"$1")});C("#facebox .close").click(C.facebox.close);C("#facebox .close_image").attr("src",C.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 E(){var L=C.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,"");C.facebox.reveal(C(O).clone().show(),L)}else{if(M.match(C.facebox.settings.imageTypesRegexp)){B(M,L)}else{F(M,L)}}}function B(M,L){var N=new Image();N.onload=function(){C.facebox.reveal('<div class="image"><img src="'+N.src+'" /></div>',L)};N.src=M}function F(M,L){C.get(M,function(N){C.facebox.reveal(N,L)})}function A(){return C.facebox.settings.overlay==false||C.facebox.settings.opacity===null}function D(){if(A()){return }if(C("facebox_overlay").length==0){C("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')}C("#facebox_overlay").hide().addClass("facebox_overlayBG").css("opacity",C.facebox.settings.opacity).click(function(){C(document).trigger("close.facebox")}).fadeIn(200);return false}function G(){if(A()){return }C("#facebox_overlay").fadeOut(200,function(){C("#facebox_overlay").removeClass("facebox_overlayBG");C("#facebox_overlay").addClass("facebox_hide");C("#facebox_overlay").remove()});return false}C(document).bind("close.facebox",function(){C(document).unbind("keydown.facebox");C("#facebox").fadeOut(function(){C("#facebox .content").removeClass().addClass("content");G();C("#facebox .loading").remove()})})})(jQuery);
$(document).bind("beforeReveal.facebox", function(){$("select").hide();})
$(document).bind("close.facebox", function(){$("select").show();})
