// Created 12/11/2013 12:56:19 PM
var iosContent={CONTENT_LOAD_COMPLETE:"CONTENT_LOAD_COMPLETE",initPageContentAPI:function(b){b.highlightContainer=el.createElement("div",{position:"absolute"});b.initContentImage=function(){this.image=el.createElement("img",{styles:this.styleObj});this.image.parent=this.parentObject};b.initContentDiv=function(){this.div=el.createElement("div",{styles:this.styleObj},this.parentObject)};b.displayDOMHighlight=function(){if(search.active&&search.pages[this.position]){var b=this;highlight.getHighlights(this.position,
function(a){b.clearDOMHighlights();b.div.appendChild(b.highlightContainer);parseContentItems("highlight",a,b.highlightContainer,b.scale)})}else this.clearDOMHighlights()};b.clearDOMHighlights=function(){deleteAllChildren(this.highlightContainer);this.div.contains(this.highlightContainer)&&this.div.removeChild(this.highlightContainer)};b.setHighlight=function(b){b?this.displayDOMHighlight():this.clearDOMHighlights()};b.rebuildTop=function(){this.div&&!hasClearChildrenBug?deleteAllChildren(this.div):
(this.div&&this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.initContentDiv());this.loaded&&(this.vector&&parseVectorizedContentToDiv(this.vector,this.div,this.scale),parseContentItems("link",publicationData.page[this.position].links,this.div,this.scale),parseContentItems("video",publicationData.page[this.position].videos,this.div,this.scale),"undefined"!==typeof publicationData.shopInfo&&parseContentItems("cartItem",publicationData.page[this.position].shopItems,this.div,this.scale,
publicationData.getPageProperty(this.position,"contentScale")),this.displayDOMHighlight())};b.hidePreloader=function(){};b.onComplete=function(){};b.setIndex=function(b){if(this.position!=b){this.position=b;this.vector=null;this.loaded=!1;deleteAllChildren(this.div);var a=this;loadManager.addPageToQueue({skipCurrentLoading:!0,image:this.image,quality:!0,position:this.position,onImageLoadComplete:function(){},onPageLoadError:function(){a.loaded=!1},onAllIsComplete:function(c,g){a.vector=g;a.loaded=
!0;a.rebuildTop();a.hidePreloader();if(a.onComplete)a.onComplete();customEvents.fireEvent(PAGE_CONTENT_DISPLAYED);a.dispatcher.fireEvent(iosContent.CONTENT_LOAD_COMPLETE,{position:a.position})},onJSLoadComplete:function(){}})}};b.dispatcher=new CustomEvents},setContent:function(b,d,a){a=a||bookModel.getRect(d);var c=publicationData.page[d].BGColor||publicationData.page.defaults.BGColor;b.style.backgroundColor=c;if(publicationData.page[d].stub)return el.css(b,{"background-repeat":"no-repeat","background-size":"0% 0%",
"background-position-y":"0%","background-position-x":"0%","background-color":c}),!1;el.css(b,{"background-size":100*a.contentWidth/a.pageWidth+"% "+100*a.contentHeight/a.pageHeight+"%","background-position":"center center"});c={};c.styleObj={position:"absolute",top:a.padding[0]+"px",left:a.padding[1]+"px",width:a.contentWidth+"px",height:a.contentHeight+"px"};this.initPageContentAPI(c);c.parentObject=b;c.initContentImage();c.scale=a.contentWidth/publicationData.getPageProperty(d,"width");hasClearChildrenBug||
c.initContentDiv();c.setIndex(d);return c},addContainer:function(b,d,a){a=a||!1;d="current"===d?pageMediator.page:"left"===d?pageMediator.rtl?1*pageMediator.page+1:pageMediator.page-1:pageMediator.rtl?pageMediator.page-1:1*pageMediator.page+1;if(1>d||d>publicationData.pageCount)return a=el.createElement("div",{id:"stopSlide",styles:{width:"100%",height:"100%",position:"absolute","background-size":"cover"}},b),{container:a,object:null};var c=bookModel.getRect(d),g=publicationData.page[d].BGColor||
publicationData.page[d].BGColor;a?(a=a.cloneNode(!1),el.clear(a),el.css(a,{width:c.pageWidth+"px",height:c.pageHeight+"px","background-size":100*c.contentWidth/c.pageWidth+"% "+100*c.contentHeight/c.pageHeight+"%","background-position":"center center"}),b.appendChild(a)):a=el.createElement("div",{"data-wide":publicationData.page[d].wide?"true":"false",styles:{width:c.pageWidth+"px",height:c.pageHeight+"px",position:"absolute",overflow:"hidden","background-repeat":"no-repeat","background-origin":"padding-box",
"background-size":100*c.contentWidth/c.pageWidth+"% "+100*c.contentHeight/c.pageHeight+"%","background-position":"center center","background-color":g}},b);return{object:this.setContent(a,d,c),container:a}},resultBlockStore:"",isBlock:function(b,d){var a=pageMediator.page,c=bookModel.getRect(a,bookModel.zoomLevel),g=(b-c.padding[1])/c.ratio,e=(d-c.padding[0])/c.ratio;if(publicationData.page[a].blocks)for(var l=0,k=publicationData.page[a].blocks.length;l<k;l++){var f=publicationData.page[a].blocks[l];
if(g>=f.rect[0]&&g<=f.rect[0]+f.rect[2]&&e>=f.rect[1]&&e<=f.rect[1]+f.rect[3]){g={rect:[]};g.rect[0]=f.rect[0]*c.ratio-5*(window.devicePixelRatio||1);g.rect[1]=f.rect[1]*c.ratio;g.rect[2]=f.rect[2]*c.ratio+10*(window.devicePixelRatio||1);g.rect[3]=f.rect[3]*c.ratio;g.rect[0]+=c.padding[1];g.rect[1]+=c.padding[0];if(this.resultBlockStore===a+"-"+l)return this.resultBlockStore="",!1;this.resultBlockStore=a+"-"+l;return g}}this.resultBlockStore="";return!1},resizeContainer:function(b,d){var a;switch(d){case "current":a=
pageMediator.page;break;case "left":a=pageMediator.rtl?1*pageMediator.page+1:pageMediator.page-1;break;case "right":a=pageMediator.rtl?pageMediator.page-1:1*pageMediator.page+1;break;default:a=d}if(!(1>a||a>publicationData.pageCount)){var c=bookModel.getRect(a);el.clear(b);if(c.pageWidth!==b.getBoundingClientRect().width||c.pageHeight!==b.getBoundingClientRect().height)return el.css(b,{width:c.pageWidth+"px",height:c.pageHeight+"px"}),this.setContent(b,a,c);if(-1===b.style.backgroundImage.indexOf("page"+
this._getNum(a)+"_"))return this.setContent(b,a,c)}},_getNum:function(b){b="000"+page;9<page&&(b="00"+page);99<page&&(b="0"+page);999<page&&(b=""+page);return b},linksSh:function(b){b=b.getElementsByClassName("link");for(var d=0,a=b.length;d<a;d++)b[d].style.webkitAnimation="linkss 2s"}};
function PagePreloader(){function b(){d&&(a+=180,c.style.webkitTransform="rotate("+a+"deg)")}var d=!1,a=0,c=el.createElement("div",{styles:{position:"absolute",left:"50%",top:"50%",margin:"-"+40*(window.devicePixelRatio||1)/2+"px 0 0 -"+40*(window.devicePixelRatio||1)/2+"px",backgroundImage:"url("+STYLES_FOLDER+"/preloader.png)",backgroundSize:"cover",width:40*(window.devicePixelRatio||1)+"px",height:40*(window.devicePixelRatio||1)+"px"}});c.style.webkitTransition="-webkit-transform 900ms";c.style.webkitTransitionTimingFunction=
"cubic-bezier(0,0,1,1)";c.style.webkitTransform="rotate("+a+"deg)";c.addEventListener("webkitTransitionEnd",b);this.show=function(){d||(d=!0,window.resources.MAIN_FRAME.appendChild(c),setTimeout(b,100))};this.hide=function(){d&&(d=!1,window.resources.MAIN_FRAME.removeChild(c))}}window.pagePreloader=new PagePreloader;
!function(){function b(){function a(a,c){this.x=a;this.y=c}this.MAX_RESOLUTION=15E6*(window.devicePixelRatio||1);this.mainContainer=el.id("mainFrame");this.globalWidth=this.mainContainer.clientWidth;this.globalHeight=this.mainContainer.clientHeight;this.maxPullSize=this.globalWidth/7;this.currentPageCorner=new a(0,0);this.leftPageCorner=new a(0,0);this.rightPageCorner=new a(0,0);this.contentCorner=new a(0,0);this.leftContentCorner=new a(0,0);this.rightContentCorner=new a(0,0);this.contentCornerStore=
new a(0,0);this.currentPageCornerStore=new a(0,0);this._newWrapper("current");this._newWrapper("right");this._newWrapper("left");var c=this;customEvents.addListener(ROTATE_DEVICE,function(){c._orientationChange.call(c)});this._bindDom();this.setHighlight=function(a){a||(search.active=!1);["left","right","current"].forEach(function(c){(c=this[c+"ContentObject"])&&c.setHighlight(a)},this)};this.updatePreloader();Hammer(el.id("mainFrame"),{stop_browser_behavior:!0,prevent_default:!0}).on("swipeleft",
function(a){"wrapper"===a.target.className&&pageMediator.right()});Hammer(el.id("mainFrame"),{stop_browser_behavior:!0,prevent_default:!0}).on("swiperight",function(a){"wrapper"===a.target.className&&pageMediator.left()})}b.prototype._orientationChange=function(){this.refresh.call(this);bookModel.getRect(pageMediator.page,bookModel.zoomLevel);var a=this.currentContentElement.getBoundingClientRect();if(this.globalWidth>a.width||1.05>bookModel.zoomLevel)bookModel.zoomLevel=1,iosContent.resizeContainer(this.currentContentElement,
"current");iosContent.resizeContainer(this.leftContentElement,"left");iosContent.resizeContainer(this.rightContentElement,"right");this._initSizes(0)};b.prototype._startRender=function(a){this.contentCornerStore.x=this.contentCorner.x;this.contentCornerStore.y=this.contentCorner.y;this.currentPageCornerStore.x=this.currentPageCorner.x;this.currentPageCornerStore.y=this.currentPageCorner.y;this._render(a)};b.prototype._render=function(a,c){c=c||0;a&&(this.contentCorner.x=this.contentCornerStore.x+
a.deltaX,this.contentCorner.y=this.contentCornerStore.y+a.deltaY);var g=this.contentCorner.x-this.currentPageCornerStore.x,b=this.contentCorner.y-this.currentPageCornerStore.y;0>this.deltaHeight?(this.contentCorner.y=Math.abs(this.deltaHeight)/2,this.currentPageCorner.y=0):0<b?(a||(this.contentCorner.y=this.currentPageCorner.y),this.contentCorner.y=this.currentPageCorner.y+this.contentCorner.y/3):Math.abs(b)>this.deltaHeight?(a||(this.contentCorner.y=this.currentPageCorner.y-this.deltaHeight),this.contentCorner.y=
this.currentPageCorner.y-this.deltaHeight+(this.contentCorner.y+this.deltaHeight)/3):this.currentPageCorner.y=this.currentPageCornerStore.y;0>this.deltaWidth?(this.currentPageCorner.x=this.contentCorner.x-Math.abs(this.deltaWidth)/2,this.contentCorner.x=Math.abs(this.deltaWidth)/2):0<g?(this.currentPageCorner.x=this.contentCorner.x,this.contentCorner.x=0):Math.abs(g)>this.deltaWidth?(this.currentPageCorner.x=this.contentCorner.x+this.deltaWidth,this.contentCorner.x=-this.deltaWidth):this.currentPageCorner.x=
this.currentPageCornerStore.x;this.leftPageCorner.x=this.currentPageCorner.x-this.globalWidth;this.rightPageCorner.x=this.currentPageCorner.x+this.globalWidth;this.leftPageCorner.y=this.currentPageCorner.y;this.rightPageCorner.y=this.currentPageCorner.y;this._setStyles(c)};b.prototype._stopRender=function(a,c,b){c=void 0===c?200:c;b=b||!1;var e=this;if("stop"!==b&&(0>this.currentPageCorner.x&&Math.abs(this.currentPageCorner.x)>this.maxPullSize||"left"===b)){if(!b&&!pageMediator.checkSlide("left")){this._render(!1,
c);return}this._animationEnd=function(a){b||(e.fireTrigger=!0,pageMediator.right());e._goToLeft.call(e,a);e.updatePreloader();customEvents.fireEvent(SLIDE_ANIMATION_END)};this.currentContainerElement.addEventListener("webkitTransitionEnd",this._animationEnd);this.contentCorner.x=-(this.globalWidth+this.deltaWidth);0>this.deltaWidth&&(this.contentCorner.x+=this.deltaWidth/2)}else if("stop"!==b&&(0<this.currentPageCorner.x&&Math.abs(this.currentPageCorner.x)>this.maxPullSize||"right"===b)){if(!b&&!pageMediator.checkSlide("right")){this._render(!1,
c);return}this._animationEnd=function(a){b||(e.fireTrigger=!0,pageMediator.left());e._goToRight.call(e,a);e.updatePreloader();customEvents.fireEvent(SLIDE_ANIMATION_END)};this.currentContainerElement.addEventListener("webkitTransitionEnd",this._animationEnd);this.contentCorner.x=this.globalWidth;0>this.deltaWidth&&(this.contentCorner.x-=this.deltaWidth/2)}this._render(!1,c)};b.prototype._startZoomRender=function(a){this._unbindDragEvent();var c=this.currentContentElement.getBoundingClientRect(),b=
a.gesture.center.pageY-c.top;a=a.gesture.center.pageX-c.left;this.transformStore=d(this.currentContentElement.style.webkitTransform);this.transformStore.accamulatedScale=1;this.currentContentElement.style.webkitTransition="-webkit-transform 0ms";this.currentContentElement.style.webkitTransformOrigin=a+"px "+b+"px";this.minZoom=bookModel.getRect(pageMediator.page,1).pageHeight/this.currentContentElement.clientHeight;this.maxZoom=fbUtils.getMaxZoom(this.MAX_RESOLUTION,bookModel.getRect(pageMediator.page).pageWidth,
bookModel.getRect(pageMediator.page).pageHeight)};b.prototype._stopZoomRender=function(a){var c=this.currentContentElement.parentNode.getBoundingClientRect(),b=this.currentContentElement.getBoundingClientRect();bookModel.setZoomLevel(b);a=Math.round(b.top-c.top);var c=Math.round(b.left-c.left),e=iosContent.addContainer(this.currentContainerElement,"current",this.currentContentElement),d=e.container,k=this;el.css(d,{webkitTransform:"translate3d("+c+"px,"+a+"px, 0px)"});setTimeout(function(){el.del(k.currentContentElement);
k.currentContentElement=d;k.currentContentObject=e.object;setTimeout(function(){iosContent.resizeContainer(k.leftContentElement,"left");iosContent.resizeContainer(k.rightContentElement,"right")},200);k.refresh.call(k,50)},150)};b.prototype._zoomRender=function(a,c){c=c||0;var b=Math.max(a.gesture.scale,this.minZoom),b=Math.min(b,this.maxZoom),e="translate3d("+this.transformStore.translate.x+"px,"+this.transformStore.translate.y+"px, 0px)",e=e+(" scale("+b+")");if(c){this.currentContentElement.style.webkitTransition=
"-webkit-transform 200ms";this.currentContentElement.style.webkitTransitionTimingFunction="cubic-bezier(0.7, 0, 0.27, 1)";var d=this,k=function(){d._stopZoomRender.call(d,a);d.currentContainerElement.removeEventListener("webkitTransitionEnd",k);k=null};this.currentContainerElement.addEventListener("webkitTransitionEnd",k)}this.currentContentElement.style.webkitTransform=e;this.transformStore.accamulatedScale=b};b.prototype._setStyles=function(a,c){a=a||0;c=c||"cubic-bezier(0,0,1,1)";this.leftContainerElement.style.webkitTransition=
"-webkit-transform "+a+"ms";this.currentContainerElement.style.webkitTransition="-webkit-transform "+a+"ms";this.rightContainerElement.style.webkitTransition="-webkit-transform "+a+"ms";this.currentContentElement.style.webkitTransition="-webkit-transform "+a+"ms";this.leftContainerElement.style.webkitTransitionTimingFunction=c;this.currentContainerElement.style.webkitTransitionTimingFunction=c;this.rightContainerElement.style.webkitTransitionTimingFunction=c;this.currentContentElement.style.webkitTransitionTimingFunction=
c;this.leftContainerElement.style.webkitTransform="translate3d("+this.leftPageCorner.x+"px,"+this.leftPageCorner.y+"px,0px)";this.currentContainerElement.style.webkitTransform="translate3d("+this.currentPageCorner.x+"px,"+this.currentPageCorner.y+"px,0px)";this.rightContainerElement.style.webkitTransform="translate3d("+this.rightPageCorner.x+"px,"+this.rightPageCorner.y+"px,0px)";this.currentContentElement.style.webkitTransform="translate3d("+this.contentCorner.x+"px,"+this.contentCorner.y+"px,0px)"};
b.prototype._setCorners=function(){var a=this.leftContentElement.clientWidth-this.globalWidth,c=this.rightContentElement.clientWidth-this.globalWidth,b=this.leftContentElement.clientHeight-this.globalHeight,e=this.rightContentElement.clientHeight-this.globalHeight;this.leftContentCorner.x=0>a?this.leftContentCorner.x+a/2:this.leftContentCorner.x-1;this.rightContentCorner.x=0>c?this.rightContentCorner.x-c/2:this.rightContentCorner.x+1;this.leftContentCorner.y=0>b?this.leftContentCorner.y-b/2:this.leftContentCorner.y+
1;this.rightContentCorner.y=0>e?this.rightContentCorner.y-e/2:this.rightContentCorner.y+1;this.leftContentElement.style.webkitTransform="translate3d("+this.leftContentCorner.x+"px,"+this.leftContentCorner.y+"px,0px)";this.rightContentElement.style.webkitTransform="translate3d("+this.rightContentCorner.x+"px,"+this.rightContentCorner.y+"px,0px)"};b.prototype._initSizes=function(a){a=a||0;this.leftPageCorner.x=-this.globalWidth;this.rightPageCorner.x=this.globalWidth;this.deltaWidth=this.currentContentElement.clientWidth-
this.globalWidth;this.deltaHeight=this.currentContentElement.clientHeight-this.globalHeight;var c=d(this.currentContentElement.style.webkitTransform);this.contentCorner.x=c.translate.x;this.contentCorner.y=c.translate.y;0===this.contentCorner.x&&0>this.deltaWidth&&(this.contentCorner.x=-this.deltaWidth/2);this.leftContentCorner.x=-(this.leftContentElement.clientWidth-this.globalWidth);this.leftContentCorner.y=0;this.rightContentCorner.x=0;this.rightContentCorner.y=0;this.contentCornerStore.x=0;this.contentCornerStore.y=
0;this.currentPageCornerStore.x=0;this.currentPageCornerStore.y=0;this._setCorners();this._render(!1);this._stopRender(!1,a,"stop")};b.prototype._tapStart=function(){};b.prototype._tapMove=function(){};b.prototype._tapEnd=function(){};b.prototype._animationEnd=function(){};b.prototype._bindDom=function(a){a=a||0;this._bindDragEvent();this._bindPinchEvent();Hammer(this.currentContainerElement,{prevent_default:!0}).on("drag",function(){});Hammer(this.mainContainer,{prevent_default:!0}).on("drag",function(){});
var c=this;iosContent.linksSh(this.currentContentElement);Hammer(this.currentContentElement,{prevent_default:!0}).on("release",function(){c._unbindDragEvent();c._unbindPinchEvent();c._bindDragEvent();c._bindPinchEvent()});this._initSizes(a)};b.prototype._bindDragEvent=function(){var a=this;this._tapStart=function(c){a._unbindPinchEvent();a._startRender.call(a,{deltaX:c.gesture.deltaX,deltaY:c.gesture.deltaY})};this._tapMove=function(c){a._render.call(a,{deltaX:c.gesture.deltaX,deltaY:c.gesture.deltaY})};
this._tapEnd=function(c){a._stopRender.call(a,{deltaX:c.gesture.deltaX,deltaY:c.gesture.deltaY})};this._swipeLeft=function(){"true"===a.currentContentElement.getAttribute("data-wide")&&a.currentContentElement.getBoundingClientRect().left>-(a.globalWidth/2)&&(a.contentCorner.x=a.currentContainerElement.getBoundingClientRect().width-a.currentContentElement.getBoundingClientRect().width)};this._swipeRight=function(){"true"===a.currentContentElement.getAttribute("data-wide")&&a.currentContentElement.getBoundingClientRect().left<
a.globalWidth/2&&(a.contentCorner.x=0)};Hammer(this.currentContentElement,{prevent_default:!0,fb_lock_to_axis:!0}).on("dragstart",this._tapStart);Hammer(this.currentContentElement,{prevent_default:!0,fb_lock_to_axis:!0}).on("drag",this._tapMove);Hammer(this.currentContentElement,{prevent_default:!0,fb_lock_to_axis:!0}).on("dragend",this._tapEnd);Hammer(this.currentContentElement,{prevent_default:!0}).on("swipeleft",this._swipeLeft);Hammer(this.currentContentElement,{prevent_default:!0}).on("swiperight",
this._swipeRight)};b.prototype._unbindDragEvent=function(){Hammer(this.currentContentElement,{prevent_default:!0,fb_lock_to_axis:!0}).off("dragstart",this._tapStart);Hammer(this.currentContentElement,{prevent_default:!0,fb_lock_to_axis:!0}).off("drag",this._tapMove);Hammer(this.currentContentElement,{prevent_default:!0,fb_lock_to_axis:!0}).off("dragend",this._tapEnd);Hammer(this.currentContentElement,{prevent_default:!0}).off("swipeleft",this._swipeLeft);Hammer(this.currentContentElement,{prevent_default:!0}).off("swiperight",
this._swipeRight)};b.prototype._bindPinchEvent=function(){var a=this;this._pinchStart=function(c){a._startZoomRender(c)};this._pinchMove=function(c){a._zoomRender(c)};this._pinchEnd=function(c){a._stopZoomRender(c)};Hammer(this.currentContentElement,{prevent_default:!0}).on("transformstart",this._pinchStart);Hammer(this.currentContentElement,{prevent_default:!0}).on("pinch",this._pinchMove);Hammer(this.currentContentElement,{prevent_default:!0}).on("transformend",this._pinchEnd);this._doubletap=function(c){var b=
a.currentContentElement.getBoundingClientRect(),e=iosContent.isBlock(c.gesture.center.pageX-b.left,c.gesture.center.pageY-b.top);if(e){var d={width:e.rect[2],height:e.rect[3],top:e.rect[1],left:e.rect[0]},e=window.innerWidth/d.width,k=Math.sqrt(this.MAX_RESOLUTION/(b.width*b.height));k<e&&(e=k);k={width:d.width*e,height:d.height*e,top:(window.innerHeight-d.height*e)/2,left:(window.innerWidth-d.width*e)/2};b=a._correctionCenter(b,d,k);c.gesture.center.pageX=b.x;c.gesture.center.pageY=k.height<window.innerHeight?
b.y:c.gesture.center.pageY;b=a._comeOutCorrection.call(a,c.gesture.center.pageX,c.gesture.center.pageY,e);c.gesture.center.pageX=b.x;c.gesture.center.pageY=b.y;a._startZoomRender(c);c.gesture.scale=e}else 1.05>bookModel.zoomLevel?(b=a._comeOutCorrection.call(a,c.gesture.center.pageX,c.gesture.center.pageY,2),c.gesture.center.pageX=b.x,c.gesture.center.pageY=b.y,a._startZoomRender(c),c.gesture.scale=2):(e=bookModel.getRect(pageMediator.page,1).pageHeight/a.currentContentElement.clientHeight,b=a._comeOutCorrection.call(a,
c.gesture.center.pageX,c.gesture.center.pageY,e),c.gesture.center.pageX=b.x,c.gesture.center.pageY=b.y,a._startZoomRender(c),c.gesture.scale=e);a._zoomRender(c,100)};Hammer(this.currentContentElement,{prevent_default:!0}).on("doubletap",this._doubletap)};b.prototype._comeOutCorrection=function(a,c,b){var d=this.currentContentElement.getBoundingClientRect(),d={top:Math.round(d.top),left:Math.round(d.left),width:Math.round(d.width),height:Math.round(d.height)};c-=d.top;a-=d.left;a=d.left+(a-a*b);c=
d.top+(c-c*b);var l=d.width*b;b*=d.height;return this._correctionCenter(d,{left:0,top:0,width:d.width,height:d.height},{left:l<window.innerWidth?(window.innerWidth-l)/2:a+l<window.innerWidth?window.innerWidth-l:0<a?0:a,top:b<window.innerHeight?(window.innerHeight-b)/2:c+b<window.innerHeight?window.innerHeight-b:0<c?0:c,width:l,height:b})};b.prototype._correctionCenter=function(a,c,b){var d=a.left+c.left-b.left,l=a.top+c.top-b.top;return{x:c.left+a.left+c.width/((d+(b.left+b.width-(a.left+c.left+c.width)))/
d),y:c.top+a.top+c.height/((l+(b.top+b.height-(a.top+c.top+c.height)))/l)}};b.prototype._unbindPinchEvent=function(){Hammer(this.currentContentElement,{prevent_default:!0}).off("transformstart",this._pinchStart);Hammer(this.currentContentElement,{prevent_default:!0}).off("pinch",this._pinchMove);Hammer(this.currentContentElement,{prevent_default:!0}).off("transformend",this._pinchEnd);Hammer(this.currentContentElement,{prevent_default:!0}).off("doubletap",this._doubletap)};b.prototype._unbindDom=
function(){this.currentContainerElement.removeEventListener("webkitTransitionEnd",this._animationEnd);this._unbindDragEvent();this._unbindPinchEvent()};b.prototype.setContainerAs=function(a,c){this[c+"ContainerElement"]=this[a+"ContainerElement"];this[c+"ContentElement"]=this[a+"ContentElement"];this[c+"ContentObject"]=this[a+"ContentObject"]};b.prototype._goToLeft=function(){bookModel.resetZoomLevel();iosContent.resizeContainer(this.currentContentElement,"left");this._unbindDom();this.mainContainer.removeChild(this.leftContainerElement);
this.setContainerAs("current","left");this.setContainerAs("right","current");this._newWrapper("right");this._bindDom()};b.prototype._goToRight=function(){bookModel.resetZoomLevel();iosContent.resizeContainer(this.currentContentElement,"right");this._unbindDom();this.mainContainer.removeChild(this.rightContainerElement);this.setContainerAs("current","right");this.setContainerAs("left","current");this._newWrapper("left");this._bindDom()};b.prototype._newWrapper=function(a){a=a||"right";var c=el.createElement("div",
{"class":"wrapper"}),b=iosContent.addContainer(c,a);"left"===a?this.mainContainer.insertBefore(c,this.mainContainer.getElementsByTagName("div")[0]):this.mainContainer.appendChild(c);this[a+"ContainerElement"]=c;this[a+"ContentElement"]=b.container;this[a+"ContentObject"]=b.object};b.prototype.right=function(){this._stopRender(!1,100,"right")};b.prototype.left=function(){this._stopRender(!1,100,"left")};b.prototype.updatePreloader=function(){if(this.currentContentObject&&!this.currentContentObject.loaded){pagePreloader.show();
var a=function(c){pagePreloader.hide();c.target.removeListener(iosContent.CONTENT_LOAD_COMPLETE,a)};this.currentContentObject.dispatcher.addListener(iosContent.CONTENT_LOAD_COMPLETE,a)}else this.currentContentObject&&pagePreloader.hide()};b.prototype.goToPage=function(a){if(a!=pageMediator.previousPage)if(bookModel.resetZoomLevel(),this.fireTrigger)this.fireTrigger=!1;else{var c=function(a,c,b){el.clear(this[a+"ContentElement"]);this[a+"ContentElement"].style.backgroundImage="";this[a+"ContentObject"]=
iosContent.resizeContainer(this[a+"ContentElement"],c);this.updatePreloader();this._initSizes(0);var d=this.currentContentElement,f=this,r=function(){iosContent.resizeContainer(d,b);f._initSizes(0);customEvents.removeListener(SLIDE_ANIMATION_END,r)};customEvents.addListener(SLIDE_ANIMATION_END,r)};a>parseInt(pageMediator.previousPage,10)?pageMediator.rtl?(1<Math.abs(pageMediator.previousPage-a)&&c.call(this,"left",a,a-1),this.right()):(1<Math.abs(pageMediator.previousPage-a)&&c.call(this,"right",
a,a-1),this.left()):a<pageMediator.previousPage&&(pageMediator.rtl?(1<Math.abs(pageMediator.previousPage-a)&&c.call(this,"right",a,a+1),this.left()):(1<Math.abs(pageMediator.previousPage-a)&&c.call(this,"left",a,a+1),this.right()))}};b.prototype.refresh=function(a){this.width=innerWidth;this.height=innerHeight;a=a||0;this.globalWidth=this.mainContainer.clientWidth;this.globalHeight=this.mainContainer.clientHeight;this.maxPullSize=this.globalWidth/7;this._unbindDom();this._bindDom(a)};var d=function(a){function c(a){return parseInt(a.replace("px",
""),10)}a=a.match(/[^(),\s]+/g);var b={};if(null===a)return b.translate={x:0,y:0,z:0},b;for(var d=0,l=a.length;d<l;d++)switch(a[d]){case "translate":b.translate={x:c(a[d+1]),y:c(a[d+2]),z:0};break;case "translateX":b.translate={x:c(a[d+1]),y:0,z:0};break;case "translateY":b.translate={x:0,y:c(a[d+1]),z:0};break;case "translate3d":b.translate={x:c(a[d+1]),y:c(a[d+2]),z:c(a[d+3])};break;case "translateZ":b.translate={x:0,y:0,z:c(a[d+1])}}return b};window.Slide=b}();
function setElementPosition(b,d){b.style.left=String(d.left).concat("px");b.style.top=String(d.top).concat("px")}function flipPage(b){b?pageMediator.right():pageMediator.left()}function hidePreloader(){window.preloaderIsShown&&(workspace.preloader.del(),window.preloaderIsShown=!1)}function showPreloader(){window.preloaderIsShown||(window.preloaderIsShown=!0,workspace.preloader.add())}function deleteAllChildren(b){for(;b.firstChild;)b.removeChild(b.firstChild)}
function sizeDiv(b,d,a,c){void 0==d&&void 0==a&&(d=window.innerWidth,a=window.innerHeight);b.style.width=c?d+"%":Math.ceil(d)+"px";b.style.height=c?a+"%":Math.ceil(a)+"px"}function px(b){return b.toString()+"px"}
function parseVectorizedContentToDiv(b,d,a,c){c="undefined"!=typeof c?c:!0;for(var g=0;4>g;g++);d=d||createDiv();for(var g=[],e=0;e<b.length;e++){var l=b[e],k=0,f=l[k++].toString(),r=l[k++].toString(),s=parseFloat(l[k++]);parseFloat(l[k++]);var x=parseFloat(l[k++]),q=parseFloat(l[k++]),n=parseFloat(l[k++]),m=l[k++].toString(),l=parseFloat(l[k++]),t=Math.round(q*a),k=q=document.createElement("p");k.style.position="absolute";k.style.whiteSpace="nowrap";q.innerText=f;q.style.fontFamily=r;k.style.top=
px(Math.round(x*a));k.style.left=px(t);r=n;x=g[r];n="undefined"==typeof x?Math.floor(n*a):x.size;q.style.fontSize=px(n);q.style.color=m;d.appendChild(k);s*=a;if(c)for(;q.offsetWidth>s&&1<n;)n-=1,q.style.fontSize=px(n);if("undefined"==typeof x)g[r]={size:n,elements:[q]};else if(x.size>=n){if(x.size>n){g[r].size=n;for(var y in x.elements)m=x.elements[y],n=m.offsetWidth,m.style.fontSize=px(g[r].size),m.style.wordSpacing="0px",m.style.wordSpacing=px((n-m.offsetWidth)/(m.innerText.split(" ").length-1))}g[r].elements.push(q)}q.style.webkitTransform=
l?dev_rotateXY(l):"";q.style.webkitTransformOrigin=l?"0 0":"";f=f.split(" ");q.style.wordSpacing="0px";q.style.wordSpacing=px((s-q.offsetWidth)/(f.length-1))}return d}function getDefaultMobileScaleMode(b,d,a,c){var g={};switch(b){case PT_CATALOG:case PT_MAGAZINE:g.isHalfPage=!d&&a;case PT_BOOK:case PT_DOCUMENT:g.fitMode=c?"screen":"width";break;case PT_PHOTOALBUM:g.fitMode="screen";break;default:throw"unknown publication type";}return g}
function getKeepZoomScaleWhileFlipping(b){return-1!=[PT_BOOK,PT_DOCUMENT].indexOf(b)}
function determineScaleMap(b,d){var a=getDefaultMobileScaleMode(publicationData.type,"tablet"==system.device.type,d,innerWidth<=innerHeight),c=a.isHalfPage?2:1,g=(new Vector2(innerWidth,innerHeight)).stretchToMe(b.x/c/b.y,!0).x/b.x,c=innerWidth/(b.x/c),e=c/0.8,a=["screen"==a.fitMode?g:c];ALBUM?(g=Math.sqrt(e/c),a=a.concat([c*g,e])):g=1.5;for(;2.15>a[a.length-1]*g;)a[a.length]=a[a.length-1]*g;return{defaultPos:0,map:a,textVisibleMaxPos:4}}var v=window.system.platform.version;
window.hasClearChildrenBug="safari"==window.system.browser.name&&fbUtils.isArray(v)&&2<=v.length&&"4"==v[0]&&2<=v[1];
function parseContentItems(b,d,a,c,g){if("undefined"!=typeof d&&d)for(var e=0,l=d.length;e<l;e++){var k=d[e],f={cart:publicationData.shopInfo?cart:null,searchHighlightColor:publicationData.visibility.search?highlight.getFillStyle():null,linkHighlightColor:publicationData.linkcolor,onInternalLinkClick:function(a){pageMediator.goToPage(parseInt(a))},getVideoImageUrl:function(a){return video.getVideoImageUrl(a)},videoPlayImage:video.getPlayImage(),onVideoClick:function(a){video.play(a.type,a.id,function(){system.platform.ios||
(window.resources.MAIN_FRAME.style.visibility="visible")});system.platform.ios||(window.resources.MAIN_FRAME.style.visibility="hidden")},formCartItemOptions:function(a,c){function b(a,c){return a.hasOwnProperty(c)?a[c]:publicationData.shopInfo.cartIconGlobals[c]}return{orientation:b(a,"position"),circleColor:b(a,"circleColor"),priceColor:b(a,"priceColor"),priceTagColor:b(a,"priceTagColor"),priceTagOpacity:b(a,"priceTagColorAlpha"),tagVisible:b(a,"tagVisible"),basketColor:b(a,"basketColor"),showTitle:b(a,
"showTitle"),cost:c.price,title:c.name,onClickAction:b(a,"onClickAction")}},onCartItemClick:function(a,c,b){a?(new ProductInfoWindow(c.id)).show():window.location.href=b.url},onNewCartItemRenderConstruction:function(a){window.cartRenders.push(a)}};parseContentItem(b,k,a,c,f,g)}}
function parseContentItem(b,d,a,c,g,e){var l=new Vector2(d.x,d.y),k=new Vector2(d.width,d.height),f=document.createElement("div");f.style.position="absolute";l=l.mul(c);k=k.mul(c);(function(a,c,b,d){a.style[HTML5lib.browserPrefix+"TransformOrigin"]="0 0";var g=d?Math.sin(d):0;d=d?Math.cos(d):1;a.style[HTML5lib.browserPrefix+"Transform"]="matrix("+[d,g,-g,d,c.x,c.y].join()+")";sizeDiv(a,b.x,b.y,!1)})(f,l,k,d.angle);"undefined"!=typeof d.zindex&&(f.style.zIndex=d.zindex);if("highlight"==b)f.style.backgroundColor=
g.searchHighlightColor,a.appendChild(f);else if("link"==b)f.style.backgroundColor=g.linkHighlightColor,f.style.opacity="0",f.style.webkitAnimation="linkss 2s",f.className="link",c=d.urls,Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("touch",function(){f.style.opacity="0.3"}),Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("drag transform hold release",function(){f.style.opacity="0"}),c&&0!=c.length?(function(a){var c=!1,b=function(a,b){setTimeout(function(){c?c=!1:(a.stopPropagation(),
window.location=b)},300)};Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("tap",function(c){b(c,a[0])});Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("doubletap",function(){c=!0})}(c),a.appendChild(f)):"undefined"!==typeof d.page&&(function(a){var c=!1,b=function(a,b){setTimeout(function(){c?c=!1:(a.stopPropagation(),g.onInternalLinkClick(b))},300)};Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("tap",function(c){b(c,a)});Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("doubletap",
function(){c=!0})}(d.page),a.appendChild(f));else if("video"==b){f.id="video."+d.id;if(d.showImage){var r=g.getVideoImageUrl(d.imageUri);(function(a){changeUrlWhenPubl(r,function(c){a.style.backgroundImage="url('"+c+"')";a.style.backgroundSize="100% 100%"})})(f)}b=new Image;c*=d.height;c=50<c?50:0.8*c;b.src=g.videoPlayImage;f.appendChild(b);b.style.position="absolute";b.style.margin="auto";b.style.left="0";b.style.right="0";b.style.top="0";b.style.bottom="0";b.style.height=c+"px";var s=!1,x=function(a){setTimeout(function(){s?
s=!1:(a.stopPropagation(),g.onVideoClick(d))},300)};Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("tap",function(a){x(a)});Hammer(f,{prevent_default:!0,stop_browser_behavior:!0}).on("doubletap",function(){s=!0});a.appendChild(f)}else"cartItem"==b&&function(c,b,d,e){cart.getItems(function(f){f=f[0];var k=g.formCartItemOptions(c,f),l=new CartItemRender(c.id,b,d,e,k,a,cart);(function(a,c,b,d){c.div.style.pointerEvents="auto";var e=!1,f=function(c){setTimeout(function(){e?e=!1:(c.stopPropagation(),
g.onCartItemClick("Window"==b.onClickAction,a,d))},300)};Hammer(c.div,{prevent_default:!0,stop_browser_behavior:!0}).on("tap",function(a){f(a)});Hammer(c.div,{prevent_default:!0,stop_browser_behavior:!0}).on("doubletap",function(){e=!0});g.onNewCartItemRenderConstruction(c)})(c,l,k,f)},function(){throw"productsDB error";},c.id)}(d,l,k,c*e)}
function CartItemRender(b,d,a,c,g,e,l){this.itemID=b||NaN;b=18*c;var k=14*c,f=!1!==g.tagVisible,r=!1!==g.showTitle&&"string"===typeof g.title&&""!=g.title,s=12*c,x=5*c,q=5*c,n=r?0:3*c;a.x=Math.max(a.x,5*b);a.y=Math.max(a.y,3*b);var m=-1!=g.orientation.indexOf("top"),t=-1!=g.orientation.indexOf("left"),y=-1!=g.orientation.indexOf("bottom"),y=!m&&!y;e=el.createElement("div",{id:"cartItem-"+(1E3*Math.random()).toFixed(0),styles:{position:"absolute",cursor:"pointer",borderRadius:x+"px",fontFamily:"Arial",
textAlign:"center",color:g.priceColor}},e);d.applyAsPosition(e);d=new Vector2(b,y?n:b);var w=a.sub(new Vector2(d.x,d.y*(y?2:1)));w.applyAsSize(e);d.applyAsMargin(e,t,y?null:m);f&&(e.style.background="rgba("+fbUtils.hexToRGB(g.priceTagColor)+","+g.priceTagOpacity+")",a=el.createElement("p",{styles:{fontWeight:"bold",fontSize:k+"px",lineHeight:k+"px"}},null,{textContent:fbUtils.formatPrice(g.cost)}),r?(r=new Vector2(w.x-10*c,w.y-k-q),d=el.createElement("p",{styles:{fontSize:s+"px",lineHeight:s+"px",
width:r.x+"px"}},e,{textContent:g.title}),f=d.offsetHeight,q=el.createElement("p",{styles:{fontSize:s+"px",lineHeight:s+"px",marginLeft:5*c+"px",marginRight:5*c+"px",marginBottom:q+"px"}},e,{textContent:g.title}),f<r.y?(e.removeChild(d),s=(r.y-f)/2):(f=r.y-r.y%s,s=(r.y-f)/2,e.removeChild(d),q.style.maxWidth=r.x+"px",q.style.overflow="hidden",q.style.textOverflow="ellipsis",q.style.maxHeight=f+"px"),q.style.marginTop=s+"px"):(s=(w.y-k)/2,a.style.marginTop=s+"px"),a.style.marginBottom=s+"px",function(a,
c){a.style.maxWidth=w.x+"px";a.style.whiteSpace="nowrap";a.style.overflow="hidden";a.style.textOverflow="ellipsis"}(a,k),e.appendChild(a));c*=3;g=el.createElement("span",{styles:{position:"absolute",background:g.circleColor,borderRadius:b+"px",borderWidth:c+"px",borderColor:"white",borderStyle:"solid",color:g.basketColor,verticalAlign:"middle"}},e);k=(new Vector2(b,b)).mul(2);k.applyAsSize(g);s=k.x/2;g.style.lineHeight=k.x-2*c+"px";g.style.fontSize=s+"px";(new Vector2(-b,y?w.y/2-b:-b)).applyAsPosition(g,
t,y||m);this.updateQuantity=function(){var a=l.getItemQuantity(this.itemID);if("undefined"==typeof this.qty||this.qty!=a)this.qty=a,this.circleSpan.className=(0<a?"fullCartButtonInPage":"cartButtonInPage")+" cartIconShadow"};this.div=e;this.circleSpan=g;this.updateQuantity()}
function OnePage(b,d){function a(){var a;publicationData.shopInfo&&(window.cartRenders=[]);t?(h.div.parentNode&&h.div.parentNode.removeChild(h.div),q()):deleteAllChildren(h.div);h.loaded?((a=document.getElementById("stubPage"))&&b.contains(a)&&b.removeChild(a),h.vector&&parseVectorizedContentToDiv(h.vector,h.div,G),a=n().stretchToMe(h.publishedSize.proportions(),!0).x/h.publishedSize.x,sizeDiv(h.div,n().x,n().y),parseContentItems("link",publicationData.page[u].links,h.div,a),parseContentItems("video",
publicationData.page[u].videos,h.div,a),publicationData.shopInfo&&parseContentItems("cartItem",publicationData.page[u].shopItems,h.div,a,publicationData.getPageProperty(u,"contentScale")),s()):g()&&(a=document.getElementById("stubPage")||createDiv("stubPage"),sizeDiv(a,this.width,this.height),a.style.backgroundColor=publicationData.getPageProperty(u,"BGColor"),b.contains(a)||b.appendChild(a))}function c(c,b){if(u!=c)if(u&&g(u)&&!g(c)&&(h.image.style.visibility="visible"),u=c,fconsole.update("pos",
u),y||showPreloader(),g())h.loaded=!1,w||(h.image.style.visibility="hidden"),h.rasterSize.set(publicationData.getPageProperty(u,"width"),publicationData.getPageProperty(u,"height")),d(!0),a(),hidePreloader(),b&&b();else{h.vector=null;h.publishedSize=new Vector2(publicationData.getPageProperty(u,"width"),publicationData.getPageProperty(u,"height"));z.style.backgroundColor=publicationData.getPageProperty(u,"BGColor");L=publicationData.getPageProperty(u,"wide");var e;H&&(e="undefined"==typeof h.isWide||
h.isWide!=L,h.isWide=L,d(e));deleteAllChildren(h.div);loadManager.addPageToQueue({skipCurrentLoading:!0,image:h.image,quality:!0,position:u,onImageLoadComplete:function(){D=!0;h.loaded=!0;w&&B.createPattern(h.image,"no-repeat");var a=new Vector2(h.image.naturalWidth,h.image.naturalHeight);H||(e=h.rasterSize.x!=a.x||h.rasterSize.y!=a.y);h.rasterSize=a;H||d(e)},onPageLoadError:function(){h.loaded=!1},onAllIsComplete:function(c,d){h.vector=d;a();hidePreloader();b&&b()},onJSLoadComplete:function(){}})}}
function g(a){a=void 0!=a?a:u;return publicationData.getPageProperty(a,"stub")}function e(){C.width=this.width;C.height=this.height}function l(){if(h.loaded||g()){var a=C.width,c=C.height;if(D||F||I||J){B.clearRect(0,0,a,c);if(g())B.fillStyle=publicationData.getPageProperty(u,"BGColor"),B.fillRect(0,0,a,c);else{var b=h.image,d=E,A=G,e=Math.round(d.x),d=Math.round(d.y),f=0<e?0:Math.abs(e/A),k=0<d?0:Math.abs(d/A),a=Math.min(b.width*A,a)/A-f,c=Math.min(b.height*A,c)/A-k;(a||c)&&B.drawImage(b,e,d,b.width*
A,b.height*A);b=Math.round(E.x);A=Math.round(E.y);r(h.div,b,A,!1)}J=I=F=D=!1}}}function k(){sizeDiv(b,this.width,this.height)}function f(){if(I||D||J){var a=n(),c=function(a){return Math.floor(a)},b=a.stretchToMe(h.rasterSize.x/h.rasterSize.y,!0).map(c);b.applyAsSize(h.image);b.applyAsSize(h.div);c=a.getCenterPosition(b).map(c);c.applyAsPosition(h.image);c.applyAsPosition(h.div);a.applyAsSize(z);h.widthScale=a.x!==b.x?a.x:a.y;D=I=!1}if(F||J)a=Math.round(E.x),b=Math.round(E.y),r(z,a,b,!1),J=F=!1}function r(a,
c,b,d){d=d?"%":"px";a.style.left=c.toString()+d;a.style.top=b.toString()+d}function s(){search.active&&search.pages[u]?highlight.getHighlights(u,function(a){x();h.div.appendChild(K);parseContentItems("highlight",a,K,G)}):x()}function x(){deleteAllChildren(K);h.div.contains(K)&&h.div.removeChild(K)}function q(){h.div=createDiv("contentDiv");w?b.appendChild(h.div):(h.div.style.webkitTransform=null,z.appendChild(h.div))}function n(a){a=a||G;return(H?h.isWide?M:H:h.publishedSize).map(function(c){return Math.floor(c*
a)})}var m=window.system.platform.version,t="safari"==window.system.browser.name&&fbUtils.isArray(m)&&2<=m.length&&"4"==m[0]&&2<=m[1],y="safari"==window.system.browser.name&&fbUtils.isArray(m)&&3==m.length&&"4"==m[0]&&"0"==m[1]&&"4"==m[2],w=!1,z=createDiv("scrollDiv"),h={},C=document.createElement("canvas"),B=C.getContext("2d");h.loaded=!1;var D,E=new Vector2(0,0),G=0.1,F,I,J,u;h.rasterSize=new Vector2;h.publishedSize=new Vector2(100,100);var L;this.goToPage=function(a){c(a,function(){})};this.resize=
function(c,b){this.width=c;this.height=b;a();w?e():k()};this.setOffset=function(a,c){E.set(a);c||(F=!0)};this.getScale=function(){return G};this.setScale=function(a,c){G=a;c||(I=!0)};this.startPinchMode=function(){h.div.style.visibility="hidden";w||(this.pinchRedrawInterval=setInterval(function(){J=!0},1E3))};this.stopPinchMode=function(){a();this.pinchRedrawInterval&&(clearInterval(this.pinchRedrawInterval),this.pinchRedrawInterval=null);h.div.style.visibility="visible";I=F=!0};this.updateTopContent=
function(){a()};var K=createDiv("highlightContainer");this.setHighlight=function(a){a?s():(search.active=!1,x())};this.set=function(a,d){w?(b.style.overflow="visible",b.appendChild(C)):(b.style.position="absolute",z.style.webkitTransform=null,b.style.webkitTransform=null,b.style.overflow="hidden",b.appendChild(z));h.image=new Image;w||(h.image.style.webkitTransform=null,h.image.style.position="absolute",z.appendChild(h.image));q();c(a,d)};var H=publicationData.size&&publicationData.size.width&&publicationData.size.height?
new Vector2(publicationData.size.width,publicationData.size.height):null,M=H.vclone();M.x*=2;this.getScaledSize=n;this.getImageLoaded=function(){return h.loaded};this.isStub=function(){return g()};this.getOriginalSize=function(){return n(1)};this.drawFrame=w?l:f;this.getIsWide=function(){return L}}
function SimpleViewer(b){function d(){lastTime=(new Date).getTime();window.requestAnimFrame=window.requestAnimFrame||function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();(function D(){t.drawFrame();requestAnimFrame(D)})()}function a(a,c){a!=n&&(n=a,fconsole.update("scale",n),t.setScale(n,c),c||r())}function c(a,c){a.sub(q).vlength()&&
(q=a,t.setOffset(q,c))}function g(a,c){var b=new e(c);return a.clip(b.xmin,b.ymin,b.xmax,b.ymax)}function e(a){var c=t.getScaledSize(a).x;a=t.getScaledSize(a).y;var b=a>innerHeight;c>innerWidth?(this.xmax=0,this.xmin=innerWidth-c):this.xmax=this.xmin=innerWidth/2-c/2;b?(this.ymax=0,this.ymin=innerHeight-a):this.ymax=this.ymin=innerHeight/2-a/2}function l(b,d,e){var h=n;b=d&&f(m.map,n)!=m.defaultPos?m.defaultPos:f(m.map,n*(d?2:1))+(d?0:b?1:-1);b=Math.min(Math.max(b,0),m.map.length-1);b=m.map[b];e=
e?e:ALBUM?new Vector2(innerWidth/2,innerHeight/2):new Vector2(publicationData.rtlMode?innerWidth:0,0);h=q.sub(e.sub(q).mul(b/h-1));h=g(h,b);a(b);c(h);t.updateTopContent()}function k(b,d,e){var h,f=t.getOriginalSize(),k=(h="change"==b)&&d;d="resize"==b;b=m;if(k||d)b=determineScaleMap(f,t.getIsWide());f=n;if(k||h&&!C)f=b.map[b.defaultPos];var k=t.getScaledSize(f).x,l=t.getScaledSize(f).y,u=q.vclone();d?publicationData.rtlMode&&(u.x+=e):u.x=ALBUM?(innerWidth-k)/2:publicationData.rtlMode?innerWidth-k:
0;h&&(u.y=ALBUM?(innerHeight-l)/2:0);e=g(u,f);h=f;m=b;c(e);a(h);r()}function f(a,c){for(var b=0;b<a.length;b++){var d=a[b];if(0==b){if(c<=d||1==a.length)return 0}else{if(b==a.length-1)return a.length-1;if(c<a[b])return c<=(a[b-1]+a[b])/2?b-1:b;if(c<=(a[b]+a[b+1])/2)return b}}throw"determineScale abnormal return";}function r(){customEvents.fireEvent(ZOOM_LEVEL_CHANGED_FOR_WORKSPACE,{isSmallest:0==f(m.map,n),isLargest:f(m.map,n)==m.map.length-1})}function s(a,b,d){function e(a){a.ctrlKey&&(b.sendPinch&&
(b.startPinch&&b.startPinch(new Vector2(a.pageX,a.pageY)),b.sendPinch(s,new Vector2(0,0),new Vector2(a.pageX,a.pageY)),b.endPinch&&b.endPinch()),a.stopImmediatePropagation());a.altKey&&b.sendPinch&&(b.startPinch&&b.startPinch(new Vector2(a.pageX,a.pageY)),b.sendPinch(w,new Vector2(0,0),new Vector2(a.pageX,a.pageY)),b.endPinch&&b.endPinch());a.shiftKey&&b.handleDoubleClick(a);var c=a.currentTarget;if(Modernizr.touch){if(1<a.touches.length){f(a);return}c.addEventListener(DOWN_EVENT,f,!1)}c.removeEventListener(DOWN_EVENT,
e,!1);c.addEventListener(MOVE_EVENT,h,!1);c.addEventListener(UP_EVENT,m,!1);c.addEventListener("touchcancel",m,!1);c.addEventListener("mouseout",m,!1);a=a.touches?a.touches[0]:a;c.pos=new Vector2(a.pageX,a.pageY);r()}function h(a){a.preventDefault();var b=a.touches?a.touches[0]:a,b=new Vector2(b.pageX,b.pageY),e=a.currentTarget.pos;a.currentTarget.pos=b;a=b.sub(e);p.dv0x=p.dv0x||a.x;if(p.timeStamp){b=(new Date).getTime();e=b-p.timeStamp;p.vDiff=p.vDiff.add(a);p.moveTime+=e;p.timeStamp=b;p.trackLength+=
Math.abs(a.x);p.movePath.push({dv:a,time:e});b=t.getScaledSize(void 0).x<=innerWidth||t.isStub();d&&(e=p.vDiff.y?Math.abs(p.vDiff.x)/Math.abs(p.vDiff.y):1E10,Math.abs(p.vDiff.x)>y/1.5*(1.5-e)?p.horizontalAllowed=!0:!p.vDiff.y||1.5<e||p.horizontalAllowed||(a.x=0));if(1E3<p.moveTime||p.dv0x&&a.x&&p.dv0x/Math.abs(p.dv0x)!=a.x/Math.abs(a.x))p.slideDisabledThisTime=!0;!p.slideDisabledThisTime&&p.vDiff.x&&0.5>Math.abs(p.vDiff.y)/Math.abs(p.vDiff.x)&&(a.y=0);if(b&&!p.slideDisabledThisTime&&4<p.trackLength&&
75<p.moveTime){for(var f=p.movePath,b=t.getScaledSize(void 0).y>innerHeight,k,l,m,B=m=l=e=k=0;B<f.length;B++){var n=f[B];k+=n.dv.x;e+=n.dv.y;l+=Math.abs(n.dv.x);m+=n.time}f=Math.abs(k);l=Math.abs(l-f);k=0>k;14>l&&7<f&&(!b&&1>=Math.abs(e)/f||b&&f>7+200*Math.abs(e)/f&&f>0.2*m)?(flipPage(k),b=!0):b=!1;b&&(p.slideDisabledThisTime=!0)}}(a.x||a.y)&&c(g(q.add(a)))}function f(a){if(1<a.touches.length){var c=a.currentTarget,d=a.touches[0];a=a.touches[1];c.pos=new Vector2((d.pageX+a.pageX)/2,(d.pageY+a.pageY)/
2);c.startDist=x(d,a);c.removeEventListener(UP_EVENT,m,!1);c.removeEventListener("touchcancel",m,!1);c.removeEventListener(MOVE_EVENT,h,!1);c.removeEventListener(DOWN_EVENT,f,!1);c.addEventListener(MOVE_EVENT,k,!1);c.addEventListener(UP_EVENT,l,!1);c.addEventListener("touchcancel",l,!1);b.startPinch&&b.startPinch(c.pos)}}function k(a){a.preventDefault();if(1<a.touches.length){var c=a.currentTarget,d=a.touches[0],e=a.touches[1];a=x(d,e);var d=new Vector2((d.pageX+e.pageX)/2,(d.pageY+e.pageY)/2),e=
a/c.startDist,f=d.sub(c.pos);b.sendPinch(e,f,d);c.startDist=a;c.pos=d}}function l(a){var c=a.currentTarget,d=a.touches.length;if(0<d){c.removeEventListener(MOVE_EVENT,k,!1);c.removeEventListener(UP_EVENT,l,!1);c.removeEventListener("touchcancel",l,!1);c.addEventListener(MOVE_EVENT,h,!1);c.addEventListener(UP_EVENT,m,!1);c.addEventListener("touchcancel",m,!1);var e=a.touches?a.touches[0]:a;c.pos=new Vector2(e.pageX,e.pageY);r()}b.endPinch&&b.endPinch();0==d&&m(a)}function n(a){p.timeoutID||(p.timeoutID=
setTimeout(function(){p.horizontalAllowed=!1;p.timeoutID=null},a))}function m(a){var b=a.currentTarget;Modernizr.touch&&a.touches&&0!=a.touches.length||(b.removeEventListener(MOVE_EVENT,h,!1),b.removeEventListener(UP_EVENT,m,!1),b.removeEventListener("touchcancel",m,!1),b.removeEventListener("mouseout",m,!1),b.addEventListener(DOWN_EVENT,e,!1));p.xDiff=0;p.yDiff=0;n(z)}function r(){p.timeStamp=(new Date).getTime();p.moveTime=0;p.movePath=[];p.trackLength=0;p.slideDisabledThisTime=!1;p.dv0x=0;p.vDiff.set(0,
0)}var s=1.15,w=0.8,y=innerWidth/4,z=1250;a.addEventListener(DOWN_EVENT,e,!1);var p={};p.vDiff=new Vector2(0,0)}function x(a,b){var c=a.pageX-b.pageX,d=a.pageY-b.pageY;return Math.sqrt(c*c+d*d)}var q=new Vector2(0,0),n=0.1,m,t=new OnePage(b,function(a){k("change",a)});this.goToPage=function(a){t.goToPage(a)};var y=this;setInterval(function(){y.width==innerWidth&&y.height==innerHeight||y.resize()},500);this.resize=function(){var a=innerWidth-this.width;this.width=innerWidth;this.height=innerHeight;
t.getImageLoaded()&&k("resize",!1,a);t.resize()};var w,z=function(){var a=document.createElement("p");a.style.opacity="0.7";a.style.backgroundColor="#e0efee";a.style.color="#11111f";a.style.fontSize="18px";a.style.zIndex=1E3;a.style.position="absolute";this.element=a};z.prototype.setText=function(a){this.element.innerText=a};z.prototype.positionMe=function(a){this.element.style.left=px(a.x-this.element.offsetWidth/2);this.element.style.top=px(a.y-this.element.offsetHeight/2)};var h=new z;this.startPinch=
function(a){b.appendChild(h.element);h.positionMe(a);w?(clearTimeout(w),w=null):t.startPinchMode()};this.endPinch=function(){b.removeChild(h.element);w=setTimeout(function(){t.stopPinchMode();w=null;r()},t.isStub()?0:500)};this.sendPinch=function(b,d,e){n*b<m.map[0]?b=m.map[0]/n:n*b>m.map[m.map.length-1]&&(b=m.map[m.map.length-1]/n);d=d.add(e.sub(q).mul(1-b));d=q.add(d);b*=n;d=g(d,b);a(b,!0);c(d,!0);h.setText(window.LOCALS.ZOOM+" "+(100*n).toFixed(0)+"%");h.positionMe(e)};this.incZoom=function(){l(!0)};
this.decZoom=function(){l(!1)};this.setHighlight=function(a){t.setHighlight(a)};var C=getKeepZoomScaleWhileFlipping(publicationData.type);this.set=function(a,c){setElementPosition(b,{left:0,top:0});t.set(a,c);this.resize();d();s(b,this,publicationData.type!=PT_PHOTOALBUM)};this.handleDoubleClick=function(a){a=a.touches?a.touches[0]:a;a=new Vector2(a.pageX,a.pageY);l(!0,!0,a)}};
