(function(){if(window.BX.CImageView)return;BX.viewImage=function(t,i,e,s,r){r=r||{};r.cycle=false;r.list=[{image:t,height:e,width:i,title:s}];var h=new BX.CImageView(r);h.show();return h};BX.viewImageBind=function(i,e,s,r){var h=new BX.CImageView(e);if(!s)s={tag:"IMG"};BX.ready(function(){t(i,s,r,h)});return h};function t(t,i,e,s){var t=BX(t);if(!!t){BX.bindDelegate(t,"click",i,function(r){var h=t;if(!!e){h=BX.findParent(this,e,t)||h}var a=BX.findChildren(h,i,true),l=[],n=false;for(var o=0;o'}),this.NEXT_LINK=BX.create(t,{props:{className:"bx-images-viewer-next-outer",href:i},events:{click:BX.proxy(this.next,this)},html:''}),this.IMAGE_TITLE=BX.create("DIV",{style:{bottom:"0"},props:{className:"bx-images-viewer-title"}}),BX.create("DIV",{props:{className:"bx-images-viewer-wrap-inner"},style:{padding:this.params.minPadding+"px"},children:[this.IMAGE_WRAP=BX.create("DIV",{props:{className:"bx-images-viewer-wrap"},children:[this.IMAGE]})]}),BX.create(t,{props:{className:"bx-images-viewer-close",href:i},events:{click:BX.proxy(this._hide,this)},html:''})]}));if(!!this.params.resizeToggle){this.IMAGE_WRAP.appendChild(BX.create("SPAN",{props:{className:"bx-images-viewer-size-toggle"},style:{right:this.params.minPadding+"px",bottom:this.params.minPadding+"px"},events:{click:BX.proxy(this._toggle_resize,this)}}))}}};BX.CImageView.prototype._keypress=function(t){var i=(t||window.event).keyCode||(t||window.event).charCode;if(!!this.params.keyMap&&!!this.params.keyMap[i]&&!!this[this.params.keyMap[i]]){this[this.params.keyMap[i]].apply(this);return BX.PreventDefault(t)}};BX.CImageView.prototype._toggle_resize=function(){var t=this.params.resize;this.params.resize=this.params.resizeToggle;this.params.resizeToggle=t;if(this.params.resize!="WH"){this.params.lockScroll=true;this._lock_scroll()}else{this.params.lockScroll=false;this._unlock_scroll()}this.adjustSize();this.adjustPos()};BX.CImageView.prototype.adjustPos=function(){if(this.list[this._current].height>0&&this.list[this._current].width>0){this._adjustPosByImg()}else{if(!this.IMAGE_WRAP.style.height)this.IMAGE_WRAP.style.height="100px";if(!this.IMAGE_WRAP.style.width)this.IMAGE_WRAP.style.width="100px";setTimeout(BX.proxy(this._adjustPosByImg,this),250)}};BX.CImageView.prototype._adjustPosByImg=function(){if(this.bVisible){var t=BX.GetWindowSize(),i=parseInt((t.innerHeight-parseInt(this.IMAGE_WRAP.style.height)-2*this.params.minPadding)/2),e=parseInt((t.innerWidth-parseInt(this.IMAGE_WRAP.style.width)-2*this.params.minPadding)/2);if(!this.params.lockScroll&&t.innerWidth=0)r.push(t.innerWidth/s);if(this.params.resize.indexOf("H")>=0)r.push(t.innerHeight/e)}r=Math.min.apply(window,r);e*=r;s*=r;this.IMAGE_WRAP.style.height=parseInt(e)+"px";this.IMAGE_WRAP.style.width=parseInt(s)+"px";if(BX.browser.IsIE()){var h=parseInt(this.IMAGE_WRAP.style.height)+this.params.minPadding*2;this.PREV_LINK.style.height=this.NEXT_LINK.style.height=h+"px";this.PREV_LINK.firstChild.style.top=this.NEXT_LINK.firstChild.style.top=parseInt(h/2-20)+"px"}}};BX.CImageView.prototype._lock_scroll=function(){if(this.params.lockScroll)BX.addClass(document.body,"bx-images-viewer-lock-scroll")};BX.CImageView.prototype._unlock_scroll=function(){if(this.params.lockScroll)BX.removeClass(document.body,"bx-images-viewer-lock-scroll")};BX.CImageView.prototype._unhide=function(){this.bVisible=true;this.DIV.style.display="block";this.OVERLAY.style.display="block";this.PREV_LINK.style.display=this.list.length>1&&(this.params.cycle||this._current>0)?"block":"none";this.NEXT_LINK.style.display=this.list.length>1&&(this.params.cycle||this._current0)this.show();else this.close()}};BX.CImageView.prototype.show=function(t){var i=this._current;if(BX.type.isElementNode(t))t=t.getAttribute("src");if(typeof t=="object"&&(!!t.image||!!t.thumb))t=t.image||t.thumb;if(BX.type.isString(t)){for(var e=0;e0||this.list_preload[this._current].height>0){this.IMAGE.onload=null;this.IMAGE.style.opacity=1}},this)()}else if(this.list_preload[this._current].bxloaded){setTimeout(BX.delegate(this.list_preload[this._current].onload,this.list_preload[this._current]),350)}setTimeout(BX.proxy(this._check_title,this),300);this._unhide();BX.onCustomEvent(this,"onImageViewShow",[t])};BX.CImageView.prototype._check_title=function(){this.IMAGE_TITLE.innerHTML="";if(this.params.showTitle&&this.list[this._current].title||this.list[this._current].full){var t=0,i=0,e={style:{opacity:"1"},children:[]};if(this.params.showTitle&&this.list[this._current].title){e.children.push(BX.create("DIV",{props:{className:"bx-images-viewer-title-item"},text:this.list[this._current].title}));t+=35;i+=35}if(this.list[this._current].full){var s=[];if(this.list[this._current].full_height&&this.list[this._current].full_width){s.push(this.list[this._current].full_width+"x"+this.list[this._current].full_height)}if(this.list[this._current].full_size){s.push(this.list[this._current].full_size)}html=''+BX.message("JS_CORE_IMAGE_FULL")+(s.length>0?" ("+s.join(", ")+")":"")+"";e.children.push(BX.create("DIV",{props:{className:"bx-images-viewer-title-item bx-images-viewer-full"},html:html}));t+=35;i+=35}e.style.height=t+"px";e.style.bottom=-i+"px";BX.adjust(this.IMAGE_TITLE,e)}else{this.IMAGE_TITLE.style.opacity="0";this.IMAGE_TITLE.style.bottom="0";this.IMAGE_TITLE.style.height="0"}};BX.CImageView.prototype._get_image_onload=function(t){t=typeof t=="undefined"?this._current:t;return BX.delegate(function(){BX.proxy_context.bxloaded=true;if(t==this._current){var i=this.list[this._current];BX.removeClass(this.IMAGE_WRAP,"bx-images-viewer-wrap-loading");this.IMAGE.onload=function(){this.onload=null;this.style.opacity=1};this.IMAGE.src=BX.proxy_context.src;if(BX.proxy_context.width)i.width=BX.proxy_context.width;if(BX.proxy_context.height)i.height=BX.proxy_context.height;this.adjustSize();this.adjustPos();BX.defer(this._preload,this)()}BX.onCustomEvent(this,"onImageViewLoad",[this.list[t],t==this._current])},this)};BX.CImageView.prototype._preload=function(){if(this.params.preload>0){var t=Math.max(this._current-this.params.preload,this.params.cycle?-1e3:0),i=Math.min(this._current+this.params.preload,this.params.cycle?this.list.length+1e3:this.list.length-1);if(t=t;e--){var s=e;if(s<0)s+=this.list.length;else if(s>=this.list.length)s-=this.list.length;if(!this.list_preload[s]){this.list_preload[s]=new Image;this.list_preload[s].src=this.list[s].image;this.list_preload[s].onload=this._get_image_onload(s)}}}}};BX.CImageView.prototype.next=function(){if(this.list.length>1){this._current++;if(this._current>=this.list.length){if(!!this.params.cycle)this._current=0;else this._current--;BX.onCustomEvent(this,"onImageViewFinishList",[this.list[this._current],1])}this.show()}};BX.CImageView.prototype.prev=function(){if(this.list.length>1){this._current--;if(this._current<0){if(!!this.params.cycle)this._current=this.list.length-1;else this._current++;BX.onCustomEvent(this,"onImageViewFinishList",[this.list[this._current],-1])}this.show()}};BX.CImageView.prototype.close=function(){this._hide()}})(window); //# sourceMappingURL=core_image.map.js