﻿function FlippingBook() {
	this.pages = [];
	this.zoomPages = [];
	this.printPages = [];
	this.contents = [];

	this.stageWidth = "100%";
	this.stageHeight = "100%";
	
	this.settings = {
			bookWidth: 1131,
			bookHeight: 800,
			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: 0xcccccc,
			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: 1280,
			zoomImageHeight: 1809,
			zoomOnClick: true,
			zoomUIColor: 0xcccccc,
			zoomHint: "Doppelklick für Vergrößerung",
			zoomHintEnabled: true,
			centerBook: true,		
			useCustomCursors: true,
			dropShadowEnabled: true,
			dropShadowHideWhenFlipping: true,
			backgroundColor: 0xFFFFFF,
			backgroundImage: "img/bookBackground.jpg",
			backgroundImagePlacement: "fit", //  "top left", "center", "fit"
			printEnabled: true,
			printTitle: "Print Pages",
			downloadURL: "",
			downloadTitle: "Download PDF",
			downloadSize: "Size: 22 Mb",
			downloadComplete: "Complete",
			extXML: ""
		};
		
		this.containerId = "fbContainer";
		this.forwardButtonId = "fbForwardButton";
		this.backButtonId = "fbBackButton";
		this.zoomButtonId = "fbZoomButton";
		this.printButtonId = "fbPrintButton";
		this.downloadButtonId = "fbDownloadButton";
		this.currentPagesId = "fbCurrentPages";
		this.totalPagesId = "fbTotalPages";
		this.contentsMenuId = "fbContentsMenu";	

        this.button_x = [
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		-110,
		0,
	        -110,
		0,
		-110,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		0,
		-110,
		0,
		0,
		0,
		0,
		-110,
		0,
		-110,
		0,
		-280,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		0,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		-280,
		0,
		-110,
		0,
		-110,
		0,
		0,
		0,
		-110,
		0,
		-150,
		0,
		-100,
		0,
		-110,
		0,
		-110,
		0,
		-110,
		0,
		0,
		0,
		0,
		0,
	        -110,
		0,
		0,
		0,
		-110,
		0,
		0,
		0,
		-110,
		0,
		-110,
		0,
		-400,
		70,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		-110,
		200,
		-110,
		0,
		-380,
		300,
		0,
		0,
		-140,
		300,
		0,
		0,
		-270,
		300,
		0,
		100,
		0,
		50,
		-200,
		10,
		-410,
		110,
		-400,
		300,
		-350,
		0,
		-150,
		300,
		0,
		0,
		0,
                300,
		-210,
		-430,
		0,
		0,
		40,
		-410,
		0,
		0,
		0,
		-110,
		0,
		0,
		0,
		0,
		0,
		0,
		340,
		40,
		-370,
		300,
		-210,
		0,
		350,
		50,
		-150,
		-350,
		-140,
		-380,
		-400,
		0,
		0,
		0,
		0,
		0,
		-350,
		320,
		0,
		0,
                0,
		350,
                -410,
                0,
                0
        ];
		
		this.button_y = [
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		500,
		0,
	        500,
		0,
		500,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		0,
		530,
		0,
		0,
		0,
		0,
		500,
		0,
		500,
		0,
		250,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		0,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		250,
		0,
		500,
		0,
		500,
		0,
		0,
		0,
		520,
		0,
		200,
		0,
		510,
		0,
		500,
		0,
		500,
		0,
		500,
		0,
		0,
		0,
		0,
		0,
	        500,
		0,
		0,
		0,
		500,
		0,
		0,
		0,
		500,
		0,
		500,
		0,
		370,
		260,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		0,
		550,
		280,
		100,
		0,
		420,
		-30,
		0,
		0,
		60,
		-50,
		0,
		0,
		60,
		-40,
		0,
		400,
		0,
		425,
		200,
		100,
		180,
		-40,
		400,
		-30,
		350,
		0,
		100,
		1,
		0,
		0,
		0,
		60,
		30,
		285,
		0,
		0,
		400,
		350,
		0,
		0,
		500,
		0,
		0,
		0,
		0,
		0,
                0,
                0,
		200,
		320,
		350,
		150,
		300,
		0,
		300,
		300,
		70,
		430,
		70,
		300,
		350,
		0,
		0,
		0,
		0,
		0,
		400,
		-50,
		0,
                0,
		0,
                500,
                500,
                0,
                0
        ];
		
		this.button_URL = [
		"",
		"",
                "",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/bc1f52c59c3d100330378315e7fd54af/Kunststoffrahmen-%26quot%3BCordoba%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3a5e65e33667afd50d967833547cd551/Kunststoffrahmen-%26quot%3BMadrid%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3a5e65e33667afd50d967833547cd551/Kunststoffrahmen-%26quot%3BMadrid%26quot%3B/",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/a1db917660efea07204ea717a0f60654/Kunststoffrahmen-%26quot%3BSevilla%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/0c1c730a9ab411567cd7376daae2e861/Kunststoffrahmen-%26quot%3BSevilla-Dekor%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/bb6d64814a27e60efef75cc4e2f06c08/Photogalerie-%26quot%3BSevilla%26quot%3B/",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/e1d6e0a0ff4b4d3dbef4ba4e753d7625/Kunststoffrahmen-%26quot%3BValencia%26quot%3B/",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/af93fe09930312f047699b1d9bafbafa/Echtholzrahmen-%26quot%3BAthen%26quot%3B",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/7b0f8c11ffc6568a5adab64fa243afe4/Echtholzrahmen-%26quot%3BAtlanta%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/dc6259abc0c9b35ffa52b18f339b5f89/Echtholzrahmen-%26quot%3BCarolina%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/18fd80e719319a4faf2899610dc33f74/Echtholzrahmen-%26quot%3BFlorida-natur%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/cc3d5be687ab9d9b3bc7ff2ba848cdaf/Echtholzrahmen-%26quot%3BFlorida-dekor%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/f0ba697469ef70e69ad1aa7b3ed9124d/Echtholzrahmen-%26quot%3BGeorgia%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/431e5b26d99824b1dcdd10ffae0b245c/Echtholzrahmen-%26quot%3BGoeteborg%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/431e5b26d99824b1dcdd10ffae0b245c/Echtholzrahmen-%26quot%3BGoeteborg%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3195664adcc98eb0053b5c797218d3c1/Echtholzrahmen-%26quot%3BIdaho%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/1f1cb93d3faf6e99f6dd97e73ce56152/Echtholzrahmen-%26quot%3BKorfu%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/1f1cb93d3faf6e99f6dd97e73ce56152/Echtholzrahmen-%26quot%3BKorfu%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/666d95f6b0379bf04e81a49d7b726b73/Echtholzrahmen-%26quot%3BMaine%26quot%3B/",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/0b9f383583f98247e329ce9287c072db/Echtholzrahmen-%26quot%3BMiami%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/0b9f383583f98247e329ce9287c072db/Echtholzrahmen-%26quot%3BMiami%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/d75910ea30334bd1981ec578c2d28400/Echtholzrahmen-%26quot%3BMichigan%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/6c928d37107f46963200939a48e15d60/Echtholzrahmen-%26quot%3BOmaha%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/7cf1d94e388b68d99ea8989119c19eb0/Echtholzrahmen-%26quot%3BOregon%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/b75ee3f7fb60fa8cfb599a7a91ec1ead/Echtholzrahmen-%26quot%3BOregon%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/6035e4f345cf60c6d308957c17e176e3/Echtholzrahmen-%26quot%3BOregon%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/bbf4670276bc95e42eaa037cde289e50/Echtholzrahmen-%26quot%3BOregon-Breit%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/db6e0e85ca6b8976a7ab8544ead3d810/Echtholzrahmen-%26quot%3BOslo%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/66e3013be6e747a60270b0ab2cadde7c/Echtholzrahmen-%26quot%3BRiga%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/66e3013be6e747a60270b0ab2cadde7c/Echtholzrahmen-%26quot%3BRiga%26quot%3B/",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/c9010e135b95e2bd74001848f30c9ec0/Stockholm/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/1cbcead4052ec0dd4eb2fce5b07235dc/Photogalerie-%26quot%3BStockholm%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/1b12059d26029a63d71d3e655506dfa4/Photogalerie-%26quot%3BStockholm%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/a6d7a60e78229e8403862fc6b27f20e9/Photogalerie-%26quot%3BStockholm%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/b53f6e74e7fe1937022e5b52efa85580/Echtholzrahmen-%26quot%3BToledo%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/b53f6e74e7fe1937022e5b52efa85580/Echtholzrahmen-%26quot%3BToledo%26quot%3B/",
		"",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/7716b96f40c53845e018c45d301bf36f/Aluminiumrahmen-%26quot%3BChicago%26quot%3B/",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/6ebbae5c6ed0e06130dcdf012a2887b5/Aluminiumrahmen-%26quot%3BManhattan%26quot%3B/",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/4b3b20dbcc4cd86e6ca14fd79516e478/Rahmenloser-Bildhalter-%26quot%3BClip-Fix%26quot%3B.-Reflex/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/7fcdebcedae77637c4b0bb3b8edc6382/Rahmenloser-Bildhalter-%26quot%3BClip-Fix%26quot%3B.-Antireflex/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/a1727d8473f8cce608ee90905b7d365a/Photogalerie-%26quot%3BClip-Fix%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/5d3efbaf8be97c9de47b7813aeb9bc51/Photogalerie-%26quot%3BClip-Fix%26quot%3B/",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3691213a8d3e2aff726f775d4abb298d/Portraitrahmen-%26quot%3BBrest%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/fb8e852d826ade9adfacf0433e994bbb/Portraitrahmen-%26quot%3BBrest%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/0211aed60145749dc570a18b552914eb/Portraitrahmen-%26quot%3BSan-Marco%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/86b899af2957f8c4127c33f0b966d085/Portraitrahmen-%26quot%3BElegance%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/043f9a3764289e66bd4caf7c5173af08/Portraitrahmen-%26quot%3BFlower%26quot%3B/",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/ddac6082d8234c6b645cbfc6018ed58d/Portraitrahmen-%26quot%3BEmotion%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/a28fdfcc1db30865713cf9040299a31b/Portraitrahmen-%26quot%3BRomance%26quot%3B/",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/d234d971dc59c14967172bfe2203d57d/Venlo/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/09439f3b4e80e7747b2ac18ad311e58a/Portraitrahmen-%26quot%3BAmsterdam%26quot%3B.-Hochformat/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/8a333d0d9ea881ff8e1019548e935762/Portraitrahmen-%26quot%3BVerdun%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/f850714a382933a084788f7310f831be/Portraitrahmen-%26quot%3BOrleans%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/b9125767e1dbde1b82d79c8ddde3a76e/Portraitrahmen-%26quot%3BBern%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/6566080231e190bf147b5557c0c07b89/Metall-Portraitrahmen-%26quot%3BRouen%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/5fdefbbe55da2160699a764d8c98d047/Portraitrahmen-%26quot%3BSt.-Tropez%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/66235fcf93391495f1d11a744243fb5e/Portraitrahmen-%26quot%3BCannes%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/8419cd186eb110f76d98b5053831c003/Portraitrahmen-%26quot%3BLe-Mans%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/f634f38084317e5c89746a1ed48f81ce/Portraitrahmen-%26quot%3BLivigno%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/230227177379e1a19f4a6dc3418d6018/Portraitrahmen-%26quot%3BLimoges%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/c7c61a05c5f53ce983b3a4789d7fe825/Portraitrahmen-%26quot%3BChic%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/dca3c4ad623dc428e505d268cd4b46cc/Minirahmen-%26quot%3BPyrmont%26quot%3B/",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/5da52b99ac64b371ca8c8154b6379031/Portraitrahmen-%26quot%3BDen-Haag%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/027853434e182869dd2064c1c4930f27/Portraitrahmen-Memoboard-%26quot%3BVichy%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/cca22054aa391ed35b7ddb792852ccf8/Kunststoff-Portraitgalerie-%26quot%3BMiramas%26quot%3B/",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/e3535bc9ba4fcbc59350c51f30f9c383/Portraitrahmen-%26quot%3BScala%26quot%3B.-Quer/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/661d1f2b4909f29192c8160ff5dc391b/Portraitrahmen-%26quot%3BScala%26quot%3B.-Hoch/",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/9e12787dc34899fb01fa34c8042c7368/Acrylrahmen/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/fb7e0ccdb7205a93aefdd72db54fa452/Acryl-Fotowuerfel/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/ad94bd25226308589843df1e7dce9631/Portraitrahmen-%26quot%3BFilm%26quot%3B.-Gebogen-Quer/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/398081e7e2b9de8a7b6b0bfe10e83fcd/Portraitrahmen-%26quot%3BKlappe%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/01a80ce6d87c77e4dedf59db0ba7fd23/Portraitrahmen-%26quot%3BGalerie%26quot%3B/",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3ba1d7688e9c192956373f7a1c39b3d2/Portraitrahmen-Kindermessleiste/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3ba1d7688e9c192956373f7a1c39b3d2/Portraitrahmen-Kindermessleiste/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/8fa6179500345ed3d92f6b6817c996ae/Portraitrahmen-%26quot%3BNils%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/e24df02514a893fc21d413d944a5422b/Portraitrahmen-%26quot%3BSophie%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/7d32f888925522b3b9645bc225766aa6/Portraitrahmen-%26quot%3BBaby-Girl%26quot%3B/",
                "http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/40d07fd9d531abd9c2265552b5b7677d/Portraitrahmen-%26quot%3BBaby-Boy%26quot%3B/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/eb78fb26336af358f9499a57dc17cae3/Portraitrahmen-%26quot%3BBaby-Baer%26quot%3B/",
		"",
		"",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/b76d671d935579449c530df7065b0741/Jena/",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/2c49bbeba2c3a87d2ca5845fb00484da/Saphira-Mona/",
		"",
		"",
		"",
		"http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3d0abe83c0a369093f9b6983e76cd5d4/Portraitrahmen-%26quot%3BBaby-Galerie%26quot%3B/",
                "http://www.allesrahmen.de/oxid.php/sid/x/cl/details/anid/3d0abe83c0a369093f9b6983e76cd5d4/Portraitrahmen-%26quot%3BBaby-Galerie%26quot%3B/",
                "",
                ""
        ];

};

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("FlippingBook.swf", this.containerId, this.stageWidth, this.stageHeight, "8.0.0", "js/expressInstall.swf", this.settings, {allowScriptAccess: "always", bgcolor:  "#" + this.settings.backgroundColor.toString( 16 ), wmode: "transparent" });
}

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();
	this.updateButton( 0, 0);
}

