(function(E){E.fn.fixPNG=function(){return this.each(function(){var L=E(this).css("backgroundImage");if(L.match(/^url\(["']?(.*\.png)["']?\)$/i)){L=RegExp.$1;E(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+(E(this).css("backgroundRepeat")=="no-repeat"?"crop":"scale")+", src='"+L+"')"}).each(function(){var M=E(this).css("position");if(M!="absolute"&&M!="relative"){E(this).css("position","relative")}})}})};var C,A,H=false,B=new Image,J,K=1,D=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i;var I=null,G=E.browser.msie&&E.browser.version.substr(0,1)==6&&!window.XMLHttpRequest,F=G||(E.browser.msie&&E.browser.version.substr(0,1)==7);E.fn.fancybox=function(L){var O=E.extend({},E.fn.fancybox.defaults,L);var V=this;function Q(){C=this;A=E.extend({},O);P();return false}function P(){if(H){return}if(E.isFunction(A.callbackOnStart)){A.callbackOnStart()}A.itemArray=[];A.itemCurrent=0;if(O.itemArray.length>0){A.itemArray=O.itemArray}else{var X={};if(!C.rel||C.rel==""){var X={href:C.href,title:C.title};if(E(C).children("img:first").length){X.orig=E(C).children("img:first")}else{X.orig=E(C)}if(X.title==""||typeof X.title=="undefined"){X.title=X.orig.attr("alt")}A.itemArray.push(X)}else{var Y=E(V).filter("a[rel="+C.rel+"]");var X={};for(var W=0;W<Y.length;W++){X={href:Y[W].href,title:Y[W].title};if(E(Y[W]).children("img:first").length){X.orig=E(Y[W]).children("img:first")}else{X.orig=E(Y[W])}if(X.title==""||typeof X.title=="undefined"){X.title=X.orig.attr("alt")}A.itemArray.push(X)}}}while(A.itemArray[A.itemCurrent].href!=C.href){A.itemCurrent++}if(A.overlayShow){if(G){E("embed, object, select").css("visibility","hidden");E("#fancy_overlay").css("height",E(document).height())}E("#fancy_overlay").css({"background-color":A.overlayColor,opacity:A.overlayOpacity}).show()}E(window).bind("resize.fb scroll.fb",E.fn.fancybox.scrollBox);R()}function R(){E("#fancy_right, #fancy_left, #fancy_close, #fancy_title").hide();var X=A.itemArray[A.itemCurrent].href;if(X.match("iframe")||C.className.indexOf("iframe")>=0){E.fn.fancybox.showLoading();var W=X.replace(/(\w+)(\.html|\/)?$/,"$1_fancy$2");N('<iframe id="fancy_frame" onload="jQuery.fn.fancybox.showIframe()" name="fancy_iframe'+Math.round(Math.random()*1000)+'" frameborder="0" hspace="0" src="'+W+'"></iframe>',A.frameWidth,A.frameHeight)}else{if(X.match(/#/)){var Y=window.location.href.split("#")[0];Y=X.replace(Y,"");Y=Y.substr(Y.indexOf("#"));N('<div id="fancy_div">'+E(Y).html()+"</div>",A.frameWidth,A.frameHeight)}else{if(X.match(D)){B=new Image;B.src=X;if(B.complete){U()}else{E.fn.fancybox.showLoading();E(B).unbind().bind("load",function(){E("#fancy_loading").hide();U()})}}else{E.fn.fancybox.showLoading();E.get(X,function(Z){E("#fancy_loading").hide();N('<div id="fancy_ajax">'+Z+"</div>",A.frameWidth,A.frameHeight)})}}}}function U(){var Z=B.width;var W=B.height;var b=(A.padding*2)+40;var a=(A.padding*2)+60;var X=E.fn.fancybox.getViewport();if(A.imageScale&&(Z>(X[0]-b)||W>(X[1]-a))){var Y=Math.min(Math.min(X[0]-b,Z)/Z,Math.min(X[1]-a,W)/W);Z=Math.round(Y*Z);W=Math.round(Y*W)}N('<img alt="" id="fancy_img" src="'+B.src+'" />',Z,W)}function S(){if((A.itemArray.length-1)>A.itemCurrent){var W=A.itemArray[A.itemCurrent+1].href||false;if(W&&W.match(D)){objNext=new Image();objNext.src=W}}if(A.itemCurrent>0){var W=A.itemArray[A.itemCurrent-1].href||false;if(W&&W.match(D)){objNext=new Image();objNext.src=W}}}function N(b,X,d){H=true;var Z=A.padding;if(F||I){E("#fancy_content")[0].style.removeExpression("height");E("#fancy_content")[0].style.removeExpression("width")}if(Z>0){X+=Z*2;d+=Z*2;E("#fancy_content").css({top:Z+"px",right:Z+"px",bottom:Z+"px",left:Z+"px",width:"auto",height:"auto"});if(F||I){E("#fancy_content")[0].style.setExpression("height","(this.parentNode.clientHeight - "+Z*2+")");E("#fancy_content")[0].style.setExpression("width","(this.parentNode.clientWidth - "+Z*2+")")}}else{E("#fancy_content").css({top:0,right:0,bottom:0,left:0,width:"100%",height:"100%"})}if(E("#fancy_outer").is(":visible")&&X==E("#fancy_outer").width()&&d==E("#fancy_outer").height()){E("#fancy_content").fadeOut("fast",function(){E("#fancy_content").empty().append(E(b)).fadeIn("normal",function(){M()})});return}var c=E.fn.fancybox.getViewport();var f=(d+60)>c[1]?c[3]:(c[3]+Math.round((c[1]-d-60)*0.5));var Y=(X+40)>c[0]?c[2]:(c[2]+Math.round((c[0]-X-40)*0.5));var e={left:Y,top:f,width:X+"px",height:d+"px"};if(E("#fancy_outer").is(":visible")){E("#fancy_content").fadeOut("normal",function(){E("#fancy_content").empty();E("#fancy_outer").animate(e,A.zoomSpeedChange,A.easingChange,function(){E("#fancy_content").append(E(b)).fadeIn("normal",function(){M()})})})}else{if(A.zoomSpeedIn>0&&A.itemArray[A.itemCurrent].orig!==undefined){E("#fancy_content").empty().append(E(b));var a=A.itemArray[A.itemCurrent].orig;var W=E.fn.fancybox.getPosition(a);E("#fancy_outer").css({left:(W.left-20-A.padding)+"px",top:(W.top-20-A.padding)+"px",width:E(a).width()+(A.padding*2),height:E(a).height()+(A.padding*2)});if(A.zoomOpacity){e.opacity="show"}E("#fancy_outer").animate(e,A.zoomSpeedIn,A.easingIn,function(){M()})}else{E("#fancy_content").hide().empty().append(E(b)).show();E("#fancy_outer").css(e).fadeIn("normal",function(){M()})}}}function T(){if(A.itemCurrent!==0){E("#fancy_left, #fancy_left_ico").unbind().bind("click",function(W){W.stopPropagation();A.itemCurrent--;R();return false});E("#fancy_left").show()}if(A.itemCurrent!=(A.itemArray.length-1)){E("#fancy_right, #fancy_right_ico").unbind().bind("click",function(W){W.stopPropagation();A.itemCurrent++;R();return false});E("#fancy_right").show()}}function M(){if(E.browser.msie){E("#fancy_content")[0].style.removeAttribute("filter");E("#fancy_outer")[0].style.removeAttribute("filter")}T();S();E(document).bind("keydown.fb",function(X){if(X.keyCode==27&&A.enableEscapeButton){E.fn.fancybox.close()}else{if(X.keyCode==37&&A.itemCurrent!==0){E(document).unbind("keydown.fb");A.itemCurrent--;R()}else{if(X.keyCode==39&&A.itemCurrent!=(A.itemArray.length-1)){E(document).unbind("keydown.fb");A.itemCurrent++;R()}}}});if(A.hideOnContentClick){E("#fancy_content").click(E.fn.fancybox.close)}if(A.overlayShow&&A.hideOnOverlayClick){E("#fancy_overlay").bind("click",E.fn.fancybox.close)}if(A.showCloseButton){E("#fancy_close").bind("click",E.fn.fancybox.close).show()}if(typeof A.itemArray[A.itemCurrent].title!=="undefined"&&A.itemArray[A.itemCurrent].title.length>0){var W=E("#fancy_outer").position();E("#fancy_title div").text(A.itemArray[A.itemCurrent].title).html();E("#fancy_title").css({top:W.top+E("#fancy_outer").outerHeight()-32,left:W.left+((E("#fancy_outer").outerWidth()*0.5)-(E("#fancy_title").width()*0.5))}).show()}if(A.overlayShow&&G){E("embed, object, select",E("#fancy_content")).css("visibility","visible")}if(E.isFunction(A.callbackOnShow)){A.callbackOnShow(A.itemArray[A.itemCurrent])}if(E.browser.msie){E("#fancy_outer")[0].style.removeAttribute("filter");E("#fancy_content")[0].style.removeAttribute("filter")}H=false}return this.unbind("click.fb").bind("click.fb",Q)};E.fn.fancybox.scrollBox=function(){var L=E.fn.fancybox.getViewport();if(A.centerOnScroll&&E("#fancy_outer").is(":visible")){var M=E("#fancy_outer").outerWidth();var N=E("#fancy_outer").outerHeight();var O={top:(N>L[1]?L[3]:L[3]+Math.round((L[1]-N)*0.5)),left:(M>L[0]?L[2]:L[2]+Math.round((L[0]-M)*0.5))};E("#fancy_outer").css(O);E("#fancy_title").css({top:O.top+N-32,left:O.left+((M*0.5)-(E("#fancy_title").width()*0.5))})}if(G&&E("#fancy_overlay").is(":visible")){E("#fancy_overlay").css({height:E(document).height()})}if(E("#fancy_loading").is(":visible")){E("#fancy_loading").css({left:((L[0]-40)*0.5+L[2]),top:((L[1]-40)*0.5+L[3])})}};E.fn.fancybox.getNumeric=function(L,M){return parseInt(E.curCSS(L.jquery?L[0]:L,M,true))||0};E.fn.fancybox.getPosition=function(L){var M=L.offset();M.top+=E.fn.fancybox.getNumeric(L,"paddingTop");M.top+=E.fn.fancybox.getNumeric(L,"borderTopWidth");M.left+=E.fn.fancybox.getNumeric(L,"paddingLeft");M.left+=E.fn.fancybox.getNumeric(L,"borderLeftWidth");return M};E.fn.fancybox.showIframe=function(){E("#fancy_loading").hide();E("#fancy_frame").show()};E.fn.fancybox.getViewport=function(){return[E(window).width(),E(window).height(),E(document).scrollLeft(),E(document).scrollTop()]};E.fn.fancybox.animateLoading=function(){if(!E("#fancy_loading").is(":visible")){clearInterval(J);return}E("#fancy_loading > div").css("top",(K*-40)+"px");K=(K+1)%12};E.fn.fancybox.showLoading=function(){clearInterval(J);var L=E.fn.fancybox.getViewport();E("#fancy_loading").css({left:((L[0]-40)*0.5+L[2]),top:((L[1]-40)*0.5+L[3])}).show();E("#fancy_loading").bind("click",E.fn.fancybox.close);J=setInterval(E.fn.fancybox.animateLoading,66)};E.fn.fancybox.close=function(){H=true;E(B).unbind();E(document).unbind("keydown.fb");E(window).unbind("resize.fb scroll.fb");E("#fancy_overlay, #fancy_content, #fancy_close").unbind();E("#fancy_close, #fancy_loading, #fancy_left, #fancy_right, #fancy_title").hide();__cleanup=function(){if(E("#fancy_overlay").is(":visible")){E("#fancy_overlay").fadeOut("fast")}E("#fancy_content").empty();if(A.centerOnScroll){E(window).unbind("resize.fb scroll.fb")}if(G){E("embed, object, select").css("visibility","visible")}if(E.isFunction(A.callbackOnClose)){A.callbackOnClose()}H=false};if(E("#fancy_outer").is(":visible")!==false){if(A.zoomSpeedOut>0&&A.itemArray[A.itemCurrent].orig!==undefined){var M=A.itemArray[A.itemCurrent].orig;var L=E.fn.fancybox.getPosition(M);var N={left:(L.left-20-A.padding)+"px",top:(L.top-20-A.padding)+"px",width:E(M).width()+(A.padding*2),height:E(M).height()+(A.padding*2)};if(A.zoomOpacity){N.opacity="hide"}E("#fancy_outer").stop(false,true).animate(N,A.zoomSpeedOut,A.easingOut,__cleanup)}else{E("#fancy_outer").stop(false,true).fadeOut("fast",__cleanup)}}else{__cleanup()}return false};E.fn.fancybox.build=function(){var L="";L+='<div id="fancy_overlay"></div>';L+='<div id="fancy_loading"><div></div></div>';L+='<div id="fancy_outer">';L+='<div id="fancy_inner">';L+='<div id="fancy_close"></div>';L+='<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>';L+='<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>';L+='<div id="fancy_content"></div>';L+="</div>";L+="</div>";L+='<div id="fancy_title"></div>';E(L).appendTo("body");E('<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");if(E.browser.msie){E(".fancy_bg").fixPNG()}if(G){E("div#fancy_overlay").css("position","absolute");E("#fancy_loading div, #fancy_close, .fancy_title, .fancy_ico").fixPNG();E("#fancy_inner").prepend('<iframe id="fancy_bigIframe" src="javascript:false;" scrolling="no" frameborder="0"></iframe>');var M=E("#fancy_bigIframe")[0].contentWindow.document;M.open();M.close()}};E.fn.fancybox.defaults={padding:10,imageScale:true,zoomOpacity:true,zoomSpeedIn:0,zoomSpeedOut:0,zoomSpeedChange:300,easingIn:"swing",easingOut:"swing",easingChange:"swing",frameWidth:560,frameHeight:340,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",enableEscapeButton:true,showCloseButton:true,hideOnOverlayClick:true,hideOnContentClick:true,centerOnScroll:true,itemArray:[],callbackOnStart:null,callbackOnShow:null,callbackOnClose:null};E(document).ready(function(){I=E.browser.msie&&!E.boxModel;if(E("#fancy_outer").length<1){E.fn.fancybox.build()}})})(jQuery);
