(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 p=e.extend({},e.fn.fancybox.defaults,l);var w=this;function r(){c=this;a=e.extend({},p);q();return false}function q(){if(h){return}if(e.isFunction(a.callbackOnStart)){a.callbackOnStart()}a.itemArray=[];a.itemCurrent=0;if(p.itemArray.length>0){a.itemArray=p.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(w).filter("a[rel="+c.rel+"]");var x={};for(var o=0;o<y.length;o++){x={href:y[o].href,title:y[o].title};if(e(y[o]).children("img:first").length){x.orig=e(y[o]).children("img:first")}else{x.orig=e(y[o])}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()}s()}function s(){e("#fancy_right, #fancy_left, #fancy_close, #fancy_title").hide();var o=a.itemArray[a.itemCurrent].href;if(o.match("iframe")||c.className.indexOf("iframe")>=0){e.fn.fancybox.showLoading();n('<iframe style="background-color: transparent;" allowTransparency="true" id="fancy_frame" onload="jQuery.fn.fancybox.showIframe()" name="fancy_iframe'+Math.round(Math.random()*1000)+'" frameborder="0" hspace="0" src="'+o+'"></iframe>',a.frameWidth,a.frameHeight)}else{if(o.match(/#/)){var x=window.location.href.split("#")[0];x=o.replace(x,"");x=x.substr(x.indexOf("#"));n('<div id="fancy_div">'+e(x).html()+"</div>",a.frameWidth,a.frameHeight)}else{if(o.match(d)){b=new Image;b.src=o;if(b.complete){v()}else{e.fn.fancybox.showLoading();e(b).unbind().bind("load",function(){e("#fancy_loading").hide();v()})}}else{e.fn.fancybox.showLoading();e.get(o,function(y){e("#fancy_loading").hide();n('<div id="fancy_ajax">'+y+"</div>",a.frameWidth,a.frameHeight)})}}}}function v(){var z=b.width;var o=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)||o>(x[1]-A))){var y=Math.min(Math.min(x[0]-B,z)/z,Math.min(x[1]-A,o)/o);z=Math.round(y*z);o=Math.round(y*o)}n('<img alt="" id="fancy_img" src="'+b.src+'" />',z,o)}function t(){if((a.itemArray.length-1)>a.itemCurrent){var o=a.itemArray[a.itemCurrent+1].href;if(o.match(d)){objNext=new Image();objNext.src=o}}if(a.itemCurrent>0){var o=a.itemArray[a.itemCurrent-1].href;if(o.match(d)){objNext=new Image();objNext.src=o}}}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)/2));var y=(x+40)>C[0]?C[2]:(C[2]+Math.round((C[0]-x-40)/2));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 o=e.fn.fancybox.getPosition(A);e("#fancy_outer").css({left:(o.left-20-a.padding)+"px",top:(o.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 u(){if(a.itemCurrent!=0){e("#fancy_left, #fancy_left_ico").unbind().bind("click",function(o){o.stopPropagation();a.itemCurrent--;s();return false});e("#fancy_left").show()}if(a.itemCurrent!=(a.itemArray.length-1)){e("#fancy_right, #fancy_right_ico").unbind().bind("click",function(o){o.stopPropagation();a.itemCurrent++;s();return false});e("#fancy_right").show()}}function m(){u();t();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--;s()}else{if(x.keyCode==39&&a.itemCurrent!=(a.itemArray.length-1)){e(document).unbind("keydown.fb");a.itemCurrent++;s()}}}});if(a.centerOnScroll){e(window).bind("resize.fb scroll.fb",e.fn.fancybox.scrollBox)}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(a.itemArray[a.itemCurrent].title!==undefined&&a.itemArray[a.itemCurrent].title.length>0){var o=e("#fancy_outer").position();e("#fancy_title div").html(a.itemArray[a.itemCurrent].title);e("#fancy_title").css({top:o.top+e("#fancy_outer").outerHeight()-32,left:o.left+((e("#fancy_outer").outerWidth()/2)-(e("#fancy_title").width()/2))}).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])}h=false}return this.unbind("click.fb").click(r)};e.fn.fancybox.scrollBox=function(){var l=e.fn.fancybox.getViewport();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()/2))});if(g){e("#fancy_overlay").css({height:e(document).height()})}};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)/2+l[2]),top:((l[1]-40)/2+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(){e("#fancy_overlay, #fancy_outer").hide();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(g){e("div#fancy_overlay, div#fancy_loading").css("position","absolute")}if(e.browser.msie){e("#fancy_loading div, #fancy_close, .fancy_bg, .fancy_title, .fancy_ico").fixPNG()}};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;e.fn.fancybox.build()})})(jQuery);