function flippingbook() { this.pages = []; this.zoompages = []; this.printpages = []; this.contents = []; this.stagewidth = "100%"; this.stageheight = "100%"; this.settings = { bookwidth: 814, bookheight: 545, pagesset: this.pages, zoompagesset: this.zoompages, printpagesset: this.printpages, scalecontent: true, preserveproportions: false, centercontent: true, hardcover: false, hardcoverthickness: 3, hardcoveredgecolor: 0xffffff, highlighthardcover: true, framewidth: 0, framecolor: 0xffffff, framealpha: 100, firstpagenumber: 1, autoflipsize: 50, navigationflipoffset: 30, fliponclick: true, handovercorner: true, handoverpage: true, alwaysopened: false, staticshadowstype: "asymmetric", // asymmetric, symmetric, default staticshadowsdepth: 1, staticshadowslightcolor: 0xffffff, // works for "symmetric" shadows only staticshadowsdarkcolor: 0x000000, dynamicshadowsdepth: 1, dynamicshadowslightcolor: 0xffffff, // works for "dark" pages only dynamicshadowsdarkcolor: 0x000000, movespeed: 2, closespeed: 3, gotospeed: 3, rigidpagespeed: 5, flipsound: "", hardcoversound: "", preloadertype: "thin", // "progress bar", "round", "thin", "dots", "gradient wheel", "gear wheel", "line", "animated book", "none" pagebackgroundcolor: 0x99ccff, loadondemand: true, allowpagesunload: true, showunderlyingpages: false, playondemand: true, freezeonflip: false, darkpages: false, smoothpages: false, rigidpages: false, flipcornerstyle: "manually",// "first page only", "each page", "manually" flipcornerposition: "bottom-right",// "bottom-right","top-right","bottom-left","top-left" flipcorneramount: 50, flipcornerangle: 20, flipcornerrelease: true, flipcornervibrate: true, flipcornerplaysound: false, zoomenabled: true, zoompath: "pages/large/", zoomimagewidth: 900, zoomimageheight: 1165, zoomonclick: true, showcopyrightpanel: false, zoomuicolor: 0x253434, zoomhint: "double click for zooming.", zoomhintenabled: false, centerbook: true, usecustomcursors: true, dropshadowenabled: true, dropshadowhidewhenflipping: true, backgroundcolor: 0x253434, /*backgroundimage: "img/bookbackground.jpg",*/ backgroundimageplacement: "fit", // "top left", "center", "fit" printenabled: true, printtitle: "print pages", downloadurl: "", downloadtitle: "download pdf", downloadsize: sizestring, downloadcomplete: "complete", extxml: "" }; this.containerid = "fbcontainer"; this.forwardbuttonid = "fbforwardbutton"; this.backbuttonid = "fbbackbutton"; this.firstbuttonid = "fbfirstbutton"; this.zoombuttonid = "fbzoombutton"; this.printbuttonid = "fbprintbutton"; this.downloadbuttonid = "fbdownloadbutton"; this.currentpagesid = "fbcurrentpages"; this.totalpagesid = "fbtotalpages"; this.contentsmenuid = "fbcontentsmenu"; }; flippingbook.prototype.create = function(){ this.settings.pagesset = this.pages; this.settings.zoompagesset = this.zoompages; this.settings.printpagesset = this.printpages; if( location.hash.substr(1) != "" ) this.settings.firstpagenumber = location.hash.substr(1); this.addloadevent( this.onwindowload ); swfobject.embedswf("flash/flippingbook.swf", this.containerid, this.stagewidth, this.stageheight, "8.0.0", "js/expressinstall.swf", this.settings, {wmode:"opaque",menu:"false",allowscriptaccess: "always", bgcolor: "#" + this.settings.backgroundcolor.tostring( 16 )}); } flippingbook.prototype.getflippingbookreference = function() { return this.getobjectreference( this.containerid ); } flippingbook.prototype.getobjectreference = function( id ) { return document.getelementbyid( id ); } flippingbook.prototype.flipforward = function() { flippingbook.getflippingbookreference().flipforward(); } flippingbook.prototype.flipback = function() { flippingbook.getflippingbookreference().flipback(); } flippingbook.prototype.zoombuttonclick = function() { if( flippingbook.getflippingbookreference().iszoomedin() ) flippingbook.zoomout(); else flippingbook.zoomin(); } flippingbook.prototype.zoomin = function() { this.getflippingbookreference().zoomin(); } flippingbook.prototype.zoomout = function() { this.getflippingbookreference().zoomout(); } flippingbook.prototype.print = function() { flippingbook.getflippingbookreference().print(); } flippingbook.prototype.downloadfile = function() { if( flippingbook.settings.downloadurl ) flippingbook.getflippingbookreference().downloadfile(); } flippingbook.prototype.onwindowload = function(){ var forwardbutton = flippingbook.getobjectreference( flippingbook.forwardbuttonid ); if( forwardbutton ){ forwardbutton.style.cursor = "pointer"; forwardbutton.onclick = flippingbook.flipforward; } var backbutton = flippingbook.getobjectreference( flippingbook.backbuttonid ); if( backbutton ){ backbutton.style.cursor = "pointer"; backbutton.onclick = flippingbook.flipback; } var zoombutton = flippingbook.getobjectreference( flippingbook.zoombuttonid ); if( zoombutton ){ zoombutton.style.cursor = "pointer"; zoombutton.onclick = flippingbook.zoombuttonclick; } var printbutton = flippingbook.getobjectreference( flippingbook.printbuttonid ); if( printbutton ){ printbutton.style.cursor = "pointer"; printbutton.onclick = flippingbook.print; } var downloadbutton = flippingbook.getobjectreference( flippingbook.downloadbuttonid ); if( downloadbutton ){ downloadbutton.style.cursor = "pointer"; downloadbutton.onclick = flippingbook.downloadfile; } flippingbook.buildcontentsmenu(); } flippingbook.prototype.onputpage = function( leftpagenumber, rightpagenumber ){ this.pagenum=rightpagenumber; this.updatepagination( leftpagenumber, rightpagenumber ); this.updatecontentsmenu( leftpagenumber, rightpagenumber ); } flippingbook.prototype.updatepagination = function( leftpagenumber, rightpagenumber ){ var leftpageexists = ( leftpagenumber != undefined ); var rightpageexists = ( rightpagenumber != undefined ); var pagenumberstring = leftpagenumber + "-" + rightpagenumber; if( !leftpageexists ) pagenumberstring = rightpagenumber; if( !rightpageexists ) pagenumberstring = leftpagenumber; this.getobjectreference( this.currentpagesid ).innerhtml = pagenumberstring; this.getobjectreference( this.totalpagesid ).innerhtml = " / " + this.getflippingbookreference().totalpages(); } flippingbook.prototype.buildcontentsmenu = function(){ var contentsselect = this.getobjectreference( this.contentsmenuid ); if( contentsselect ){ for( var i = 0; i < this.contents.length; i++ ) contentsselect.options[i] = new option(this.contents[i][0], this.contents[i][1]); contentsselect.onchange = this.oncontentschange; } } flippingbook.prototype.oncontentschange = function(){ var contentsselect = flippingbook.getobjectreference( flippingbook.contentsmenuid ); var pagenumber = contentsselect.options[contentsselect.selectedindex].value; if( pagenumber ) flippingbook.getflippingbookreference().flipgotopage( pagenumber ); } flippingbook.prototype.updatecontentsmenu = function( leftpagenumber, rightpagenumber ){ var contentsselect = flippingbook.getobjectreference( flippingbook.contentsmenuid ); if( contentsselect ){ for( var i = 0; i < this.contents.length - 1; i++ ){ var minpage = contentsselect.options[i].value; var maxpage = contentsselect.options[i+1].value; var leftok = false; var rightok = false; if( leftpagenumber ) leftok = ( number( leftpagenumber ) >= minpage && number( leftpagenumber ) <= maxpage ); else leftok = true; if( rightpagenumber ) rightok = ( number( rightpagenumber ) >= minpage && number( rightpagenumber ) <= maxpage ); else rightok = true; if( leftok && rightok ) break; } contentsselect.selectedindex = i; } } flippingbook.prototype.getwindowheight = function() { var windowheight = 0; if (typeof(window.innerheight) == 'number' ) { windowheight=window.innerheight; } else { if (document.documentelement && document.documentelement.clientheight) { windowheight = document.documentelement.clientheight; } else { if (document.body&&document.body.clientheight) { windowheight=document.body.clientheight; } } } return windowheight; } flippingbook.prototype.addloadevent = function ( fn ) { if (typeof window.addeventlistener != "undefined") { window.addeventlistener("load", fn, false); } else if (typeof document.addeventlistener != "undefined") { document.addeventlistener("load", fn, false); } else if (typeof window.attachevent != "undefined") { window.attachevent("onload", fn); } else if (typeof window.onload == "function") { var fnold = window.onload; window.onload = function() { fnold(); fn(); }; } else { window.onload = fn; } } flippingbook.prototype.handlewheel = function ( delta ){ this.getflippingbookreference().onwheelscroll( delta ); } flippingbook = new flippingbook(); function wheel(event){ var delta = 0; if (!event) event = window.event; if (event.wheeldelta) { delta = event.wheeldelta/120; if (window.opera) delta = -delta; } else if (event.detail) { delta = -event.detail/3; } if (delta) flippingbook.handlewheel(delta); if (event.preventdefault) event.preventdefault(); event.returnvalue = false; } if (window.addeventlistener) window.addeventlistener('dommousescroll', wheel, false); window.onmousewheel = document.onmousewheel = wheel;