if(typeof XML=="undefined")XML=function(){};XML.ObjTree=function(){return this};XML.ObjTree.VERSION="0.24";XML.ObjTree.prototype.xmlDecl='\n';XML.ObjTree.prototype.attr_prefix="-";XML.ObjTree.prototype.overrideMimeType="text/xml"; XML.ObjTree.prototype.parseXML=function(a){var b;if(window.DOMParser){b=new DOMParser;a=b.parseFromString(a,"application/xml");if(!a)return;b=a.documentElement}else if(window.ActiveXObject){b=new ActiveXObject("Microsoft.XMLDOM");b.async=false;b.loadXML(a);b=b.documentElement}if(b)return this.parseDOM(b)}; XML.ObjTree.prototype.parseHTTP=function(a,b,c){var d={},e;for(e in b)d[e]=b[e];if(!d.method)d.method=typeof d.postBody=="undefined"&&typeof d.postbody=="undefined"&&typeof d.parameters=="undefined"?"get":"post";if(c){d.asynchronous=true;var g=this,f=d.onComplete;d.onComplete=function(j){var k;if(j&&j.responseXML&&j.responseXML.documentElement)k=g.parseDOM(j.responseXML.documentElement);else if(j&&j.responseText)k=g.parseXML(j.responseText);c(k,j);f&&f(j)}}else d.asynchronous=false;var h;if(typeof HTTP!= "undefined"&&HTTP.Request){d.uri=a;if(a=new HTTP.Request(d))h=a.transport}else if(typeof Ajax!="undefined"&&Ajax.Request)if(a=new Ajax.Request(a,d))h=a.transport;if(c)return h;if(h&&h.responseXML&&h.responseXML.documentElement)return this.parseDOM(h.responseXML.documentElement);else if(h&&h.responseText)return this.parseXML(h.responseText)}; XML.ObjTree.prototype.parseDOM=function(a){if(a){this.__force_array={};if(this.force_array)for(var b=0;b":typeof g=="object"&&g.constructor==Array?this.array_to_xml(e,g):typeof g=="object"?this.hash_to_xml(e,g):this.scalar_to_xml(e,g);else d[d.length]=" "+e.substring(1)+'="'+this.xml_escape(g)+'"'}d=d.join("");e=c.join("");typeof a=="undefined"||a==null||(e=c.length>0?e.match(/\n/)?"<"+a+d+">\n"+e+"\n": "<"+a+d+">"+e+"\n":"<"+a+d+" />\n");return e};XML.ObjTree.prototype.array_to_xml=function(a,b){for(var c=[],d=0;d":typeof e=="object"&&e.constructor==Array?this.array_to_xml(a,e):typeof e=="object"?this.hash_to_xml(a,e):this.scalar_to_xml(a,e)}return c.join("")};XML.ObjTree.prototype.scalar_to_xml=function(a,b){return a=="#text"?this.xml_escape(b):"<"+a+">"+this.xml_escape(b)+"\n"}; XML.ObjTree.prototype.xml_escape=function(a){return String(a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}; var bookData={loaded:false,background:"",load:function(a){function b(d){var e={},g,f=1;if(d.length)for(g in d){g=d[g];e[f]={};if(g.title)e[f].name=g.title["@value"];if(g.pageNumber)e[f].page=g.pageNumber["@value"];if(g.children){e[f].children={};e[f].children.tocElement=b(g.children.tocData)}f++}else{e[1]={};if(d.title)e[1].name=d.title["@value"];if(d.pageNumber)e[1].page=d.pageNumber["@value"];if(d.children){e[1].children={};e[1].children.tocElement=b(d.children.tocData)}}return e}var c=new XML.ObjTree; c.attr_prefix="@";a=c.parseDOM(a);a=a["#document"];this.size={};this.size.width=a.Properties.bookProperties.bookWidth?a.Properties.bookProperties.bookWidth["@value"]:600;this.size.height=a.Properties.bookProperties.bookHeight?a.Properties.bookProperties.bookHeight["@value"]:800;bookData.background=a.Properties.bookProperties.bookBG["@src"];bookData.TOC={};if(a.Properties.tableOfContent.tocData.children){bookData.TOC.tocElement={};bookData.TOC.tocElement=b(a.Properties.tableOfContent.tocData.children.tocData)}this.page= {};c=0;for(item in a.Properties.bookProperties.pages.elements.page){c++;item=a.Properties.bookProperties.pages.elements.page[item];bookData.page[c]={};bookData.page[c].width=item.width?item.isWide&&item.isWide["@value"]=="true"?item.width["@value"]/2:item.width["@value"]:item.isWide&&item.isWide["@value"]=="true"?a.Properties.bookProperties.pages.defaultValue.width["@value"]/2:a.Properties.bookProperties.pages.defaultValue.width["@value"];bookData.page[c].height=item.height?item.height["@value"]: a.Properties.bookProperties.pages.defaultValue.height["@value"];bookData.page[c].proportions=(bookData.page[c].width/bookData.page[c].height-0.0010).toFixed(2);bookData.page[c].stub=item.isStub?true:false;if(item.isWide&&item.isWide["@value"]=="true"){bookData.page[c+1]={};bookData.page[c+1].height=bookData.page[c].height;bookData.page[c+1].width=bookData.page[c].width;bookData.page[c+1].stub=bookData.page[c].stub;bookData.page[c+1].proportions=bookData.page[c].proportions;bookData.page[c].wide=true; bookData.page[c+1].wide=true;bookData.page[c].src=images.getImagePath(item.id["@value"],"stand",true,1);bookData.page[c+1].src=images.getImagePath(item.id["@value"],"stand",true,2);bookData.page[c].srcZoom=images.getImagePath(item.id["@value"],"zoom",true,1);bookData.page[c+1].srcZoom=images.getImagePath(item.id["@value"],"zoom",true,2);if(item.links){bookData.page[c].links={};this.linksImport(item,c)}c++}else{bookData.page[c].src=images.getImagePath(item.id["@value"]);bookData.page[c].srcZoom=images.getImagePath(item.id["@value"], "zoom");bookData.page[c].wide=false;if(item.links){bookData.page[c].links={};this.linksImport(item,c)}}}this.pageCount=c;c=null;this.size.proportions=(bookData.size.width/bookData.size.height-0.0010).toFixed(2);this.loaded=true},linksImport:function(a,b,c){c=c||"normal";a=a.links.link[0]?a.links.link:[a.links.link];for(var d=0;dbookData.size.width*1){bookData.page[b+1].links[d].x=a[d].x["@value"]- bookData.size.width*1;bookData.page[b].links[d].width=a[d].width["@value"]}else if(a[d].x["@value"]*1bookData.size.width*1){bookData.page[b].links[d].x=a[d].x["@value"];bookData.page[b+1].links[d].x=0;bookData.page[b].links[d].width=a[d].width["@value"]*1-a[d].x["@value"]*1;bookData.page[b+1].links[d].width=a[d].x["@value"]*1+a[d].width["@value"]*1-bookData.size.width*1}else{bookData.page[b].links[d].x=a[d].x["@value"];bookData.page[b].links[d].width= a[d].width["@value"]}bookData.page[b].links[d].y=a[d].y["@value"]}else{bookData.page[b].links[d].x=a[d].x["@value"];bookData.page[b].links[d].y=a[d].y["@value"];bookData.page[b].links[d].width=a[d].width["@value"]}bookData.page[b].links[d].height=a[d].height["@value"];if(a[d].page["@id"])bookData.page[b].links[d].page=a[d].page["@id"];if(a[d].urls){bookData.page[b].links[d].urls=[];if(a[d].urls.url[0])for(var e=0;e250&&orientationObserver.getOrientation()=="landscape"?window.innerHeight: window.innerHeight<250&&orientationObserver.getOrientation()=="landscape"?window.innerHeight+60:window.innerHeight:browser.publisher.name==="publisher"?window.innerHeight*2:window.innerHeight},proportions:function(){return(this.width()/this.height()).toFixed(2)},name:function(){var a;a=window.innerWidth<=480&&browser.platform.ios&&orientationObserver.getOrientation()=="landscape"?"iPhone3G":"android";a=window.innerWidth<=320&&browser.platform.ios&&orientationObserver.getOrientation()=="portrait"? "iPhone3G":a;a=window.innerWidth<=960&&window.innerWidth>480&&browser.platform.ios&&orientationObserver.getOrientation()=="landscape"?"iPhone4G":a;a=window.innerWidth<=640&&window.innerWidth>320&&browser.platform.ios&&orientationObserver.getOrientation()=="portrait"?"iPhone4G":a;a=window.innerWidth<=1024&&window.innerWidth>960&&browser.platform.ios&&orientationObserver.getOrientation()=="landscape"?"iPad":a;a=window.innerWidth<=768&&window.innerWidth>640&&browser.platform.ios&&orientationObserver.getOrientation()== "portrait"?"iPad":a;return a=browser.platform.android==true?"android":a}},eventManager={touchInterface:false,leftAndRightArea:0.15,gesture:false,touchStartCoordinate:{x:0,y:0},clickStartCoordinate:{x:0,y:0},click:false,clickCount:0,doubleClickTime:250,start:function(){if("createTouch"in document){eventManager.touchInterface=true;eventManager.loadTouchEvents()}else{eventManager.touchInterface=false;eventManager.loadClickEvents()}},loadTouchEvents:function(){var a=document.getElementById("mainFrame"), b=function(h){h.preventDefault();eventManager.gesture=true;delete b},c=function(h){h.preventDefault();delete c},d=function(h){h.preventDefault();window.setTimeout(function(){eventManager.gesture=false},10);delete d};a.addEventListener("gesturestart",b);a.addEventListener("gesturechange",c);a.addEventListener("gestureend",d);var e=function(h){pager.state=="input"&&pager.cancelInput();eventManager.touchStartCoordinate.x=h.targetTouches[0].pageX;eventManager.touchStartCoordinate.y=h.targetTouches[0].pageY; if(twoPageBook.installed&&!zoomBook.installed)twoPageBook.events.touchStart(h);else if(onePageBook.installed&&!zoomBook.installed)onePageBook.events.touchStart(h);else zoomBook.installed&&zoomBook.events.touchStart(h);h.preventDefault();delete e},g=function(h){if(twoPageBook.installed&&!zoomBook.installed)twoPageBook.events.touchMove(h);else if(onePageBook.installed&&!zoomBook.installed)onePageBook.events.touchMove(h);else zoomBook.installed&&zoomBook.events.touchMove(h);h.preventDefault();delete g}, f=function(h){if(twoPageBook.installed&&!zoomBook.installed)twoPageBook.events.touchEnd(h);else if(onePageBook.installed&&!zoomBook.installed)onePageBook.events.touchEnd(h);else zoomBook.installed&&zoomBook.events.touchEnd(h);h.preventDefault();delete f};a.addEventListener("touchstart",e);a.addEventListener("touchmove",g);a.addEventListener("touchend",f);delete null},loadClickEvents:function(){var a=function(){event.preventDefault();eventManager.click=true;pager.state=="input"&&pager.cancelInput(); eventManager.clickStartCoordinate.x=event.pageX;eventManager.clickStartCoordinate.y=event.pageY;if(twoPageBook.installed&&!zoomBook.installed)twoPageBook.events.mousedown(event);else if(onePageBook.installed&&!zoomBook.installed)onePageBook.events.mousedown(event);else zoomBook.installed&&zoomBook.events.mousedown(event);delete a},b=function(){event.preventDefault();eventManager.click=false;if(twoPageBook.installed&&!zoomBook.installed)twoPageBook.events.mouseup(event);else if(onePageBook.installed&& !zoomBook.installed)onePageBook.events.mouseup(event);else zoomBook.installed&&zoomBook.events.mouseup(event);delete b},c=function(){event.preventDefault();if(eventManager.click)if(twoPageBook.installed&&!zoomBook.installed)twoPageBook.events.mousemove(event);else if(onePageBook.installed&&!zoomBook.installed)onePageBook.events.mousemove(event);else zoomBook.installed&&zoomBook.events.mousemove(event);delete c},d=document.getElementById("mainFrame");d.addEventListener("mousedown",a);d.addEventListener("mousemove", c);d.addEventListener("mouseup",b);delete null},pagerEvent:function(){document.getElementById("pagerCurrentPage").addEventListener("click",pager.enableInput)},pagerInputEvent:function(){if(pager.installed&&pager.state=="input"){var a=function(b){if(b.keyCode==13){pager.change();pageMediator.goToPage(b.target.value)}delete a};document.getElementById("inputPage").addEventListener("keydown",a)}},linkClick:function(a,b,c,d){if(eventManager.touchInterface)var e=a.changedTouches[0].pageX-a.target.getBoundingClientRect().left, g=a.changedTouches[0].pageY-a.target.getBoundingClientRect().top;else{e=a.clientX-a.target.getBoundingClientRect().left;g=a.clientY-a.target.getBoundingClientRect().top}for(linkI in bookData.page[b].links){var f=bookData.page[b].links[linkI];if(e>=f.x*c&&e<=f.x*c+f.width*c&&g>=(f.y*d).toFixed(0)*1&&g<=((f.y*d).toFixed(0)*1+f.height*d).toFixed(0)*1){a.preventDefault();a.stopPropagation();var h=f.x*c,j=f.y*d;if(eventManager.touchInterface){var k=a.target.getContext("2d"),o=k.getImageData(h,j,f.width* c+10,f.height*d+10);k.fillStyle="rgba(0,0,0,0.4)";k.fillRect(f.x*c,f.y*d,f.width*c,f.height*d);(function(l){a.target.addEventListener("touchend",function(){k.putImageData(o,h,j);l.page&&pageMediator.goToPage(l.page);if(l.urls)for(var m=0;m9)e="00"+a;if(a>99)e="0"+a;if(a>999)e=""+a;if(dir==null)PATH_TO_PROPERTIES=photographer_img;if((b||"")==="zoom")return c?PATH_TO_PROPERTIES+"page"+e+"_i2_"+d+".jpg?id="+Math.random().toFixed(5)*1E5:PATH_TO_PROPERTIES+"page"+e+"_i2.jpg?id="+Math.random().toFixed(5)*1E5;if(device.name()=="iPhone3G")return c?PATH_TO_PROPERTIES+"page"+e+"_i1_"+d+".jpg?id="+Math.random().toFixed(5)*1E5:PATH_TO_PROPERTIES+"page"+e+"_i1.jpg?id="+Math.random().toFixed(5)* 1E5;if(device.name()=="iPhone4G")return c?PATH_TO_PROPERTIES+"page"+e+"_i1_"+d+".jpg?id="+Math.random().toFixed(5)*1E5:PATH_TO_PROPERTIES+"page"+e+"_i1.jpg?id="+Math.random().toFixed(5)*1E5;if(device.name()=="iPad")return c?PATH_TO_PROPERTIES+"page"+e+"_i1_"+d+".jpg?id="+Math.random().toFixed(5)*1E5:PATH_TO_PROPERTIES+"page"+e+"_i1.jpg?id="+Math.random().toFixed(5)*1E5;if(device.name()=="android")return c?PATH_TO_PROPERTIES+"page"+e+"_i1_"+d+".jpg?id="+Math.random().toFixed(5)*1E5:PATH_TO_PROPERTIES+ "page"+e+"_i1.jpg?id="+Math.random().toFixed(5)*1E5;if(device.name()=="other")return c?PATH_TO_PROPERTIES+"page"+e+"_i2_"+d+".jpg?id="+Math.random().toFixed(5)*1E5:PATH_TO_PROPERTIES+"page"+e+"_i2.jpg?id="+Math.random().toFixed(5)*1E5},init:function(){this.image.onload=this.loadImage},loadImage:function(){var a=this.id;if(el.id("canvas"+a)){preloader.deletePreloader(a*1);var b=el.id("canvas"+a).getContext("2d");if(twoPageBook.installed&&!zoomBook.installed)var c=twoPageBook.bookWidth/2,d=twoPageBook.bookHeight; else if(onePageBook.installed&&!zoomBook.installed){c=onePageBook.bookWidth;d=onePageBook.bookHeight}else if(zoomBook.installed){c=zoomBook.pageWidth;d=zoomBook.pageHeight}if(bookData.page[a].proportions>=bookData.size.proportions){var e=c,g=(e/bookData.page[a].proportions).toFixed(0);c=(d-g)/2}else{g=d;e=(g*bookData.page[a].proportions).toFixed(0);c=bookData.page[a].wide&&a%2==0?c-e:0}bookData.page[a].proportions>=bookData.size.proportions?b.drawImage(images.image,0,c,e,g):b.drawImage(images.image, c,0,e,g);if(a!=1&&a!=bookData.pageCount&&twoPageBook.installed)images.drawShadow(b,a);else a==bookData.pageCount&&a%2!=0&&images.drawShadow(b,a)}if(images.imageStack.length>0)images.shiftImage();else images.processing=false},drawShadow:function(a,b){if(b%2==0){var c=a.createLinearGradient(twoPageBook.bookWidth/2-twoPageBook.bookWidth/10,0,twoPageBook.bookWidth/2,0);c.addColorStop(0,"rgba(0,0,0,0.0)");c.addColorStop(0.4,"rgba(0,0,0,0.05)");c.addColorStop(0.8,"rgba(0,0,0,0.20)");c.addColorStop(1,"rgba(0,0,0,0.15)")}else{c= a.createLinearGradient(twoPageBook.bookWidth/20,0,0,0);c.addColorStop(0,"rgba(0,0,0,0)");c.addColorStop(0.6,"rgba(0,0,0,0.1)");c.addColorStop(0.95,"rgba(0,0,0,0.2)");c.addColorStop(1,"rgba(0,0,0,0.65)")}a.fillStyle=c;if(b%2==0){a.fillRect(twoPageBook.bookWidth/2-twoPageBook.bookWidth/4,0,twoPageBook.bookWidth/4,twoPageBook.bookHeight);a.beginPath();a.moveTo(twoPageBook.bookWidth/2,0);a.lineTo(twoPageBook.bookWidth/2,twoPageBook.bookHeight);a.strokeStyle="rgba(0,0,0,0.1)";a.stroke()}else a.fillRect(0, 0,twoPageBook.bookWidth/10,twoPageBook.bookHeight)},shiftImage:function(){if(this.imageStack.length>0){this.processing=true;var a=this.imageStack.shift();this.image.id=a;this.image.src=zoomBook.installed?bookData.page[a].srcZoom+Math.random().toFixed(5)*1E5:bookData.page[a].src+Math.random().toFixed(5)*1E5}},push:function(a){this.imageStack.push(a);this.processing||this.shiftImage()},deleteImageFromStack:function(a){a=images.imageStack.indexOf(a);a!=-1&&images.imageStack.splice(a,1)}},links={currStorage:"", currCanvas:"",currX:0,currY:0,currGoPage:0,isLinkBool:false,currURLs:0,drawRect:function(a){links.clearRect();if(onePageBook.installed)var b=onePageBook.currentPage;else if(twoPageBook.installed)if(a.target.id=="canvas"+twoPageBook.currentPage.left)b=twoPageBook.currentPage.left;else{if(a.target.id=="canvas"+twoPageBook.currentPage.right)b=twoPageBook.currentPage.right}else if(zoomBook.installed)b=zoomBook.currentPage;var c=a.target.width/bookData.size.width,d=a.target.height/bookData.size.height; if(eventManager.touchInterface)var e=eventManager.touchStartCoordinate.x-a.target.getBoundingClientRect().left,g=eventManager.touchStartCoordinate.y-a.target.getBoundingClientRect().top;else{e=a.clientX-a.target.getBoundingClientRect().left;g=a.clientY-a.target.getBoundingClientRect().top}for(linkI in bookData.page[b].links){var f=bookData.page[b].links[linkI];links.isLinkBool=false;if(e>=f.x*c&&e<=f.x*c+f.width*c&&g>=(f.y*d).toFixed(0)*1&&g<=((f.y*d).toFixed(0)*1+f.height*d).toFixed(0)*1){links.currX= f.x*c;links.currY=f.y*d;b=a.target.getContext("2d");links.currCanvas=a.target.id;links.currStorage=b.getImageData(links.currX,links.currY,f.width*c+10,f.height*d+10);b.fillStyle="rgba(0,0,0,0.3)";b.fillRect(f.x*c,f.y*d,f.width*c,f.height*d);links.currGoPage=f.page?f.page:0;links.currURLs=f.urls?f.urls:0;links.isLinkBool=true;break}}},clearRect:function(){if(el.id(links.currCanvas)){el.id(links.currCanvas).getContext("2d").putImageData(links.currStorage,links.currX,links.currY);links.isLinkBool=false}}}; document.addEventListener("DOMContentLoaded",function(){if(dir=="./<%=FilesFolderName%>/")dir="files";PATH_TO_PROPERTIES="../"+assetsFolder+"/mobile/";if(dir==null){PATH_TO_PROPERTIES=photographer_dir;STYLES_SRC=photographer_src}var a=function(){browser.detect();preloader.init();bookData.load(this.responseXML);images.init();workspace.draw();toolbar.draw();toc.init();pager.draw();orientationObserver.start();eventManager.start();if(browser.platform.ios)if(orientationObserver.getOrientation()==="landscape")device.name()== "iPad"?twoPageBook.draw(1):onePageBook.draw(1);else orientationObserver.getOrientation()==="portrait"?onePageBook.draw(1):twoPageBook.draw(1);else if(browser.platform.android)browser.publisher.name=="Publisher2"?twoPageBook.draw(1):onePageBook.draw(1);else twoPageBook.draw(1);if(browser.publisher.name==="publisher"){el.id("scaler").style.position="absolute";el.id("scaler").style.overflow="hidden";el.id("scaler").style.width=window.innerWidth+"px";el.id("scaler").style.height=window.innerHeight+"px"; el.id("body").style.webkitTransform="scale(0.5) translate(-"+device.width()/2+"px,-"+device.height()/2+"px)"}if(bookData.background!="image/grey-inner.jpg"&&bookData.background!="image/grey-outer.jpg"&&bookData.background!="image/dark-wood-inner.jpg"&&bookData.background!="image/dark-wood-outer.jpg"&&bookData.background!="image/sky-blue-inner.jpg"&&bookData.background!="image/sky-blue-outer.jpg"){el.id("body").style.backgroundImage="url(../"+assetsFolder+"/"+bookData.background+")";el.id("mainFrame").style.backgroundImage= "url(../"+assetsFolder+"/"+bookData.background+")"}window.setTimeout(function(){window.scrollTo(0,1)},10);delete a},b=new XMLHttpRequest;b.open("GET",PATH_TO_PROPERTIES+"properties.xml");b.onload=a;b.send();delete b}); var el={id:function(a){return document.getElementById(a)},tag:function(a){return document.getElementsByTagName(a)[0]},tags:function(a){return document.getElementsByTagName(a)},add:function(a){return document.createElement(a)},del:function(a){el.id(a).parentNode.removeChild(el.id(a))},Class:function(){return document.getElementsByClassName(tag)}},onePageBook={currentPage:0,installed:false,nextPageBuffer:2,prevPageBuffer:2,flipSpeed:600,triggerStopTime:700,bookWidth:0,bookHeight:0,bookTop:0,bookLeft:0, draw:function(a){if(bookData.size.proportions0&&a<=bookData.pageCount&&!el.id("canvas"+a)){var b=el.add("canvas");b.id="canvas"+a;b.className="canvasBook";b.width=onePageBook.bookWidth;b.height=onePageBook.bookHeight;b.style.position="absolute";b.style.left=a1&&timer.check("fx")){onePageBook.slideFxPage(onePageBook.currentPage-1);if(el.id("bookPortrait").childNodes.length==5){var a=onePageBook.currentPage*1+onePageBook.nextPageBuffer*1;images.deleteImageFromStack(a);onePageBook.destroyPage(a);window.scrollTo(0, 1)}onePageBook.currentPage--;onePageBook.drawPage(onePageBook.currentPage-onePageBook.prevPageBuffer);pager.change();timer.setBlockTime(twoPageBook.flipSpeed/2,twoPageBook.flipSpeed)}toc.tocLock||toc.hide()},slideFxPage:function(a){if(abookData.pageCount)a=bookData.pageCount;if(a==onePageBook.currentPage)pageMediator.change();else if(a==onePageBook.currentPage*1+1)onePageBook.next();else if(a==onePageBook.currentPage* 1-1)onePageBook.prev();else if(a>0&&a<=bookData.pageCount&&timer.check("fx")){if(a*1>onePageBook.currentPage*1)var b=onePageBook.currentPage*1+1,c=onePageBook.currentPage;else c=b=onePageBook.currentPage-1;var d=el.id("canvas"+b).getContext("2d");d.fillStyle="rgb(255,255,255)";d.fillRect(0,0,onePageBook.bookWidth,onePageBook.bookHeight);preloader.add(b);preloader.setSpecial(b);this.slideFxPage(c);this.currentPage=a;pager.change();var e=function(){onePageBook.destroy();onePageBook.draw(a);window.scrollTo(0, 1);delete e};d=null;window.setTimeout(e,onePageBook.flipSpeed);b=c=null}},destroyOtherPages:function(){for(var a=onePageBook.currentPage*1+onePageBook.nextPageBuffer*1,b=onePageBook.currentPage-onePageBook.prevPageBuffer;b<=a;b++)b!=onePageBook.currentPage&&b>0&&b<=bookData.pageCount&&el.del("canvas"+b)},goToZoom:function(){this.destroyOtherPages();var a=orientationObserver.getOrientation()=="portrait"?browser.publisher.name==="publisher"?screen.height/2/onePageBook.bookWidth:screen.height/onePageBook.bookWidth: browser.publisher.name==="publisher"?window.innerWidth*2/onePageBook.bookWidth:window.innerWidth/onePageBook.bookWidth,b=el.id("canvas"+onePageBook.currentPage);if(b.style.left||b.style.left=="0px"){b.style.webkitTransitionDuration="0ms";b.style.webkitTransform=device.name=="android"?"translate(0px, 0px)":"translate3d(0px, 0px,0px)";b.style.left="0px"}var c=function(){b.style.webkitTransitionDuration=zoomBook.zoomIOSpeed+"ms";b.style.webkitTransform=device.name()=="android"?"scale("+a+")":"scale3d("+ a+","+a+",1)";delete c};window.setTimeout(c,1);var d=function(){onePageBook.installed=false;onePageBook.destroyPage(onePageBook.currentPage);el.del("bookPortrait");zoomBook.draw(onePageBook.currentPage,a);delete d};window.setTimeout(d,zoomBook.zoomIOSpeed+10)},destroy:function(){preloader.stopAll();el.del("bookPortrait");onePageBook.installed=false}}; onePageBook.events={tapCount:0,clickCount:0,doubleTapTime:250,doubleClickTime:250,leftAndRightArea:0.15,touchStart:function(a){a.target.tagName=="CANVAS"&&links.drawRect(a)},touchMove:function(a){if(links.isLinkBool){var b=a.targetTouches[0].pageY-eventManager.touchStartCoordinate.y;if(Math.abs(a.targetTouches[0].pageX-eventManager.touchStartCoordinate.x)>10||Math.abs(b)>10)links.clearRect()}delete a},touchEnd:function(a){if(!zoomBook.installed)if(eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX< -50)onePageBook.events.flipRight();else eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX>50?onePageBook.events.flipLeft():onePageBook.events.touchManger(a)},touchManger:function(a){if(links.isLinkBool&&links.currURLs){links.clearRect();if(links.currURLs)for(var b=0;b50?onePageBook.events.flipLeft():onePageBook.events.clickManger(event)}}, mousemove:function(a){if(links.isLinkBool){var b=a.pageY-eventManager.clickStartCoordinate.y;if(Math.abs(a.pageX-eventManager.clickStartCoordinate.x)>10||Math.abs(b)>10)links.clearRect()}delete a},clickManger:function(a){if(links.isLinkBool&&links.currURLs){links.clearRect();if(links.currURLs)for(var b=0;bdevice.width()-device.width()*onePageBook.events.leftAndRightArea?onePageBook.next(): toolbar.toogle();delete a},doubleTap:function(){links.isLinkBool&&links.clearRect();onePageBook.goToZoom()},singleClick:function(a){if(links.isLinkBool){links.clearRect();links.currGoPage&&onePageBook.goToPage(links.currGoPage);if(links.currURLs)for(a=0;adevice.width()-device.width()*onePageBook.events.leftAndRightArea?onePageBook.next():toolbar.toogle(); delete a}},doubleClick:function(){links.isLinkBool&&links.clearRect();onePageBook.goToZoom()},flipLeft:function(){onePageBook.next()},flipRight:function(){onePageBook.prev()}}; var orientationObserver={start:function(){if(browser.platform.android){window.addEventListener("resize",workspace.reDraw,false);var a=function(){if(onePageBook.installed){onePageBook.destroy();onePageBook.draw(onePageBook.currentPage)}delete a};window.addEventListener("resize",a,false)}else{window.addEventListener("orientationchange",workspace.reDraw,false);a=function(){if(device.name()=="iPad")if(orientationObserver.getOrientation()=="portrait"){if(twoPageBook.installed){twoPageBook.destroy();onePageBook.draw(twoPageBook.currentPage.right)}}else{if(orientationObserver.getOrientation()== "landscape")if(onePageBook.installed){onePageBook.destroy();twoPageBook.draw(onePageBook.currentPage)}}else if(onePageBook.installed){onePageBook.destroy();onePageBook.draw(onePageBook.currentPage)}delete a};window.addEventListener("orientationchange",a,false)}},stop:function(){browser.platform.android?window.removeEventListener("resize",workspace.reDraw,false):window.removeEventListener("orientationchange",workspace.reDraw,false)},getOrientation:function(){if(browser.platform.android){if(device.width()> device.height())return"landscape";if(device.width()0&&twoPageBook.currentPage.right<=bookData.pageCount){a=el.id("pagerCurrentPage");a.removeChild(a.childNodes[0]);nTe=document.createTextNode(twoPageBook.currentPage.left+"-"+twoPageBook.currentPage.right);a.appendChild(nTe)}else if(twoPageBook.currentPage.left<= 0){a=el.id("pagerCurrentPage");a.removeChild(a.childNodes[0]);nTe=document.createTextNode(twoPageBook.currentPage.right);a.appendChild(nTe)}else{if(twoPageBook.currentPage.right>bookData.pageCount){a=el.id("pagerCurrentPage");a.removeChild(a.childNodes[0]);nTe=document.createTextNode(twoPageBook.currentPage.left);a.appendChild(nTe)}}else if(zoomBook.installed){a=el.id("pagerCurrentPage");a.removeChild(a.childNodes[0]);nTe=document.createTextNode(zoomBook.currentPage);a.appendChild(nTe)}},enableInput:function(a){a.preventDefault(); pager.state="input";var b=el.add("input");b.id="inputPage";b.type="number";b.style.height=toolbar.toolbarHeight/100*40+"px";b.style.width=toolbar.toolbarHeight/100*120+"px";b.style.verticalAlign="text-top";b.style.padding="0px";b.style.border="1px solid white";b.style.textAlign="center";var c=el.id("pagerCurrentPage");c.parentNode.replaceChild(b,c);b.focus();eventManager.pagerInputEvent();a.preventDefault()},cancelInput:function(){var a=toolbar.toolbarHeight/100*40,b=(toolbar.toolbarHeight-(a+4))/ 2,c=el.add("span");c.id="pagerCurrentPage";c.style.margin=b+"px 0 0 0";c.style.color="#e5e5e5";c.style.fontSize=a+"px";if(onePageBook.installed)a=onePageBook.currentPage;else if(twoPageBook.installed){a="";if(twoPageBook.currentPage.left>0&&twoPageBook.currentPage.left<=bookData.pageCount)a=a+twoPageBook.currentPage.left+"-";if(twoPageBook.currentPage.right>0&&twoPageBook.currentPage.right<=bookData.pageCount)a+=twoPageBook.currentPage.right}else a=zoomBook.installed?zoomBook.currentPage:"0";a=document.createTextNode(a); c.appendChild(a);c.addEventListener("click",pager.enableInput);a=el.id("inputPage");a.parentNode.replaceChild(c,a);pager.state="show"}},preloader={image:new Image,interval:null,preloadersStack:[],imageLoad:false,angle:0,special:0,init:function(){this.image.src=STYLES_SRC+"progress.png";this.image.onload=function(){preloader.imageLoad=true;if(preloader.preloadersStack.length>0){for(var a=0;a0&&twoPageBook.currentPage.left<=bookData.pageCount)a=a+twoPageBook.currentPage.left+"-";if(twoPageBook.currentPage.right>0&&twoPageBook.currentPage.right<=bookData.pageCount)a+=twoPageBook.currentPage.right;if(twoPageBook.currentPage.left==bookData.pageCount||twoPageBook.currentPage.right==bookData.pageCount)a=bookData.pageCount}else a="0";a==bookData.pageCount?pageMediator.goToPage(1):pageMediator.slideNext();pager.change()},2E3);toc&&toc.hide()},stop:function(){slideShow.state= "unlock";clearInterval(slideShow.interval)},toGo:function(){if(slideShow.state=="lock")slideShow.stop();else slideShow.state=="unlock"&&slideShow.play()}}; timer={state:true,blockTime:0,endFX:0,startTime:Date.now(),setBlockTime:function(a,b){this.endFX=b||a;this.blockTime=a;this.startTime=Date.now()},check:function(a){a=a||"standart";if(a=="standart")return Date.now()-this.startTime>this.blockTime?true:false;else if(a=="high")return true;else if(a=="fx")return Date.now()-this.startTime>this.endFX?true:false}}; var toc={installed:false,state:"hide",mark:0,level:[],tocLock:false,shiftSpeed:800,parseLevel:function(a){var b;for(i=0;i1){var b=toc.parseLevel(a-1);toc.content.leftShift();toc.mark=toc.level[a-1];toc.level=toc.level.slice(0,a-1);toc.content.generate(b);el.id("LI"+toc.mark).style.background="#888888";toc.backButton.check()}}},lable:{draw:function(){var a=el.add("div");a.style.position="absolute";a.style.left="65px";a.style.top="30px";a.style.height="20px";a.style.width="200px";a.id="tocContentLable";a.style.overflow="hidden";var b=el.add("h1"); b.align="center";b.style.color="#e5e5e5";b.style.fontSize="16px";var c=document.createTextNode("Table of Contents");b.appendChild(c);a.appendChild(b);el.id("tocContentBorder").appendChild(a)}},border:{width:344,draw:function(){toc.border.width=device.width()<344?device.width():344;var a=0.8*device.height(),b=el.add("div");b.style.position="absolute";b.style.left="2px";b.style.top="35px";b.style.height=a+"px";b.style.width=toc.border.width+"px";b.id="tocContentBorder";b.overflow="hidden";el.id("topToolbar").appendChild(b); el.id("tocContentBorder").innerHTML='
';b=el.add("div");b.style.position="absolute";b.style.left="6px";b.style.top="65px";b.style.height=a-95+"px";b.style.width=toc.border.width-24+"px";b.id="tocContent"; b.style.overflow="hidden";el.id("tocContentBorder").appendChild(b)}},content:{generate:function(a){var b=el.add("div");b.style.width=toc.border.width-24+"px";b.id="tocContentInner";b.style.position="absolute";el.id("tocContent").appendChild(b);toc.events.scroll();if(a){b=el.add("ul");b.id="UL";el.id("tocContentInner").appendChild(b);for(var c in a.tocElement){b=el.add("li");b.id="LI"+c;b.style.borderBottom="1px dotted #aaaaaa";b.style.padding="10px";b.style.listStyleType="none";b.style.cursor="pointer"; var d=document.createTextNode(a.tocElement[c].name);b.appendChild(d);if(a.tocElement[c].children){d=el.add("img");d.src=STYLES_SRC+"subToc.png";d.align="right";b.appendChild(d)}el.id("UL").appendChild(b);toc.events.subToc("LI"+c)}}},remove:function(){el.del("tocContentInner")},draw:function(){var a=toc.parseLevel(toc.level.length);a&&toc.content.generate(a)},subToc:function(a){a=1*a.substring(2);var b=toc.level.length,c=toc.parseLevel(b);toc.tocLock=true;pageMediator.goToPage(c.tocElement[a].page); if(c.tocElement[a].children){toc.content.rightShift();toc.level[b]=a;toc.content.generate(c.tocElement[toc.level[b]].children);toc.backButton.check()}},rightShift:function(){toc.content.remove()},leftShift:function(){toc.content.remove()}},display:function(){if(slideShow.state=="unlock"){toc.state="display";toc.border.draw();toc.lable.draw();toc.backButton.draw();toc.level[0]=0;toc.content.draw()}window.addEventListener("orientationchange",toc.hide,false)},hide:function(){if(toc.state=="display"){toc.state= "hide";toc.level=[];el.del("tocContentBorder")}}}; toc.events={touchInterface:false,downCLk:false,moveCLk:false,startY:0,currY:0,deltaY:0,init:function(){toc.events.touchInterface="createTouch"in document?true:false},tocButton:function(){if(toc.events.touchInterface==false){el.id("tocButton").addEventListener("mouseup",toc.tocButton.action);el.id("tocButton").addEventListener("mousedown",toc.tocButton.down);el.id("tocButton").addEventListener("mouseup",toc.tocButton.up)}else{el.id("tocButton").addEventListener("touchend",toc.tocButton.action);el.id("tocButton").addEventListener("touchstart", toc.tocButton.down);el.id("tocButton").addEventListener("touchend",toc.tocButton.up)}},backButton:function(){if(toc.events.touchInterface==false){el.id("backButton").addEventListener("mouseup",toc.backButton.action);el.id("backButton").addEventListener("mousedown",toc.backButton.down);el.id("backButton").addEventListener("mouseup",toc.backButton.check)}else{el.id("backButton").addEventListener("touchend",toc.backButton.action);el.id("backButton").addEventListener("touchstart",toc.backButton.down); el.id("backButton").addEventListener("touchend",toc.backButton.check)}},subToc:function(a){if(toc.events.touchInterface==false){el.id(a).addEventListener("mousedown",toc.events.downSubToc);el.id(a).addEventListener("mouseup",toc.events.upSubToc)}else{el.id(a).addEventListener("touchstart",toc.events.downSubToc);el.id(a).addEventListener("touchend",toc.events.upSubToc)}},scroll:function(){if(toc.events.touchInterface==false){el.id("tocContentInner").addEventListener("mousedown",toc.events.down);el.id("tocContentInner").addEventListener("mouseup", toc.events.up);el.id("tocContentInner").addEventListener("mousemove",toc.events.move)}else{el.id("tocContentInner").addEventListener("touchstart",toc.events.down);el.id("tocContentInner").addEventListener("touchend",toc.events.up);el.id("tocContentInner").addEventListener("touchcancel",toc.events.up);el.id("tocContentInner").addEventListener("touchmove",toc.events.move)}},getId:function(a){return a.id?a.id:a.parentNode.id},downSubToc:function(a){a.preventDefault();a=toc.events.getId(a.target);a=a.substring(2); if(timer.check("fx"))el.id("LI"+a).style.background="#bbbbbb";if(a!=toc.mark&&toc.mark>0){el.id("LI"+toc.mark).style.background="";toc.mark=0}},upSubToc:function(a){a.preventDefault();a=toc.events.getId(a.target);el.id("LI"+a.substring(2)).style.background="";if(toc.events.deltaY==0&&timer.check("fx")){toc.content.subToc(a);toc.mark=0}},down:function(a){a.preventDefault();toc.events.downClk=true;toc.events.startY=toc.events.touchInterface==false?a.pageY-el.id("tocContentInner").offsetTop:a.targetTouches[0].clientY- el.id("tocContentInner").offsetTop;toc.events.deltaY=0},up:function(a){a.preventDefault();toc.events.downClk=false},move:function(a){a.preventDefault();if(toc.events.downClk==true){a.preventDefault();var b=toc.events.getId(a.target);el.id("LI"+b.substring(2)).style.background="";toc.events.currY=toc.events.touchInterface==false?a.pageY:a.targetTouches[0].clientY;toc.events.deltaY=toc.events.currY-toc.events.startY;a=el.id("tocContent").offsetHeight-el.id("tocContentInner").offsetHeight;if(toc.events.deltaY+ el.id("tocContentInner").offsetTop>=0)el.id("tocContentInner").style.top="0px";else if(toc.events.deltaY>=a)el.id("tocContentInner").style.top=toc.events.deltaY+"px"}}}; var toolbar={toolbarHeight:40,status:"hide",installed:false,keyStateCheck:function(){if(onePageBook.installed)var a=onePageBook.currentPage;else if(twoPageBook.installed){a="";if(twoPageBook.currentPage.left>0&&twoPageBook.currentPage.left<=bookData.pageCount)a=a+twoPageBook.currentPage.left+"-";if(twoPageBook.currentPage.right>0&&twoPageBook.currentPage.right<=bookData.pageCount)a+=twoPageBook.currentPage.right;if(twoPageBook.currentPage.left==bookData.pageCount||twoPageBook.currentPage.right==bookData.pageCount)a= bookData.pageCount}else a=zoomBook.installed?zoomBook.currentPage:"0";if(slideShow.state=="lock"){el.id("keyFirst").src=STYLES_SRC+"inActiveFirst.png";el.id("keyPrev").src=STYLES_SRC+"inActivePrev.png";el.id("keyLast").src=STYLES_SRC+"inActiveLast.png";el.id("keyNext").src=STYLES_SRC+"inActiveNext.png"}else{if(a==1){el.id("keyFirst").src=STYLES_SRC+"inActiveFirst.png";el.id("keyPrev").src=STYLES_SRC+"inActivePrev.png"}else{el.id("keyFirst").src=STYLES_SRC+"activeFirst.png";el.id("keyPrev").src=STYLES_SRC+ "activePrev.png"}if(a==bookData.pageCount){el.id("keyLast").src=STYLES_SRC+"inActiveLast.png";el.id("keyNext").src=STYLES_SRC+"inActiveNext.png"}else{el.id("keyLast").src=STYLES_SRC+"activeLast.png";el.id("keyNext").src=STYLES_SRC+"activeNext.png"}}},draw:function(){if(!el.id("topToolbar")){var a=el.add("div");a.className="topToolbar";a.id="topToolbar";a.style.height=toolbar.toolbarHeight+"px";a.style.top="-"+toolbar.toolbarHeight-2+"px";el.id("body").appendChild(a)}if(!el.id("bottomToolbar")){a= el.add("div");a.className="bottomToolbar";a.id="bottomToolbar";a.style.height=toolbar.toolbarHeight+"px";a.style.bottom="-"+toolbar.toolbarHeight-2+"px";var b=el.add("img");b.src=STYLES_SRC+"activeLast.png";b.id="keyLast";b.style.height="20px";b.style.margin="10px 20px 0 0";b.style.cursor="pointer";b.style.cssFloat="right";b.addEventListener("click",pageMediator.last);a.appendChild(b);b=el.add("img");b.src=STYLES_SRC+"activeNext.png";b.id="keyNext";b.style.height="20px";b.style.margin="10px 20px 0 0"; b.style.cursor="pointer";b.style.cssFloat="right";b.addEventListener("click",pageMediator.next);a.appendChild(b);b=el.add("img");b.src=STYLES_SRC+"slideShow.png";b.id="keySlideShow";b.style.height="20px";b.style.margin="10px 20px 0 0";b.style.cursor="pointer";b.style.cssFloat="right";b.addEventListener("click",pageMediator.slideShow);a.appendChild(b);b=el.add("img");b.src=STYLES_SRC+"inActivePrev.png";b.id="keyPrev";b.style.height="20px";b.style.margin="10px 20px 0 0";b.style.cursor="pointer";b.style.cssFloat= "right";b.addEventListener("click",pageMediator.prev);a.appendChild(b);b=el.add("img");b.src=STYLES_SRC+"inActiveFirst.png";b.id="keyFirst";b.style.height="20px";b.style.margin="10px 20px 0 0";b.style.cursor="pointer";b.style.cssFloat="right";b.addEventListener("click",pageMediator.first);a.appendChild(b);el.id("body").appendChild(a)}toolbar.setToolbarHeight();toolbar.installed=true},setToolbarHeight:function(){toolbar.toolbarHeight=40},toogle:function(){pager.state=="input"&&pager.cancelInput(); if(this.status=="show"){var a=-toolbar.toolbarHeight-2;toolbar.status="hide";toc.hide()}else{a=toolbar.toolbarHeight+2;toolbar.status="show"}el.id("topToolbar").style.webkitTransformStyle="flat";el.id("topToolbar").style.webkitTransition="0.3s";el.id("topToolbar").style.webkitTransform="translateY("+a+"px) translateZ(100px)";el.id("bottomToolbar").style.webkitTransformStyle="flat";el.id("bottomToolbar").style.webkitTransition="0.3s";el.id("bottomToolbar").style.webkitTransform="translateY("+-a+"px) translateZ(100px)"}}, twoPageBook={currentPage:{left:0,right:0},installed:false,nextPageBuffer:2,prevPageBuffer:2,flipSpeed:800,triggerStopTime:850,bookWidth:0,bookHeight:0,bookTop:0,bookLeft:0,pageConverter:function(a){if(a%2!=0){twoPageBook.currentPage.left=a-1;twoPageBook.currentPage.right=a}else{twoPageBook.currentPage.left=a;twoPageBook.currentPage.right=a*1+1}twoPageBook.currentPage.left*=1;twoPageBook.currentPage.right*=1},draw:function(a){twoPageBook.pageConverter(a);if(bookData.size.proportions*2twoPageBook.currentPage.left-twoPageBook.prevPageBuffer*2;b-=2)twoPageBook.drawPage(b,a,"left");for(b=twoPageBook.currentPage.right*1;b0&&a<=bookData.pageCount){var h=el.add("div");h.id=d;h.style.position="absolute";h.style.cssFloat= c;if(c=="right")h.style.left=twoPageBook.bookWidth/2+"px";h.style.width=twoPageBook.bookWidth/2+"px";h.style.height=twoPageBook.bookHeight+"px";h.style.webkitTransformStyle="preserve-3d";h.style.webkitTransition="-webkit-transform 1s";h.style.webkitTransform=g;h.style.zIndex=f+"";b.appendChild(h);twoPageBook.drawCanvasPage(a,h,"front")}e>0&&e<=bookData.pageCount&&twoPageBook.drawCanvasPage(e,h,"back");delete b}},drawCanvasPage:function(a,b,c){var d=el.add("canvas");d.id="canvas"+a;d.className="canvasBook"; d.width=twoPageBook.bookWidth/2;d.height=twoPageBook.bookHeight;d.style.position="absolute";d.style.webkitBackfaceVisibility="hidden";d.style.webkitTransform=c=="front"?"":"rotateY(180deg)";d.style.zIndex=c=="front"?"1":"-1";c=d.getContext("2d");c.fillStyle="rgb(255,255,255)";c.fillRect(0,0,twoPageBook.bookWidth/2,twoPageBook.bookHeight);a==1||a==bookData.pageCount&&a%2==0||images.drawShadow(c,a);b.appendChild(d);if(!bookData.page[a].stub){images.push(a);preloader.add(a)}},next:function(){if(twoPageBook.installed&& twoPageBook.currentPage.right0&&timer.check("fx")){twoPageBook.flipFxCurrentPage(twoPageBook.currentPage.left);if(el.id("bookLandscape").childNodes.length==4){var a=twoPageBook.currentPage.left*1+(twoPageBook.prevPageBuffer*2-1),b=twoPageBook.currentPage.right* 1+(twoPageBook.prevPageBuffer*2-1);images.deleteImageFromStack(a);images.deleteImageFromStack(b);el.del(twoPageBook.currentPage.left*1+(twoPageBook.prevPageBuffer*2-1)+"x"+(twoPageBook.currentPage.right+(twoPageBook.prevPageBuffer*2-1)));preloader.deletePreloader(a);preloader.deletePreloader(b)}twoPageBook.currentPage.left-=2;twoPageBook.currentPage.right-=2;a=twoPageBook.currentPage.left*1-twoPageBook.prevPageBuffer;el.id(a)||twoPageBook.drawPage(a,el.id("bookLandscape"),"left");pageMediator.change(); timer.setBlockTime(twoPageBook.flipSpeed/2,twoPageBook.flipSpeed)}},goToPage:function(a){if(a<0)a=1;else if(a>bookData.pageCount)a=bookData.pageCount;if(a==twoPageBook.currentPage.left||a==twoPageBook.currentPage.right)pageMediator.change();else if(a==twoPageBook.currentPage.right*1+1||a==twoPageBook.currentPage.right*1+2)twoPageBook.next();else if(a==twoPageBook.currentPage.left*1-1||a==twoPageBook.currentPage.left*1-2)twoPageBook.prev();else if(a>0&&a<=bookData.pageCount&&timer.check("fx")){if(a> twoPageBook.currentPage.right){if(a==bookData.pageCount&&a%2==0){for(var b=1,c=(twoPageBook.nextPageBuffer-1)*2;b0){if(device.name()=="android"){b=el.id(this.currentPage.left-1+"x"+this.currentPage.left);if(b.style.webkitTransform=="rotateY(0deg)"){c=a==2||a==bookData.countPages? "rotateY(179."+(1E4-(bookData.pageCount-a))+"deg)":"rotateY( 179."+(1E4-(bookData.pageCount-a))+"deg)";d="100% 100%"}else{c="rotateY(0deg)";d="0% 0%"}}else{b=el.id(this.currentPage.left-1+"x"+this.currentPage.left);if(b.style.webkitTransform=="rotate3d(0, -1, 0, 0deg)"||b.style.webkitTransform=="rotate3d(0, 1, 0, 0deg)"){c="rotate3d(0, 1, 0, 179."+(1E4-(bookData.pageCount-a))+"deg)";d="100% 100%"}else{c="rotate3d(0, 1, 0, 0deg)";d="0% 0%"}}e=bookData.pageCount-this.currentPage.left}b.style.webkitTransform= c+"";b.style.webkitTransformOrigin=d+"";b.style.webkitTransitionTimingFunction="cubic-bezier(0, 0, 1, 0.95)";b.style.webkitTransitionDuration=this.flipSpeed+"ms";var g=function(){b.style.zIndex=e+"";for(var f=b.getElementsByTagName("*"),h=0;h10||Math.abs(b)>10)links.clearRect()}delete a},touchEnd:function(a){if(eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX<-50)twoPageBook.events.flipRight(); else eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX>50?twoPageBook.events.flipLeft():twoPageBook.events.touchManger(a);delete a},mousedown:function(a){a.target.tagName=="CANVAS"&&links.drawRect(a);delete a},mousemove:function(a){if(links.isLinkBool){var b=a.pageY-eventManager.clickStartCoordinate.y;if(Math.abs(a.pageX-eventManager.clickStartCoordinate.x)>10||Math.abs(b)>10)links.clearRect()}delete a},mouseup:function(a){if(eventManager.clickStartCoordinate.x-a.pageX<-50)twoPageBook.events.flipRight(); else eventManager.clickStartCoordinate.x-a.pageX>50?twoPageBook.events.flipLeft():twoPageBook.events.clickManger(a);delete a},touchManger:function(a){if(links.isLinkBool&&links.currURLs){links.clearRect();if(links.currURLs)for(var b=0;bdevice.width()-device.width()*twoPageBook.events.leftAndRightArea?twoPageBook.next():toolbar.toogle();delete a},doubleTap:function(a){links.isLinkBool&&links.clearRect();a.target.tagName=="CANVAS"&&twoPageBook.goToZoom(a)}, singleClick:function(a){if(links.isLinkBool){links.clearRect();links.currGoPage&&twoPageBook.goToPage(links.currGoPage)}else{if(a.xdevice.width()-device.width()*twoPageBook.events.leftAndRightArea?twoPageBook.next():toolbar.toogle();delete a;a=null}delete a},doubleClick:function(a){links.isLinkBool&&links.clearRect();a.target.tagName=="CANVAS"&&twoPageBook.goToZoom(a)},flipLeft:function(){twoPageBook.next()},flipRight:function(){twoPageBook.prev()}}; var workspace={draw:function(){var a=device.width()+"px",b=device.height()+"px";el.id("mainFrame").style.width=a;el.id("mainFrame").style.height=b;el.id("body").style.width=a;el.id("body").style.height=b},reDraw:function(){workspace.draw()}},zoomBook={currentPage:0,installed:false,verticalScroll:false,horizontalScroll:false,pageAreaWidth:0,pageAreaHeight:0,pageWidth:0,pageHeight:0,topShift:0,leftShift:0,translateScrollX:0,translateScrollY:0,zoomFactor:0,currentPage:0,nextPageBuffer:1,prevPageBuffer:1, slideSpeed:800,zoomIOSpeed:800,sourcePageHeight:0,sourcePageWidth:0,initSizes:function(a,b,c,d){this.zoomFactor=a;this.currentPage=d;this.pageWidth=b;this.pageHeight=c;this.pageAreaWidth=b>device.width()?b:device.width();this.pageAreaHeight=c>device.height()?c:device.height();this.pageAreaWidth=this.pageAreaWidth;this.translateScrollY=((this.pageAreaHeight-device.height())/2).toFixed(0);this.translateScrollX=((this.pageAreaWidth-device.width())/2).toFixed(0);this.topShift=((device.height()-c)/2).toFixed(0); this.leftShift=((device.width()-b)/2).toFixed(0);if(b.toFixed(0)>=device.width()){this.horizontalScroll=true;this.leftShift=0}else{this.horizontalScroll=false;this.translateScrollX=0}if(c.toFixed(0)>device.height()){this.verticalScroll=true;this.topShift=0}else{this.verticalScroll=false;this.translateScrollY=0}this.translateX=this.pageAreaWidth*(this.currentPage-1)+this.translateScrollX*1},draw:function(a,b,c,d){el.id("keySlideShow").src=STYLES_SRC+"inActiveSlideShow.png";b=b||this.zoomFactor;if(bookData.size.proportions< device.proportions()){onePageBook.bookHeight=(device.height()-50).toFixed(0);onePageBook.bookWidth=(onePageBook.bookHeight*bookData.size.proportions).toFixed(0)}else{onePageBook.bookWidth=device.width()-50;onePageBook.bookHeight=(onePageBook.bookWidth/bookData.size.proportions).toFixed(0)}this.sourcePageWidth=c||onePageBook.bookWidth;this.sourcePageHeight=d||onePageBook.bookHeight;pageWidth=this.sourcePageWidth*b;pageHeight=this.sourcePageHeight*b;this.initSizes(b,pageWidth,pageHeight,a);if(!el.id("zoomBook")){b= el.add("div");b.id="zoomBook";b.style.webkitPerspective="3000";b.style.position="absolute";b.style.width=this.pageAreaWidth+"px";b.style.height=this.pageAreaHeight+"px";b.style.webkitBackfaceVisibility="hidden";b.style.webkitTransform="translate3d("+-(this.translateScrollX*1)+"px,"+-this.translateScrollY+"px,0px)";el.id("mainFrame").appendChild(b)}zoomBook.installed=true;pager.change();for(b=a-zoomBook.prevPageBuffer;b<=a*1+zoomBook.nextPageBuffer;b++)zoomBook.drawPage(b)},drawPage:function(a){if(a> 0&&a<=bookData.pageCount){var b=el.add("canvas");b.id="canvas"+a;b.className="canvasZoom";b.width=zoomBook.pageWidth;b.height=zoomBook.pageHeight;b.style.left=zoomBook.leftShift+"px";b.style.position="absolute";b.style.webkitBackfaceVisibility="hidden";b.style.webkitTransform="translate3d("+(a-zoomBook.currentPage)*zoomBook.pageAreaWidth+"px, 0px, 0px)";var c=b.getContext("2d");c.fillStyle="rgb(255,255,255)";c.fillRect(0,0,zoomBook.pageWidth,zoomBook.pageHeight);el.id("zoomBook").appendChild(b);if(!bookData.page[a].stub){images.push(a); preloader.add(a)}}},moveFX:function(a){for(var b=zoomBook.currentPage*1-zoomBook.prevPageBuffer;b<=zoomBook.currentPage*1+zoomBook.nextPageBuffer;b++)if(b>0&&b<=bookData.pageCount){if(el.id("canvas"+b)){var c=el.id("canvas"+b),d=(b-zoomBook.currentPage-a*1)*zoomBook.pageAreaWidth;c.style.webkitTransitionDuration=zoomBook.slideSpeed+"ms";c.style.webkitTransform="translate3d("+d+"px, 0px, 0px)"}this.adjustmentFX()}},adjustmentFX:function(){this.translateScrollX=this.translateScrollY=0;var a=el.id("zoomBook"); a.style.webkitTransitionDuration=zoomBook.slideSpeed+"ms";a.style.webkitTransform="translate3d("+-this.translateScrollX+"px,"+-this.translateScrollY+"px,0px)"},next:function(){if(zoomBook.currentPage1&&timer.check("fx")){zoomBook.moveFX(-1);zoomBook.currentPage--;pager.change();var a=function(){var b=zoomBook.currentPage*1+zoomBook.nextPageBuffer*1+1;el.id("canvas"+b)&&el.del("canvas"+b);images.deleteImageFromStack(b);preloader.deletePreloader(b);delete a;zoomBook.drawPage(zoomBook.currentPage*1-zoomBook.prevPageBuffer)}; window.setTimeout(a,zoomBook.slideSpeed);timer.setBlockTime(zoomBook.slideSpeed/2,zoomBook.slideSpeed)}},destroy:function(){preloader.stopAll();el.del("zoomBook")},goToPage:function(a){if(a<0)a=1;else if(a>bookData.pageCount)a=bookData.pageCount;if(a==zoomBook.currentPage)pageMediator.change();else if(a==zoomBook.currentPage*1+1)zoomBook.next();else if(a==zoomBook.currentPage*1-1)zoomBook.prev();else if(a>0&&a<=bookData.pageCount&&timer.check("fx")){if(a*1>zoomBook.currentPage*1){var b=zoomBook.currentPage* 1+1,c=el.id("canvas"+b).getContext("2d");b=null;c.fillStyle="rgb(255,255,255)";c.fillRect(0,0,zoomBook.pageWidth,zoomBook.pageHeight);preloader.add(zoomBook.currentPage*1+1);preloader.setSpecial(zoomBook.currentPage*1+1);zoomBook.moveFX(1)}else{b=zoomBook.currentPage*1-1;c=el.id("canvas"+b).getContext("2d");b=null;c.fillStyle="rgb(255,255,255)";c.fillRect(0,0,zoomBook.pageWidth,zoomBook.pageHeight);preloader.add(zoomBook.currentPage*1-1);preloader.setSpecial(zoomBook.currentPage*1-1);zoomBook.moveFX(-1)}zoomBook.currentPage= a;pager.change();var d=function(){zoomBook.destroy();zoomBook.draw(a,zoomBook.zoomFactor,zoomBook.sourcePageWidth,zoomBook.sourcePageHeight);zoomBook.adjustmentFX();delete d};c=null;window.setTimeout(d,zoomBook.slideSpeed)}},scroll:function(a,b){if(this.horizontalScroll)if(this.translateScrollX-a>this.pageWidth-device.width()){var c=this.pageWidth-device.width()-this.translateScrollX;a=-(c-(a+c)/2)}else{if(this.translateScrollX-a<0)a=this.translateScrollX*1-(this.translateScrollX*1-a)/3}else a=0; if(this.verticalScroll)if(this.translateScrollY-b>this.pageHeight-device.height()){c=this.pageHeight-device.height()-this.translateScrollY;b=-(c-(b+c)/2)}else{if(this.translateScrollY-b<0)b=this.translateScrollY*1-(this.translateScrollY*1-b)/3}else b=0;c=el.id("zoomBook");c.style.webkitTransitionDuration="0ms";c.style.webkitTransform="translate3d("+(-this.translateScrollX*1+a*1)+"px,"+(-this.translateScrollY*1+b*1)+"px,0px)"},scrollEnd:function(a,b){var c=this.horizontalScroll?device.name()=="iPad"? -300:-125:device.name()=="iPad"?-130:-50;if(this.translateScrollX-a>this.pageWidth-device.width()&&athis.pageHeight-device.height())this.translateScrollY=this.pageHeight-device.height();else if(this.translateScrollY-b<0)this.translateScrollY=0;else this.translateScrollY-=b;if(this.horizontalScroll)if(this.translateScrollX- a>this.pageWidth-device.width())this.translateScrollX=this.pageWidth-device.width();else if(this.translateScrollX-a<0)this.translateScrollX=0;else this.translateScrollX-=a;c=el.id("zoomBook");c.style.webkitTransitionDuration="300ms";c.style.webkitTransform="translate3d("+-this.translateScrollX+"px,"+-this.translateScrollY+"px,0px)"}maxDeltaX=null},zoomOut:function(){el.id("keySlideShow").src=STYLES_SRC+"SlideShow.png";if(orientationObserver.getOrientation()=="portrait"||device.name()=="android"&& browser.publisher.name!="Publisher2"){if(bookData.size.proportions0&&b<=bookData.pageCount&&el.del("canvas"+b)}}; zoomBook.events={tapCount:0,clickCount:0,doubleTapTime:250,doubleClickTime:250,leftAndRightArea:0.15,touchStart:function(a){a.target.tagName=="CANVAS"&&links.drawRect(a);delete a},touchMove:function(a){var b=a.targetTouches[0].pageX-eventManager.touchStartCoordinate.x,c=a.targetTouches[0].pageY-eventManager.touchStartCoordinate.y;if(links.isLinkBool&&(Math.abs(b)>2||Math.abs(c)>2))links.clearRect();zoomBook.scroll(b,c);delete a},touchEnd:function(a){Math.abs(eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX)> 2||Math.abs(eventManager.touchStartCoordinate.y-a.changedTouches[0].pageY)>2?zoomBook.scrollEnd(a.changedTouches[0].pageX-eventManager.touchStartCoordinate.x,a.changedTouches[0].pageY-eventManager.touchStartCoordinate.y):zoomBook.events.touchManger(a)},mousedown:function(a){a.target.tagName=="CANVAS"&&links.drawRect(a);delete a},mousemove:function(a){var b=a.pageX-eventManager.clickStartCoordinate.x,c=a.pageY-eventManager.clickStartCoordinate.y;if(links.isLinkBool&&(Math.abs(b)>2||Math.abs(c)>2))links.clearRect(); zoomBook.scroll(b,c);delete a},mouseup:function(a){Math.abs(eventManager.clickStartCoordinate.x-a.pageX)>2||Math.abs(eventManager.clickStartCoordinate.y-a.pageY)>2?zoomBook.scrollEnd(a.pageX-eventManager.clickStartCoordinate.x,a.pageY-eventManager.clickStartCoordinate.y):zoomBook.events.clickManger(a)},touchManger:function(a){if(links.isLinkBool&&links.currURLs){links.clearRect();if(links.currURLs){for(var b=0;bdevice.width()-device.width()* zoomBook.events.leftAndRightArea?zoomBook.next():toolbar.toogle();delete a},doubleTap:function(){links.isLinkBool&&links.clearRect();zoomBook.zoomOut()},singleClick:function(a){if(links.isLinkBool){links.clearRect();links.currGoPage&&zoomBook.goToPage(links.currGoPage)}else{var b=browser.publisher.name==="publisher"?device.width()/2:device.width();if(a.xb-b*twoPageBook.events.leftAndRightArea?zoomBook.next():toolbar.toogle()}delete a}, doubleClick:function(a){links.isLinkBool&&links.clearRect();zoomBook.zoomOut(a)},flipLeft:function(){zoomBook.next()},flipRight:function(){zoomBook.prev()}};