function nanofade(){var a=new function(){};for(var b in nanofadeProto)a[b]=nanofadeProto[b];return nanofadeProto.initialize.apply(a,arguments),a}var nanofadeProto={transProp:null,transEndEvent:null,filter:"DXImageTransform.Microsoft.Fade",transType:null,el1:null,el2:null,currentEl:null,nextEl:null,current:1,images:null,links:null,duration:null,slidetime:null,fadeTimer:null,animFade:function(a,b,c,d,e){var f=+(new Date),g=f+d,h=this,i=setInterval(function(){var j=+(new Date),k=j>g?1:(j-f)/d;k=-Math.cos(k*Math.PI)/2+.5+c,a.style.opacity=(b+(c-b)*k).toFixed(3),j>g&&(clearInterval(i),e&&h.schedule(e,1))},10)},cssFade:function(a,b,c,d){a.style[this.transProp]="opacity "+d/1e3+"s linear",a.style.opacity=c},filterFade:function(a,b){a.style.filter="progid:"+this.filter+"(duration="+b/1e3+")",a.filters.item(this.filter).apply(),this.show(a,this.current),a.filters.item(this.filter).play()},getTransitionType:function(a){var b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",Transition:"transitionend"};for(var c in b)a.style[c]!==undefined&&(this.transProp=c,this.transEndEvent=b[c]);return this.transProp!==null?"css":a.filters!==undefined?"filter":"anim"},stack:function(){this.currentEl.style.zIndex=100;var a=this.currentEl==this.el1?this.el2:this.el1;a.style[this.transProp]="",a.style.zIndex=10,a.style.opacity=1,this.show(a,this.current),this.nextEl=a},show:function(a,b){this.getImg(a).src=this.images[b],this.links&&(a.href=this.links[b])},getImg:function(a){return a.tagName=="A"?a.firstChild:a},fade:function(){if(!this.getImg(this.nextEl).complete)return this.schedule(this.fade,500),!1;this.transType=="css"?this.cssFade(this.currentEl,1,0,this.duration):this.transType=="filter"?(this.filterFade(this.el1,this.getImg(this.el2).src,this.duration),this.getImg(this.el2).src=this.images[this.current]):this.animFade(this.currentEl,1,0,this.duration,this.stack),this.currentEl=this.nextEl,this.current=this.current<this.images.length-1?this.current+1:0,this.schedule(this.fade,this.slidetime)},"goto":function(a){return a<this.images.length&&(clearTimeout(this.fadeTimer),this.current=a,this.show(this.nextEl,a),this.fade()),!1},initialize:function(a,b,c){if(b.length<=1)return;this.images=b,c=c||{},this.duration=c.duration||500,this.slidetime=c.slidetime||6e3;var d=typeof a=="string"?document.getElementById(a):a,e=document.createElement("img");d.className=e.className=c.imageClass||"fade_img",this.transType=this.getTransitionType(d);var f=document.createElement("div");f.style.position="relative",c.height&&(f.style.height=c.height+"px"),c.width&&(f.style.width=c.width+"px"),d.parentNode.replaceChild(f,d),f.appendChild(d),f.appendChild(e);if(c.links){this.links=c.links;var g=[d,e],h=[];for(var i=0;i<g.length;i++)h[i]=document.createElement("a"),h[i].target="_blank",g[i].parentNode.replaceChild(h[i],g[i]),h[i].appendChild(g[i]),g[i].style.border="0";h[0].href=this.links[0],this.el1=h[0],this.el2=h[1]}else this.el1=d,this.el2=e;this.currentEl=this.el1;var h=[this.el1,this.el2],j=this;for(var i=0;i<h.length;i++)h[i].style.cssText="position:absolute;top:0;left:0",this.transType=="css"&&h[i].addEventListener(this.transEndEvent,function(){j.stack()});this.stack(),this.schedule(this.fade,this.slidetime)},schedule:function(a,b){var c=this;this.fadeTimer=setTimeout(function(){a.apply(c)},b)}}
