(function(Al){var Ac,AX,AV,Ai,AN,Ag,AT,AQ,AP,Aa=0,Aj={},AZ=[],Ab=0,Ak={},Af=[],AM=null,AY=new Image,AK=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,w=/[^\.]\.(swf)\s*$/i,AJ,AI=1,Ae,Ad,Ah=false,AU=Al.extend(Al("<div/>")[0],{prop:0}),AW=0,AC=!Al.support.opacity&&!window.XMLHttpRequest,AH=function(){AX.hide();AY.onerror=AY.onload=null;AM&&AM.abort();Ac.empty()},AB=function(){Al.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})},AG=function(){return[Al(window).width(),Al(window).height(),Al(document).scrollLeft(),Al(document).scrollTop()]},t=function(){var B=AG(),G={},E=Ak.margin,F=Ak.autoScale,C=(20+E)*2,A=(20+E)*2,D=Ak.padding*2;if(Ak.width.toString().indexOf("%")>-1){G.width=B[0]*parseFloat(Ak.width)/100-40;F=false}else{G.width=Ak.width+D}if(Ak.height.toString().indexOf("%")>-1){G.height=B[1]*parseFloat(Ak.height)/100-40;F=false}else{G.height=Ak.height+D}if(F&&(G.width>B[0]-C||G.height>B[1]-A)){if(Aj.type=="image"||Aj.type=="swf"){C+=D;A+=D;F=Math.min(Math.min(B[0]-C,Ak.width)/Ak.width,Math.min(B[1]-A,Ak.height)/Ak.height);G.width=Math.round(F*(G.width-D))+D;G.height=Math.round(F*(G.height-D))+D}else{G.width=Math.min(G.width,B[0]-C);G.height=Math.min(G.height,B[1]-A)}}G.top=B[3]+(B[1]-(G.height+40))*0.5;G.left=B[2]+(B[0]-(G.width+40))*0.5;if(Ak.autoScale===false){G.top=Math.max(B[3]+E,G.top);G.left=Math.max(B[2]+E,G.left)}return G},r=function(A){if(A&&A.length){switch(Ak.titlePosition){case"inside":return A;case"over":return'<span id="fancybox-title-over">'+A+"</span>";default:return'<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">'+A+'</span><span id="fancybox-title-right"></span></span>'}}return false},o=function(){var A=Ak.title,C=Ad.width-Ak.padding*2,B="fancybox-title-"+Ak.titlePosition;Al("#fancybox-title").remove();AW=0;if(Ak.titleShow!==false){A=Al.isFunction(Ak.titleFormat)?Ak.titleFormat(A,Af,Ab,Ak):r(A);if(!(!A||A==="")){Al('<div id="fancybox-title" class="'+B+'" />').css({width:C,paddingLeft:Ak.padding,paddingRight:Ak.padding}).html(A).appendTo("body");switch(Ak.titlePosition){case"inside":AW=Al("#fancybox-title").outerHeight(true)-Ak.padding;Ad.height+=AW;break;case"over":Al("#fancybox-title").css("bottom",Ak.padding);break;default:Al("#fancybox-title").css("bottom",Al("#fancybox-title").outerHeight(true)*-1);break}Al("#fancybox-title").appendTo(AN).hide()}}},f=function(){Al(document).unbind("keydown.fb").bind("keydown.fb",function(A){if(A.keyCode==27&&Ak.enableEscapeButton){A.preventDefault();Al.fancybox.close()}else{if(A.keyCode==37){A.preventDefault();Al.fancybox.prev()}else{if(A.keyCode==39){A.preventDefault();Al.fancybox.next()}}}});if(Al.fn.mousewheel){Ai.unbind("mousewheel.fb");Af.length>1&&Ai.bind("mousewheel.fb",function(A,B){A.preventDefault();Ah||B===0||(B>0?Al.fancybox.prev():Al.fancybox.next())})}if(Ak.showNavArrows){if(Ak.cyclic&&Af.length>1||Ab!==0){AQ.show()}if(Ak.cyclic&&Af.length>1||Ab!=Af.length-1){AP.show()}}},d=function(){var A,B;if(Af.length-1>Ab){A=Af[Ab+1].href;if(typeof A!=="undefined"&&A.match(AK)){B=new Image;B.src=A}}if(Ab>0){A=Af[Ab-1].href;if(typeof A!=="undefined"&&A.match(AK)){B=new Image;B.src=A}}},AF=function(){Ag.css("overflow",Ak.scrolling=="auto"?Ak.type=="image"||Ak.type=="iframe"||Ak.type=="swf"?"hidden":"auto":Ak.scrolling=="yes"?"auto":"visible");if(!Al.support.opacity){Ag.get(0).style.removeAttribute("filter");Ai.get(0).style.removeAttribute("filter")}Al("#fancybox-title").show();Ak.hideOnContentClick&&Ag.one("click",Al.fancybox.close);Ak.hideOnOverlayClick&&AV.one("click",Al.fancybox.close);Ak.showCloseButton&&AT.show();f();Al(window).bind("resize.fb",Al.fancybox.center);Ak.centerOnScroll?Al(window).bind("scroll.fb",Al.fancybox.center):Al(window).unbind("scroll.fb");Al.isFunction(Ak.onComplete)&&Ak.onComplete(Af,Ab,Ak);Ah=false;d()},AE=function(A){var E=Math.round(Ae.width+(Ad.width-Ae.width)*A),C=Math.round(Ae.height+(Ad.height-Ae.height)*A),D=Math.round(Ae.top+(Ad.top-Ae.top)*A),B=Math.round(Ae.left+(Ad.left-Ae.left)*A);Ai.css({width:E+"px",height:C+"px",top:D+"px",left:B+"px"});E=Math.max(E-Ak.padding*2,0);C=Math.max(C-(Ak.padding*2+AW*A),0);Ag.css({width:E+"px",height:C+"px"});if(typeof Ad.opacity!=="undefined"){Ai.css("opacity",A<0.5?0.5:A)}},a=function(A){var B=A.offset();B.top+=parseFloat(A.css("paddingTop"))||0;B.left+=parseFloat(A.css("paddingLeft"))||0;B.top+=parseFloat(A.css("border-top-width"))||0;B.left+=parseFloat(A.css("border-left-width"))||0;B.width=A.width();B.height=A.height();return B},AA=function(){var A=Aj.orig?Al(Aj.orig):false,B={};if(A&&A.length){A=a(A);B={width:A.width+Ak.padding*2,height:A.height+Ak.padding*2,top:A.top-Ak.padding-20,left:A.left-Ak.padding-20}}else{A=AG();B={width:1,height:1,top:A[3]+A[1]*0.5,left:A[2]+A[0]*0.5}}return B},AD=function(){AX.hide();if(Ai.is(":visible")&&Al.isFunction(Ak.onCleanup)){if(Ak.onCleanup(Af,Ab,Ak)===false){Al.event.trigger("fancybox-cancel");Ah=false;return }}Af=AZ;Ab=Aa;Ak=Aj;Ag.get(0).scrollTop=0;Ag.get(0).scrollLeft=0;if(Ak.overlayShow){AC&&Al("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});AV.css({"background-color":Ak.overlayColor,opacity:Ak.overlayOpacity}).unbind().show()}Ad=t();o();if(Ai.is(":visible")){Al(AT.add(AQ).add(AP)).hide();var A=Ai.position(),B;Ae={top:A.top,left:A.left,width:Ai.width(),height:Ai.height()};B=Ae.width==Ad.width&&Ae.height==Ad.height;Ag.fadeOut(Ak.changeFade,function(){var C=function(){Ag.html(Ac.contents()).fadeIn(Ak.changeFade,AF)};Al.event.trigger("fancybox-change");Ag.empty().css("overflow","hidden");if(B){Ag.css({top:Ak.padding,left:Ak.padding,width:Math.max(Ad.width-Ak.padding*2,1),height:Math.max(Ad.height-Ak.padding*2-AW,1)});C()}else{Ag.css({top:Ak.padding,left:Ak.padding,width:Math.max(Ae.width-Ak.padding*2,1),height:Math.max(Ae.height-Ak.padding*2,1)});AU.prop=0;Al(AU).animate({prop:1},{duration:Ak.changeSpeed,easing:Ak.easingChange,step:AE,complete:C})}})}else{Ai.css("opacity",1);if(Ak.transitionIn=="elastic"){Ae=AA();Ag.css({top:Ak.padding,left:Ak.padding,width:Math.max(Ae.width-Ak.padding*2,1),height:Math.max(Ae.height-Ak.padding*2,1)}).html(Ac.contents());Ai.css(Ae).show();if(Ak.opacity){Ad.opacity=0}AU.prop=0;Al(AU).animate({prop:1},{duration:Ak.speedIn,easing:Ak.easingIn,step:AE,complete:AF})}else{Ag.css({top:Ak.padding,left:Ak.padding,width:Math.max(Ad.width-Ak.padding*2,1),height:Math.max(Ad.height-Ak.padding*2-AW,1)}).html(Ac.contents());Ai.css(Ad).fadeIn(Ak.transitionIn=="none"?0:Ak.speedIn,AF)}}},AL=function(){Ac.width(Aj.width);Ac.height(Aj.height);if(Aj.width=="auto"){Aj.width=Ac.width()}if(Aj.height=="auto"){Aj.height=Ac.height()}AD()},R=function(){Ah=true;Aj.width=AY.width;Aj.height=AY.height;Al("<img />").attr({id:"fancybox-img",src:AY.src,alt:Aj.title}).appendTo(Ac);AD()},AO=function(){AH();var B=AZ[Aa],F,D,E,C,A;Aj=Al.extend({},Al.fn.fancybox.defaults,typeof Al(B).data("fancybox")=="undefined"?Aj:Al(B).data("fancybox"));E=B.title||Al(B).title||Aj.title||"";if(B.nodeName&&!Aj.orig){Aj.orig=Al(B).children("img:first").length?Al(B).children("img:first"):Al(B)}if(E===""&&Aj.orig){E=Aj.orig.attr("alt")}F=B.nodeName&&/^(?:javascript|#)/i.test(B.href)?Aj.href||null:Aj.href||B.href||null;if(Aj.type){D=Aj.type;if(!F){F=Aj.content}}else{if(Aj.content){D="html"}else{if(F){if(F.match(AK)){D="image"}else{if(F.match(w)){D="swf"}else{if(Al(B).hasClass("iframe")){D="iframe"}else{if(F.match(/#/)){B=F.substr(F.indexOf("#"));D=Al(B).length>0?"inline":"ajax"}else{D="ajax"}}}}}else{D="inline"}}}Aj.type=D;Aj.href=F;Aj.title=E;if(Aj.autoDimensions&&Aj.type!=="iframe"&&Aj.type!=="swf"){Aj.width="auto";Aj.height="auto"}if(Aj.modal){Aj.overlayShow=true;Aj.hideOnOverlayClick=false;Aj.hideOnContentClick=false;Aj.enableEscapeButton=false;Aj.showCloseButton=false}if(Al.isFunction(Aj.onStart)){if(Aj.onStart(AZ,Aa,Aj)===false){Ah=false;return }}Ac.css("padding",20+Aj.padding+Aj.margin);Al(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){Al(this).replaceWith(Ag.children())});switch(D){case"html":Ac.html(Aj.content);AL();break;case"inline":Al('<div class="fancybox-inline-tmp" />').hide().insertBefore(Al(B)).bind("fancybox-cleanup",function(){Al(this).replaceWith(Ag.children())}).bind("fancybox-cancel",function(){Al(this).replaceWith(Ac.children())});Al(B).appendTo(Ac);AL();break;case"image":Ah=false;Al.fancybox.showActivity();AY=new Image;AY.onerror=function(){AB()};AY.onload=function(){AY.onerror=null;AY.onload=null;R()};AY.src=F;break;case"swf":C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+Aj.width+'" height="'+Aj.height+'"><param name="movie" value="'+F+'"></param>';A="";Al.each(Aj.swf,function(H,G){C+='<param name="'+H+'" value="'+G+'"></param>';A+=" "+H+'="'+G+'"'});C+='<embed src="'+F+'" type="application/x-shockwave-flash" width="'+Aj.width+'" height="'+Aj.height+'"'+A+"></embed></object>";Ac.html(C);AL();break;case"ajax":B=F.split("#",2);D=Aj.ajax.data||{};if(B.length>1){F=B[0];if(typeof D=="string"){D+="&selector="+B[1]}else{D.selector=B[1]}}Ah=false;Al.fancybox.showActivity();AM=Al.ajax(Al.extend(Aj.ajax,{url:F,data:D,error:AB,success:function(G){if(AM.status==200){Ac.html(G);AL()}}}));break;case"iframe":Al('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" scrolling="'+Aj.scrolling+'" src="'+Aj.href+'"></iframe>').appendTo(Ac);AD();break}},AS=function(){if(AX.is(":visible")){Al("div",AX).css("top",AI*-40+"px");AI=(AI+1)%12}else{clearInterval(AJ)}},AR=function(){if(!Al("#fancybox-wrap").length){Al("body").append(Ac=Al('<div id="fancybox-tmp"></div>'),AX=Al('<div id="fancybox-loading"><div></div></div>'),AV=Al('<div id="fancybox-overlay"></div>'),Ai=Al('<div id="fancybox-wrap"></div>'));if(!Al.support.opacity){Ai.addClass("fancybox-ie");AX.addClass("fancybox-ie")}AN=Al('<div id="fancybox-outer"></div>').append('<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>').appendTo(Ai);AN.append(Ag=Al('<div id="fancybox-inner"></div>'),AT=Al('<a id="fancybox-close"></a>'),AQ=Al('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),AP=Al('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));AT.click(Al.fancybox.close);AX.click(Al.fancybox.cancel);AQ.click(function(A){A.preventDefault();Al.fancybox.prev()});AP.click(function(A){A.preventDefault();Al.fancybox.next()});if(AC){AV.get(0).style.setExpression("height","document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");AX.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");AN.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>')}}};Al.fn.fancybox=function(A){Al(this).data("fancybox",Al.extend({},A,Al.metadata?Al(this).metadata():{})).unbind("click.fb").bind("click.fb",function(B){B.preventDefault();if(!Ah){Ah=true;Al(this).blur();AZ=[];Aa=0;B=Al(this).attr("rel")||"";if(!B||B==""||B==="nofollow"){AZ.push(this)}else{AZ=Al("a[rel="+B+"], area[rel="+B+"]");Aa=AZ.index(this)}AO();return false}});return this};Al.fancybox=function(A,D){if(!Ah){Ah=true;D=typeof D!=="undefined"?D:{};AZ=[];Aa=D.index||0;if(Al.isArray(A)){for(var B=0,C=A.length;B<C;B++){if(typeof A[B]=="object"){Al(A[B]).data("fancybox",Al.extend({},D,A[B]))}else{A[B]=Al({}).data("fancybox",Al.extend({content:A[B]},D))}}AZ=jQuery.merge(AZ,A)}else{if(typeof A=="object"){Al(A).data("fancybox",Al.extend({},D,A))}else{A=Al({}).data("fancybox",Al.extend({content:A},D))}AZ.push(A)}if(Aa>AZ.length||Aa<0){Aa=0}AO()}};Al.fancybox.showActivity=function(){clearInterval(AJ);AX.show();AJ=setInterval(AS,66)};Al.fancybox.hideActivity=function(){AX.hide()};Al.fancybox.next=function(){return Al.fancybox.pos(Ab+1)};Al.fancybox.prev=function(){return Al.fancybox.pos(Ab-1)};Al.fancybox.pos=function(A){if(!Ah){A=parseInt(A,10);if(A>-1&&Af.length>A){Aa=A;AO()}if(Ak.cyclic&&Af.length>1&&A<0){Aa=Af.length-1;AO()}if(Ak.cyclic&&Af.length>1&&A>=Af.length){Aa=0;AO()}}};Al.fancybox.cancel=function(){if(!Ah){Ah=true;Al.event.trigger("fancybox-cancel");AH();Aj&&Al.isFunction(Aj.onCancel)&&Aj.onCancel(AZ,Aa,Aj);Ah=false}};Al.fancybox.close=function(){function A(){AV.fadeOut("fast");Ai.hide();Al.event.trigger("fancybox-cleanup");Ag.empty();Al.isFunction(Ak.onClosed)&&Ak.onClosed(Af,Ab,Ak);Af=Aj=[];Ab=Aa=0;Ak=Aj={};Ah=false}if(!(Ah||Ai.is(":hidden"))){Ah=true;if(Ak&&Al.isFunction(Ak.onCleanup)){if(Ak.onCleanup(Af,Ab,Ak)===false){Ah=false;return }}AH();Al(AT.add(AQ).add(AP)).hide();Al("#fancybox-title").remove();Ai.add(Ag).add(AV).unbind();Al(window).unbind("resize.fb scroll.fb");Al(document).unbind("keydown.fb");Ag.css("overflow","hidden");if(Ak.transitionOut=="elastic"){Ae=AA();var B=Ai.position();Ad={top:B.top,left:B.left,width:Ai.width(),height:Ai.height()};if(Ak.opacity){Ad.opacity=1}AU.prop=1;Al(AU).animate({prop:0},{duration:Ak.speedOut,easing:Ak.easingOut,step:AE,complete:A})}else{Ai.fadeOut(Ak.transitionOut=="none"?0:Ak.speedOut,A)}}};Al.fancybox.resize=function(){var A,B;if(!(Ah||Ai.is(":hidden"))){Ah=true;A=Ag.wrapInner("<div style='overflow:auto'></div>").children();B=A.height();Ai.css({height:B+Ak.padding*2+AW});Ag.css({height:B});A.replaceWith(A.children());Al.fancybox.center()}};Al.fancybox.center=function(){Ah=true;var A=AG(),C=Ak.margin,B={};B.top=A[3]+(A[1]-(Ai.height()-AW+40))*0.5;B.left=A[2]+(A[0]-(Ai.width()+40))*0.5;B.top=Math.max(A[3]+C,B.top);B.left=Math.max(A[2]+C,B.left);Ai.css(B);Ah=false};Al.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};Al(document).ready(function(){AR()})})(jQuery);