FlippingBook.prototype.zoomOut = function() {
	this.getFlippingBookReference().zoomOut();
	this.updateButton( 0, 0);
}

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.updatePagination( leftPageNumber, rightPageNumber );
	this.updateContentsMenu( leftPageNumber, rightPageNumber );
	this.updateButton( leftPageNumber, rightPageNumber );
}

FlippingBook.prototype.updateButton = function( leftPageNumber, rightPageNumber ){
  	var leftPageExists = ( leftPageNumber != undefined );
	var rightPageExists = ( rightPageNumber != undefined );
	var iszoomed = flippingBook.getFlippingBookReference().isZoomedIn()

	if( leftPageExists) {
	  if(leftPageNumber > 0){
	    leftPageNumber--;
		if( this.button_URL[leftPageNumber]!="" ) {
		  this.getObjectReference( "btn_div1" ).setAttribute("style", 'visibility:visible;', 0);
          this.getObjectReference( "btn_div1" ).innerHTML = 
		  '<a href="' + this.button_URL[leftPageNumber] + '" target="_blank">' +
		    '<img src="/rahmentest/img/onlineshop.jpg" style="position: relative;top:' + this.button_y[leftPageNumber] + 'px;Left:' + this.button_x[leftPageNumber] + 'px;"/>' +
		  '</a>'
        }else{
		  this.getObjectReference( "btn_div1" ).innerHTML = '';
		}
	  }else{
	    if (iszoomed == 0){
		  this.getObjectReference( "btn_div1" ).setAttribute("style", 'visibility:hidden;', 0);
		}else{
	      this.getObjectReference( "btn_div1" ).setAttribute("style", 'visibility:visible;', 0);
		}
	  }
	}else{
	  this.getObjectReference( "btn_div1" ).innerHTML = '';
	}
	if( rightPageExists) {
	  if(rightPageNumber > 0){
	    rightPageNumber--;
		if( this.button_URL[rightPageNumber]!="" ) {
		  this.getObjectReference( "btn_div2" ).setAttribute("style", 'visibility:visible;', 0);
		  this.getObjectReference( "btn_div2" ).innerHTML = 
		  '<a href="' + this.button_URL[rightPageNumber] + '" target="_blank">' +
		    '<img src="/rahmentest/img/onlineshop.jpg" style="position: relative;top:' + this.button_y[rightPageNumber] + 'px;Left:' + this.button_x[rightPageNumber] + 'px;"/>' +
		  '</a>'
	    }else{
		  this.getObjectReference( "btn_div2" ).innerHTML = '';
		}
	  }else{
	    if (iszoomed == 0){
		  this.getObjectReference( "btn_div2" ).setAttribute("style", 'visibility:hidden;', 0);
		}else{
          this.getObjectReference( "btn_div2" ).setAttribute("style", 'visibility:visible;', 0);
		}
	  }
	}else{
	  this.getObjectReference( "btn_div2" ).innerHTML = '';
	}
}

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;
}

function doubleclick(event){
  flippingBook.updateButton( 0, 0);
}

if (window.addEventListener)
	window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
if (window.addEventListener)
	window.addEventListener('dblclick', doubleclick, false);

