(function(aI){function ad(){aA.hide();ax.onerror=ax.onload=null;aq&&aq.abort();aF.empty()}function p(){aI.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"})}function am(){ad();var e=aw[ay];aK=aI.extend({},aI.fn.fancybox.defaults,typeof aI(e).data("fancybox")=="undefined"?aK:aI(e).data("fancybox"));var h,i,b=e.title||aI(e).title||aK.title||"";if(e.nodeName&&!aK.orig){aK.orig=aI(e).children("img:first").length?aI(e).children("img:first"):aI(e)}if(b==""&&aK.orig){b=aK.orig.attr("alt")}h=e.nodeName&&/^(?:javascript|#)/i.test(e.href)?aK.href||null:aK.href||e.href||null;if(aK.type){i=aK.type;if(!h){h=aK.content}}else{if(aK.content){i="html"}else{if(h){if(h.match(aO)){i="image"}else{if(h.match(w)){i="swf"}else{if(aI(e).hasClass("iframe")){i="iframe"}else{if(h.match(/#/)){e=h.substr(h.indexOf("#"));i=aI(e).length>0?"inline":"ajax"}else{i="ajax"}}}}}else{i="inline"}}}aK.type=i;aK.href=h;aK.title=b;if(aK.autoDimensions&&aK.type!=="iframe"&&aK.type!=="swf"){aK.width="auto";aK.height="auto"}if(aK.modal){aK.overlayShow=true;aK.hideOnOverlayClick=false;aK.hideOnContentClick=false;aK.enableEscapeButton=false;aK.showCloseButton=false}if(aI.isFunction(aK.onStart)){if(aK.onStart(aw,ay,aK)===false){aB=false;return}}aF.css("padding",az+aK.padding+aK.margin);aI(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){aI(this).replaceWith(aC.children())});switch(i){case"html":aF.html(aK.content);ar();break;case"inline":aI('<div class="fancybox-inline-tmp" />').hide().insertBefore(aI(e)).bind("fancybox-cleanup",function(){aI(this).replaceWith(aC.children())}).bind("fancybox-cancel",function(){aI(this).replaceWith(aF.children())});aI(e).appendTo(aF);ar();break;case"image":aB=false;aI.fancybox.showActivity();ax=new Image;ax.onerror=function(){p()};ax.onload=function(){ax.onerror=null;ax.onload=null;R()};ax.src=h;break;case"swf":var c="",g="";c+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+aK.width+'" height="'+aK.height+'"><param name="movie" value="'+h+'"></param>';aI.each(aK.swf,function(k,j){c+='<param name="'+k+'" value="'+j+'"></param>';g+=" "+k+'="'+j+'"'});c+='<embed src="'+h+'" type="application/x-shockwave-flash" width="'+aK.width+'" height="'+aK.height+'"'+g+"></embed></object>";aF.html(c);ar();break;case"ajax":e=h.split("#",2);i=aK.ajax.data||{};if(e.length>1){h=e[0];typeof i=="string"?(i+="&selector="+e[1]):(i.selector=e[1])}aB=false;aI.fancybox.showActivity();aq=aI.ajax(aI.extend(aK.ajax,{url:h,data:i,error:p,success:function(j){if(aq.status==200){aF.html(j);ar()}}}));break;case"iframe":aI('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" scrolling="'+aK.scrolling+'" src="'+aK.href+'"></iframe>').appendTo(aF);af();break}}function R(){aB=true;aK.width=ax.width;aK.height=ax.height;aI("<img />").attr({id:"fancybox-img",src:ax.src,alt:aK.title}).appendTo(aF);af()}function ar(){aF.width(aK.width);aF.height(aK.height);if(aK.width=="auto"){aK.width=aF.width()}if(aK.height=="auto"){aK.height=aF.height()}af()}function af(){aA.hide();if(aL.is(":visible")&&aI.isFunction(aJ.onCleanup)){if(aJ.onCleanup(o,aH,aJ)===false){aI.event.trigger("fancybox-cancel");aB=false;return}}o=aw;aH=ay;aJ=aK;aC.get(0).scrollTop=0;aC.get(0).scrollLeft=0;if(aJ.overlayShow){ag&&aI("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});au.css({"background-color":aJ.overlayColor,opacity:aJ.overlayOpacity}).unbind().show()}aG=ab();ac();if(aL.is(":visible")){aI(av.add(an).add(ao)).hide();var b=aL.position();aN={top:b.top,left:b.left,width:aL.width(),height:aL.height()};var c=aN.width==aG.width&&aN.height==aG.height;aC.fadeOut(aJ.changeFade,function(){function e(){aC.html(aF.contents()).fadeIn(aJ.changeFade,ah)}aI.event.trigger("fancybox-change");aC.css({top:aJ.padding,left:aJ.padding,width:Math.max(aN.width-aJ.padding*2,1),height:Math.max(aN.height-aJ.padding*2,1)}).empty().css("overflow","hidden");al.prop=0;aI(al).animate({prop:1},{duration:c?0:aJ.changeSpeed,easing:aJ.easingChange,step:ai,complete:e})})}else{aL.css("opacity",1);if(aJ.transitionIn=="elastic"){aN=u();aC.css({top:aJ.padding,left:aJ.padding,width:Math.max(aN.width-aJ.padding*2,1),height:Math.max(aN.height-aJ.padding*2,1)}).html(aF.contents());aL.css(aN).show();if(aJ.opacity){aG.opacity=0}al.prop=0;aI(al).animate({prop:1},{duration:aJ.speedIn,easing:aJ.easingIn,step:ai,complete:ah})}else{aC.css({top:aJ.padding,left:aJ.padding,width:Math.max(aG.width-aJ.padding*2,1),height:Math.max(aG.height-aJ.padding*2-at,1)}).html(aF.contents());aL.css(aG).fadeIn(aJ.transitionIn=="none"?0:aJ.speedIn,ah)}}}function ai(e){var g=Math.round(aN.width+(aG.width-aN.width)*e),h=Math.round(aN.height+(aG.height-aN.height)*e),b=Math.round(aN.top+(aG.top-aN.top)*e),c=Math.round(aN.left+(aG.left-aN.left)*e);aL.css({width:g+"px",height:h+"px",top:b+"px",left:c+"px"});g=Math.max(g-aJ.padding*2,0);h=Math.max(h-(aJ.padding*2+at*e),0);aC.css({width:g+"px",height:h+"px"});if(typeof aG.opacity!=="undefined"){aL.css("opacity",e<0.5?0.5:e)}}function ah(){aC.css("overflow",overflow=aJ.scrolling=="auto"?aJ.type=="image"||aJ.type=="iframe"||aJ.type=="swf"?"hidden":"auto":aJ.scrolling=="yes"?"auto":"visible");if(!aI.support.opacity){aC.get(0).style.removeAttribute("filter");aL.get(0).style.removeAttribute("filter")}aI("#fancybox-title").show();aJ.hideOnContentClick&&aC.one("click",aI.fancybox.close);aJ.hideOnOverlayClick&&au.one("click",aI.fancybox.close);aJ.showCloseButton&&av.show();a();aI(window).bind("resize.fb",aI.fancybox.center);aJ.centerOnScroll?aI(window).bind("scroll.fb",aI.fancybox.center):aI(window).unbind("scroll.fb");aI.isFunction(aJ.onComplete)&&aJ.onComplete(o,aH,aJ);aB=false;d()}function ab(){var g=aj(),i={},j=aJ.margin,c=aJ.autoScale,e=(az+j)*2,h=(az+j)*2,b=aJ.padding*2;if(aJ.width.toString().indexOf("%")>-1){i.width=g[0]*parseFloat(aJ.width)/100-az*2;c=false}else{i.width=aJ.width+b}if(aJ.height.toString().indexOf("%")>-1){i.height=g[1]*parseFloat(aJ.height)/100-az*2;c=false}else{i.height=aJ.height+b}if(c&&(i.width>g[0]-e||i.height>g[1]-h)){if(aK.type=="image"||aK.type=="swf"){e+=b;h+=b;c=Math.min(Math.min(g[0]-e,aJ.width)/aJ.width,Math.min(g[1]-h,aJ.height)/aJ.height);i.width=Math.round(c*(i.width-b))+b;i.height=Math.round(c*(i.height-b))+b}else{i.width=Math.min(i.width,g[0]-e);i.height=Math.min(i.height,g[1]-h)}}i.top=g[3]+(g[1]-(i.height+az*2))*0.5;i.left=g[2]+(g[0]-(i.width+az*2))*0.5;if(aJ.autoScale==false){i.top=Math.max(g[3]+j,i.top);i.left=Math.max(g[2]+j,i.left)}return i}function u(){var b=aK.orig?aI(aK.orig):false,c={};if(b&&b.length){b=f(b);c={width:b.width+aJ.padding*2,height:b.height+aJ.padding*2,top:b.top-aJ.padding-az,left:b.left-aJ.padding-az}}else{b=aj();c={width:1,height:1,top:b[3]+b[1]*0.5,left:b[2]+b[0]*0.5}}return c}function a(){aI(document).unbind("keydown.fb").bind("keydown.fb",function(b){if(b.keyCode==27&&aJ.enableEscapeButton){b.preventDefault();aI.fancybox.close()}else{if(b.keyCode==37){b.preventDefault();aI.fancybox.prev()}else{if(b.keyCode==39){b.preventDefault();aI.fancybox.next()}}}});if(aI.fn.mousewheel){aL.unbind("mousewheel.fb");o.length>1&&aL.bind("mousewheel.fb",function(b,c){b.preventDefault();aB||c==0||(c>0?aI.fancybox.prev():aI.fancybox.next())})}if(aJ.showNavArrows){if(aJ.cyclic&&o.length>1||aH!=0){an.show()}if(aJ.cyclic&&o.length>1||aH!=o.length-1){ao.show()}}}function d(){if(o.length-1>aH){var b=o[aH+1].href;if(typeof b!=="undefined"&&b.match(aO)){var c=new Image;c.src=b}}if(aH>0){b=o[aH-1].href;if(typeof b!=="undefined"&&b.match(aO)){c=new Image;c.src=b}}}function ae(){if(aA.is(":visible")){aI("div",aA).css("top",ak*-40+"px");ak=(ak+1)%12}else{clearInterval(aM)}}function aj(){return[aI(window).width(),aI(window).height(),aI(document).scrollLeft(),aI(document).scrollTop()]}function f(b){var c=b.offset();c.top+=parseFloat(b.css("paddingTop"))||0;c.left+=parseFloat(b.css("paddingLeft"))||0;c.top+=parseFloat(b.css("border-top-width"))||0;c.left+=parseFloat(b.css("border-left-width"))||0;c.width=b.width();c.height=b.height();return c}function ac(){aI("#fancybox-title").remove();at=0;if(aJ.titleShow!=false){var b=aJ.title;b=aI.isFunction(aJ.titleFormat)?aJ.titleFormat(b,o,aH,aJ):aD(b);if(!(!b||b=="")){var c=aG.width-aJ.padding*2;aI('<div id="fancybox-title" class="'+("fancybox-title-"+aJ.titlePosition)+'" />').css({width:c,paddingLeft:aJ.padding,paddingRight:aJ.padding}).html(b).appendTo("body");switch(aJ.titlePosition){case"inside":at=aI("#fancybox-title").outerHeight(true)-aJ.padding;aG.height+=at;break;case"over":aI("#fancybox-title").css("bottom",aJ.padding);break;default:aI("#fancybox-title").css("bottom",aI("#fancybox-title").outerHeight(true)*-1);break}aI("#fancybox-title").appendTo(ap).hide();ag&&aI("#fancybox-title span").fixPNG()}}}function aD(b){if(b&&b.length){switch(aJ.titlePosition){case"inside":return b;case"over":return'<span id="fancybox-title-over">'+b+"</span>";default:return'<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">'+b+'</span><span id="fancybox-title-right"></span></span>'}}return false}function aE(){if(!aI("#fancybox-wrap").length){aI("body").append(aF=aI('<div id="fancybox-tmp"></div>'),aA=aI('<div id="fancybox-loading"><div></div></div>'),au=aI('<div id="fancybox-overlay"></div>'),aL=aI('<div id="fancybox-wrap"></div>'));ap=aI('<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(aL);ap.append(aC=aI('<div id="fancybox-inner"></div>'),av=aI('<a id="fancybox-close"></a>'),an=aI('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),ao=aI('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));av.click(aI.fancybox.close);aA.click(aI.fancybox.cancel);an.click(function(b){b.preventDefault();aI.fancybox.prev()});ao.click(function(b){b.preventDefault();aI.fancybox.next()});aI.support.opacity||ap.find(".fancy-bg").fixPNG();if(ag){aI(av.add(".fancy-ico").add("div",aA)).fixPNG();au.get(0).style.setExpression("height","document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");aA.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'");ap.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>')}}}var aF,aA,au,aL,ap,aC,av,an,ao,ay=0,aK={},aw=[],aH=0,aJ={},o=[],aq=null,ax=new Image,aO=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,w=/[^\.]\.(swf)\s*$/i,aM,ak=1,aN,aG,aB=false,az=20,al=aI.extend(aI("<div/>")[0],{prop:0}),at=0,ag=!aI.support.opacity&&!window.XMLHttpRequest;aI.fn.fixPNG=function(){return this.each(function(){var b=aI(this).css("backgroundImage");if(b.match(/^url\(["']?(.*\.png)["']?\)$/i)){b=RegExp.$1;aI(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+(aI(this).css("backgroundRepeat")=="no-repeat"?"crop":"scale")+", src='"+b+"')"}).each(function(){var c=aI(this).css("position");c!="absolute"&&c!="relative"&&aI(this).css("position","relative")}).css("zoom",1)}})};aI.fn.fancybox=function(b){aI(this).data("fancybox",aI.extend({},b));aI(this).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!aB){aB=true;aI(this).blur();aw=[];ay=0;c=aI(this).attr("rel")||"";if(!c||c==""||c==="nofollow"){aw.push(this)}else{aw=aI("a[rel="+c+"], area[rel="+c+"]");ay=aw.index(this)}am();return false}});return this};aI.fancybox=function(c,e){if(!aB){aB=true;aw=[];ay=0;if(aI.isArray(c)){for(var g=0,b=c.length;g<b;g++){if(typeof c[g]=="object"){aI(c[g]).data("fancybox",aI.extend({},e,c[g]))}else{c[g]=aI({}).data("fancybox",aI.extend({content:c[g]},e))}}aw=jQuery.merge(aw,c)}else{if(typeof c=="object"){aI(c).data("fancybox",aI.extend({},e,c))}else{c=aI({}).data("fancybox",aI.extend({content:c},e))}aw.push(c)}am()}};aI.fancybox.showActivity=function(){clearInterval(aM);aA.show();aM=setInterval(ae,66)};aI.fancybox.hideActivity=function(){aA.hide()};aI.fancybox.next=function(){return aI.fancybox.pos(aH+1)};aI.fancybox.prev=function(){return aI.fancybox.pos(aH-1)};aI.fancybox.pos=function(b){if(!aB){b=parseInt(b);if(b>-1&&o.length>b){ay=b;am()}if(aJ.cyclic&&o.length>1&&b<0){ay=o.length-1;am()}if(aJ.cyclic&&o.length>1&&b>=o.length){ay=0;am()}}};aI.fancybox.cancel=function(){if(!aB){aB=true;aI.event.trigger("fancybox-cancel");ad();aK&&aI.isFunction(aK.onCancel)&&aK.onCancel(aw,ay,aK);aB=false}};aI.fancybox.close=function(){function b(){au.fadeOut("fast");aL.hide();aI.event.trigger("fancybox-cleanup");aC.empty();aI.isFunction(aJ.onClosed)&&aJ.onClosed(o,aH,aJ);o=aK=[];aH=ay=0;aJ=aK={};aB=false}if(!(aB||aL.is(":hidden"))){aB=true;if(aJ&&aI.isFunction(aJ.onCleanup)){if(aJ.onCleanup(o,aH,aJ)===false){aB=false;return}}ad();aI(av.add(an).add(ao)).hide();aI("#fancybox-title").remove();aL.add(aC).add(au).unbind();aI(window).unbind("resize.fb scroll.fb");aI(document).unbind("keydown.fb");aC.css("overflow","hidden");if(aJ.transitionOut=="elastic"){aN=u();var c=aL.position();aG={top:c.top,left:c.left,width:aL.width(),height:aL.height()};if(aJ.opacity){aG.opacity=1}al.prop=1;aI(al).animate({prop:0},{duration:aJ.speedOut,easing:aJ.easingOut,step:ai,complete:b})}else{aL.fadeOut(aJ.transitionOut=="none"?0:aJ.speedOut,b)}}};aI.fancybox.resize=function(){if(!(aB||aL.is(":hidden"))){aB=true;var b=aC.wrapInner("<div style='overflow:auto'></div>").children(),c=b.height();aL.css({height:c+aJ.padding*2+at});aC.css({height:c});b.replaceWith(b.children());aI.fancybox.center()}};aI.fancybox.center=function(){aB=true;var b=aj(),c=aJ.margin,e={};e.top=b[3]+(b[1]-(aL.height()-at+az*2))*0.5;e.left=b[2]+(b[0]-(aL.width()+az*2))*0.5;e.top=Math.max(b[3]+c,e.top);e.left=Math.max(b[2]+c,e.left);aL.css(e);aB=false};aI.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};aI(document).ready(function(){aE()})})(jQuery);
