(function(b){function G(){v.hide();b(w).unbind();H&&H.abort();n.empty()}function C(){G();var a=p[t];f=typeof b(a).data("fancybox")=="undefined"?b.extend({},b.fn.fancybox.defaults,f):b.extend({},b.fn.fancybox.defaults,b(a).data("fancybox"));var c,e,q=a.title||b(a).title||f.title||"";c=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?f.href||null:a.href||b(a).href||f.href||null;if(f.type){e=f.type;if(!c)c=f.content}else if(c)if(c.match(I))e="image";else if(c.match(T))e="swf";else if(b(a).hasClass("iframe"))e=
"iframe";else if(c.match(/#/)){a=c.substr(c.indexOf("#"));e=b(a).length>0?"inline":"ajax"}else e="ajax";else if(f.content){a=f.content;e="html";f.content=null}else e="inline";f.type=e;f.href=c;f.title=q;if(f.autoDimensions&&f.type!=="iframe"&&f.type!=="swf"){f.frameWidth="auto";f.frameHeight="auto"}if(f.modal){f.overlayShow=true;f.hideOnOverlayClick=false;f.hideOnContentClick=false;f.enableEscapeButton=false;f.showCloseButton=false}if(b.isFunction(f.onStart))if(f.onStart(p,t,f)===false){h=false;return}n.css("padding",
r+f.padding+f.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(e){case "html":n.html(a);F();break;case "inline":b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(n.children())});b(a).appendTo(n);F();break;case "image":w=new Image;w.src=c;if(w.complete)Q();else{h=false;b.fancybox.showActivity();
b(w).unbind().one("load",Q)}break;case "swf":var s="",y="";s+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+f.frameWidth+'" height="'+f.frameHeight+'"><param name="movie" value="'+c+'"></param>';b.each(f.swf,function(o,R){s+='<param name="'+o+'" value="'+R+'"></param>';y+=" "+o+'="'+R+'"'});s+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+f.frameWidth+'" height="'+f.frameHeight+'"'+y+"></embed></object>";n.html(s);F();break;case "ajax":a=c.split("#",2);
e=f.ajax.data||{};if(a.length>1){c=a[0];typeof e=="string"?(e+="&selector="+a[1]):(e.selector=a[1])}h=false;b.fancybox.showActivity();H=b.ajax(b.extend(f.ajax,{url:c,data:e,success:function(o){n.html(o);F()}}));break;case "iframe":h=false;b.fancybox.showActivity();b('<iframe id="fancybox-frame" name="fancybox-frame'+Math.round(Math.random()*1E3)+'" frameborder="0" hspace="0" src="'+c+'"></iframe>').appendTo(n).load(function(){h=true;b(this).unbind();J()});break}}function Q(){h=true;f.frameWidth=w.width;
f.frameHeight=w.height;b("<img />").attr({id:"fancybox-img",src:w.src,alt:f.title}).appendTo(n);J()}function F(){n.width(f.frameWidth);n.height(f.frameHeight);if(f.frameWidth=="auto")f.frameWidth=n.width();if(f.frameHeight=="auto")f.frameHeight=n.height();J()}function J(){v.hide();if(g.is(":visible")&&b.isFunction(d.onCleanup))if(d.onCleanup(j,l,d)===false){b.event.trigger("fancybox-cancel");h=false;return}j=p;l=t;d=f;i[0].scrollTop=0;i[0].scrollLeft=0;if(d.overlayShow){K&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!==
"hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});z.css({"background-color":d.overlayColor,opacity:d.overlayOpacity}).unbind().show()}m=U();V();if(g.is(":visible")){b(A.add(D).add(E)).hide();var a=g.position();k={top:a.top,left:a.left,width:g.width(),height:g.height()};var c=k.width==m.width&&k.height==m.height;i.fadeOut(d.changeFade,function(){function e(){i.html(n.contents()).fadeIn(d.changeFade,L)}b.event.trigger("fancybox-change");i.css({top:d.padding,
left:d.padding,width:k.width-d.padding*2>0?k.width-d.padding*2:1,height:k.height-d.padding*2>0?k.height-d.padding*2:1}).empty();i.css("overflow","hidden");B.prop=0;b(B).animate({prop:1},{duration:c?0:d.changeSpeed,easing:d.easingChange,step:M,complete:e})})}else if(d.transitionIn=="elastic"){k=S();i.css({top:d.padding,left:d.padding,width:k.width-d.padding*2>0?k.width-d.padding*2:1,height:k.height-d.padding*2>0?k.height-d.padding*2:1});i.html(n.contents());g.css(k).show();if(d.opacity)m.opacity=0;
B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:M,complete:L})}else{i.css({top:d.padding,left:d.padding,width:m.width-d.padding*2>0?m.width-d.padding*2:1,height:m.height-d.padding*2-u>0?m.height-d.padding*2-u:1});i.html(n.contents());g.css(m).fadeIn(d.transitionIn=="none"?0:d.speedIn,L)}}function M(a){var c=Math.round(k.width+(m.width-k.width)*a),e=Math.round(k.height+(m.height-k.height)*a),q=Math.round(k.top+(m.top-k.top)*a),s=Math.round(k.left+(m.left-k.left)*a);b(g).css({width:c+
"px",height:e+"px",top:q+"px",left:s+"px"});c-=d.padding*2;e-=d.padding*2+u*a;c=c>0?c:0;e=e>0?e:0;i.css({width:c+"px",height:e+"px"});if(typeof m.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)}function L(){i.removeAttr("filter");g.removeAttr("filter").css("opacity","");b(j[l]).is("img")==false&&f.type!=="image"&&f.type!=="iframe"&&i.css({overflow:"auto"});b("#fancybox-title").show();d.hideOnContentClick?i.one("click",b.fancybox.close):i.unbind();d.hideOnOverlayClick?z.one("click",b.fancybox.close):
z.unbind();d.showCloseButton?A.show():A.hide();W();d.centerOnScroll?b(window).bind("resize.fb scroll.fb",b.fancybox.center):b(window).unbind("resize.fb scroll.fb");b.isFunction(d.onComplete)&&d.onComplete(j,l,d);h=false;X()}function U(){var a=N(),c={},e=d.margin,q=d.autoScale,s=(r+e)*2,y=(r+e)*2,o=d.padding*2;if(d.frameWidth.toString().indexOf("%")>-1){c.width=a[0]*parseFloat(d.frameWidth)/100-r*2;q=false}else c.width=d.frameWidth+o;if(d.frameHeight.toString().indexOf("%")>-1){c.height=a[1]*parseFloat(d.frameHeight)/
100-r*2;q=false}else c.height=d.frameHeight+o;if(q&&(c.width>a[0]-s||c.height>a[1]-y))if(b(j[l]).is("img")||f.type=="image"||f.type=="swf"){s+=o;y+=o;q=Math.min(Math.min(a[0]-s,d.frameWidth)/d.frameWidth,Math.min(a[1]-y,d.frameHeight)/d.frameHeight);c.width=Math.round(q*(c.width-o))+o;c.height=Math.round(q*(c.height-o))+o}else{c.width=Math.min(c.width,a[0]-s);c.height=Math.min(c.height,a[1]-y)}c.top=a[3]+(a[1]-(c.height+r*2))*0.5;c.left=a[2]+(a[0]-(c.width+r*2))*0.5;if(d.autoScale==false){c.top=c.top<
a[3]+e?a[3]+e:c.top;c.left=c.left<a[2]+e?a[2]+e:c.left}return c}function S(){var a=j[l],c=N();c={width:1,height:1,top:c[3]+c[1]*0.5,left:c[2]+c[0]*0.5};var e=false;if(typeof a.orig!=="undefined"&&a.orig.nodeName)e=b(a.orig);else if(b(a).children("img:first").length)e=b(a).children("img:first");else if(a.nodeName)e=b(a);if(e&&e.length){a=Y(e);c.width=a.width+d.padding*2;c.height=a.height+d.padding*2;c.top=a.top-d.padding-r;c.left=a.left-d.padding-r}return c}function W(){b(document).unbind("keydown.fb").bind("keydown.fb",
function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode==37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,c){a.preventDefault();h||c==0||(c<0?b.fancybox.prev():b.fancybox.next())})}if(d.showNavArrows){if(d.cyclic&&j.length>1||l!=0)D.show();if(d.cyclic&&j.length>1||l!=j.length-1)E.show()}}function X(){if(j.length-
1>l){var a=j[l+1].href;if(typeof a!=="undefined"&&a.match(I)){var c=new Image;c.src=a}}if(l>0){a=j[l-1].href;if(typeof a!=="undefined"&&a.match(I)){c=new Image;c.src=a}}}function Z(){if(v.is(":visible")){b("div",v).css("top",O*-40+"px");O=(O+1)%12}else clearInterval(P)}function N(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]}function Y(a){var c=a.offset();c.top+=parseFloat(a.css("paddingTop"))||0;c.left+=parseFloat(a.css("paddingLeft"))||0;c.top+=
parseFloat(a.css("border-top-width"))||0;c.left+=parseFloat(a.css("border-left-width"))||0;c.width=a.width();c.height=a.height();return c}function V(){b("#fancybox-title").remove();u=0;if(d.titleShow==false)return false;var a=d.title;a=b.isFunction(d.titleFormat)?d.titleFormat(a,j,l,d):$(a);if(!(a==false||a.length<1))if(a.length>0){var c=m.width-d.padding*2;b('<div id="fancybox-title" class="'+(d.titlePosition=="inside"?"fancybox-title-inside":"fancybox-title-outside")+'" />').css({width:c,paddingLeft:d.padding,
paddingRight:d.padding}).html(a).appendTo("body");u=b("#fancybox-title").outerHeight(true);if(d.titlePosition=="outside"){b("#fancybox-title").css("bottom",u*-1);u=0}else{u-=d.padding;m.height+=u}b("#fancybox-title").appendTo(x).hide();K&&b("#fancybox-title span").fixPNG()}}function $(a){if(a.length)return d.titlePosition=="inside"?a:'<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}
function aa(){if(!b("#fancybox-wrap").length){n=b('<div id="fancybox-tmp"></div>').appendTo("body");v=b('<div id="fancybox-loading"><div></div></div>').appendTo("body");z=b('<div id="fancybox-overlay"></div>').appendTo("body");g=b('<div id="fancybox-wrap"></div>').appendTo("body");x=b('<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(g);
i=b('<div id="fancybox-inner"></div').appendTo(x);A=b('<a id="fancybox-close"></a>').appendTo(x);D=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>').appendTo(x);E=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>').appendTo(x);A.click(b.fancybox.close);v.click(b.fancybox.cancel);D.bind("click",function(a){a.preventDefault();b.fancybox.prev()});E.bind("click",function(a){a.preventDefault();
b.fancybox.next()});b.support.opacity||x.find(".fancy-bg").fixPNG();if(K){b(A.add(".fancy-ico").add("div",v)).fixPNG();z.get(0).style.setExpression("height","document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");v.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'");
x.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>')}}}var n,v,z,g,x,i,A,D,E,t=0,f={},p=[],l=0,d={},j=[],H=null,w=new Image,I=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,T=/[^\.]\.(swf)\s*$/i,P,O=1,k,m,h=false,r=20,B=b.extend(b("<div/>")[0],{prop:0}),u=0,K=!b.support.opacity&&!window.XMLHttpRequest;b.fn.fixPNG=function(){return this.each(function(){var a=b(this).css("backgroundImage");if(a.match(/^url\(["']?(.*\.png)["']?\)$/i)){a=RegExp.$1;b(this).css({backgroundImage:"none",
filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+(b(this).css("backgroundRepeat")=="no-repeat"?"crop":"scale")+", src='"+a+"')"}).each(function(){var c=b(this).css("position");c!="absolute"&&c!="relative"&&b(this).css("position","relative")})}})};b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a));b(this).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){b(this).blur();h=true;p=[];t=0;c=b(this).attr("rel")||"";if(!c||c==""||
c==="nofollow")p.push(this);else{p=b("a[rel="+c+"], area[rel="+c+"]");t=p.index(this)}C();return false}});return this};b.fancybox=function(a,c){if(!h){h=true;p=[];t=0;if(b.isArray(a)){for(var e=0,q=a.length;e<q;e++)if(typeof a[e]=="object")b(a[e]).data("fancybox",b.extend({},c,a[e]));else a[e]=b({}).data("fancybox",b.extend({content:a[e]},c));p=jQuery.merge(p,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},c,a));else a=b({}).data("fancybox",b.extend({content:a},c));p.push(a)}C()}};
b.fancybox.showActivity=function(){clearInterval(P);v.show();P=setInterval(Z,66)};b.fancybox.prev=function(){return b.fancybox.pos(l-1)};b.fancybox.next=function(){return b.fancybox.pos(l+1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);if(a>-1&&j.length>a){t=a;C()}if(d.cyclic&&j.length>1&&a<0){t=j.length-1;C()}if(d.cyclic&&j.length>1&&a>=j.length){t=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");G();f&&b.isFunction(f.onCancel)&&f.onCancel(p,t,f);h=false}};
b.fancybox.close=function(){function a(){z.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();i.removeAttr("filter");g.removeAttr("filter").css("opacity","");b.isFunction(d.onClosed)&&d.onClosed(j,l,d);j=f=[];l=selecteIndex=0;d=f={};h=false}if(!(h||g.is(":hidden"))){h=true;if(d&&b.isFunction(d.onCleanup))if(d.onCleanup(j,l,d)===false){h=false;return}G();b(A.add(D).add(E)).hide();b("#fancybox-title").remove();g.add(i).add(z).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");
i.css("overflow","hidden");if(d.transitionOut=="elastic"){k=S();var c=g.position();m={top:c.top,left:c.left,width:g.width(),height:g.height()};if(d.opacity)m.opacity=1;B.prop=1;b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:M,complete:a})}else g.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}};b.fancybox.resize=function(){if(!(h||g.is(":hidden"))){h=true;var a=i.wrapInner("<div style='overflow:auto'></div>").children(),c=a.height();g.css({height:c+d.padding*2+u});i.css({height:c});
a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=N(),c=d.margin,e={width:g.width(),height:g.height()};e.top=a[3]+(a[1]-(e.height+r*2))*0.5;e.left=a[2]+(a[0]-(e.width+r*2))*0.5;e.top=e.top<a[3]+c?a[3]+c:e.top;e.left=e.left<a[2]+c?a[2]+c:e.left;b(g).css(e);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,frameWidth:560,frameHeight:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},
hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:false,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};b(document).ready(function(){aa()})})(jQuery);