(function(a){a.fn.fixPNG=function(){return this.each(function(){var b=a(this).css("backgroundImage");if(b.match(/^url\(["']?(.*\.png)["']?\)$/i))b=RegExp.$1,a(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+(a(this).css("backgroundRepeat")=="no-repeat"?"crop":"scale")+", src='"+b+"')"}).each(function(){var b=a(this).css("position");b!="absolute"&&b!="relative"&&a(this).css("position","relative")})})};var g,b,l=!1,i=new Image,
m,j=1,p=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,q=null,k=a.browser.msie&&a.browser.version.substr(0,1)==6&&!window.XMLHttpRequest,r=k||a.browser.msie&&a.browser.version.substr(0,1)==7;a.fn.fancybox=function(c){function d(){a("#fancy_right, #fancy_left, #fancy_close, #fancy_title").hide();var c=b.itemArray[b.itemCurrent].href;if(b.href.length)c=b.href;if(c.match("iframex")||g.className.indexOf("iframex")>=0)a.fn.fancybox.showLoading(),n('<iframe id="fancy_frame" onload="jQuery.fn.fancybox.showIframe()" name="fancy_iframe'+
Math.round(Math.random()*1E3)+'" frameborder="0" hspace="0" src="'+c+'"></iframe>',b.frameWidth,b.frameHeight);else if(c.match(/#/)){var e=window.location.href.split("#")[0],e=c.replace(e,""),e=e.substr(e.indexOf("#"));n('<div id="fancy_div">'+a(e).html()+"</div>",b.frameWidth,b.frameHeight)}else c.match(p)?(i=new Image,i.src=c,i.complete?s():(a.fn.fancybox.showLoading(),a(i).unbind().bind("load",function(){a("#fancy_loading").hide();s()}))):(a.fn.fancybox.showLoading(),c=c.search(/\?/)==-1?c+"?ms="+
(new Date).getTime()+"&javascript=true":c+"&ms="+(new Date).getTime()+"&javascript=true",a.get(c,function(b){a("#fancy_loading").hide();a("#fancy_outer").show();var c=a("#fancy_content");c.html(b);ajax_content_height=a("#overlay-wrapper").outerHeight();ajax_content_width=a("#overlay-wrapper").outerWidth();a.browser.msie&a.browser.version.indexOf("8")>-1&&(ajax_content_height+=3,ajax_content_width+=3);c.html("");a("#fancy_outer").hide();n('<div id="fancy_ajax">'+b+"</div>",ajax_content_width,ajax_content_height);
a(window).trigger("load")}))}function s(){var c=i.width,e=i.height,h=b.padding*2+40,f=b.padding*2+60,d=a.fn.fancybox.getViewport();if(b.imageScale&&(c>d[0]-h||e>d[1]-f))h=Math.min(Math.min(d[0]-h,c)/c,Math.min(d[1]-f,e)/e),c=Math.round(h*c),e=Math.round(h*e);n('<img alt="" id="fancy_img" src="'+i.src+'" />',c,e)}function t(){if(b.itemArray.length-1>b.itemCurrent){var a=b.itemArray[b.itemCurrent+1].href;if(a.match(p))objNext=new Image,objNext.src=a}if(b.itemCurrent>0&&(a=b.itemArray[b.itemCurrent-
1].href,a.match(p)))objNext=new Image,objNext.src=a}function n(c,e,d){l=!0;var f=b.padding;if(r||q)a("#fancy_content")[0].style.removeExpression("height"),a("#fancy_content")[0].style.removeExpression("width");if(f>0){if(e+=f*2,d+=f*2,a("#fancy_content").css({top:f+"px",right:f+"px",bottom:f+"px",left:f+"px",width:"auto",height:"auto"}),r||q)a("#fancy_content")[0].style.setExpression("height","(this.parentNode.clientHeight - "+f*2+")"),a("#fancy_content")[0].style.setExpression("width","(this.parentNode.clientWidth - "+
f*2+")")}else a("#fancy_content").css({top:0,right:0,bottom:0,left:0,width:"100%",height:"100%"});if(a("#fancy_outer").is(":visible")&&e==a("#fancy_outer").width()&&d==a("#fancy_outer").height())a("#fancy_content").fadeOut("fast",function(){a("#fancy_content").empty().append(c).fadeIn("normal",function(){o()})});else{var f=a.fn.fancybox.getViewport(),g={left:e+40>f[0]?f[2]:f[2]+Math.round((f[0]-e-40)*0.5),top:d+60>f[1]?f[3]:f[3]+Math.round((f[1]-d-60)*0.5),width:e+"px",height:d+"px"};if(a("#fancy_outer").is(":visible"))a("#fancy_content").fadeOut("normal",
function(){a("#fancy_content").empty();a("#fancy_outer").animate(g,b.zoomSpeedChange,b.easingChange,function(){a("#fancy_content").append(c).fadeIn("normal",function(){o()})})});else if(b.zoomSpeedIn>0&&b.itemArray[b.itemCurrent].orig!==void 0){document.getElementById("fancy_content").innerHTML=c;e=b.itemArray[b.itemCurrent].orig;if(b.caller!=null&&b.caller.length)e=b.caller;d=a.fn.fancybox.getPosition(e);a("#fancy_outer").css({left:d.left-20-b.padding+"px",top:d.top-20-b.padding+"px",width:a(e).width()+
b.padding*2,height:a(e).height()+b.padding*2});if(b.zoomOpacity)g.opacity="show";a("#fancy_outer").animate(g,b.zoomSpeedIn,b.easingIn,function(){o()})}else a("#fancy_content").hide().empty().append(c).show(),a("#fancy_outer").css(g).fadeIn("normal",function(){o()})}}function m(){b.itemCurrent!=0&&(a("#fancy_left, #fancy_left_ico").unbind().bind("click",function(a){a.stopPropagation();b.itemCurrent--;d();return!1}),a("#fancy_left").show());b.itemCurrent!=b.itemArray.length-1&&(a("#fancy_right, #fancy_right_ico").unbind().bind("click",
function(a){a.stopPropagation();b.itemCurrent++;d();return!1}),a("#fancy_right").show())}function o(){a.browser.msie&&(a("#fancy_content")[0].style.removeAttribute("filter"),a("#fancy_outer")[0].style.removeAttribute("filter"));m();t();a(document).bind("keydown.fb",function(c){c.keyCode==27&&b.enableEscapeButton?a.fn.fancybox.close():c.keyCode==37&&b.itemCurrent!=0?(a(document).unbind("keydown.fb"),b.itemCurrent--,d()):c.keyCode==39&&b.itemCurrent!=b.itemArray.length-1&&(a(document).unbind("keydown.fb"),
b.itemCurrent++,d())});b.centerOnScroll&&a(window).bind("resize.fb scroll.fb",a.fn.fancybox.scrollBox);b.hideOnContentClick&&a("#fancy_content").click(a.fn.fancybox.close);b.overlayShow&&b.hideOnOverlayClick&&a("#fancy_overlay").bind("click",a.fn.fancybox.close);b.showCloseButton&&a("#fancy_close").bind("click",a.fn.fancybox.close).show();if(typeof b.itemArray[b.itemCurrent].title!=="undefined"&&b.itemArray[b.itemCurrent].title.length>0){var c=a("#fancy_outer").position();a("#fancy_title div").text(b.itemArray[b.itemCurrent].title).html();
a("#fancy_title").css({top:c.top+a("#fancy_outer").outerHeight()-32,left:c.left+(a("#fancy_outer").outerWidth()*0.5-a("#fancy_title").width()*0.5)}).show()}b.overlayShow&&k&&a("embed, object, select",a("#fancy_content")).css("visibility","visible");a.isFunction(b.callbackOnShow)&&b.callbackOnShow(b.itemArray[b.itemCurrent]);a.browser.msie&&(a("#fancy_outer")[0].style.removeAttribute("filter"),a("#fancy_content")[0].style.removeAttribute("filter"));a("#fancy_content script").each(function(){eval(a(this).html())});
l=!1}var j=a.extend({},a.fn.fancybox.defaults,c),u=this;return this.unbind("click.fb").bind("click.fb",function(){g=this;b=a.extend({},j);a("#fancy_title").remove();b.contentClass.length&&a("#fancy_content").addClass(b.contentClass);if(!l){a.isFunction(b.callbackOnStart)&&b.callbackOnStart();b.itemArray=[];b.itemCurrent=0;if(j.itemArray.length>0)b.itemArray=j.itemArray;else{var c={};if(!g.rel||g.rel==""){c={href:g.href,title:g.title};c.orig=a(g).children("img:first").length?a(g).children("img:first"):
a(g);if(c.title==""||typeof c.title=="undefined")c.title=c.orig.attr("alt");b.itemArray.push(c)}else for(var e=a(u).filter("a[rel="+g.rel+"]"),h=0;h<e.length;h++){c={href:e[h].href,title:e[h].title};c.orig=a(e[h]).children("img:first").length?a(e[h]).children("img:first"):a(e[h]);if(c.title==""||typeof c.title=="undefined")c.title=c.orig.attr("alt");b.itemArray.push(c)}}for(;b.itemArray[b.itemCurrent].href!=g.href;)b.itemCurrent++;b.overlayShow&&(k&&(a("embed, object, select").css("visibility","hidden"),
a("#fancy_overlay").css("height",a(document).height())),a("#fancy_overlay").css({opacity:b.overlayOpacity,background:b.overlayColor}).show());a(window).bind("resize.fb scroll.fb",a.fn.fancybox.scrollBox);k&&a(window).trigger("scroll");d()}return!1})};a.fn.fancybox.scrollBox=function(){if(!(a(window).height()<a("#fancy_outer").outerHeight())){var b=a.fn.fancybox.getViewport();if(a("#fancy_outer").is(":visible")){var d=a("#fancy_outer").outerWidth(),g=a("#fancy_outer").outerHeight(),i={top:g>b[1]?b[3]:
b[3]+Math.round((b[1]-g)*0.5),left:d>b[0]?b[2]:b[2]+Math.round((b[0]-d)*0.5)};a("#fancy_outer").css(i);a("#fancy_title").css({top:i.top+g-32,left:i.left+(d*0.5-a("#fancy_title").width()*0.5)})}k&&a("#fancy_overlay").is(":visible")&&a("#fancy_overlay").children().css({height:a(document).height()});a("#fancy_loading").is(":visible")&&a("#fancy_loading").css({left:(b[0]-40)*0.5+b[2],top:(b[1]-40)*0.5+b[3]})}};a.fn.fancybox.getNumeric=function(b,d){return parseInt(a.curCSS(b.jquery?b[0]:b,d,!0))||0};
a.fn.fancybox.getPosition=function(b){var d=b.offset();d.top+=a.fn.fancybox.getNumeric(b,"paddingTop");d.top+=a.fn.fancybox.getNumeric(b,"borderTopWidth");d.left+=a.fn.fancybox.getNumeric(b,"paddingLeft");d.left+=a.fn.fancybox.getNumeric(b,"borderLeftWidth");return d};a.fn.fancybox.showIframe=function(){a("#fancy_loading").hide();a("#fancy_frame").show()};a.fn.fancybox.getViewport=function(){return[a(window).width(),a(window).height(),a(document).scrollLeft(),a(document).scrollTop()]};a.fn.fancybox.animateLoading=
function(){a("#fancy_loading").is(":visible")?(a("#fancy_loading > div").css("top",j*-40+"px"),j=(j+1)%12):clearInterval(m)};a.fn.fancybox.showLoading=function(){clearInterval(m);var b=a.fn.fancybox.getViewport();a("#fancy_loading").css({left:(b[0]-40)*0.5+b[2],top:(b[1]-40)*0.5+b[3]}).show();a("#fancy_loading").bind("click",a.fn.fancybox.close);m=setInterval(a.fn.fancybox.animateLoading,66)};a.fn.fancybox.close=function(){l=!0;a(i).unbind();a(document).unbind("keydown.fb");a(window).unbind("resize.fb scroll.fb");
a("#fancy_overlay, #fancy_content, #fancy_close").unbind();a("#fancy_close, #fancy_loading, #fancy_left, #fancy_right, #fancy_title").hide();__cleanup=function(){a("#fancy_overlay").is(":visible")&&a("#fancy_overlay").fadeOut("fast");a("#fancy_content").empty();b.centerOnScroll&&a(window).unbind("resize.fb scroll.fb");k&&a("embed, object, select").css("visibility","visible");a.isFunction(b.callbackOnClose)&&b.callbackOnClose();l=!1};if(a("#fancy_outer").is(":visible")!==!1)if(b.zoomSpeedOut>0&&b.itemArray[b.itemCurrent].orig!==
void 0){var c=b.itemArray[b.itemCurrent].orig;if(b.caller!=null&&b.caller.length)c=b.caller;var d=a.fn.fancybox.getPosition(c),c={left:d.left-20-b.padding+"px",top:d.top-20-b.padding+"px",width:a(c).width()+b.padding*2,height:a(c).height()+b.padding*2};if(b.zoomOpacity)c.opacity="hide";a("#fancy_outer").stop(!1,!0).animate(c,b.zoomSpeedOut,b.easingOut,__cleanup)}else a("#fancy_outer").stop(!1,!0).fadeOut("fast",__cleanup);else __cleanup();return!1};a.fn.fancybox.build=function(){var b="";b+='<div id="fancy_overlay"></div>';
b+='<div id="fancy_loading"><div></div></div>';b+='<div id="fancy_outer">';b+='<div id="fancy_inner">';b+='<div id="fancy_close"></div>';b+='<div id="fancy_bg"><div class="fancy_bg" id="fancy_bg_n"></div><div class="fancy_bg" id="fancy_bg_ne"></div><div class="fancy_bg" id="fancy_bg_e"></div><div class="fancy_bg" id="fancy_bg_se"></div><div class="fancy_bg" id="fancy_bg_s"></div><div class="fancy_bg" id="fancy_bg_sw"></div><div class="fancy_bg" id="fancy_bg_w"></div><div class="fancy_bg" id="fancy_bg_nw"></div></div>';
b+='<a href="javascript:;" id="fancy_left"><span class="fancy_ico" id="fancy_left_ico"></span></a><a href="javascript:;" id="fancy_right"><span class="fancy_ico" id="fancy_right_ico"></span></a>';b+='<div id="fancy_content"></div>';b+="</div>";b+="</div>";b+='<div id="fancy_title"></div>';a(b).appendTo("body");a("#site").hasClass("background-style-black")&&a("#fancy_outer").addClass("fancy-background-style-black background-style-black");a('<table cellspacing="0" cellpadding="0" border="0"><tr><td class="fancy_title" id="fancy_title_left"></td><td class="fancy_title" id="fancy_title_main"><div></div></td><td class="fancy_title" id="fancy_title_right"></td></tr></table>').appendTo("#fancy_title");
a.browser.msie&&a(".fancy_bg").fixPNG();if(k)a("div#fancy_overlay").css("position","absolute"),a("#fancy_loading div, #fancy_close, .fancy_title, .fancy_ico").fixPNG(),a("#fancy_inner").prepend('<iframe id="fancy_bigIframe" src="javascript:false;" scrolling="no" frameborder="0"></iframe>'),b=a("#fancy_bigIframe")[0].contentWindow.document,b.open(),b.close()};a.fn.fancybox.defaults={padding:19,imageScale:!0,zoomOpacity:!0,zoomSpeedIn:0,zoomSpeedOut:0,zoomSpeedChange:300,easingIn:"swing",easingOut:"swing",
easingChange:"swing",frameWidth:560,frameHeight:340,overlayShow:!0,overlayOpacity:0.7,overlayColor:"#FFF",enableEscapeButton:!0,showCloseButton:!0,hideOnOverlayClick:!0,hideOnContentClick:!0,centerOnScroll:!0,itemArray:[],callbackOnStart:null,callbackOnShow:null,callbackOnClose:null,showTitle:!1,contentClass:"",caller:null,href:""};a(document).ready(function(){q=a.browser.msie&&!a.boxModel;a("#fancy_outer").length<1&&a.fn.fancybox.build()})})(jQuery);
