var bm={installed:!1,isBm:!1,isAdd:!0,isSelect:!1,shiftSpeed:300,init:function(){if(!bm.installed){for(var a in bookData.BM.bmElement);if(void 0!=a)bm.isBm=!0,bm.rasterize.init();bm.installed=!0}},showList:function(){if(bm.isBm)if("hide"==ctrlEngine.state)ctrlEngine.mode="bm",ctrlEngine.display();else if(bm.isEdit=!1,bm.isSelect=!1,"bm"==ctrlEngine.mode)ctrlEngine.hide();else if("toc"==ctrlEngine.mode||"search"==ctrlEngine.mode)ctrlEngine.mode="bm",ctrlEngine.change()},addButton:{action:function(){bm.isAdd? bm.addButton.addBM(pageMediator.getPage()):onePageBook.installed||zoomBook.installed?(bm.rasterize.remFx(pageMediator.getPage()),bookData.BM.rem(pageMediator.getPage()),bm.addButton.remBM()):twoPageBook.installed&&(01*bookData.size.width?(bookData.page[b+1].links[d].x=a[d].x["@value"]-1*bookData.size.width,bookData.page[b].links[d].width=a[d].width["@value"]):1*a[d].x["@value"]<1*bookData.size.width&&1*a[d].x["@value"]+1*a[d].width["@value"]>1*bookData.size.width?(bookData.page[b].links[d].x=a[d].x["@value"],bookData.page[b+1].links[d].x=0,bookData.page[b].links[d].width=1*a[d].width["@value"]-1*a[d].x["@value"],bookData.page[b+1].links[d].width=1*a[d].x["@value"]+1*a[d].width["@value"]- 1*bookData.size.width):(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"]):(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)if(bookData.page[b].links[d].urls=[],a[d].urls.url[0])for(var e= 0;ea.left){if("fat"==bookWidthFx.widthStateL&&"toThin"!=bookWidthFx.widthChangeL)bookWidthFx.widthChangeL="toThin";else if("thin"==bookWidthFx.widthStateL&&"toThin"==bookWidthFx.widthChangeL)bookWidthFx.widthChangeL="none";bookWidthFx.widthStateL="thin";bookWidthFx.shiftL=-9}else{if("thin"==bookWidthFx.widthStateL&&"toFat"!=bookWidthFx.widthChangeL)bookWidthFx.widthChangeL="toFat";else if("fat"==bookWidthFx.widthStateL&&"toFat"==bookWidthFx.widthChangeL)bookWidthFx.widthChangeL="none";bookWidthFx.widthStateL= "fat";bookWidthFx.shiftL=-18}1==a.right?(bookWidthFx.widthChangeB="right"!=bookWidthFx.twoPageState&&"toRight"!=bookWidthFx.widthChangeB?"toRight":"none",bookWidthFx.twoPageState="right"):0==bookData.pageCount%2&&a.left==bookData.pageCount?(bookWidthFx.widthChangeB="left"!=bookWidthFx.twoPageState&&"left"!=bookWidthFx.widthChangeB?"toLeft":"none",bookWidthFx.twoPageState="left"):(bookWidthFx.widthChangeB="Landscape"!=bookWidthFx.twoPageState&&"toLandscape"!=bookWidthFx.widthChangeB?"toLandscape": "none",bookWidthFx.twoPageState="Landscape")}if(3>bookData.pageCount-b&&onePageBook.installed){if("fat"==bookWidthFx.widthStateR&&"toThin"!=bookWidthFx.widthChangeR)bookWidthFx.widthChangeR="toThin";else if("thin"==bookWidthFx.widthStateR&&"toThin"==bookWidthFx.widthChangeR)bookWidthFx.widthChangeR="none";bookWidthFx.widthStateR="thin"}else if(6>bookData.pageCount-b&&twoPageBook.installed){if("fat"==bookWidthFx.widthStateR&&"toThin"!=bookWidthFx.widthChangeR)bookWidthFx.widthChangeR="toThin";else if("thin"== bookWidthFx.widthStateR&&"toThin"==bookWidthFx.widthChangeR)bookWidthFx.widthChangeR="none";bookWidthFx.widthStateR="thin"}else{if("thin"==bookWidthFx.widthStateR&&"toFat"!=bookWidthFx.widthChangeR)bookWidthFx.widthChangeR="toFat";else if("fat"==bookWidthFx.widthStateR&&"toFat"==bookWidthFx.widthChangeR)bookWidthFx.widthChangeR="none";bookWidthFx.widthStateR="fat"}onePageBook.installed?window.setTimeout(bookWidthFx.changeState,onePageBook.flipSpeed):twoPageBook.installed&&("right"==bookWidthFx.twoPageState? bookWidthFx.changeState():"left"==bookWidthFx.twoPageState?bookWidthFx.changeState():window.setTimeout(bookWidthFx.changeState,twoPageBook.flipSpeed))},changeState:function(){if(el.id("bookWidthBG1")){var a;if("toFat"==bookWidthFx.widthChangeL)a=el.id("bookWidthBG1"),a.style.width="18px",a.style.left=bookWidthFx.shiftL+"px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_03.png")',a=el.id("bookWidthBG2"),a.style.width="18px",a.style.left=bookWidthFx.shiftL+"px",a.style.background='url("'+ STYLES_SRC+'bookWidth/bookWidth_07.png")',a=el.id("bookWidthBG3"),a.style.width="18px",a.style.left=bookWidthFx.shiftL+"px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_11.png")';else if("toThin"==bookWidthFx.widthChangeL)a=el.id("bookWidthBG1"),a.style.width="9px",a.style.left=bookWidthFx.shiftL+"px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_03Thin.png")',a=el.id("bookWidthBG2"),a.style.width="9px",a.style.left=bookWidthFx.shiftL+"px",a.style.background='url("'+STYLES_SRC+ 'bookWidth/bookWidth_07Thin.png")',a=el.id("bookWidthBG3"),a.style.width="9px",a.style.left=bookWidthFx.shiftL+"px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_11Thin.png")';if("toFat"==bookWidthFx.widthChangeR)a=el.id("bookWidthBG5"),a.style.width="18px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_05.png")',a=el.id("bookWidthBG6"),a.style.width="18px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_08.png")',a=el.id("bookWidthBG7"),a.style.width="18px",a.style.background= 'url("'+STYLES_SRC+'bookWidth/bookWidth_14.png")';else if("toThin"==bookWidthFx.widthChangeR)a=el.id("bookWidthBG5"),a.style.width="9px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_05Thin.png")',a=el.id("bookWidthBG6"),a.style.width="9px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_08Thin.png")',a=el.id("bookWidthBG7"),a.style.width="9px",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_14Thin.png")';var b=1*twoPageBook.bookWidth/2,b=b.toFixed();if("toLeft"== bookWidthFx.widthChangeB)a=el.id("bookWidthBG1"),a.style.left=bookWidthFx.shiftL+"px",a=el.id("bookWidthBG2"),a.style.left=bookWidthFx.shiftL+"px",a=el.id("bookWidthBG3"),a.style.left=bookWidthFx.shiftL+"px",a=el.id("bookWidthBG4"),a.style.left="0px",a.style.width=b+"px",a=el.id("bookWidthBG5"),a.style.left=b+"px",a=el.id("bookWidthBG6"),a.style.left=b+"px",a=el.id("bookWidthBG7"),a.style.left=b+"px";else if("toRight"==bookWidthFx.widthChangeB)a=el.id("bookWidthBG1"),a.style.left=1*b+1*bookWidthFx.shiftL+ "px",a=el.id("bookWidthBG2"),a.style.left=1*b+1*bookWidthFx.shiftL+"px",a=el.id("bookWidthBG3"),a.style.left=1*b+1*bookWidthFx.shiftL+"px",a=el.id("bookWidthBG4"),a.style.left=b+"px",a.style.width=1*twoPageBook.bookWidth-1*b+"px",a=el.id("bookWidthBG5"),a.style.left=twoPageBook.bookWidth+"px",a=el.id("bookWidthBG6"),a.style.left=twoPageBook.bookWidth+"px",a=el.id("bookWidthBG7"),a.style.left=twoPageBook.bookWidth+"px";else if("toLandscape"==bookWidthFx.widthChangeB)a=el.id("bookWidthBG1"),a.style.left= bookWidthFx.shiftL+"px",a=el.id("bookWidthBG2"),a.style.left=bookWidthFx.shiftL+"px",a=el.id("bookWidthBG3"),a.style.left=bookWidthFx.shiftL+"px",a=el.id("bookWidthBG4"),a.style.left="0px",a.style.width=1*twoPageBook.bookWidth+"px",a=el.id("bookWidthBG5"),a.style.left=1*twoPageBook.bookWidth+"px",a=el.id("bookWidthBG6"),a.style.left=1*twoPageBook.bookWidth+"px",a=el.id("bookWidthBG7"),a.style.left=1*twoPageBook.bookWidth+"px"}else bookWidthFx.draw()},draw:function(){if(onePageBook.installed){var a= el.add("div");a.id="bookWidthBG1";a.style.zIndex="-1";a.style.width="9px";a.style.height="8px";a.style.left="-9px";a.style.top="0px";a.style.position="absolute";a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_03Thin.png")';el.id("bookWidth").appendChild(a);a=el.add("div");a.id="bookWidthBG2";a.style.zIndex="-1";a.style.width="9px";a.style.height=1*onePageBook.bookHeight-8+"px";a.style.left="-9px";a.style.top="8px";a.style.position="absolute";a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_07Thin.png") repeat-y'; el.id("bookWidth").appendChild(a);a=el.add("div");a.id="bookWidthBG3";a.style.zIndex="-1";a.style.width="9px";a.style.height="13px";a.style.left="-9px";a.style.top=1*onePageBook.bookHeight+"px";a.style.position="absolute";a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_11Thin.png")';el.id("bookWidth").appendChild(a);a=el.add("div");a.id="bookWidthBG4";a.style.zIndex="-1";a.style.width=onePageBook.bookWidth+"px";a.style.height="13px";a.style.left="0px";a.style.top=1*onePageBook.bookHeight+ "px";a.style.position="absolute";a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_12.png") repeat-x';el.id("bookWidth").appendChild(a);if("fat"==bookWidthFx.widthStateR)a=el.add("div"),a.id="bookWidthBG5",a.style.zIndex="-1",a.style.width="18px",a.style.height="8px",a.style.left=1*onePageBook.bookWidth+"px",a.style.top="0px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_05.png")',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG6", a.style.zIndex="-1",a.style.width="18px",a.style.height=1*onePageBook.bookHeight-8+"px",a.style.left=1*onePageBook.bookWidth+"px",a.style.top="8px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_08.png") repeat-y',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG7",a.style.zIndex="-1",a.style.width="18px",a.style.height="13px",a.style.left=1*onePageBook.bookWidth+"px",a.style.top=1*onePageBook.bookHeight+"px",a.style.position="absolute",a.style.background= 'url("'+STYLES_SRC+'bookWidth/bookWidth_14.png")',el.id("bookWidth").appendChild(a);else if("thin"==bookWidthFx.widthStateR)a=el.add("div"),a.id="bookWidthBG5",a.style.zIndex="-1",a.style.width="9px",a.style.height="8px",a.style.left=1*onePageBook.bookWidth+"px",a.style.top="0px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_05Thin.png")',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG6",a.style.zIndex="-1",a.style.width="9px",a.style.height= 1*onePageBook.bookHeight-8+"px",a.style.left=1*onePageBook.bookWidth+"px",a.style.top="8px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_08Thin.png") repeat-y',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG7",a.style.zIndex="-1",a.style.width="9px",a.style.height="13px",a.style.left=1*onePageBook.bookWidth+"px",a.style.top=1*onePageBook.bookHeight+"px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_14Thin.png")', el.id("bookWidth").appendChild(a)}else if(twoPageBook.installed){var b=0,c=0,d=0,e=twoPageBook.bookWidth,a=1*twoPageBook.bookWidth/2,a=a.toFixed(),d="right"==bookWidthFx.twoPageState?a:0;"right"==bookWidthFx.twoPageState?b=a:"Landscape"==bookWidthFx.twoPageState&&(b=0);"left"==bookWidthFx.twoPageState?c=a:"Landscape"==bookWidthFx.twoPageState&&(c=0);e="Landscape"==bookWidthFx.twoPageState?1*twoPageBook.bookWidth:1*twoPageBook.bookWidth-a;if("fat"==bookWidthFx.widthStateL)a=el.add("div"),a.id="bookWidthBG1", a.style.zIndex="-1",a.style.width="18px",a.style.height="8px",a.style.left=b-18+"px",a.style.top="0px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_03.png")',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG2",a.style.zIndex="-1",a.style.width="18px",a.style.height=1*twoPageBook.bookHeight-8+"px",a.style.left=b-18+"px",a.style.top="8px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_07.png") repeat-y', el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG3",a.style.zIndex="-1",a.style.width="18px",a.style.height="13px",a.style.left=b-18+"px",a.style.top=1*twoPageBook.bookHeight+"px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_11.png")',el.id("bookWidth").appendChild(a);else if("thin"==bookWidthFx.widthStateL)a=el.add("div"),a.id="bookWidthBG1",a.style.zIndex="-1",a.style.width="9px",a.style.height="8px",a.style.left=b-9+"px",a.style.top="0px", a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_03Thin.png")',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG2",a.style.zIndex="-1",a.style.width="9px",a.style.height=1*twoPageBook.bookHeight-8+"px",a.style.left=b-9+"px",a.style.top="8px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_07Thin.png") repeat-y',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG3",a.style.zIndex="-1",a.style.width= "9px",a.style.height="13px",a.style.left=b-9+"px",a.style.top=1*twoPageBook.bookHeight+"px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_11Thin.png")',el.id("bookWidth").appendChild(a);if("fat"==bookWidthFx.widthStateR)a=el.add("div"),a.id="bookWidthBG5",a.style.zIndex="-1",a.style.width="18px",a.style.height="8px",a.style.left=1*twoPageBook.bookWidth+c+"px",a.style.top="0px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_05.png")', el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG6",a.style.zIndex="-1",a.style.width="18px",a.style.height=1*twoPageBook.bookHeight-8+"px",a.style.left=1*twoPageBook.bookWidth+c+"px",a.style.top="8px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_08.png") repeat-y',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG7",a.style.zIndex="-1",a.style.width="18px",a.style.height="13px",a.style.left=1*twoPageBook.bookWidth+c+"px", a.style.top=1*twoPageBook.bookHeight+"px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_14.png")',el.id("bookWidth").appendChild(a);else if("thin"==bookWidthFx.widthStateR)a=el.add("div"),a.id="bookWidthBG5",a.style.zIndex="-1",a.style.width="9px",a.style.height="8px",a.style.left=1*twoPageBook.bookWidth+c+"px",a.style.top="0px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_05Thin.png")',el.id("bookWidth").appendChild(a), a=el.add("div"),a.id="bookWidthBG6",a.style.zIndex="-1",a.style.width="9px",a.style.height=1*twoPageBook.bookHeight-8+"px",a.style.left=1*twoPageBook.bookWidth+c+"px",a.style.top="8px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_08Thin.png") repeat-y',el.id("bookWidth").appendChild(a),a=el.add("div"),a.id="bookWidthBG7",a.style.zIndex="-1",a.style.width="9px",a.style.height="13px",a.style.left=1*twoPageBook.bookWidth+c+"px",a.style.top=1*twoPageBook.bookHeight+ "px",a.style.position="absolute",a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_14Thin.png")',el.id("bookWidth").appendChild(a);a=el.add("div");a.id="bookWidthBG4";a.style.zIndex="-1";a.style.width=e+"px";a.style.height="13px";a.style.left=d+"px";a.style.top=1*twoPageBook.bookHeight+"px";a.style.position="absolute";a.style.background='url("'+STYLES_SRC+'bookWidth/bookWidth_12.png") repeat-x';el.id("bookWidth").appendChild(a)}}},buttons={bgImg:"#000",bgImgOnclick:"#ccc",height:20,margin:10, fieldWidth:40,fieldHeight:30,infoWidth:25,infoHeight:25,infoMargin:15,navigation:{parentNodeId:"",installed:!1,draw:function(a){var b=el.add("span");b.className="navigationField";b.id="navigationField";a.appendChild(b);buttons.navigation.first.draw(b);buttons.navigation.prev.draw(b);"navigationField"==buttons.slideShow.parentNodeId&&bookData.slideshowVisible&&buttons.slideShow.draw(b);buttons.navigation.next.draw(b);buttons.navigation.last.draw(b);buttons.navigation.installed=!0},first:{srcActive:STYLES_SRC+ "navigation/activefirst.png",srcInActive:STYLES_SRC+"navigation/inactivefirst.png",installed:!1,draw:function(a){var b=el.add("img");b.id="keyFirst";b.className="navigationButtons";b.src=buttons.navigation.first.srcInActive;b.style.height=buttons.navigation.height+"px";b.style.border=buttons.navigation.margin+"px solid transparent";buttons.navigation.first.events(b);buttons.navigation.first.installed=!0;a.appendChild(b)},check:function(a){if(buttons.navigation.first.installed)if(0==a)el.id("keyFirst").src= buttons.navigation.first.srcInActive;else if(1==a)el.id("keyFirst").src=buttons.navigation.first.srcActive},down:function(a){a.stopPropagation();if(!slideShow.active&&-1==el.id("keyFirst").src.indexOf("inactive"))el.id("keyFirst").style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();el.id("keyFirst").style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();bookData.rightToLeftMode?slideShow.active||pageMediator.goToPage(bookData.pageCount):slideShow.active|| pageMediator.goToPage(1)},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.navigation.first.up),a.addEventListener("mouseup",buttons.navigation.first.action),a.addEventListener("mousedown",buttons.navigation.first.down)):(a.addEventListener("touchstart",buttons.navigation.first.down),a.addEventListener("touchend",buttons.navigation.first.up),a.addEventListener("touchend",buttons.navigation.first.action),a.addEventListener("touchmove",buttons.lockMove))}},prev:{srcActive:STYLES_SRC+ "navigation/activeprev.png",srcInActive:STYLES_SRC+"navigation/inactiveprev.png",installed:!1,draw:function(a){var b=el.add("img");b.id="keyPrev";b.className="navigationButtons";b.src=buttons.navigation.prev.srcInActive;b.style.height=buttons.navigation.height+"px";b.style.border=buttons.navigation.margin+"px solid transparent";buttons.navigation.prev.events(b);buttons.navigation.prev.installed=!0;a.appendChild(b)},check:function(a){if(buttons.navigation.prev.installed)if(0==a)el.id("keyPrev").src= buttons.navigation.prev.srcInActive;else if(1==a)el.id("keyPrev").src=buttons.navigation.prev.srcActive},down:function(a){a.stopPropagation();if(!slideShow.active&&-1==el.id("keyPrev").src.indexOf("inactive"))el.id("keyPrev").style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();el.id("keyPrev").style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();bookData.rightToLeftMode?slideShow.active||pageMediator.next():slideShow.active||pageMediator.prev()},events:function(a){!1== eventManager.touchInterface?(a.addEventListener("mouseup",buttons.navigation.prev.up),a.addEventListener("mouseup",buttons.navigation.prev.action),a.addEventListener("mousedown",buttons.navigation.prev.down)):(a.addEventListener("touchstart",buttons.navigation.prev.down),a.addEventListener("touchend",buttons.navigation.prev.up),a.addEventListener("touchend",buttons.navigation.prev.action),a.addEventListener("touchmove",buttons.lockMove))}},next:{srcActive:STYLES_SRC+"navigation/activenext.png",srcInActive:STYLES_SRC+ "navigation/inactivenext.png",installed:!1,draw:function(a){var b=el.add("img");b.id="keyNext";b.className="navigationButtons";b.src=buttons.navigation.next.srcInActive;b.style.height=buttons.navigation.height+"px";b.style.border=buttons.navigation.margin+"px solid transparent";buttons.navigation.next.events(b);buttons.navigation.next.installed=!0;a.appendChild(b)},check:function(a){if(buttons.navigation.next.installed)if(0==a)el.id("keyNext").src=buttons.navigation.next.srcInActive;else if(1==a)el.id("keyNext").src= buttons.navigation.next.srcActive},down:function(a){a.stopPropagation();if(!slideShow.active&&-1==el.id("keyNext").src.indexOf("inactive"))el.id("keyNext").style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();el.id("keyNext").style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();bookData.rightToLeftMode?slideShow.active||pageMediator.prev():slideShow.active||pageMediator.next()},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup", buttons.navigation.next.up),a.addEventListener("mouseup",buttons.navigation.next.action),a.addEventListener("mousedown",buttons.navigation.next.down)):(a.addEventListener("touchstart",buttons.navigation.next.down),a.addEventListener("touchend",buttons.navigation.next.up),a.addEventListener("touchend",buttons.navigation.next.action),a.addEventListener("touchmove",buttons.lockMove))}},last:{srcActive:STYLES_SRC+"navigation/activelast.png",srcInActive:STYLES_SRC+"navigation/inactivelast.png",installed:!1, draw:function(a){var b=el.add("img");b.id="keyLast";b.className="navigationButtons";b.src=buttons.navigation.last.srcInActive;b.style.height=buttons.navigation.height+"px";b.style.border=buttons.navigation.margin+"px solid transparent";buttons.navigation.last.events(b);buttons.navigation.last.installed=!0;a.appendChild(b)},check:function(a){if(buttons.navigation.last.installed)if(0==a)el.id("keyLast").src=buttons.navigation.last.srcInActive;else if(1==a)el.id("keyLast").src=buttons.navigation.last.srcActive}, down:function(a){a.stopPropagation();if(!slideShow.active&&-1==el.id("keyLast").src.indexOf("inactive"))el.id("keyLast").style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();el.id("keyLast").style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();bookData.rightToLeftMode?slideShow.active||pageMediator.goToPage(1):slideShow.active||pageMediator.goToPage(bookData.pageCount)},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup", buttons.navigation.last.up),a.addEventListener("mouseup",buttons.navigation.last.action),a.addEventListener("mousedown",buttons.navigation.last.down)):(a.addEventListener("touchstart",buttons.navigation.last.down),a.addEventListener("touchend",buttons.navigation.last.up),a.addEventListener("touchend",buttons.navigation.last.action),a.addEventListener("touchmove",buttons.lockMove))}}},slideShow:{parentNodeId:"",srcActive:STYLES_SRC+"navigation/activeslideshow.png",srcInActive:STYLES_SRC+"navigation/inactiveslideshow.png", srcPaused:STYLES_SRC+"navigation/slideshowpause.png",installed:!1,draw:function(a){var b=el.add("img");b.id="keySlideShow";b.className="navigationButtons";if(bookData.rightToLeftMode)buttons.slideShow.srcActive=STYLES_SRC+"navigation/activeslideshowleft.png";if(bookData.rightToLeftMode)buttons.slideShow.srcInActive=STYLES_SRC+"navigation/inactiveslideshowleft.png";b.src=buttons.slideShow.srcActive;b.style.height=buttons.navigation.height+"px";b.style.border=buttons.navigation.margin+"px solid transparent"; buttons.slideShow.events(b);buttons.slideShow.installed=!0;a.appendChild(b)},check:function(a){if(buttons.slideShow.installed)zoomBook.installed?el.id("keySlideShow").src=buttons.slideShow.srcInActive:0==a?el.id("keySlideShow").src=buttons.slideShow.srcPaused:el.id("keySlideShow").src=buttons.slideShow.srcActive},down:function(a){a.stopPropagation();if(-1==el.id("keySlideShow").src.indexOf("inactive"))el.id("keySlideShow").style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation(); el.id("keySlideShow").style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();zoomBook.installed||(slideShow.toGo(),buttons.check())},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.slideShow.up),a.addEventListener("mouseup",buttons.slideShow.action),a.addEventListener("mousedown",buttons.slideShow.down)):(a.addEventListener("touchstart",buttons.slideShow.down),a.addEventListener("touchend",buttons.slideShow.up),a.addEventListener("touchend", buttons.slideShow.action),a.addEventListener("touchmove",buttons.lockMove))}},toc:{parentNodeId:"",src:STYLES_SRC+"buttons/toc.png",installed:!1,width:30,height:30,marginTop:0,marginLeft:5,draw:function(a){var b=el.add("span");b.id="tocField";b.className="buttonsField";b.style.width=buttons.fieldWidth+"px";b.style.height=buttons.fieldHeight+"px";a.appendChild(b);a=el.add("img");a.id="imgTocButton";a.className="imgTocButton";a.style.height=buttons.toc.height+"px";a.style.width=buttons.toc.width+"px"; a.style.margin=buttons.toc.marginTop+"px "+buttons.toc.marginLeft+"px ";a.src=buttons.toc.src;a.style.opacity=toc.isToc?"1":"0.5";b.appendChild(a);buttons.toc.events(b);buttons.toc.installed=!0},check:function(a){if(buttons.toc.installed){var b=el.id("imgTocButton");if(toc.isToc){b.style.opacity="1";if(0==a)b.parentNode.style.backgroundColor=buttons.bgImg;if(1==a)b.parentNode.style.backgroundColor=buttons.bgImgOnclick}else b.style.opacity="0.5"}},down:function(a){a.stopPropagation();if(toc.isToc&& !slideShow.active)el.id("imgTocButton").parentNode.style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();if(toc.isToc)el.id("imgTocButton").parentNode.style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();!slideShow.active&&"input"!=pager.state&&toc.showFirstMenu()},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.toc.action),a.addEventListener("mousedown",buttons.toc.down),a.addEventListener("mouseup",buttons.toc.up)): (a.addEventListener("touchend",buttons.toc.action),a.addEventListener("touchstart",buttons.toc.down),a.addEventListener("touchend",buttons.toc.up))}},back:{parentNodeId:"contentBorder",color:"#ccc",colorOn:"#000",installed:!1,draw:function(){var a=el.add("div");a.className="backButton";a.id="backButton";a.style.paddingTop=5*bookData.skinScale+"px";a.style.paddingLeft=8*bookData.skinScale+"px";a.style.paddingBottom=5*bookData.skinScale+"px";a.style.paddingRight=8*bookData.skinScale+"px";a.style.marginTop= 7*bookData.skinScale+"px";a.style.marginLeft=10*bookData.skinScale+"px";var b=el.add("span");b.className="backFont";b.id="backText";b.style.fontSize=14*bookData.skinScale+"px";b.appendChild(document.createTextNode("back"));a.appendChild(b);el.id(buttons.back.parentNodeId).appendChild(a);buttons.back.events(a);buttons.back.installed=!0},clear:function(){if(buttons.back.installed)el.del("backButton"),buttons.back.installed=!1},down:function(a){a.stopPropagation();if(2<=toc.level.length)el.id("backText").parentNode.style.border= "1px solid #aaa"},check:function(){2<=toc.level.length?buttons.back.installed?el.id("backText").parentNode.style.border="none":buttons.back.draw():buttons.back.clear()},action:function(a){a.stopPropagation();!slideShow.active&&"input"!=pager.state&&toc.showPrevMenu()},events:function(a){el.id("backButton")&&(!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.back.action),a.addEventListener("mousedown",buttons.back.down),a.addEventListener("mouseup",buttons.back.check)):(a.addEventListener("touchend", buttons.back.action),a.addEventListener("touchstart",buttons.back.down),a.addEventListener("touchend",buttons.back.check),a.addEventListener("touchmove",buttons.lockMove)))}},bm:{src:STYLES_SRC+"buttons/bm.png",installed:!1,width:30,height:30,marginTop:0,marginLeft:5,draw:function(a){var b=el.add("span");b.id="bmField";b.className="buttonsField";b.style.width=buttons.fieldWidth+"px";b.style.height=buttons.fieldHeight+"px";a.appendChild(b);a=el.add("img");a.id="imgBmButton";a.className="imgBmButton"; a.style.height=buttons.bm.height+"px";a.style.width=buttons.bm.width+"px";a.style.margin=buttons.bm.marginTop+"px "+buttons.bm.marginLeft+"px ";a.src=buttons.bm.src;a.style.opacity=bm.isBm?"1":"0.5";b.appendChild(a);buttons.bm.events(b);buttons.bm.installed=!0;imgTocButton=null},check:function(a){if(buttons.bm.installed){var b=el.id("imgBmButton");if(bm.isBm){b.style.opacity="1";if(0==a)b.parentNode.style.backgroundColor=buttons.bgImg;if(1==a)b.parentNode.style.backgroundColor=buttons.bgImgOnclick}else b.style.opacity= "0.5"}},down:function(a){a.stopPropagation();if(bm.isBm&&!slideShow.active)el.id("imgBmButton").parentNode.style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();if(bm.isBm)el.id("imgBmButton").parentNode.style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();!slideShow.active&&"input"!=pager.state&&bm.showList()},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.bm.action),a.addEventListener("mousedown",buttons.bm.down), a.addEventListener("mouseup",buttons.bm.up)):(a.addEventListener("touchend",buttons.bm.action),a.addEventListener("touchstart",buttons.bm.down),a.addEventListener("touchend",buttons.bm.up),a.addEventListener("touchmove",buttons.lockMove))}},addBm:{parentNodeId:"",srcAdd:STYLES_SRC+"addbm.png",srcRem:STYLES_SRC+"rembm.png",installed:!1,width:30,height:30,marginTop:0,marginLeft:5,draw:function(a){var b=el.add("span");b.id="addField";b.className="buttonsField";b.style.width=buttons.fieldWidth+"px";b.style.height= buttons.fieldHeight+"px";a.appendChild(b);a=el.add("img");a.id="imgAddButton";a.className="imgAddButton";a.style.height=buttons.addBm.height+"px";a.style.width=buttons.addBm.width+"px";a.style.margin=buttons.addBm.marginTop+"px "+buttons.addBm.marginLeft+"px ";a.src=bm.isAdd?buttons.addBm.srcAdd:buttons.addBm.srcRem;b.appendChild(a);buttons.addBm.events(b);buttons.addBm.installed=!0},check:function(){if(buttons.addBm.installed){elem=el.id("imgAddButton");if(onePageBook.installed||zoomBook.installed)bookData.page[pageMediator.getPage()].mark? (bm.isAdd=!1,elem.src=buttons.addBm.srcRem):(bm.isAdd=!0,elem.src=buttons.addBm.srcAdd);else if(twoPageBook.installed)bookData.page[pageMediator.getPage()].mark||!bookData.rightToLeftMode&&(pageMediator.getPage("right")==bookData.pageCount?0:bookData.page[pageMediator.getPage("right")].mark)||"true"==bookData.rightToLeftMode&&(pageMediator.getPage("left")==bookData.pageCount?0:bookData.page[pageMediator.getPage("left")].mark)?(bm.isAdd=!1,elem.src=buttons.addBm.srcRem):(bm.isAdd=!0,elem.src=buttons.addBm.srcAdd); elem=null}},down:function(a){a.stopPropagation();if(!slideShow.active)el.id("imgAddButton").parentNode.style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();el.id("imgAddButton").parentNode.style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();!slideShow.active&&"input"!=pager.state&&bm.addButton.action()},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.addBm.up),a.addEventListener("mouseup",buttons.addBm.action), a.addEventListener("mousedown",buttons.addBm.down)):(a.addEventListener("touchstart",buttons.addBm.down),a.addEventListener("touchend",buttons.addBm.up),a.addEventListener("touchend",buttons.addBm.action),a.addEventListener("touchmove",buttons.lockMove))}},search:{parentNodeId:"",src:STYLES_SRC+"buttons/search.png",installed:!1,width:30,height:30,marginTop:0,marginLeft:5,draw:function(a){var b=el.add("span");b.id="searchField";b.className="buttonsField";b.style.width=buttons.fieldWidth+"px";b.style.height= buttons.fieldHeight+"px";a.appendChild(b);a=el.add("img");a.id="imgSearchButton";a.className="imgSearchButton";a.style.height=buttons.search.height+"px";a.style.width=buttons.search.width+"px";a.style.margin=buttons.search.marginTop+"px "+buttons.search.marginLeft+"px ";a.src=buttons.search.src;b.appendChild(a);buttons.search.events(b);buttons.search.installed=!0},check:function(a){if(buttons.search.installed){var b=el.id("imgSearchButton");if(0==a)b.parentNode.style.backgroundColor=buttons.bgImg; if(1==a)b.parentNode.style.backgroundColor=buttons.bgImgOnclick}},down:function(a){a.stopPropagation();if(!slideShow.active)el.id("imgSearchButton").parentNode.style.backgroundColor=buttons.bgImgOnclick},up:function(a){a.stopPropagation();el.id("imgSearchButton").parentNode.style.backgroundColor=buttons.bgImg},action:function(a){a.stopPropagation();!slideShow.active&&"input"!=pager.state&&ctrlEngine.search.action()},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup", buttons.search.action),a.addEventListener("mousedown",buttons.search.down),a.addEventListener("mouseup",buttons.search.up)):(a.addEventListener("touchend",buttons.search.action),a.addEventListener("touchstart",buttons.search.down),a.addEventListener("touchend",buttons.search.up),a.addEventListener("touchmove",buttons.lockMove))}},stopSearch:{parentNodeId:"",src:STYLES_SRC+"buttons/exit.png",draw:function(a){var b=el.add("span");b.className="exitField";b.id="stopSearch";b.style.height=30*bookData.skinScale+ "px";b.style.width=30*bookData.skinScale+"px";b.style.right=5*bookData.skinScale+"px";b.style.top=5*bookData.skinScale+"px";a.appendChild(b);a=el.add("img");a.id="imgExitButton";a.className="imgExitButton";a.style.height=30*bookData.skinScale+"px";a.style.width=30*bookData.skinScale+"px";a.src=buttons.exit.src;b.appendChild(a);buttons.stopSearch.events(b)},action:function(a){a.stopPropagation();el.id("imgExitButton").parentNode.style.border="none";if(search.active){"search"==ctrlEngine.mode&&ctrlEngine.hide(); for(tb in bookData.toolbar)tb=bookData.toolbar[tb],"navigationToolbar"==tb.id&&toolbar.transform(tb,-1),"searchToolbar"==tb.id&&toolbar.transform(tb,0);ctrlEngine.search.clearResults()}},down:function(a){a.stopPropagation();el.id("imgExitButton").parentNode.style.border="1px solid #aaa"},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.stopSearch.action),a.addEventListener("mousedown",buttons.stopSearch.down)):(a.addEventListener("touchend",buttons.stopSearch.action), a.addEventListener("touchstart",buttons.stopSearch.down))}},edit:{},info:{parentNodeId:"",src:STYLES_SRC+"buttons/info.png",isShow:!1,width:25,height:25,margin:0,imgWidth:25,imgHeight:25,draw:function(a){var b=el.add("span");b.id="infoField";b.className="infoField";b.style.width=buttons.info.width+"px";b.style.height=buttons.info.height+"px";b.style.margin=buttons.info.margin+"px";a.appendChild(b);a=el.add("img");a.id="imgInfoButton";a.className="imgInfoButton";a.style.width=buttons.info.imgWidth+ "px";a.style.height=buttons.info.imgHeight+"px";a.src=buttons.info.src;b.appendChild(a);buttons.info.events(b);buttons.info.installed=!0},action:function(a){a.stopPropagation();if(!slideShow.active&&(el.id("imgInfoButton").parentNode.style.backgroundColor=buttons.info.bgImg,toolbar.toogle(),eventManager.lock=!0,"hide"==ctrlEngine.state))ctrlEngine.mode="info",ctrlEngine.display()},down:function(a){a.stopPropagation();if(!slideShow.active)el.id("imgInfoButton").parentNode.style.backgroundColor=buttons.info.bgImgOnclick}, events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.info.action),a.addEventListener("mousedown",buttons.info.down)):(a.addEventListener("touchend",buttons.info.action),a.addEventListener("touchstart",buttons.info.down),a.addEventListener("touchmove",buttons.lockMove))}},exit:{parentNodeId:"",src:STYLES_SRC+"buttons/exit.png",draw:function(a){var b=el.add("span");b.className="exitField";b.id="exitField";b.style.height=30*bookData.skinScale+"px";b.style.width=30* bookData.skinScale+"px";b.style.right=5*bookData.skinScale+"px";b.style.top=5*bookData.skinScale+"px";a.appendChild(b);a=el.add("img");a.id="imgExitButton";a.className="imgExitButton";a.style.height=30*bookData.skinScale+"px";a.style.width=30*bookData.skinScale+"px";a.src=buttons.exit.src;b.appendChild(a);buttons.exit.events(b)},action:function(a){a.stopPropagation();el.id("imgExitButton").parentNode.style.border="none";if("info"==ctrlEngine.mode)ctrlEngine.hide(),eventManager.lock=!1,toolbar.toogle(); if("notification"==ctrlEngine.mode)ctrlEngine.notification.hide(),eventManager.lock=!1;("search"==ctrlEngine.mode||"toc"==ctrlEngine.mode||"bm"==ctrlEngine.mode)&&ctrlEngine.hide()},down:function(a){a.stopPropagation();el.id("imgExitButton").parentNode.style.border="1px solid #aaa"},events:function(a){!1==eventManager.touchInterface?(a.addEventListener("mouseup",buttons.exit.action),a.addEventListener("mousedown",buttons.exit.down)):(a.addEventListener("touchend",buttons.exit.action),a.addEventListener("touchstart", buttons.exit.down))}},share:{},check:function(){var a=pageMediator.getPage();slideShow.active?(buttons.navigation.first.check(0),buttons.navigation.prev.check(0),buttons.slideShow.check(0),buttons.navigation.next.check(0),buttons.navigation.last.check(0)):(buttons.slideShow.check(1),bookData.rightToLeftMode?(pageMediator.isLastPage()?(buttons.navigation.first.check(0),buttons.navigation.prev.check(0)):(buttons.navigation.first.check(1),buttons.navigation.prev.check(1)),1==a?(buttons.navigation.next.check(0), buttons.navigation.last.check(0)):(buttons.navigation.next.check(1),buttons.navigation.last.check(1))):(1==a?(buttons.navigation.first.check(0),buttons.navigation.prev.check(0)):(buttons.navigation.first.check(1),buttons.navigation.prev.check(1)),pageMediator.isLastPage()?(buttons.navigation.next.check(0),buttons.navigation.last.check(0)):(buttons.navigation.next.check(1),buttons.navigation.last.check(1))));buttons.addBm.check()},lockMove:function(a){a.preventDefault();a.stopPropagation()}},ctrlEngine= {state:"hide",mode:"toc",init:function(){toc.init();bm.init();toolbar.draw()},border:{width:350,height:390,orientation:"top",left:0,top:0,isFx:!0,draw:function(){switch(ctrlEngine.mode){case "info":ctrlEngine.border.width=system.device.width()-10=a)b.style.top=ctrlEngine.events.deltaY+"px",prefix=ctrlEngine.events.deltaY,ctrlEngine.events.offset=prefix,prefix=null}}}; var eventManager={touchInterface:!1,leftAndRightArea:0.15,gesture:!1,touchStartCoordinate:{x:0,y:0},clickStartCoordinate:{x:0,y:0},click:!1,clickCount:0,doubleClickTime:250,lock:!1,start:function(){"createTouch"in document?(eventManager.touchInterface=!0,eventManager.loadTouchEvents(el.id("mainFrame"))):(eventManager.touchInterface=!1,eventManager.loadClickEvents(el.id("mainFrame")))},loadTouchEvents:function(a){var b=function(a){eventManager.gesture=!0;a.target=a.target?a.target:a.srcElement;a.preventDefault? a.preventDefault():a.returnValue=!1;twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.gestureStart(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.gestureStart(a):zoomBook.installed&&zoomBook.events.gestureStart(a);delete b},c=function(a){a.target=a.target?a.target:a.srcElement;a.preventDefault?a.preventDefault():a.returnValue=!1;twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.gestureChange(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.gestureChange(a): zoomBook.installed&&zoomBook.events.gestureChange(a);delete c},d=function(a){a.target=a.target?a.target:a.srcElement;a.preventDefault?a.preventDefault():a.returnValue=!1;twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.gestureEnd(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.gestureEnd(a):zoomBook.installed&&zoomBook.events.gestureEnd(a);window.setTimeout(function(){eventManager.gesture=!1},100);delete d};a.addEventListener("gesturestart",b,!1);a.addEventListener("gesturechange", c,!1);a.addEventListener("gestureend",d,!1);var e=function(a){if(!eventManager.gesture)a.target=a.target?a.target:a.srcElement,"input"==pager.state&&pager.cancelInput(),eventManager.touchStartCoordinate.x=a.targetTouches[0].pageX,eventManager.touchStartCoordinate.y=a.targetTouches[0].pageY,twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.touchStart(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.touchStart(a):zoomBook.installed&&zoomBook.events.touchStart(a),a.preventDefault? a.preventDefault():a.returnValue=!1;delete e},f=function(a){if(!eventManager.gesture)a.target=a.target?a.target:a.srcElement,twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.touchMove(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.touchMove(a):zoomBook.installed&&zoomBook.events.touchMove(a),a.preventDefault?a.preventDefault():a.returnValue=!1;delete f},h=function(a){if(!eventManager.gesture)a.target=a.target?a.target:a.srcElement,twoPageBook.installed&&!zoomBook.installed? twoPageBook.events.touchEnd(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.touchEnd(a):zoomBook.installed&&zoomBook.events.touchEnd(a),a.preventDefault?a.preventDefault():a.returnValue=!1;delete h};a.addEventListener("touchstart",e,!1);a.addEventListener("touchmove",f,!1);a.addEventListener("touchend",h,!1);a=null},loadClickEvents:function(a){var b=function(a){a.target=a.target?a.target:a.srcElement;a.preventDefault?a.preventDefault():a.returnValue=!1;eventManager.click=!0;"input"== pager.state&&pager.cancelInput();eventManager.clickStartCoordinate.x=a.pageX;eventManager.clickStartCoordinate.y=a.pageY;twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.mousedown(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.mousedown(a):zoomBook.installed&&zoomBook.events.mousedown(a);delete b},c=function(a){a.target=a.target?a.target:a.srcElement;a.preventDefault?a.preventDefault():a.returnValue=!1;eventManager.click=!1;twoPageBook.installed&&!zoomBook.installed? twoPageBook.events.mouseup(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.mouseup(a):zoomBook.installed&&zoomBook.events.mouseup(a);delete c},d=function(a){a.target=a.target?a.target:a.srcElement;a.preventDefault?a.preventDefault():a.returnValue=!1;eventManager.click&&(twoPageBook.installed&&!zoomBook.installed?twoPageBook.events.mousemove(a):onePageBook.installed&&!zoomBook.installed?onePageBook.events.mousemove(a):zoomBook.installed&&zoomBook.events.mousemove(a));delete d};a.addEventListener("mousedown", b,!1);a.addEventListener("mousemove",d,!1);a.addEventListener("mouseup",c,!1);a=null},linkClick:function(a,b,c,d){if(eventManager.touchInterface)var e=a.changedTouches[0].pageX-a.target.getBoundingClientRect().left,f=a.changedTouches[0].pageY-a.target.getBoundingClientRect().top;else e=a.clientX-a.target.getBoundingClientRect().left,f=a.clientY-a.target.getBoundingClientRect().top;for(linkI in bookData.page[b].links){var h=bookData.page[b].links[linkI];if(e>=h.x*c&&e<=h.x*c+h.width*c&&f>=1*(h.y*d).toFixed(0)&& f<=1*(1*(h.y*d).toFixed(0)+h.height*d).toFixed(0)){a.preventDefault?a.preventDefault():a.returnValue=!1;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;var g=h.x*c,j=h.y*d;if(eventManager.touchInterface){var k=a.target.getContext("2d"),m=k.getImageData(g,j,h.width*c+10,h.height*d+10);k.fillStyle="rgba(0,0,0,0.4)";k.fillRect(h.x*c,h.y*d,h.width*c,h.height*d);(function(b){a.target.addEventListener("touchend",function(){k.putImageData(m,g,j);b.page&&pageMediator.goToPage(b.page);if(b.urls)for(var a= 0;a=bookData.size.proportions){var e=c,f=(e/bookData.page[a].proportions).toFixed(0);b.drawImage(images.image,0,(d-f)/2,e,f)}else f=d,e=(f*bookData.page[a].proportions).toFixed(0),d=(c-e)/2,bookData.page[a].wide&&0==a%2&&!bookData.rightToLeftMode?d=c-e:bookData.page[a].wide&& !bookData.rightToLeftMode?d=0:bookData.page[a].wide&&0==a%2&&bookData.rightToLeftMode?d=0:bookData.page[a].wide&&bookData.rightToLeftMode&&(d=c-e),b.drawImage(images.image,d,0,e,f);bookData.page[a].mark&&bm.rasterize.draw(b,a);1!=a&&a!=bookData.pageCount&&twoPageBook.installed&&!zoomBook.installed?images.drawShadow(b,a):a==bookData.pageCount&&0!=a%2&&!zoomBook.installed&&images.drawShadow(b,a);if(onePageBook.installed&&zoomBook.installed&&onePageBook.currentPage==a)onePageBook.installed=!1,window.setTimeout(function(){preloader.delSimplePreloader(); el.del("tmpDiv");zoomLock.unLock()},300);if(twoPageBook.installed&&zoomBook.installed&&zoomBook.currentPage==a)twoPageBook.installed=!1,window.setTimeout(function(){preloader.delSimplePreloader();el.del("tmpDiv");zoomLock.unLock()},300);if(zoomBook.innerZoomState&&zoomBook.currentPage==a)zoomBook.innerZoomState=!1,window.setTimeout(function(){preloader.delSimplePreloader();el.del("exZoomBook");zoomLock.unLock()},300);b=d=f=e=d=c=null}0=h.x*c&&e<=h.x*c+h.width*c&&f>=1*(h.y*d).toFixed(0)&&f<=1*(1*(h.y*d).toFixed(0)+h.height*d).toFixed(0)){links.currX=h.x*c;links.currY=h.y*d;b=a.target.getContext("2d");links.currCanvas=a.target.id;links.currStorage=b.getImageData(links.currX, links.currY,h.width*c+10,h.height*d+10);b.fillStyle="rgba(0,0,0,0.3)";b.fillRect(h.x*c,h.y*d,h.width*c,h.height*d);links.currGoPage=h.page?h.page:0;links.currURLs=h.urls?h.urls:0;links.isLinkBool=!0;break}}},clearRect:function(){if(el.id(links.currCanvas))el.id(links.currCanvas).getContext("2d").putImageData(links.currStorage,links.currX,links.currY),links.isLinkBool=!1}},main=function(){function a(a){system.init();"one"===bookChoice.getType()?onePageBook.draw(a):twoPageBook.draw(a);if(system.device.publisher.isOn)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("+1/system.browser.scale+") translate("+system.device.width()*(1-system.browser.scale)/2+"px,"+system.device.height()*(1-system.browser.scale)/2+"px)"}window.GAEnable||(GAEnable=!1);var b=function(){system.init();preloader.init();eventManager.start();bookData.load(this.responseXML);images.init();workspace.draw(); ctrlEngine.init();pager.draw();orientationObserver.start();html5lib.init();var c=bookData.lastLocation.load();if(window.location.hash){var e=window.location.hash.substring(1,window.location.hash.length),e=parseInt(e);if(-10===e&&c&&bookData.sessionRestore)e=c;else if(0>=e)e=1;else if(e>bookData.pageCount)e=bookData.pageCount;a(1*e)}else c&&bookData.sessionRestore?a(c):a(1);c=el.id("mainFrame");if(void 0===bookData.background.src)c.style.backgroundColor=bookData.background.color;else if("image/grey-inner.jpg"!= bookData.background.src&&"image/grey-outer.jpg"!=bookData.background.src&&"image/dark-wood-inner.jpg"!=bookData.background.src&&"image/dark-wood-outer.jpg"!=bookData.background.src&&"image/sky-blue-inner.jpg"!=bookData.background.src&&"image/sky-blue-outer.jpg"!=bookData.background.src)c.style.backgroundImage="url(../"+assetsFolder+"/"+bookData.background.src+")";else{if("DarkWood"==bookData.skin)c.style.backgroundImage="url("+STYLES_SRC+"dark-wood-inner.jpg)",c.style.backgroundRepeat="no-repeat", c.style.backgroundPosition="center",c.style.backgroundSize="cover";if("ClassicGrey"==bookData.skin)c.style.background="-webkit-linear-gradient(top, #d0d9e2, #63696e)";if("DarkSkyBlue"==bookData.skin)c.style.background="-webkit-linear-gradient(top, #d2deec, #839cb2)"}"single"==bookData.background.scale?(c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="auto"):"fill"==bookData.background.scale?(c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition= "center",c.style.backgroundSize="cover"):"fit"==bookData.background.scale?(c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"):"scale"==bookData.background.scale?(c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="100% 100%"):c.style.backgroundRepeat="repeat";delete b};if(PUBL){var c=new XMLHttpRequest;c.open("GET",xml_dir+"properties.xml?1"+PS);c.onload=function(){var a=new XMLHttpRequest;a.open("GET", this.responseText);a.onload=b;a.onerror=function(){console.log("Error: can`t load xml")};a.send();delete a};c.onerror=function(){console.log(this)}}else c=new XMLHttpRequest,c.open("GET",PATH_TO_PROPERTIES+"properties.xml"),c.onload=b,c.onerror=function(){document.write("Error: can`t load xml3")};c.send();delete c;delete main}; null==dir?(PATH_TO_PROPERTIES=photographer_dir,STYLES_SRC=photographer_src,PUBL=!0,ALBM=!1,PUBLDOMAIN=document.referrer,main()):("./<%=FilesFolderName%>/"==dir&&(dir="files"),PATH_TO_PROPERTIES="../"+assetsFolder+"/mobile/",ALBM=PUBL=!1,PS="",document.addEventListener("DOMContentLoaded",main,!1)); 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)}}; window.Modernizr=function(a,b,c){function d(a,b){for(var d in a)if(j[a[d]]!==c)return"pfx"==b?a[d]:!0;return!1}function e(a,b,e){var f=a.charAt(0).toUpperCase()+a.substr(1),g=(a+" "+l.join(f+" ")+f).split(" ");if("string"===typeof b||"undefined"===typeof b)b=d(g,b);else{g=(a+" "+q.join(f+" ")+f).split(" ");a:{var a=g,h;for(h in a)if(f=b[a[h]],f!==c){b=!1===e?a[h]:"function"===typeof f?f.bind(e||b):f;break a}b=!1}}return b}var f={},h=b.documentElement,g=b.createElement("modernizr"),j=g.style,k={}.toString, m=" -webkit- -moz- -o- -ms- ".split(" "),l="Webkit Moz O ms".split(" "),q="webkit moz o ms".split(" "),g={},o=[],n=o.slice,p,u=function(a,c,d,e){var f,g,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))for(;d--;)j=b.createElement("div"),j.id=e?e[d]:"modernizr"+(d+1),k.appendChild(j);return f=["­"].join(""),k.id="modernizr",(l?k:m).innerHTML+=f,m.appendChild(k),l||(m.style.background="",h.appendChild(m)),g=c(k,a),l?k.parentNode.removeChild(k): m.parentNode.removeChild(m),!!g},r={}.hasOwnProperty,s;"undefined"!==typeof r&&"undefined"!==typeof r.call?s=function(a,b){return r.call(a,b)}:s=function(a,b){return b in a&&"undefined"===typeof a.constructor.prototype[b]};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=n.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var e=new e,f=b.apply(e,c.concat(n.call(arguments)));return Object(f)=== f?f:e}return b.apply(a,c.concat(n.call(arguments)))};return d});(function(a,b){var c=a.join(""),d=b.length;u(c,function(a){for(var a=a.childNodes,b={};d--;)b[a[d].id]=a[d];f.csstransforms3d=9===(b.csstransforms3d&&b.csstransforms3d.offsetLeft)&&3===b.csstransforms3d.offsetHeight},d,b)})([,["@media (",m.join("transform-3d),("),"modernizr){#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join("")],[,"csstransforms3d"]);g.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&& !!a.getContext("2d")};g.postmessage=function(){return!!a.postMessage};g.websockets=function(){for(var b=-1,c=l.length;++ba)a=1;else if(a>bookData.pageCount)a=bookData.pageCount;if(a==onePageBook.currentPage)pageMediator.change();else if(a==1*onePageBook.currentPage+1)onePageBook.next();else if(a==1*onePageBook.currentPage-1)onePageBook.prev();else if(01*onePageBook.currentPage)var b=1*onePageBook.currentPage+1,c=onePageBook.currentPage;else c=b=onePageBook.currentPage-1;bm.rasterize.imgData= {};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);(system.device.iphone||system.device.ipod)&&window.scrollTo(0,1);delete e},d=null;window.setTimeout(e,onePageBook.flipSpeed);b=c=null}},destroyOtherPages:function(){for(var a=1*onePageBook.currentPage+1*onePageBook.nextPageBuffer, b=onePageBook.currentPage-onePageBook.prevPageBuffer;b<=a;b++)b!=onePageBook.currentPage&&0c){if(b.style.left||"0px"==b.style.left)html5lib.duration(b, 0),html5lib.translate(b,0,0,0),b.style.left="0px";html5lib.duration(b,300);html5lib.scale(b,c,c,c);b.id="zoomedPage";zoomBook.draw(onePageBook.currentPage,c)}else 1.2>a?(b.style.webkitTransitionDuration="200ms",b.style.webkitTransform=""):(b.id="zoomedPage",zoomBook.draw(onePageBook.currentPage,a));zoomFacrot=null}},destroy:function(){preloader.stopAll();el.del("bookPortrait");onePageBook.installed=!1}}; onePageBook.events={tapCount:0,clickCount:0,doubleTapTime:250,doubleClickTime:250,leftAndRightArea:0.15,gestureX:0,gestureY:0,touchCancel:!1,gestureTarget:0,touchStart:function(a){"CANVAS"==a.target.tagName&&links.drawRect(a)},touchMove:function(a){if(links.isLinkBool){var b=a.targetTouches[0].pageY-eventManager.touchStartCoordinate.y;(10eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX?onePageBook.events.flipRight():50eventManager.clickStartCoordinate.x-b?onePageBook.events.flipRight():50system.device.width()*(1-onePageBook.events.leftAndRightArea)/system.browser.scale?onePageBook.events.flipLeft():toolbar.toogle();delete a},doubleTap:function(){slideShow.active||(links.isLinkBool&&links.clearRect(),onePageBook.goToZoom())},singleClick:function(a){if(links.isLinkBool){if(links.clearRect(), links.currGoPage&&onePageBook.goToPage(links.currGoPage),links.currURLs)for(a=0;asystem.device.width()*(1-onePageBook.events.leftAndRightArea)/system.browser.scale?onePageBook.events.flipLeft():toolbar.toogle(),delete a},doubleClick:function(){slideShow.active||(links.isLinkBool&&links.clearRect(),onePageBook.goToZoom())}, flipLeft:function(){bookData.rightToLeftMode?onePageBook.prev():onePageBook.next()},flipRight:function(){bookData.rightToLeftMode?onePageBook.next():onePageBook.prev()}}; var orientationObserver={start:function(){if(system.device.publisher.isOn)return system.device.publisher.orientation;if(system.platform.android){PUBL||window.addEventListener("resize",workspace.reDraw,!1);var a=function(){onePageBook.installed&&(onePageBook.destroy(),onePageBook.draw(onePageBook.currentPage));delete a};PUBL||window.addEventListener("resize",a,!1)}else PUBL||window.addEventListener("orientationchange",workspace.reDraw,!1),a=function(){if(system.device.ipad&&!bookData.singlePageMode)if("portrait"== orientationObserver.getOrientation()){if(twoPageBook.installed){var b=pageMediator.getPage();twoPageBook.destroy();onePageBook.draw(b)}}else"landscape"==orientationObserver.getOrientation()&&onePageBook.installed&&(onePageBook.destroy(),twoPageBook.draw(onePageBook.currentPage));else onePageBook.installed&&(onePageBook.destroy(),onePageBook.draw(onePageBook.currentPage));delete a},PUBL||window.addEventListener("orientationchange",a,!1)},stop:function(){system.platform.android?window.removeEventListener("resize", workspace.reDraw,!1):window.removeEventListener("orientationchange",workspace.reDraw,!1)},getOrientation:function(){if(system.device.publisher.isOn)return system.device.publisher.orientation;if(system.platform.android||PUBL){if(window.innerWidth>window.innerHeight)return"landscape";if(window.innerWidth a)a=1;else if(a>bookData.pageCount)a=bookData.pageCount;onePageBook.installed&&!zoomBook.installed?(onePageBook.goToPage(a),!1==toc.tocLock&&ctrlEngine.hide(),toc.tocLock=!1):twoPageBook.installed&&!zoomBook.installed?twoPageBook.goToPage(a):zoomBook.installed&&zoomBook.goToPage(a)},getPage:function(a){var a=a||"left",b=1;onePageBook.installed?b=onePageBook.currentPage:zoomBook.installed?b=zoomBook.currentPage:twoPageBook.installed&&(b=1==1*twoPageBook.currentPage.right?twoPageBook.currentPage.right: pageMediator.isLastPage(twoPageBook.currentPage.left)?twoPageBook.currentPage.left:pageMediator.isLastPage(twoPageBook.currentPage.right)?twoPageBook.currentPage.right:"left"===a?twoPageBook.currentPage.left:twoPageBook.currentPage.right);if(b>bookData.pageCount)b=bookData.pageCount;return b},getCurrentPage:function(){if(onePageBook.installed)return onePageBook.currentPage;if(zoomBook.installed)return zoomBook.currentPage;if(twoPageBook.installed)return twoPageBook.currentPage},isLastPage:function(){return onePageBook.installed&& bookData.pageCount===onePageBook.currentPage?!0:zoomBook.installed&&bookData.pageCount===zoomBook.currentPage?!0:twoPageBook.installed&&(twoPageBook.currentPage.right===bookData.pageCount||twoPageBook.currentPage.left===bookData.pageCount)?!0:!1},isLastNum:function(){if(bookData.rightToLeftMode)return onePageBook.installed&&1==onePageBook.currentPage?!0:zoomBook.installed&&1==zoomBook.currentPage?!0:twoPageBook.installed&&(1==twoPageBook.currentPage.right||1==twoPageBook.currentPage.left)?!0:!1;pageMediator.isLastPage()}}, pager={installed:!1,state:"show",fontSize:14,fontMarginTop:10,fontMarginLeft:10,draw:function(){if(el.id("pagerToolbar")){if(!pager.installed){var a=el.add("span");a.className="pagerField";a.id="pagerField";el.id("pagerToolbar").appendChild(a);pager.event(a);var b=el.add("span");b.className="pagerFont";b.style.margin=pager.fontMarginTop+"px "+pager.fontMarginLeft+"px";b.style.fontSize=pager.fontSize+"px";b.appendChild(document.createTextNode("Page "));a.appendChild(b);b=el.add("span");b.id="pagerCurrentPage"; b.className="pagerFont";b.style.margin=pager.fontMarginTop+"px 0 0 0";b.style.fontSize=pager.fontSize+"px";b.innerHTML="0";a.appendChild(b);b=el.add("span");b.className="pagerFont";b.style.margin=pager.fontMarginTop+"px "+pager.fontMarginLeft+"px";b.style.fontSize=pager.fontSize+"px";b.appendChild(document.createTextNode(" / "+bookData.pageCount));a.appendChild(b)}pager.installed=!0}},change:function(){buttons.check();var a=window.location.pathname.split("/");if(el.id("pagerToolbar")){(system.device.iphone|| system.device.ipod)&&window.scrollTo(0,1);"input"==pager.state&&pager.cancelInput();if(onePageBook.installed&&!zoomBook.installed){var b=el.id("pagerCurrentPage");b.removeChild(b.childNodes[0]);nTe=document.createTextNode(onePageBook.currentPage);b.appendChild(nTe);window.location.hash="#"+onePageBook.currentPage;GAEnable&&_trackPageview(a[a.length-4]+"-"+onePageBook.currentPage);bookData.lastLocation.save(onePageBook.currentPage)}else if(twoPageBook.installed&&!zoomBook.installed)if(bookData.rightToLeftMode)if(0< twoPageBook.currentPage.right&&twoPageBook.currentPage.left<=bookData.pageCount)b=el.id("pagerCurrentPage"),b.removeChild(b.childNodes[0]),nTe=document.createTextNode(twoPageBook.currentPage.left+"-"+twoPageBook.currentPage.right),b.appendChild(nTe),window.location.hash="#"+twoPageBook.currentPage.left,GAEnable&&_trackPageview(a[a.length-4]+"-"+twoPageBook.currentPage.left),bookData.lastLocation.save(twoPageBook.currentPage.left);else if(0>=twoPageBook.currentPage.right)b=el.id("pagerCurrentPage"), b.removeChild(b.childNodes[0]),nTe=document.createTextNode(twoPageBook.currentPage.left),b.appendChild(nTe),window.location.hash="#"+twoPageBook.currentPage.left,GAEnable&&_trackPageview(a[a.length-4]+"-"+twoPageBook.currentPage.left),bookData.lastLocation.save(twoPageBook.currentPage.left);else{if(twoPageBook.currentPage.left>bookData.pageCount)b=el.id("pagerCurrentPage"),b.removeChild(b.childNodes[0]),nTe=document.createTextNode(twoPageBook.currentPage.right),b.appendChild(nTe),window.location.hash= "#"+twoPageBook.currentPage.right,GAEnable&&_trackPageview(a[a.length-4]+"-"+twoPageBook.currentPage.left),bookData.lastLocation.save(twoPageBook.currentPage.right)}else if(0=twoPageBook.currentPage.left)b=el.id("pagerCurrentPage"),b.removeChild(b.childNodes[0]),nTe=document.createTextNode(twoPageBook.currentPage.right),b.appendChild(nTe),window.location.hash="#"+twoPageBook.currentPage.right,GAEnable&&_trackPageview(a[a.length-4]+"-"+twoPageBook.currentPage.right),bookData.lastLocation.save(twoPageBook.currentPage.right);else{if(twoPageBook.currentPage.right>bookData.pageCount)b= el.id("pagerCurrentPage"),b.removeChild(b.childNodes[0]),nTe=document.createTextNode(twoPageBook.currentPage.left),b.appendChild(nTe),window.location.hash="#"+twoPageBook.currentPage.left,GAEnable&&_trackPageview(a[a.length-4]+"-"+twoPageBook.currentPage.left),bookData.lastLocation.save(twoPageBook.currentPage.left)}else if(zoomBook.installed)b=el.id("pagerCurrentPage"),b.removeChild(b.childNodes[0]),nTe=document.createTextNode(zoomBook.currentPage),b.appendChild(nTe),window.location.hash="#"+zoomBook.currentPage, GAEnable&&_trackPageview(a[a.length-4]+"-"+twoPageBook.currentPage.left+"/zoomed");if(PUBL)parent.window.location=PUBLDOMAIN+window.location.hash}},enableInput:function(a){a.stopPropagation();if(!slideShow.active){a.target=a.target?a.target:a.srcElement;a.preventDefault();pager.state="input";a=el.add("input");a.className="inputPage";a.id="inputPage";a.type="number";a.style.height=pager.fontSize+"px";a.style.width="100px";a.style.fontSize=pager.fontSize-1+"px";a.style.margin=pager.fontMarginTop+"px "+ pager.fontMarginLeft+"px";a.value=pageMediator.getPage();if(el.id("pagerCurrentPage")){var b=el.id("pagerCurrentPage");b.parentNode.replaceChild(a,b)}pager.inputEvent(a);a.focus();a.select()}},cancelInput:function(){var a=el.add("span");a.id="pagerCurrentPage";a.className="pagerFont";a.style.margin=pager.fontMarginTop+"px 0 0 0";a.style.fontSize=pager.fontSize+"px";if(onePageBook.installed)var b=onePageBook.currentPage;else twoPageBook.installed?(b="",0dfgh \u0430\u0432\u0430\u043f\u043b\u0432\u043e\u0440\u0430\u043f"},{id:5,text:"dds df fhs dfgh sdfslkfjksjhdfk"}],buildIndexes:function(a,b,c){for(var d=[],e=0;eo?n-o:o-n)*(n>o?1:2);p=b&&d.push(c[e]);return d},isSplitter:function(a){for(var b=0;bb?2E3:b;else b= bookData.page[pageMediator.getPage()].slideDelay,b=bwindow.innerHeight?270:410window.innerHeight?540:window.innerHeight:350window.innerHeight?417:710window.innerHeight? 834:window.innerHeight:window.innerHeight};this.device.proportions=function(){return(system.device.width()/system.device.height()).toFixed(2)};this.isInit=!0;if(system.platform.ios||system.platform.android)this.isMobile=!0},route:function(){this.isInit||this.init()}}; timer={state:!0,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("standart"==a)return Date.now()-this.startTime>this.blockTime?!0:!1;if("high"==a)return!0;if("fx"==a)return Date.now()-this.startTime>this.endFX?!0:!1}}; var toc={installed:!1,isToc:!1,mark:0,pageNum:0,level:[],tocLock:!1,shiftSpeed:500,parseLevel:function(a){var b;for(i=0;ie&&0>d.offsetHeight-b.offsetHeight)b.style.top=(e.toFixed()-toc.level[a-2])*c.offsetHeight1*twoPageBook.currentPage.right-2*twoPageBook.nextPageBuffer;b-=2)twoPageBook.drawPage(b,a,"right")}else{for(var b=1*twoPageBook.currentPage.left;b>twoPageBook.currentPage.left-2*twoPageBook.prevPageBuffer;b-=2)twoPageBook.drawPage(b,a,"left");for(b=1*twoPageBook.currentPage.right;b<1*twoPageBook.currentPage.right+2*twoPageBook.nextPageBuffer;b+=2)twoPageBook.drawPage(b,a,"right")}pager.change(); twoPageBook.shadow.draw();delete a},drawPage:function(a,b,c){if(bookData.rightToLeftMode)"right"==c?(d=a-1+"x"+a,e=a-1,f=system.device.android?"rotateY(0deg)":"rotate3d(0, -1, 0, 0deg)",h=a):"left"==c&&(d=a+"x"+(1*a+1),e=1*a+1,f=system.device.android?"rotateY(0deg)":"rotate3d(0, 1, 0, 0deg)",h=bookData.pageCount-a);else if("left"==c)var d=a-1+"x"+a,e=a-1,f=system.device.android?"rotateY(0deg)":"rotate3d(0, -1, 0, 0deg)",h=a;else"right"==c&&(d=a+"x"+(1*a+1),e=1*a+1,f=system.device.android?"rotateY(0deg)": "rotate3d(0, 1, 0, 0deg)",h=bookData.pageCount-a);if(!el.id(d)){if(0a)a=1;else if(a>bookData.pageCount)a=bookData.pageCount;if(bookData.rightToLeftMode)if(a==twoPageBook.currentPage.left||a==twoPageBook.currentPage.right)pageMediator.change();else if(a==1*twoPageBook.currentPage.left+1||a==1*twoPageBook.currentPage.left+2)twoPageBook.next();else if(a==1*twoPageBook.currentPage.right-1||a==1*twoPageBook.currentPage.right-2)twoPageBook.prev(); else{if(0twoPageBook.currentPage.left){if(a==bookData.pageCount&&0==a%2){b=1;for(c=2*twoPageBook.nextPageBuffer;b=b;b++)c=el.id("canvas"+(1*twoPageBook.currentPage.left+b)),c=c.getContext("2d"),c.fillStyle="rgb(255,255,255)",c.fillRect(0,0,twoPageBook.bookWidth/2,twoPageBook.bookHeight),images.drawShadow(c,1*twoPageBook.currentPage.left+b),c=null,preloader.add(1*twoPageBook.currentPage.left+b),preloader.setSpecial(1*twoPageBook.currentPage.left+b);twoPageBook.flipFxCurrentPage(twoPageBook.currentPage.left); twoPageBook.pageConverter(a);twoPageBook.shadow.reDraw("prev");pageMediator.change()}else if(a=b;b++)c=el.id("canvas"+(twoPageBook.currentPage.right-b)),c=c.getContext("2d"),c.fillStyle="rgb(255,255,255)",c.fillRect(0,0,twoPageBook.bookWidth/2,twoPageBook.bookHeight),images.drawShadow(c,twoPageBook.currentPage.right-b),preloader.add(twoPageBook.currentPage.right-b),preloader.setSpecial(twoPageBook.currentPage.right-b),c=c=null;twoPageBook.flipFxCurrentPage(twoPageBook.currentPage.right);twoPageBook.pageConverter(a); twoPageBook.shadow.reDraw("next");pageMediator.change()}window.setTimeout(function(){preloader.stopAll();el.del("bookLandscape");twoPageBook.draw(a)},twoPageBook.flipSpeed+100);timer.setBlockTime(twoPageBook.flipSpeed/2,twoPageBook.flipSpeed)}}else if(a==twoPageBook.currentPage.left||a==twoPageBook.currentPage.right)pageMediator.change();else if(a==1*twoPageBook.currentPage.right+1||a==1*twoPageBook.currentPage.right+2)twoPageBook.next();else if(a==1*twoPageBook.currentPage.left-1||a==1*twoPageBook.currentPage.left- 2)twoPageBook.prev();else if(0twoPageBook.currentPage.right){if(a==bookData.pageCount&&0==a%2){for(var b=1,c=2*(twoPageBook.nextPageBuffer-1);b=b;b++)c=el.id("canvas"+(1*twoPageBook.currentPage.right+b)),c=c.getContext("2d"),c.fillStyle="rgb(255,255,255)",c.fillRect(0,0,twoPageBook.bookWidth/2,twoPageBook.bookHeight),images.drawShadow(c,1*twoPageBook.currentPage.right+b),c=null,preloader.add(1*twoPageBook.currentPage.right+b),preloader.setSpecial(1*twoPageBook.currentPage.right+b);twoPageBook.flipFxCurrentPage(twoPageBook.currentPage.right); twoPageBook.pageConverter(a);twoPageBook.shadow.reDraw("next");pageMediator.change()}else if(a=b;b++)c=el.id("canvas"+(twoPageBook.currentPage.left-b)),c=c.getContext("2d"),c.fillStyle="rgb(255,255,255)",c.fillRect(0,0,twoPageBook.bookWidth/2,twoPageBook.bookHeight),images.drawShadow(c,twoPageBook.currentPage.left-b),preloader.add(twoPageBook.currentPage.left-b),preloader.setSpecial(twoPageBook.currentPage.left-b),c=c=null;twoPageBook.flipFxCurrentPage(twoPageBook.currentPage.left);twoPageBook.pageConverter(a); twoPageBook.shadow.reDraw("prev");pageMediator.change()}window.setTimeout(function(){preloader.stopAll();el.del("bookLandscape");twoPageBook.draw(a)},twoPageBook.flipSpeed+100);timer.setBlockTime(twoPageBook.flipSpeed/2,twoPageBook.flipSpeed)}},flipFxCurrentPage:function(a){if(bookData.rightToLeftMode)0!=a%2&&twoPageBook.installed&&twoPageBook.currentPage.leftb?b:f;h.style.left=d+"px";el.id("bookLandscape").appendChild(h); if("rotateY(180deg)"==h.style.webkitTransform)h.style.webkitTransform="rotateY(0deg)";h.style.zIndex="500";var g=function(){h.style.webkitTransitionDuration=zoomBook.zoomIOSpeed+"ms";h.style.webkitTransform=system.device.android?"translate("+e+"px, 0px) scale("+f+","+f+")":"translate3d("+e+"px, 0px, 2px) scale3d("+f+","+f+",1)";delete g};window.setTimeout(g,1);var j=function(){el.id("canvas"+c).id="zoomedPage";zoomBook.draw(c,f,twoPageBook.bookWidth/2,twoPageBook.bookHeight);delete j};GAEnable&&(a= window.location.pathname.split("/"),_trackEvent(a[a.length-4]+"","Zooming","page"+c));window.setTimeout(j,zoomBook.zoomIOSpeed+10)}},gestureStart:function(a){if(!this.gesturePending)this.gesturePending=!0,a=a.target,twoPageBook.gestureStore.element=a.id,twoPageBook.gestureStore.left=a.style.left,twoPageBook.gestureStore.zIndex=a.style.zIndex,twoPageBook.gestureStore.webkit=a.style.webkitTransform,twoPageBook.gestureStore.parent=a.parentNode.id},gestureZoom:function(a){if(zoomLock.check()){var b=twoPageBook.gestureStore.element; if(b=="canvas"+twoPageBook.currentPage.left)var c=0;else b=="canvas"+twoPageBook.currentPage.right&&(c=twoPageBook.bookWidth/2);a=1+(a.scale-1)/3;b=el.id(twoPageBook.gestureStore.element);b.style.left=c+"px";b.style.zIndex=5E3;el.id("bookLandscape").appendChild(b);if("rotateY(180deg)"==b.style.webkitTransform)b.style.webkitTransform="rotateY(0deg)";b.style.webkitTransitionDuration="0ms";if(1h?(html5lib.duration(f,200),html5lib.transform(f,{translate:{x:d,y:0, z:2},scale:{x:h,y:h,z:h}}),window.setTimeout(function(){el.id("canvas"+c).id="zoomedPage";zoomBook.draw(c,h,twoPageBook.bookWidth/2,twoPageBook.bookHeight)},200)):1.2>e?(html5lib.duration(f,200),html5lib.scale(f,1,1,1),window.setTimeout(function(){f.style.left=twoPageBook.gestureStore.left;f.style.zIndex=twoPageBook.gestureStore.zIndex;f.style.webkitTransform=twoPageBook.gestureStore.webkit;el.id(twoPageBook.gestureStore.parent).appendChild(f)},200)):(html5lib.duration(f,200),html5lib.transform(f, {translate:{x:d,y:0,z:2},scale:{x:e,y:e,z:e}}),window.setTimeout(function(){el.id("canvas"+c).id="zoomedPage";zoomBook.draw(c,1*e,twoPageBook.bookWidth/2,twoPageBook.bookHeight)},200))}}}; twoPageBook.shadow={shadowSize:3,draw:function(){if(!system.device.publisher.isOn)if(bookData.rightToLeftMode)if(1==twoPageBook.currentPage.left){if(el.id("3x4"))el.id("3x4").style.webkitBoxShadow="0px 0px "+this.shadowSize+"px #000"}else if(twoPageBook.currentPage.right==bookData.pageCount){if(a=bookData.pageCount-3+"x"+(bookData.pageCount-2),el.id(a))el.id(a).style.webkitBoxShadow="0px 0px "+this.shadowSize+"px #000"}else{if(el.id("bookLandscape"))el.id("bookLandscape").style.webkitBoxShadow="0px 0px "+ this.shadowSize+"px #000"}else if(1==twoPageBook.currentPage.right){if(el.id("3x4"))el.id("3x4").style.webkitBoxShadow="0px 0px "+this.shadowSize+"px #000"}else if(twoPageBook.currentPage.left==bookData.pageCount){var a=bookData.pageCount-3+"x"+(bookData.pageCount-2);if(el.id(a))el.id(a).style.webkitBoxShadow="0px 0px "+this.shadowSize+"px #000"}else if(el.id("bookLandscape"))el.id("bookLandscape").style.webkitBoxShadow="0px 0px "+this.shadowSize+"px #000"},erase:function(){if(!system.device.publisher.isOn){if(el.id("3x4"))el.id("3x4").style.webkitBoxShadow= "0px 0px 0px #000";var a=bookData.pageCount-3+"x"+(bookData.pageCount-2);if(el.id(a))el.id(a).style.webkitBoxShadow="0px 0px 0px #000";if(el.id("bookLandscape"))el.id("bookLandscape").style.webkitBoxShadow="0px 0px 0px #000"}},reDraw:function(a){if(bookData.rightToLeftMode)if(2==twoPageBook.currentPage.right)"next"==a?window.setTimeout(function(){twoPageBook.shadow.erase();twoPageBook.shadow.draw()},twoPageBook.flipSpeed):"prev"==a&&(5eventManager.touchStartCoordinate.x-a.changedTouches[0].pageX?twoPageBook.events.flipRight():50 eventManager.clickStartCoordinate.x-a.pageX?twoPageBook.events.flipRight():50system.device.width()*(1-twoPageBook.events.leftAndRightArea)/ system.browser.scale?bookData.rightToLeftMode?twoPageBook.prev():twoPageBook.next():toolbar.toogle();delete a},doubleTap:function(a){slideShow.active||(links.isLinkBool&&links.clearRect(),"CANVAS"==a.target.tagName&&twoPageBook.goToZoom(a))},singleClick:function(a){links.isLinkBool?(links.clearRect(),links.currGoPage&&twoPageBook.goToPage(links.currGoPage)):(a.xsystem.device.width()*(1-twoPageBook.events.leftAndRightArea)/system.browser.scale?bookData.rightToLeftMode?twoPageBook.prev():twoPageBook.next():toolbar.toogle(),delete a,a=null);delete a},doubleClick:function(a){slideShow.active||(links.isLinkBool&&links.clearRect(),"CANVAS"==a.target.tagName&&twoPageBook.goToZoom(a))},flipLeft:function(){bookData.rightToLeftMode?twoPageBook.prev():twoPageBook.next()},flipRight:function(){bookData.rightToLeftMode?twoPageBook.next():twoPageBook.prev()}}; var workspace={draw:function(){var a=system.device.width()+"px",b=system.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(){if(slideShow.active)slideShow.active=!1;workspace.draw()}};"undefined"==typeof XML&&(XML=function(){});XML.ObjTree=function(){return this};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=!1,b.loadXML(a),b=b.documentElement;return!b?void 0: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="undefined"==typeof d.postBody&&"undefined"==typeof d.postbody&&"undefined"==typeof d.parameters?"get":"post";if(c){d.asynchronous=!0;var f=this,h=d.onComplete;d.onComplete=function(a){var b;a&&a.responseXML&&a.responseXML.documentElement?b=f.parseDOM(a.responseXML.documentElement):a&&a.responseText&&(b=f.parseXML(a.responseText));c(b,a);h&&h(a)}}else d.asynchronous=!1;var g;if("undefined"!=typeof HTTP&& HTTP.Request){if(d.uri=a,a=new HTTP.Request(d))g=a.transport}else if("undefined"!=typeof Ajax&&Ajax.Request&&(a=new Ajax.Request(a,d)))g=a.transport;if(c)return g;if(g&&g.responseXML&&g.responseXML.documentElement)return this.parseDOM(g.responseXML.documentElement);if(g&&g.responseText)return this.parseXML(g.responseText)}; XML.ObjTree.prototype.parseDOM=function(a){if(a){this.__force_array={};if(this.force_array)for(var b=0;b":"object"==typeof f&&f.constructor==Array?this.array_to_xml(e,f):"object"==typeof f?this.hash_to_xml(e,f):this.scalar_to_xml(e,f):d[d.length]=" "+e.substring(1)+'="'+this.xml_escape(f)+'"'}d=d.join("");e=c.join("");"undefined"==typeof a||null==a||(e=0\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":"object"==typeof e&&e.constructor==Array?this.array_to_xml(a,e):"object"==typeof e?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"#text"==a?this.xml_escape(b):"<"+a+">"+this.xml_escape(b)+"\n"}; XML.ObjTree.prototype.xml_escape=function(a){return(""+a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}; var zoomBook={currentPage:0,installed:!1,verticalScroll:!1,horizontalScroll:!1,noFreeze:!1,pageAreaWidth:0,pageAreaHeight:0,pageWidth:0,pageHeight:0,topShift:0,leftShift:0,innerShift:10,translateScrollX:0,translateScrollY:0,zoomFactor:0,currentPage:0,nextPageBuffer:1,prevPageBuffer:1,slideSpeed:800,zoomIOSpeed:800,sourcePageHeight:0,sourcePageWidth:0,innerZoomState:!1,initSizes:function(a,b,c,d){this.zoomFactor=a;this.currentPage=d;this.pageWidth=b.toFixed(0);this.pageHeight=c.toFixed(0);this.pageAreaWidth= b>system.device.width()?b+this.innerShift:system.device.width()+this.innerShift;this.pageAreaHeight=c>system.device.height()?c:system.device.height();this.pageAreaWidth=this.pageAreaWidth;this.translateScrollY=((this.pageAreaHeight-system.device.height())/2).toFixed(0);this.translateScrollX=((this.pageAreaWidth-system.device.width())/2).toFixed(0);this.topShift=((system.device.height()-c)/2).toFixed(0);this.leftShift=((system.device.width()-b)/2).toFixed(0);b.toFixed(0)>=system.device.width()?(this.horizontalScroll= !0,this.leftShift=0):(this.horizontalScroll=!1,this.translateScrollX=0);c.toFixed(0)>system.device.height()?(this.verticalScroll=!0,this.topShift=0):(this.verticalScroll=!1,this.translateScrollY=0);this.translateX=this.pageAreaWidth*(this.currentPage-1)+1*this.translateScrollX},draw:function(a,b,c,d,e,f){preloader.stopAll();zoomBook.noFreeze?zoomBook.noFreeze=!1:zoomLock.lock();b=b||this.zoomFactor;bookData.size.proportionsa)a=1; else if(a>bookData.pageCount)a=bookData.pageCount;if(a==zoomBook.currentPage)pageMediator.change();else if(a==1*zoomBook.currentPage+1)bookData.rightToLeftMode?zoomBook.prev():zoomBook.next();else if(a==1*zoomBook.currentPage-1)bookData.rightToLeftMode?zoomBook.next():zoomBook.prev();else if(01*zoomBook.currentPage){var b=1*zoomBook.currentPage+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(1*zoomBook.currentPage+1);preloader.setSpecial(1*zoomBook.currentPage+1);bookData.rightToLeftMode?zoomBook.moveFX(-1):zoomBook.moveFX(1)}else b=1*zoomBook.currentPage-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(1*zoomBook.currentPage-1),preloader.setSpecial(1*zoomBook.currentPage-1),bookData.rightToLeftMode?zoomBook.moveFX(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(zoomLock.check()){if(this.horizontalScroll)if(this.translateScrollX-a>this.pageWidth-system.device.width())var c=this.pageWidth-system.device.width()-this.translateScrollX,a=-(c-(a+c)/2);else 0>this.translateScrollX-a&&(a=1*this.translateScrollX- (1*this.translateScrollX-a)/3);else a=0;this.verticalScroll?this.translateScrollY-b>this.pageHeight-system.device.height()?(c=this.pageHeight-system.device.height()-this.translateScrollY,b=-(c-(b+c)/2)):0>this.translateScrollY-b&&(b=1*this.translateScrollY-(1*this.translateScrollY-b)/3):b=0;c=el.id("zoomBook");html5lib.duration(c,0);html5lib.translate(c,1*-this.translateScrollX+1*a,1*-this.translateScrollY+1*b,0)}},scrollEnd:function(a,b){if(zoomLock.check()){var c=this.horizontalScroll?system.device.ipad? -300:-125:system.device.ipad?-130:-50;if(this.translateScrollX-a>this.pageWidth-system.device.width()&&athis.translateScrollX-a&&1!=this.currentPage&&1*this.translateScrollX-athis.pageHeight-system.device.height()?this.pageHeight-system.device.height():0>this.translateScrollY- b?0:this.translateScrollY-b;if(this.horizontalScroll)this.translateScrollX=this.translateScrollX-a>this.pageWidth-system.device.width()?this.pageWidth-system.device.width():0>this.translateScrollX-a?0:this.translateScrollX-a;c=el.id("zoomBook");html5lib.duration(c,300);html5lib.translate(c,-this.translateScrollX,-this.translateScrollY,0)}maxDeltaX=null}},zoomOutOnePage:function(a,b){bookData.size.proportionsthis.pageWidth)this.xScale=(this.pageWidth/2).toFixed(0);if(system.device.height()>this.pageHeight)this.yScale=(this.pageHeight/2).toFixed(0)}},gestureZoom:function(a){if(zoomLock.check()){var b=el.id("canvas"+zoomBook.currentPage),a=(1+(a.scale-1)/2).toFixed(2);html5lib.duration(b,0);b.style.webkitTransformOrigin=this.xScale+"px "+this.yScale+"px";html5lib.scale(b,a,a,1)}},gestureStop:function(a){if(zoomLock.check()&&a.target.id== "canvas"+zoomBook.currentPage){var b="one"===bookChoice.getType()?1.15:1.55,c=Math.sqrt(5E6/(this.pageWidth*this.pageHeight));if("two"===bookChoice.getType())if(bookData.size.proportions*bookData.size.proportionsc?g=c:g/d=system.device.width()&&0>f*g-system.device.width()/2?(a=f*g-system.device.width()/2,j=0):this.pageWidth* g>=system.device.width()&&0=system.device.height()&&0>h*g-system.device.height()/2?(c=h*g-system.device.height()/2,k=0):this.pageHeight* g>=system.device.height()&&0system.device.width()*(1-zoomBook.events.leftAndRightArea)/system.browser.scale?bookData.rightToLeftMode?zoomBook.prev():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=system.device.publisher.isOn?system.device.width()/2:system.device.width();a.xb*(1-twoPageBook.events.leftAndRightArea)/system.browser.scale?bookData.rightToLeftMode?zoomBook.prev():zoomBook.next():toolbar.toogle()}delete a},doubleClick:function(a){links.isLinkBool&&links.clearRect();zoomBook.zoomOut(a)},flipLeft:function(){bookData.rightToLeftMode? zoomBook.prev():zoomBook.next()},flipRight:function(){bookData.rightToLeftMode?zoomBook.next():zoomBook.prev()}};var zoomLock={status:!0,lock:function(){this.status=!1},unLock:function(){this.status=!0},check:function(){return zoomLock.status}};