(function($){
$.facebox=function(_2){
$.facebox.init();
$.facebox.loading();
$.isFunction(_2)?_2.call():$.facebox.reveal(_2);
};
$.facebox.settings={loading_image:"/images/facebox/loading.gif",close_image:"/images/facebox/closelabel.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=\"content\">               </div>               <div class=\"footer\">                 <a href=\"#\" class=\"close\">                   <img src=\"\" 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>"};
$.facebox.loading=function(){
if($("#facebox .loading").length==1){
return true;
}
$("#facebox .content").empty();
$("#facebox .body").children().hide().end().append("<div class=\"loading\"><img src=\""+$.facebox.settings.loading_image+"\"/></div>");
var _3=$.facebox.getPageScroll();
$("#facebox").css({top:_3[1]+($.facebox.getPageHeight()/10),left:_3[0]}).show();
$(document).bind("keydown.facebox",function(e){
if(e.keyCode==27){
$.facebox.close();
}
});
};
$.facebox.reveal=function(_5,_6){
if(_6){
$("#facebox .content").addClass(_6);
}
$("#facebox .content").append(_5);
$("#facebox .loading").remove();
$("#facebox .body").children().fadeIn("normal");
};
$.facebox.close=function(){
$(document).unbind("keydown.facebox");
$("#facebox").fadeOut(function(){
$("#facebox .content").removeClass().addClass("content");
});
return false;
};
$.fn.facebox=function(){
$.facebox.init();
var _7=$.facebox.settings.image_types.join("|");
_7=new RegExp("."+_7+"$","i");
function click_handler(){
$.facebox.loading(true);
var _8=this.rel.match(/facebox\[\.(\w+)\]/);
if(_8){
_8=_8[1];
}
if(this.href.match(/#/)){
var _9=window.location.href.split("#")[0];
var _a=this.href.replace(_9,"");
$.facebox.reveal($(_a).clone().show(),_8);
}else{
if(this.href.match(_7)){
var _b=new Image();
_b.onload=function(){
$.facebox.reveal("<div class=\"image\"><img src=\""+_b.src+"\" /></div>",_8);
};
_b.src=this.href;
}else{
$.get(this.href,function(_c){
$.facebox.reveal(_c,_8);
});
}
}
return false;
}
this.click(click_handler);
return this;
};
$.facebox.init=function(){
if($.facebox.settings.inited){
return true;
}else{
$.facebox.settings.inited=true;
}
$("body").append($.facebox.settings.facebox_html);
var _d=[new Image(),new Image()];
_d[0].src=$.facebox.settings.close_image;
_d[1].src=$.facebox.settings.loading_image;
$("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){
_d.push(new Image());
_d.slice(-1).src=$(this).css("background-image").replace(/url\((.+)\)/,"$1");
});
$("#facebox .close").click($.facebox.close);
$("#facebox .close_image").attr("src",$.facebox.settings.close_image);
};
$.facebox.getPageScroll=function(){
var _e,yScroll;
if(self.pageYOffset){
yScroll=self.pageYOffset;
_e=self.pageXOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
yScroll=document.documentElement.scrollTop;
_e=document.documentElement.scrollLeft;
}else{
if(document.body){
yScroll=document.body.scrollTop;
_e=document.body.scrollLeft;
}
}
}
return new Array(_e,yScroll);
};
$.facebox.getPageHeight=function(){
var _f;
if(self.innerHeight){
_f=self.innerHeight;
}else{
if(document.documentElement&&document.documentElement.clientHeight){
_f=document.documentElement.clientHeight;
}else{
if(document.body){
_f=document.body.clientHeight;
}
}
}
return _f;
};
})(jQuery);

