!function(a){"use strict";function b(){var a=-1;if("Microsoft Internet Explorer"==navigator.appName){var b=navigator.userAgent,c=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=c.exec(b)&&(a=parseFloat(RegExp.$1))}else if("Netscape"==navigator.appName){var b=navigator.userAgent,c=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");null!=c.exec(b)&&(a=parseFloat(RegExp.$1))}return a}function c(){function c(b){var c=a.document.cookie.match(new RegExp("(?:^|; )"+b.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return c?decodeURIComponent(c[1]):void 0}this.isMobile=!1,this.isFlash=!1,this.isBasic=!1,this.ua=navigator.userAgent.toLowerCase();var d="undefined",e="object",f="Shockwave Flash",g="ShockwaveFlash.ShockwaveFlash",h="application/x-shockwave-flash",i=[0,0,0],j=navigator.platform.toLowerCase(),k=this.ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,"unknown",0];if(typeof navigator.plugins!==d&&typeof navigator.plugins[f]===e){var l=navigator.plugins[f].description;if(l&&(typeof navigator.mimeTypes==d||!navigator.mimeTypes[h]||navigator.mimeTypes[h].enabledPlugin)){var m=!1;l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),i[0]=parseInt(l.replace(/^(.*)\..*$/,"$1"),10),i[1]=parseInt(l.replace(/^.*\.(.*)\s.*$/,"$1"),10),i[2]=/[a-zA-Z]/.test(l)?parseInt(l.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else if(typeof window.ActiveXObject!==d)try{var n=new ActiveXObject(g);n&&(l=n.GetVariable("$version"),l&&(m=!0,l=l.split(" ")[1].split(","),i=[parseInt(l[0],10),parseInt(l[1],10),parseInt(l[2],10)]))}catch(a){}0===i[0]&&0===i[1]&&0===i[2]?this.flash=!1:this.flash=!0,this.publisher={},this.publisher.isOn="undefined"!=typeof c("publisher"),this.browser={},this.platform={},this.device={},this.browser.name="version"==k[1]?k[3]:k[1],this.browser.name="unknown"==this.browser.name?"safari":this.browser.name,this.browser[this.browser.name]=!0;var o="ie"==k[1]&&document.documentMode;if(this.browser.version=o||parseFloat("opera"==k[1]&&k[4]?k[4]:k[2]),this.platform.name=this.ua.match(/ip(?:ad|od|hone)/)?"ios":this.ua.match(/(?:trident)/)?"win":(this.ua.match(/(?:webos|android|bada|symbian|palm|blackberry)/)||j.match(/mac|win|linux/)||["other"])[0],("ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0)&&"win"===this.platform.name&&(this.platform.name="wphone"),this.platform[this.platform.name]=!0,this.platform.version=0,this.platform.mac){var p=this.ua.match(/os\sx\s(\d+[\._]*\d*[\._]*\d*)/);this.platform.version="[object Array]"===Object.prototype.toString.call(p)&&p.length>1?p[1].split(/[\._]/):0}else if(this.platform.ios){var p=this.ua.match(/os\s(\d+_*\d*_*\d*)/);this.platform.version="[object Array]"===Object.prototype.toString.call(p)&&p.length>1?p[1].split("_"):0}else if(this.platform.android){var p=this.ua.match(/android\s(\d+\.*\d*\.*\d*)/);this.platform.version="[object Array]"===Object.prototype.toString.call(p)&&p.length>1?p[1].split("."):0}switch(this.platform.verCheck=function(a){return 1*this.platform.version===1*a?0:1*a>1*this.platform.version?-1:1},this.device.name=this.ua.match(/ipad/)?"ipad":this.ua.match(/ipad/)?"ipad":this.ua.match(/iphone/)?"iphone":this.ua.match(/android/)?"android":j.match(/mac|win|linux/)?"pc":"other","wphone"===this.platform.name&&(this.device.name="wphone"),this.device[this.device.name]=!0,this.device.version=this.platform.version[0],this.device.type=this.ua.match(/(mobile\ssafari)|iphone|ipod/)?"mobile":"tablet",this.queryString=function(){var a={},b=window.location.search.substring(1);if(""===b)return a;for(var c=b.split("&"),d=0;d4||4===parseInt(this.platform.version[0],10)&&parseInt(this.platform.version[1],10)>=1),s=q&&this.browser.safari&&b()===-1,t=r&&this.browser.chrome&&b()===-1;if(this.isBasic||this.isMobile||this.isFlash||((q||r)&&"undefined"==typeof COMPATIBLE?this.isMobile=!0:s||t?this.isMobile=!0:this.flash&&this.device.pc&&(i[0]>10||10===i[0]&&i[1]>=3)?this.isFlash=!0:this.isBasic=!0),this._loadVersion(),this.device.android&&!this.browser.chrome){for(var u=document.getElementsByTagName("meta"),v=0;vb._getWindowHeight.call(b)||b.currentWindowWidth>b.currentWindowHeight&&b._getWindowWidth.call(b)d||(c.currentZoom=c.currentZoom+.2,c._setSizes.call(c),c._fontCorrection.call(c))}),this._addEvent(document.getElementById("zoomOut"),"click",function(){1!==c.currentZoom&&(c.currentZoom=c.currentZoom-.2,c._setSizes.call(c),c._fontCorrection.call(c),b("zoom",c.currentZoom,e))})}},b.prototype._getFitScreenSizes=function(a,b,c){c=c||this._getWindowWidth()*(2*this.offset.top),c=Math.round(c);var d=this._getWindowWidth(),e=this._getWindowHeight(),f=d/e,g=0==b?0:a/b,h=Math.round(f>g?0==b?0:a*(e-c)/b:d-c),i=Math.round(f>g?e-c:0==a?0:b*(d-c)/a);return{width:Math.round(h),height:Math.round(i)}},b.prototype._getFitWidthSizes=function(a,b,c){c=c||this._getBoundingClientRect(document.body).width*(2*this.offset.top),c=Math.round(c);var d=this._getBoundingClientRect(document.body).width,e=Math.round(d-c),f=Math.round(b*(d-c)/a);return{width:Math.round(e),height:Math.round(f)}},b.prototype._setSizes=function(){var b=0,c=0;"undefined"!=typeof a.TOC_BOOK_HEIGHT?(this.newRect=a.detector.device.pc?this._getFitScreenSizes(this.pageRect.width,a.TOC_BOOK_HEIGHT):this._getFitWidthSizes(this.pageRect.width,a.TOC_BOOK_HEIGHT),this.pageContainer.style.width=this.newRect.width*this.currentZoom+"px",b=this._getWindowHeight()>this.pageRect.height*this.currentZoom?(this._getWindowHeight()-this.pageRect.height*this.currentZoom)/2:this._getWindowHeight()*this.offset.top,c=this._getWindowWidth()-100>this.newRect.width*this.currentZoom?(this._getWindowWidth()-this.newRect.width*this.currentZoom)/2+"px":this._getWindowWidth()*this.offset.left+"px"):(this.newRect=a.detector.device.pc?this._getFitScreenSizes(this.pageRect.width,this.pageRect.height):this._getFitWidthSizes(this.pageRect.width,this.pageRect.height),this.pageContainer.style.width=this.newRect.width*this.currentZoom+"px",this.pageContainer.style.height=this.newRect.height*this.currentZoom+"px",b=this._getWindowHeight()>this.newRect.height*this.currentZoom?(this._getWindowHeight()-this.newRect.height*this.currentZoom)/2:this._getWindowHeight()*this.offset.top,c=this._getWindowWidth()-100>this.newRect.width*this.currentZoom?(this._getWindowWidth()-this.newRect.width*this.currentZoom)/2+"px":this._getWindowWidth()*this.offset.left+"px"),this.pageContainer.style.left="0",b=b-45>10?b-45:10,"pc"!==a.detector.device.type&&(b=20),this.pageContainer.style.margin=b+"px 0 0 "+c;var d=0==this.pageRect.width?0:this.newRect.width*this.currentZoom*20/this.pageRect.width;this.lastFontSize=d.toFixed(6),document.body.style.fontSize=this.lastFontSize+"px"},b.prototype._fontCorrection=function(){for(var a=this._getElementsByClass("testString"),b=0,c=0,d=a.length;c0?(g.width-h.width)/h.width:0;k*=j,b=b>=k?b:k}document.body.style.fontSize=this.lastFontSize*(1-b)+"px"},b.prototype._parseVideos=function(){for(var a=this._getElementsByClass("videoItem"),b=this,c=0,d=a.length;c50?.35*b.height:.8*b.height;c.style.width=d+"px",c.style.height=d+"px",c.style.margin=-d/2+"px 0 0 "+-d/2+"px"}},b.prototype._showVideo=function(b,c){this.videoFrame=document.createElement("iframe");var d=document.createElement("div"),e=this;this._getFitScreenSizes(1600,900,this._getWindowHeight()/10);d.className="blackoutVideo",document.body.appendChild(d),this._addEvent(d,"click",function(a){a.stopPropagation?a.stopPropagation():a.returnValue=!1,e._hideVideo.call(e)}),"youtube"===c?(this.videoFrame.className=this.videoFrame.className+" youtube-player",this.videoFrame.src="//www.youtube.com/embed/"+b+"?autoplay=1&html5=1"):this.videoFrame.src="//player.vimeo.com/video/"+b+"?title=0&byline=0&portrait=0&color=da4541",a.detector.publisher.isOn&&(this.videoFrame.src+="&publisher=1"),document.body.appendChild(this.videoFrame),this._resizeVideo(),this._addEvent(a.document,"keyup",function(a){a.stopPropagation?a.stopPropagation():a.returnValue=!1;var b=a.keyCode?a.keyCode:a.which;27===b&&e._hideVideo.call(e)}),this._addEvent(window,"resize",function(a){e._resizeVideo()})},b.prototype._resizeVideo=function(){if(this.videoFrame){var a=this._getFitScreenSizes(1600,900,this._getWindowHeight()/10);this.videoFrame.className="videoFrame",this.videoFrame.setAttribute("type","text/html"),this.videoFrame.setAttribute("width",a.width+"px"),this.videoFrame.setAttribute("height",a.height+"px"),this.videoFrame.setAttribute("frameBorder","0"),this.videoFrame.style.top="50%",this.videoFrame.style.left="50%",this.videoFrame.style.margin=-a.height/2+"px 0 0 "+-a.width/2+"px"}},b.prototype._hideVideo=function(){var a=this._getElementsByClass("blackoutVideo");this.videoFrame&&this.videoFrame.parentNode.removeChild(this.videoFrame);for(var b=0,c=a.length;be-2*a||this.imageContainerHeight>f-2*a){var g=this._getFitScreenSizes(this.imageContainerWidth,this.imageContainerHeight,d);this.imageContainer.setAttribute("width",g.width+"px"),this.imageContainer.setAttribute("height",g.height+"px"),this.imageContainer.style.margin=-(g.height/2+a)+"px 0 0 "+(-g.width/2-a)+"px",this.imageContainerCloseButton.style.margin=-(g.height/2+a+15)+"px 0 0 "+(g.width/2+a-15)+"px"}else this.imageContainer.setAttribute("width",b+"px"),this.imageContainer.setAttribute("height",c+"px"),this.imageContainer.style.margin=-(c/2+a)+"px 0 0 "+(-b/2-a)+"px",this.imageContainerCloseButton.style.margin=-(c/2+a+15)+"px 0 0 "+(b/2+a-15)+"px";this.imageContainer.style.borderWidth=a+"px",this.imageContainer.style.top="50%",this.imageContainer.style.left="50%"}},b.prototype._hideGallery=function(){var a=this._getElementsByClass("blackoutGallery"),b=this._getElementsByClass("galleryPreloader");this.imageContainer&&this.imageContainer.parentNode.removeChild(this.imageContainer),this.imageContainerCloseButton&&this.imageContainerCloseButton.parentNode.removeChild(this.imageContainerCloseButton);for(var c=0,d=a.length;c