/*!
 * projekktor zwei
 * http://www.projekktor.com
 *
 * Copyright 2010, Sascha Kluger, Spinning Airwhale Media, http://www.spinningairwhale.com
 * under GNU General Public License
 * http://www.projekktor.com/license/
 *
 * You can use, modify and distribute the software, but do so in the spirit of Open Source.
 * You need to leave the copyright notices intact.
 * You need to be able to share any modifications you make to the Projekktor source (not the software Projekktor is integrated to).
 * Give credit where credit is due, spread the word, link to us if you can.
 *
 * Includes jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * ,------------------------------------------,      .    _  .
 * |  Naaah, love shines through !!1!         |      |\_|/__/|
 * |------------------------------------------|     / / \/ \  \
 *                                           \     /__|O||O|__ \
 *                                             \  |/_ \_/\_/ _\ |
 *                                                | | (____) | ||
 *                                                \/\___/\__/  //
 *                                                (_/         ||
 *                                                 |          ||
 *                                                 |          ||\
 *                                                  \        //_/
 *                                                   \______//
 *                                                 __ || __||
 *                                                (____(____)
 */
var PROJEKKTOR_CONFIG = [];
var PROJEKKTOR = [];
var playerObjectAUDIOFLASH = function () {};
	playerObjectAUDIOFLASH.prototype = {
	imageElement: {},
	createMediaElement: function (b) {
		this.elementReady = false;
		var a = this;
		var c = {
			id: this.environment.publicName + "_media_flash",
			name: this.environment.publicName + "_media_flash",
			src: this.config.playerFlashMP3,
			width: "1",
			height: "1",
			AllowScriptAccess: "always",
			wmode: "opaque",
			bgcolor: "#000000",
			FlashVars: {}
		};
		this.createFlash(c, b, "api_get");
		if (this.config.poster.length > 5) {
			this.imageElement = $(document.createElement("img")).appendTo(b).attr({
				id: this.environment.publicName + "_media_image",
				src: this.config.poster
			});
			this.imageElement.load(function (d) {
				a.scaleImage()
			});
			this.imageElement.error(function (d) {
				a.scaleImage()
			})
		}
	},
	scaleImage: function () {
		var a = $("#" + this.environment.publicName + "_media");
		this.stretch(this.imageElement, a.width(), a.height())
	},
	flashReadyListener: function () {
		this.addListeners();
		this.elementReady = true;
		this.mediaElement.api_source(this.media.file)
	},
	flashReinitListener: function () {
		try {
			if ($.browser.mozilla) {
				this.mediaElement.api_source(this.media.file);
				if (this._isPlaying) {
					this.setPlay()
				}
			}
			this.addListeners();
			this.elementReady = true
		} catch(a) {}
	},
	addListeners: function () {
		this.mediaElement.api_attribute("onprogress", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.progressListener");
		this.mediaElement.api_attribute("ontimeupdate", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.timeListener");
		this.mediaElement.api_attribute("onended", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.endedListener");
		this.mediaElement.api_attribute("onpause", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.pauseListener");
		this.mediaElement.api_attribute("onplaying", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.playingListener");
		this.mediaElement.api_attribute("onplay", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.startListener");
		this.mediaElement.api_attribute("onvolumechange", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.volumeListener");
		this.mediaElement.api_attribute("onwaiting", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.waitingListener");
		this.mediaElement.api_attribute("oncanplaythrough", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.canplayListener");
		this.mediaElement.api_attribute("oncanplay", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.canplayListener");
		this.mediaElement.api_attribute("onerror", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.errorListener")
	},
	removeListeners: function () {
		try {
			this.mediaElement.api_attribute("ontimeupdate", false);
			this.mediaElement.api_attribute("onprogress", false);
			this.mediaElement.api_attribute("onended", false);
			this.mediaElement.api_attribute("onpause", false);
			this.mediaElement.api_attribute("onplaying", false);
			this.mediaElement.api_attribute("onplay", false);
			this.mediaElement.api_attribute("onvolumechange", false);
			this.mediaElement.api_attribute("onwaiting", false);
			this.mediaElement.api_attribute("oncanplaythrough", false);
			this.mediaElement.api_attribute("oncanplay", false);
			this.mediaElement.api_attribute("onerror", false)
		} catch(a) {}
	},
	setSeek: function (b) {
		try {
			this.mediaElement.api_seek(b)
		} catch(a) {}
	},
	setVolume: function (a) {
		try {
			this.mediaElement.api_volume(a)
		} catch(b) {}
	},
	setPause: function (a) {
		this._isPlaying = false;
		try {
			this.mediaElement.api_pause()
		} catch(b) {}
	},
	setPlay: function (a) {
		this._isPlaying = true;
		try {
			this.mediaElement.api_play()
		} catch(b) {}
	},
	getVolume: function () {
		try {
			return this.mediaElement.api_get("volume")
		} catch(a) {}
	},
	errorListener: function (a) {
		this.setTestcard(4)
	}
};
var playerObjectAUDIO = function () {};
	playerObjectAUDIO.prototype = {
	
	allowRandomSeek: false,
	imageElement: {},
	createMediaElement: function (b) {
	
		var a = this;
	 
		if (this.config.poster.length > 5) {
			this.imageElement = $(document.createElement("img")).appendTo(b).attr({
				id: this.environment.publicName + "_media_image",
				src: this.config.poster
			});
			this.imageElement.load(function (c) {
				a.scaleImage()
			});
			this.imageElement.error(function (c) {
				a.scaleImage()
			})
		}
		this.mediaElement = $(document.createElement("audio")).appendTo(b).attr({
			id: this.environment.publicName + "_media_html",
			src: this.media.file,
			controls: false,
			autoplay: false,
			autobuffer: false,
			loop: false
		}).css({
			width: "1px",
			height: "1px"
		});
		if (this.media.mediaType.indexOf("/ogg") > -1) {
			this.allowRandomSeek = true
		}
		this.waitforPlayer()
	},
	scaleImage: function () {
		var a = $("#" + this.environment.publicName + "_media");
		this.stretch(this.imageElement, a.width(), a.height())
	},
	waitforPlayer: function () {
		if (this.elementReady == true) {
			return
		}
		var c = this;
		var a = $("#" + this.environment.publicName + "_media_html");
		try {
			if (a == undefined) {
				setTimeout(function () {
					c.waitforPlayer()
				},
				500);
				return
			}
			if (a[0].networkState == undefined) {
				setTimeout(function () {
					c.waitforPlayer()
				},
				500);
				return
			}
		} catch(b) {
			setTimeout(function () {
				c.waitforPlayer()
			},
			500);
			return
		}
		this.mediaElement = a;
		this.addListeners();
		this.elementReady = true
	},
	addListeners: function () {
		var a = this;
		this.mediaElement.bind("pause", function () {
			a.pauseListener(this)
		});
		this.mediaElement.bind("playing", function () {
			a.playingListener(this)
		});
		this.mediaElement.bind("play", function () {
			a.startListener(this)
		});
		this.mediaElement.bind("volumechange", function () {
			a.volumeListener(this)
		});
		this.mediaElement.bind("progress", function (b) {
			a.progressListener(b, this)
		});
		this.mediaElement.bind("timeupdate", function () {
			a.timeListener(this)
		});
		this.mediaElement.bind("ended", function () {
			a.endedListener(this)
		});
		this.mediaElement.bind("waiting", function () {
			a.waitingListener(this)
		});
		this.mediaElement.bind("canplaythrough", function () {
			a.canplayListener(this)
		});
		this.mediaElement.bind("canplay", function () {
			a.canplayListener(this)
		});
		this.mediaElement.bind("error", function () {
			a.errorListener(this)
		});
		this.mediaElement.bind("suspend", function () {
			a.suspendListener(this)
		})
	},
	updatePlayerInfo: function () {
		var b = this;
		var a = 4;
		try {
			if (this._isPlaying == true) {
				if ($.browser.opera) {
					a = 3
				}
				if (this.mediaElement[0].networkState == a && this.mediaElement[0].networkState != undefined) {
					this.errorListener()
				}
				setTimeout(function () {
					b.updatePlayerInfo()
				},
				500)
			}
		} catch(c) {}
	},
	detachMedia: function () {
		try {
			$(this.mediaElement[0]).attr("src", "");
			this.mediaElement[0].load()
		} catch(a) {}
	},
	setPlay: function () {
		try {
			this.mediaElement[0].play();
			this._isPlaying = true
		} catch(a) {}
		this.updatePlayerInfo()
	},
	setPause: function () {
		try {
			this.mediaElement[0].pause();
			this._isPlaying = false
		} catch(a) {}
	},
	setVolume: function (a) {
		this.mediaElement.attr("volume", a)
	},
	setSeek: function (a) {
		this.mediaElement.attr("currentTime", a)
	}
};
var playerObjectIMAGE = function () {};
	playerObjectIMAGE.prototype = {
	createMediaElement: function (b) {
		var a = this;
			 
		this.mediaElement = $(document.createElement("img")).appendTo(b).attr({
			id: this.environment.publicName + "_media_image",
			src: this.media.file
		});
		this.mediaElement.load(function (c) {
			a.scaleImage()
		});
		this.mediaElement.error(function (c) {
			a.scaleImage()
		});
		this.elementReady = true
	},
	scaleImage: function () {
		if (this.config.designMode === true) {
			return
		}
		var a = $("#" + this.environment.publicName + "_media");
		this.stretch(this.mediaElement, a.width(), a.height())
	},
	setPlay: function () {
		this._caller.elementUpdateListener("start");
		this._caller.elementUpdateListener("ended")
	}
};
var playerObjectNA = function () {};
	playerObjectNA.prototype = {
			
	createMediaElement: function () {
		 
		this.setTestcard(this.media.errorCode);
		this.elementReady = true
	},
	setPlay: function () {
		 
		this._caller.elementUpdateListener("start")
	},
	setPause: function () {
		if (this._hasEnded == false) {
			this._hasEnded = true;
			this._caller.elementUpdateListener("ended")
		}
	}
};
var playerObjectVIDEOFLASH = function () {};
	playerObjectVIDEOFLASH.prototype = {
	createMediaElement: function (b) {
		this.elementReady = false;
		var a = this;
		 
		var c = {
			id: this.environment.publicName + "_media_flash",
			name: this.environment.publicName + "_media_flash",
			src: this.config.playerFlashMP4,
			width: "100%",
			height: "100%",
			AllowScriptAccess: "always",
			wmode: "opaque",
			bgcolor: "#000000",
			FlashVars: {}
		};
		this.createFlash(c, b, "api_get")
	},
	flashReadyListener: function () {
		this.addListeners();
		this.elementReady = true;
		this.mediaElement.api_source(this.media.file)
	},
	flashReinitListener: function () {
		try {
			if ($.browser.mozilla) {
				this.mediaElement.api_source(this.media.file);
				if (this._isPlaying) {
					this.setPlay()
				}
			}
			this.addListeners();
			this.elementReady = true
		} catch(a) {}
	},
	addListeners: function () {
		this.mediaElement.api_attribute("onprogress", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.progressListener");
		this.mediaElement.api_attribute("ontimeupdate", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.timeListener");
		this.mediaElement.api_attribute("onended", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.endedListener");
		this.mediaElement.api_attribute("onpause", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.pauseListener");
		this.mediaElement.api_attribute("onplaying", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.playingListener");
		this.mediaElement.api_attribute("onplay", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.startListener");
		this.mediaElement.api_attribute("onvolumechange", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.volumeListener");
		this.mediaElement.api_attribute("onwaiting", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.waitingListener");
		this.mediaElement.api_attribute("oncanplaythrough", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.canplayListener");
		this.mediaElement.api_attribute("oncanplay", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.canplayListener");
		this.mediaElement.api_attribute("onerror", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.errorListener")
	},
	removeListeners: function () {
		try {
			this.mediaElement.api_attribute("ontimeupdate", false);
			this.mediaElement.api_attribute("onprogress", false);
			this.mediaElement.api_attribute("onended", false);
			this.mediaElement.api_attribute("onpause", false);
			this.mediaElement.api_attribute("onplaying", false);
			this.mediaElement.api_attribute("onplay", false);
			this.mediaElement.api_attribute("onvolumechange", false);
			this.mediaElement.api_attribute("onwaiting", false);
			this.mediaElement.api_attribute("oncanplaythrough", false);
			this.mediaElement.api_attribute("oncanplay", false);
			this.mediaElement.api_attribute("onerror", false)
		} catch(a) {}
	},
	setSeek: function (b) {
		try {
			this.mediaElement.api_seek(b)
		} catch(a) {}
	},
	setVolume: function (a) {
		try {
			this.mediaElement.api_volume(a)
		} catch(b) {}
	},
	setPause: function (a) {
		this._isPlaying = false;
		try {
			this.mediaElement.api_pause()
		} catch(b) {}
	},
	setPlay: function (a) {
		this._isPlaying = true;
		try {
			this.mediaElement.api_play()
		} catch(b) {}
	},
	getVolume: function () {
		try {
			return this.mediaElement.api_get("volume")
		} catch(a) {}
	},
	errorListener: function (a) {
		this.setTestcard(4)
	}
};


var playerObjectVIDEO = function () {};
playerObjectVIDEO.prototype = {
	allowRandomSeek: false,
	createMediaElement: function (a) {
		this.elementReady = false;
		if (this.media.mediaType.indexOf("/ogg") > -1) {
			this.allowRandomSeek = true
		}
		this.mediaElement = $(document.createElement("video")).appendTo(a).attr({
			id: this.environment.publicName + "_media_html",
			src: this.media.file,
			controls: false,
			autoplay: false,
			autobuffer: false,
			loop: false
		}).css({
			width: "100%",
			height: "100%"
		});
		this.mediaElement = $("#" + this.environment.publicName + "_media_html");
		this.waitforPlayer()
	},
	waitforPlayer: function () {
		if (this.elementReady == true) {
			return
		}
		var c = this;
		var a = $("#" + this.environment.publicName + "_media_html");
		try {
			if (a == undefined) {
				setTimeout(function () {
					c.waitforPlayer()
				},
				200);
				return
			}
			if (a[0].networkState == undefined) {
				setTimeout(function () {
					c.waitforPlayer()
				},
				200);
				return
			}
		} catch(b) {
			setTimeout(function () {
				c.waitforPlayer()
			},
			200);
			return
		}
		this.mediaElement = a;
		this.addListeners();
		this.elementReady = true
	},
	addListeners: function () {
		var a = this;
		this.mediaElement.bind("pause", function () {
			a.pauseListener(this)
		});
		this.mediaElement.bind("playing", function () {
			a.playingListener(this)
		});
		this.mediaElement.bind("play", function () {
			a.startListener(this)
		});
		this.mediaElement.bind("volumechange", function () {
			a.volumeListener(this)
		});
		this.mediaElement.bind("progress", function (b) {
			a.progressListener(b, this)
		});
		this.mediaElement.bind("timeupdate", function () {
			a.timeListener(this)
		});
		this.mediaElement.bind("ended", function () {
			a.endedListener(this)
		});
		this.mediaElement.bind("waiting", function () {
			a.waitingListener(this)
		});
		this.mediaElement.bind("canplaythrough", function () {
			a.canplayListener(this)
		});
		this.mediaElement.bind("canplay", function () {
			a.canplayListener(this)
		});
		this.mediaElement.bind("error", function () {
			a.errorListener(this)
		});
		this.mediaElement.bind("suspend", function () {
			a.suspendListener(this)
		})
	},
	updatePlayerInfo: function () {
		var b = this;
		var a = 4;
		try {
			if (this._isPlaying == true) {
				if ($.browser.opera) {
					a = 3
				}
				if (this.mediaElement[0].networkState == a && this.mediaElement[0].networkState != undefined) {
					this.errorListener()
				}
				setTimeout(function () {
					b.updatePlayerInfo()
				},
				500)
			}
		} catch(c) {}
	},
	detachMedia: function () {
		try {
			$(this.mediaElement[0]).attr("src", "");
			this.mediaElement[0].load()
		} catch(a) {}
	},
	setPlay: function () {
		try {
			this.mediaElement[0].play();
			this._isPlaying = true
		} catch(a) {}
		this.updatePlayerInfo()
	},
	setPause: function () {
		try {
			this.mediaElement[0].pause();
			this._isPlaying = false
		} catch(a) {}
	},
	setVolume: function (a) {
		this.mediaElement.attr("volume", a)
	},
	setSeek: function (a) {
		this.mediaElement.attr("currentTime", a)
	}
};
var playerObjectYOUTUBE = function () {};
playerObjectYOUTUBE.prototype = {
	allowRandomSeek: true,
	createMediaElement: function (b) {
		this.elementReady = false;
		var a = this;
		var c;
		var d = {
			id: this.environment.publicName + "_media_youtube",
			name: this.environment.publicName + "_media_youtube",
			src: "http://www.youtube.com/apiplayer",
			width: "100%",
			height: "100%",
			bgcolor: "#000000",
			AllowScriptAccess: "always",
			wmode: "opaque",
			FlashVars: {
				enablejsapi: 1
			}
		};
		this.createFlash(d, b, "cueVideoById")
	},
	flashReadyListener: function () {
		this._youtubeResizeFix();
		this.addListeners();
		this.elementReady = true;
		this.mediaElement.cueVideoById(this.media.file.replace(/^[^v]+v.(.{11}).*/, "$1"))
	},
	flashReinitListener: function () {
		if ($.browser.mozilla) {
			this.mediaElement.cueVideoById(this.media.file.replace(/^[^v]+v.(.{11}).*/, "$1"));
			if (this._isPlaying) {
				this.setPlay()
			}
		}
		this._youtubeResizeFix();
		this.addListeners();
		this.elementReady = true
	},
	_youtubeResizeFix: function () {
		var a = $("#" + this.environment.publicName + "_canvas");
		$(this.mediaElement).attr({
			width: a.width() + "px",
			height: (a.height() - 1) + "px"
		})
	},
	addListeners: function () {
		this.mediaElement.addEventListener("onStateChange", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.youtubeStateChangeListener");
		this.mediaElement.addEventListener("onError", "window.PInstance[" + this.environment.instanceIdx + "].playerObject.errorListener")
	},
	setSeek: function (b) {
		try {
			this.mediaElement.seekTo(b, true)
		} catch(a) {}
	},
	setVolume: function (a) {
		try {
			this.mediaElement.setVolume(a * 100)
		} catch(b) {}
		this.volumeListener({})
	},
	setPause: function (a) {
		this._isPlaying = false;
		try {
			this.mediaElement.pauseVideo()
		} catch(b) {}
	},
	setPlay: function (a) {
		try {
			this.mediaElement.playVideo()
		} catch(b) {}
		this._isPlaying = true;
		this.updatePlayerInfo()
	},
	getVolume: function () {
		try {
			return this.mediaElement.getVolume() / 100
		} catch(a) {}
	},
	errorListener: function (a) {
		this.setTestcard(4)
	},
	youtubeStateChangeListener: function (a) {
		switch (a) {
		case - 1 : break;
		case 0:
			this.endedListener({});
		case 1:
			this.startListener({});
			this.playingListener({});
			break;
		case 2:
			this.pauseListener({});
			break;
		case 3:
			this.waitingListener({});
			break;
		case 5:
		}
	},
	updatePlayerInfo: function () {
		var a = this;
		(function () {
			try {
				if (a._isPlaying == true) {
					a.timeListener({
						position: a.mediaElement.getCurrentTime(),
						duration: a.mediaElement.getDuration()
					});
					a.progressListener({
						loaded: a.mediaElement.getVideoBytesLoaded(),
						total: a.mediaElement.getVideoBytesTotal()
					});
					setTimeout(arguments.callee, 500)
				}
			} catch(b) {}
		})()
	}
};
var projekktorControlbar = function () {};
projekktorControlbar.prototype = {
	_controlHideTimer: null,
	_noControlHide: false,
	_controlsFading: false,
	_volumeSliderActive: false,
	initialize: function () {
		this.drawControls();
		this.addGuiListeners();
		if (this.config.designMode === true) {
			try {
				this.drawTitle("Phnglui mglwnafh Cthulhu Rlyeh wgahnagl fhtagn.");
				this.drawUpdateTimeDisplay();
				$("#" + this.player.getPublicName() + "_" + this.config.playheadDomId).css("width", "50%");
				$("#" + this.player.getPublicName() + "_" + this.config.loadedDomId).css("width", "100%")
			} catch(a) {}
		}
	},
	itemHandler: function () {
		this.setControlsBlock()
	},
	setControlsBlock: function () {
		var a = (this.player.getItemCount() <= 1 || this.config.disallowSkip);
		if (!a) {
			$("#" + this.player.getPublicName() + "_" + this.config.prevDomId).show();
			$("#" + this.player.getPublicName() + "_" + this.config.nextDomId).show()
		} else {
			$("#" + this.player.getPublicName() + "_" + this.config.prevDomId).hide();
			$("#" + this.player.getPublicName() + "_" + this.config.nextDomId).hide()
		}
		if (this.config.disablePause) {
			$("#" + this.player.getPublicName() + "_" + this.config.pauseDomId).css("display", "none");
			$("#" + this.player.getPublicName() + "_" + this.config.playDomId).css("display", "none")
		} else {
			if (this.player.getIsPlaying() === true) {
				this.drawPauseButton()
			} else {
				this.drawPlayButton()
			}
		}
		if (this.config.disableFullscreen) {
			$("#" + this.player.getPublicName() + "_" + this.config.fsexitDomId).css("display", "none");
			$("#" + this.player.getPublicName() + "_" + this.config.fsenterDomId).css("display", "none")
		}
		this.drawTitle(this.config.title)
	},
	objectReadyHandler: function (a) {
		if (this.player.getInFullscreen() == true) {
			this.drawExitFullscreenButton()
		} else {
			this.drawEnterFullscreenButton()
		}
		this.drawUpdateVolumeDisplay();
		if (this.player.getIsStarted() == false || this.player.getIsAutoslide() == true) {
			this.hideControlbar(true)
		}
	},
	detachHandler: function () {
		this.drawUpdateProgressDisplay();
		this.drawUpdateTimeDisplay();
		this._noControlHide = false
	},
	playHandler: function () {
		this.drawPauseButton();
		this.setControlsBlock();
		this.setControlsAutohide()
	},
	pauseHandler: function () {
		this.drawPlayButton();
		this.setControlsBlock();
		this.setControlsAutohide()
	},
	volumeHandler: function (a) {
		this.drawUpdateVolumeDisplay()
	},
	progressHandler: function (a) {
		this.drawUpdateProgressDisplay()
	},
	timeHandler: function (a) {
		this.drawUpdateTimeDisplay();
		this.drawUpdateProgressDisplay()
	},
	fullscreenHandler: function (a) {
		if (this.player.getInFullscreen() === true) {
			this.drawExitFullscreenButton()
		} else {
			this.drawEnterFullscreenButton()
		}
	},
	addGuiListeners: function () {
		var a = this;
		$("#" + this.player.getPublicName() + "_" + this.config.controlsDomId).mouseenter(function (b) {
			a.controlsMouseEnterListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.controlsDomId).mouseleave(function (b) {
			a.controlsMouseLeaveListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.controlsDomId).click(function (b) {
			a.controlsClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.controlsDomId).dblclick(function (b) {
			return false
		});
		$("#" + this.player.getPublicName() + "_" + this.config.playDomId).click(function (b) {
			a.playClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.pauseDomId).click(function (b) {
			a.pauseClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.vmaxDomId).click(function (b) {
			a.unmuteClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.muteDomId).click(function (b) {
			a.muteClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.vknobDomId).mousedown(function (b) {
			a.vknobStartDragListener(b, this)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.vsliderDomId).click(function (b) {
			a.vsliderClickListener(b, this)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.vmarkerDomId).click(function (b) {
			a.vsliderClickListener(b, this)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.scrubberDomId).click(function (b) {
			a.scrubberClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.fsexitDomId).click(function (b) {
			a.exitFullscreenClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.fsenterDomId).click(function (b) {
			a.enterFullscreenClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.prevDomId).click(function (b) {
			a.prevClickListener(b)
		});
		$("#" + this.player.getPublicName() + "_" + this.config.nextDomId).click(function (b) {
			a.nextClickListener(b)
		})
	},
	drawControls: function () {
		var c = this.config.controlsTemplate;
		var b = "";
		var d = $(document.createElement("div")).appendTo(this.playerDom).attr({
			id: this.player.getPublicName() + "_" + this.config.controlsDomId,
			"class": this.config.cssClassPrefix + "controls"
		});
		for (var a in this.config) {
			if (a.indexOf("DomId") == -1) {
				continue
			}
			b = 'id="' + this.player.getPublicName() + "_" + this.config[a] + '" class="' + this.config.cssClassPrefix + a.replace("DomId", "") + '"';
			c = c.replace("{" + a.replace("DomId", "") + "}", b)
		}
		c = c.replace(/(my_)/g, this.config.cssClassPrefix + "");
		d.html(c);
		if (this.config.designMode !== true) {
			d.hide()
		}
	},
	drawTitle: function (d) {
		var f = this.player.getPublicName() + "_" + this.config.titleDomId;
		var b = this.config.cssClassPrefix;
		var a = false;
		try {
			a = this.config.controlsTemplateFilter.title(d, b)
		} catch(c) {}
		$("#" + f).html((a == false) ? d: a)
	},
	hideControlbar: function (a) {
		clearTimeout(this._controlHideTimer);
		if (this.config.designMode === true) {
			return
		}
		if (this._noControlHide == true && this.config.controls == true) {
			return
		}
		var b = $("#" + this.player.getPublicName() + "_" + this.config.controlsDomId);
		if (!b.is(":visible")) {
			return
		}
		b.stop(true, true);
		if (this.config.controls == false) {
			b.hide()
		} else {
			if (a == true) {
				b.hide()
			} else {
				b.fadeOut("slow")
			}
		}
	},
	showControlbar: function () {
		var a = this;
		clearTimeout(this._controlHideTimer);
		if (this.config.controls == false || this.player.getIsStarted() == false || this.player.getIsAutoslide() == true) {
			return
		}
		var b = $("#" + this.player.getPublicName() + "_" + this.config.controlsDomId);
		if (b.is(":visible") || this._controlsFading == true) {
			a._controlHideTimer = setTimeout(function () {
				a.hideControlbar()
			},
			2500);
			return
		}
		this._controlsFading = true;
		b.stop(true, true);
		b.fadeIn("fast", function () {
			a.drawUpdateVolumeDisplay();
			a._controlsFading = false
		})
	},
	drawUpdateTimeDisplay: function () {
		try {
			var d = this.player.getLoadPlaybackProgress();
			var g = this.player.getDuration();
			var b = this.player.getPosition()
		} catch(f) {
			var d = 0;
			var g = 0;
			var b = 0
		}
		var a = this.config.cssClassPrefix;
		var c = false;
		try {
			c = this.config.controlsTemplateFilter.time(g, b, a)
		} catch(f) {}
		try {
			$("#" + this.player.getPublicName() + "_" + this.config.playheadDomId).css("width", d + "%");
			$("#" + this.player.getPublicName() + "_" + this.config.timeleftDomId).html((c === false) ? this._clockDigits(b) + this.config.timeDelimeter + this._clockDigits(g) : c)
		} catch(f) {}
	},
	drawUpdateProgressDisplay: function () {
		try {
			$("#" + this.player.getPublicName() + "_" + this.config.loadedDomId).css("width", this.player.getLoadProgress() + "%")
		} catch(a) {}
	},
	drawUpdateVolumeDisplay: function () {
		if (this._volumeSliderActive == true) {
			return
		}
		var a = $("#" + this.player.getPublicName() + "_" + this.config.vknobDomId);
		var b = $("#" + this.player.getPublicName() + "_" + this.config.vsliderDomId);
		switch (this.config.volume) {
		case 0:
			$("#" + this.player.getPublicName() + "_" + this.config.vknobDomId).css("left", 0);
			break;
		case 1:
			$("#" + this.player.getPublicName() + "_" + this.config.vknobDomId).css("left", (b.width() - (a.width() / 2)));
			break;
		default:
			$("#" + this.player.getPublicName() + "_" + this.config.vknobDomId).css("left", this.config.volume * (b.width() - (a.width() / 2)));
			break
		}
		$("#" + this.player.getPublicName() + "_" + this.config.vmarkerDomId).css("width", this.config.volume * 100 + "%")
	},
	drawPauseButton: function (a) {
		$("#" + this.player.getPublicName() + "_" + this.config.pauseDomId).css("display", "block");
		$("#" + this.player.getPublicName() + "_" + this.config.playDomId).css("display", "none")
	},
	drawPlayButton: function (a) {
		$("#" + this.player.getPublicName() + "_" + this.config.pauseDomId).css("display", "none");
		$("#" + this.player.getPublicName() + "_" + this.config.playDomId).css("display", "block")
	},
	drawEnterFullscreenButton: function (a) {
		$("#" + this.player.getPublicName() + "_" + this.config.fsexitDomId).css("display", "none");
		$("#" + this.player.getPublicName() + "_" + this.config.fsenterDomId).css("display", "block")
	},
	drawExitFullscreenButton: function (a) {
		$("#" + this.player.getPublicName() + "_" + this.config.fsenterDomId).css("display", "none");
		$("#" + this.player.getPublicName() + "_" + this.config.fsexitDomId).css("display", "block")
	},
	setControlsAutohide: function () {
		if (this.config.controls == false) {
			this.hideControlbar(true)
		} else {
			var a = this;
			this.showControlbar();
			clearTimeout(this._controlHideTimer);
			this._controlHideTimer = setTimeout(function () {
				a.hideControlbar()
			},
			3500)
		}
	},
	playClickListener: function (a) {
		this.player.sendEvent("play", 0);
		a.stopPropagation()
	},
	pauseClickListener: function (a) {
		this.player.sendEvent("pause", 0);
		a.stopPropagation()
	},
	controlsMouseEnterListener: function (a) {
		this._noControlHide = true
	},
	controlsMouseLeaveListener: function (a) {
		this._noControlHide = false
	},
	controlsClickListener: function (a) {
		a.stopPropagation()
	},
	mousemoveHandler: function (a) {
		this.showControlbar()
	},
	prevClickListener: function (a) {
		this.player.sendEvent("previous", 0);
		a.stopPropagation()
	},
	nextClickListener: function (a) {
		this.player.sendEvent("next", 0);
		a.stopPropagation()
	},
	muteClickListener: function (a) {
		this.player.sendEvent("volume", 0);
		a.stopPropagation()
	},
	unmuteClickListener: function (a) {
		this.player.sendEvent("volume", 1);
		a.stopPropagation()
	},
	enterFullscreenClickListener: function (a) {
		this.player.sendEvent("fullscreen", true);
		a.stopPropagation()
	},
	exitFullscreenClickListener: function (a) {
		this.player.sendEvent("fullscreen", false);
		a.stopPropagation()
	},
	startClickListener: function (a) {
		this.player.sendEvent("play", false);
		a.stopPropagation()
	},
	scrubberClickListener: function (c) {
		var b = 0;
		if (c == undefined) {
			return
		}
		if (this.config.disallowSkip == true) {
			return
		}
		var a = $("#" + this.player.getPublicName() + "_" + this.config.scrubberDomId).width();
		var d = $("#" + this.player.getPublicName() + "_" + this.config.loadedDomId).width();
		var f = c.pageX - $("#" + this.player.getPublicName() + "_" + this.config.scrubberDomId).offset().left;
		if (f < 0 || f == "NaN" || f == undefined) {
			b = 0
		} else {
			if (d != undefined) {
				if (f > d) {
					f = d - 1
				}
				b = Math.ceil((f * 100 / a) * this.player.getDuration() / 100) * 1
			}
		}
		this.player.sendEvent("seek", b);
		c.stopPropagation()
	},
	vmarkerClickListener: function (a) {
		vsliderClickListener(a)
	},
	vsliderClickListener: function (b) {
		if (this._volumeSliderActive == true) {
			return
		}
		var a = $("#" + this.player.getPublicName() + "_" + this.config.vsliderDomId).width();
		var c = b.pageX - $("#" + this.player.getPublicName() + "_" + this.config.vsliderDomId).offset().left;
		if (c < 0 || c == "NaN" || c == undefined) {
			result = 0
		} else {
			result = (c / a)
		}
		this.player.sendEvent("volume", result);
		if (b.stopPropagation) {
			b.stopPropagation()
		} else {
			b.cancelBubble = true
		}
	},
	vknobStartDragListener: function (g, c) {
		this._volumeSliderActive = true;
		var f = this;
		var a = $(c);
		var b = Math.abs(parseInt(a.css("left")) - g.clientX);
		var d = 0;
		if (g.stopPropagation) {
			g.stopPropagation()
		} else {
			g.cancelBubble = true
		}
		$("#" + this.player.getPublicName() + "_" + this.config.vsliderDomId).mouseup(function (h) {
			$("#" + f.player.getPublicName() + "_" + f.config.vsliderDomId).unbind("mousemove");
			$("#" + f.player.getPublicName() + "_" + f.config.vsliderDomId).unbind("mouseup");
			f._volumeSliderActive = false;
			return false
		});
		$("#" + this.player.getPublicName() + "_" + this.config.vsliderDomId).mousemove(function (h) {
			clearTimeout(f._controlHideTimer);
			var j = (h.clientX - b);
			j = (j > $(this).width() - a.width()) ? $(this).width() - (a.width() / 2) : j;
			j = (j < 0) ? 0 : j;
			a.css("left", j + "px");
			d = Math.abs(j / ($(this).width() - (a.width() / 2)));
			f.player.sendEvent("volume", d);
			$("#" + f.player.getPublicName() + "_" + f.config.vmarkerDomId).css("width", d * 100 + "%");
			if (h.stopPropagation) {
				h.stopPropagation()
			} else {
				h.cancelBubble = true
			}
			return false
		})
	},
	_clockDigits: function (a) {
		if (a < 0 || isNaN(a) || a == undefined) {
			return "00:00"
		}
		var b = Math.floor(a / 60);
		var c = Math.floor(a % 60);
		return ((b < 10) ? "0" + b: b) + ":" + ((c < 10) ? "0" + c: c)
	}
};
var projekktorLogo = function () {};
projekktorLogo.prototype = {
	player: {},
	config: {},
	playerDom: null,
	logo: null,
	logoFile: false,
	fading: false,
	initialize: function () {
		this.logo = $(document.createElement("div")).appendTo(this.playerDom).css({
			id: this.player.getPublicName() + "_logo",
			position: "absolute",
			overflow: "hidden",
			right: 10 + "px",
			top: 10 + "px",
			width: 100 + "px",
			height: 100 + "px"
		}).hide()
	},
	itemHandler: function (b) {
		var a = "";
		this.fading = false;
		this.logo.stop(true, false);
		this.logo.hide();
		this.logoFile = (this.config.logo == "") ? false: this.config.logo;
		if (this.logoFile != false) {
			this.logo.css("background", "transparent url(" + this.logoFile + ") top left no-repeat")
		}
	},
	timeHandler: function () {
		if (this.logoFile === false) {
			return
		}
		var a = this.player.getPosition();
		var c = this.player.getDuration();
		var b = this;
		if (!this.logo.is(":visible") && !this.fading && a + this.config.logoDelay < c) {
			if (a > this.config.logoDelay && c > (this.config.logoDelay * 2)) {
				this.fading = true;
				this.logo.fadeIn("slow", function () {
					b.fading = false
				})
			}
		}
		if (this.logo.is(":visible") && !this.fading) {
			if (a + this.config.logoDelay > c) {
				this.fading = true;
				this.logo.fadeOut("slow", function () {
					b.fading = false
				})
			}
		}
	},
	testcardHandler: function () {
		this.logo.hide()
	}
};
var projekktorPluginInterface = function () {};
projekktorPluginInterface.prototype = {
	player: {},
	config: {},
	playerDom: null,
	initialize: function () {},
	playlistHandler: function (a) {},
	itemHandler: function (a) {},
	detachHandler: function (a) {},
	objectReadyHandler: function (a) {},
	startHandler: function (a) {},
	doneHandler: function (a) {},
	detachHandler: function (a) {},
	endedHandler: function (a) {},
	playHandler: function (a) {},
	pauseHandler: function (a) {},
	volumeHandler: function (a) {},
	timeHandler: function (a) {},
	progressHandler: function (a) {},
	mousemoveHandler: function (a) {},
	fullscreenHandler: function (a) {},
	testcardHandler: function (a) {}
};
var projekktorTracker = function () {};
projekktorTracker.prototype = {
	isPlaying: false,
	isWaiting: false,
	waitTime: null,
	trackData: {},
	playbackStart: 0,
	sessionID: null,
	trackThis: false,
	endpointFailed: false,
	endpoint: "http://localhost/tracker/",
	initialize: function () {
		this._resetTrackData();
		this.sessionID = this._uuid()
	},
	itemHandler: function (a) {
		this._resetTrackData();
		if (this.endpointFailed == true) {
			return
		}
		if (a.isposter !== true && this.player.getItemId() !== null) {
			this.trackThis = true
		} else {
			his.trackThis = false;
			return
		}
		this.trackData.i.l = a.file;
		this.trackData.i.m = this.player.getMediaType().split("/")[0];
		this.trackData.i.t = this.player.getMediaType().split("/")[1];
		this.trackData.uid = this._getUserUUID();
		this.trackData.sid = this.sessionID;
		this.trackData.pl.l = this.player.getItemCount();
		this.trackData.i.id = this.player.getItemId()
	},
	detachHandler: function (a) {
		this.trackIt()
	},
	endedHandler: function (a) {
		this.trackData.evt.push(this._getEventObj("ended"))
	},
	seekHandler: function (a) {
		this.trackData.evt.push(this._getEventObj("seek", a.dest))
	},
	waitingHandler: function () {
		if (this.isWaiting == false) {
			this.isWaiting = true;
			this.waitTime = Number(new Date())
		}
	},
	canplayHandler: function () {
		if (this.isWaiting == true) {
			this.isWaiting = false;
			this.trackData.evt.push(this._getEventObj("wait", this._roundNumber((Number(new Date()) - this.waitTime) / 1000, 1)))
		}
	},
	playHandler: function (a) {
		if (this.playbackStart == 0) {
			this.playbackStart = Number(new Date());
			this.trackData.evt.push(this._getEventObj("start"))
		} else {
			this.trackData.evt.push(this._getEventObj("play"))
		}
	},
	previousHandler: function (a) {
		this.trackData.evt.push(this._getEventObj("prev"))
	},
	nextHandler: function (a) {
		this.trackData.evt.push(this._getEventObj("next"))
	},
	pauseHandler: function (a) {
		this.trackData.evt.push(this._getEventObj("pause"))
	},
	timeHandler: function (a) {
		if (this.trackData.i.d <= 0) {
			this.trackData.i.d = this._roundNumber(this.player.getDuration(), 2)
		}
	},
	fullscreenHandler: function (a) {
		this.trackData.events.push(this._getEventObj("fullscreen"))
	},
	testcardHandler: function (a) {
		this.trackData.events.push(this._getEventObj("testcard"))
	},
	trackIt: function (c) {
		if (this.trackThis === false) {
			return
		}
		if (this.endpointFailed == true) {
			return
		}
		var a = this;
		if (this.playbackStart > 0) {
			this.trackData.pd = this._roundNumber((Number(new Date()) - this.playbackStart) / 1000, 1)
		}
		this.trackData.bw = this.player.getKbPerSec();
		try {
			$.ajax({
				type: "POST",
				url: this.endpoint,
				data: this.trackData,
				success: function (d) {
					a.endpointFailed = false
				},
				error: function (d) {
					a.endpointFailed = true
				}
			})
		} catch(b) {}
	},
	_getEventObj: function (a, b) {
		return {
			n: a,
			tidx: this._roundNumber(this.player.getPosition(), 2),
			pbt: this._roundNumber((Number(new Date()) - this.playbackStart) / 1000, 2),
			v: (b) ? b: 0
		}
	},
	_resetTrackData: function () {
		this.trackData = {
			uid: 0,
			sid: 0,
			pd: 0,
			pl: {
				l: 0
			},
			i: {
				id: "",
				l: "",
				m: "",
				t: "",
				d: 0
			},
			bw: 0,
			evt: []
		};
		this.playbackStart = 0
	},
	_roundNumber: function (a, b) {
		if (a <= 0 || isNaN(a)) {
			return 0
		}
		return Math.round(a * Math.pow(10, b)) / Math.pow(10, b)
	},
	_getUserUUID: function () {
		var a = "prkusruuid";
		var b = null;
		b = this._readCookie(a);
		if (b == null) {
			b = this._uuid();
			this._setCookie(a, b)
		}
		return b
	},
	_uuid: function () {
		var f = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
		var c = new Array(36),
		b = 0,
		d;
		for (var a = 0; a < 36; a++) {
			if (a == 8 || a == 13 || a == 18 || a == 23) {
				c[a] = "-"
			} else {
				if (a == 14) {
					c[a] = "4"
				} else {
					if (b <= 2) {
						b = 33554432 + (Math.random() * 16777216) | 0
					}
					d = b & 15;
					b = b >> 4;
					c[a] = f[(a == 19) ? (d & 3) | 8 : d]
				}
			}
		}
		return c.join("")
	},
	_setCookie: function (d, b) {
		var a;
		var c;
		a = new Date();
		a.setTime(a.getTime() + 356 * 86400000);
		document.cookie = d + "=" + escape(b) + ";expires=" + a.toGMTString() + ";path=" + (c ? c: "/")
	},
	_readCookie: function (b) {
		var a = document.cookie.split(";");
		var f = b + "=";
		for (var d = 0; d < a.length; d++) {
			var g = a[d];
			while (g.charAt(0) == " ") {
				g = g.substring(1, g.length)
			}
			if (g.indexOf(f) == 0) {
				return g.substring(f.length, g.length)
			}
		}
		return null
	}
};
var playerObject = function () {};
playerObject.prototype = {
	_caller: {},
	_hideTimer: null,
	_controlsFading: false,
	_nohide: false,
	_isPlaying: false,
	_isSeeking: false,
	_isStarted: false,
	_isTestcard: false,
	_hasEnded: false,
	_KbPerSec: 0,
	_bandWidthTimer: null,
	isAutoslide: false,
	allowRandomSeek: false,
	elementReady: false,
	mediaElement: null,
	flashVerfiyMethod: "",
	environment: {},
	config: {},
	media: {
		duration: 0,
		position: 0,
		startOffset: 0,
		file: false,
		poster: "",
		ended: false,
		message: "",
		error: null,
		mediaType: "",
		loadProgress: 0,
		errorCode: 0,
		message: "",
		type: "NA"
	},
	init: function (b) {
		var a = this;
		this._caller = b.caller;
		$.extend(this.environment, b.environment);
		$.extend(this.config, b.config);
		this.media = b.media;
		this.createMediaElement(this.getDestcontainer());
		this.waitForPlayerElement()
	},
	getDestcontainer: function () {
		this.elementReady = false;
		var a = $("#" + this.environment.publicName + "_media");
		a.attr("style", "width:100$;height:100%;background-color:#000;z-index:1;position:static;top:0;left:0;overflow:hidden;");
		a.html("");
		return a
	},
	createMediaElement: function () {},
	waitForPlayerElement: function () {
		var a = this;
		(function () {
			if (a.elementReady !== true) {
				setTimeout(arguments.callee, 50);
				return
			}
			a._caller.elementUpdateListener("objectReady")
		})()
	},
	addListeners: function () {},
	removeListeners: function () {
		try {
			this.mediaElement.unbind()
		} catch(a) {}
	},
	detachMedia: function () {},
	destroy: function () {
		this.setPause();
		this.removeListeners();
		this.detachMedia();
		$(this.mediaElement).remove()
	},
	reInit: function () {
		if (this.flashVerfiyMethod == "" || !($.browser.mozilla) || this._isTestcard == true) {
			this.flashReinitListener();
			this._caller.elementUpdateListener("canvas");
			return
		}
		this.removeListeners();
		this.createMediaElement(this.getDestcontainer());
		this.waitForPlayerElement()
	},
	applyCommand: function (b, a) {
		if (b == "play" && this._isStarted == false) {
			this._caller.elementUpdateListener("awaking")
		}
		switch (b) {
		case "play":
			this.setPlay();
			break;
		case "pause":
			this.setPause();
			break;
		case "volume":
			this.setVolume(a);
			break;
		case "seek":
			if (this.media.loadProgress == -1) {
				break
			}
			this._isSeeking = true;
			this.setSeek(a);
			break;
		case "fullscreen":
			this.setFullscreen(a);
			break
		}
	},
	setPrev: function () {},
	setNext: function () {},
	setSeek: function (a) {},
	setPlay: function () {},
	setPause: function () {},
	setVolume: function (a) {},
	setFullscreen: function (a) {
		this.environment.inFullscreen = a;
		this._caller.elementUpdateListener("fullscreen");
		this.reInit()
	},
	getVolume: function () {
		var a = this.mediaElement.attr("muted");
		return (a == true) ? 0 : this.mediaElement.attr("volume")
	},
	getLoadProgress: function () {
		return this.media.loadProgress
	},
	getLoadPlaybackProgress: function () {
		return this.media.playProgress
	},
	getPosition: function () {
		return this.media.position
	},
	getDuration: function () {
		return this.media.duration
	},
	getInFullscreen: function () {
		return this.environment.inFullscreen
	},
	getIsAutoslide: function () {
		return this.isAutoslide
	},
	getKbPerSec: function () {
		return this._KbPerSec
	},
	timeListener: function (d) {
		if (d == undefined) {
			return
		}
		var c = (d.position != undefined) ? d.position: d.currentTime;
		var b = d.duration;
		var a = (c > 0 && b > 0) ? c * 100 / b: 0;
		this.media.duration = this._roundNumber(b, 2);
		this.media.position = this._roundNumber(c, 2);
		this.media.playProgress = a;
		if (this._isSeeking == true) {
			this._isSeeking = false;
			this._caller.elementUpdateListener("seek", this.media.position)
		} else {
			this._caller.elementUpdateListener("time")
		}
	},
	progressListener: function (a, f) {
		if (this.media.loadProgress >= 100 || this.media.loadProgress == -1) {
			return
		}
		if (this._bandWidthTimer == null) {
			this._bandWidthTimer = (new Date()).getTime()
		}
		var d = 0;
		var c = 0;
		if (!isNaN(a.loaded / a.total)) {
			d = a.loaded;
			c = a.total
		} else {
			if (a.originalEvent && !isNaN(a.originalEvent.loaded / a.originalEvent.total)) {
				d = a.originalEvent.loaded;
				c = a.originalEvent.total
			} else {
				if (f && !isNaN(f.loaded / f.total)) {
					d = f.loaded;
					c = f.total
				} else {
					this.media.loadProgress = (this.allowRandomSeek === true) ? 100 : -1;
					this._caller.elementUpdateListener("progress");
					return
				}
			}
		}
		var b = (d > 0 && c > 0) ? d * 100 / c: 0;
		if (Math.round(b) > Math.round(this.media.loadProgress)) {
			this._KbPerSec = ((d / 1024) / (((new Date()).getTime() - this._bandWidthTimer) / 1000))
		}
		this.media.loadProgress = (this.media.loadProgress < 100 || this.media.loadProgress == undefined) ? b: 100;
		this.media.loadProgress = (this.allowRandomSeek === true) ? 100 : this.media.loadProgress;
		this._caller.elementUpdateListener("progress")
	},
	canplayListener: function (a) {
		this._caller.elementUpdateListener("canplay")
	},
	canplaythroughListener: function (a) {
		this._caller.elementUpdateListener("canplaythrough")
	},
	suspendListener: function (a) {
		this._caller.elementUpdateListener("suspend")
	},
	playingListener: function (a) {
		this._caller.elementUpdateListener("play")
	},
	startListener: function (a) {
		if (this._isStarted === false) {
			this._caller.elementUpdateListener("start");
			this._isStarted = true
		}
	},
	pauseListener: function (a) {
		this._caller.elementUpdateListener("pause")
	},
	volumeListener: function (a) {
		this._caller.elementUpdateListener("volume")
	},
	endedListener: function (a) {
		this._hasEnded = true;
		this._caller.elementUpdateListener("ended")
	},
	suspendListener: function (a) {
		this._caller.elementUpdateListener("suspend")
	},
	waitingListener: function (a) {
		this._caller.elementUpdateListener("waiting")
	},
	flashReadyListener: function () {},
	flashReinitListener: function () {},
	errorListener: function (a) {
		this._isPlaying = false;
		try {
			switch (a.target.error.code) {
			case a.target.error.MEDIA_ERR_ABORTED:
				this.setTestcard(1);
				break;
			case a.target.error.MEDIA_ERR_NETWORK:
				this.setTestcard(2);
				break;
			case a.target.error.MEDIA_ERR_DECODE:
				this.setTestcard(3);

				break;
			case a.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
				this.setTestcard(4);
				break;
			default:
				this.setTestcard(5);
				break
			}
		} catch(b) {
			this.setTestcard(4)
		}
	},
	setTestcard: function (f, a) {
		this._isTestcard = true;
		var d = this;
		var c = $("#" + this.environment.publicName + "_media");
		var b = (this.config.messages[f] != undefined) ? this.config.messages[f] : this.config.messages[0];
		b = (a != undefined && a != "") ? a: b;
		if (this._caller.getItemCount() > 1) {
			b += this.config.messages[99]
		}
		if (b.length < 3) {
			b = "ERROR"
		}
		if (f == 100) {
			b = ""
		}
		c.attr("style", "width: 100%; height:100%; background-color: #000;");
		c.html("");
		this.mediaElement = $(document.createElement("div")).attr({
			"class": "pptestcard"
		}).appendTo(c);
		if (b.length > 0) {
			$(document.createElement("p")).appendTo(this.mediaElement).html(b);
			this._caller.elementUpdateListener("testcard")
		}
	},
	stretch: function (d, k, h) {
		var c = d.width();
		var a = d.height();
		var f = k / c;
		var j = h / a;
		var b = 0;
		var g = 0;
		if (f > j) {
			b = Math.round(c * f);
			g = Math.round(a * f);
			d.width(Math.round(c * f));
			d.height(Math.round(a * f))
		} else {
			b = Math.round(c * j);
			g = Math.round(a * j);
			d.width(Math.round(c * j));
			d.height(Math.round(a * j))
		}
		d.css({
			"margin-left": Math.round(k / 2 - b / 2) + "px",
			"margin-top": Math.round(h / 2 - g / 2) + "px"
		})
	},
	toAttributeString: function (b) {
		var c = "";
		for (var a in b) {
			if (typeof b[a] != "function") {
				c += a + '="' + b[a] + '" '
			}
		}
		return c
	},
	toFlashvarsString: function (b) {
		var c = "";
		for (var a in b) {
			if (typeof b[a] != "function") {
				c += a + "=" + encodeURIComponent(b[a]) + "&"
			}
		}
		return c.replace(/&$/, "")
	},
	createFlash: function (h, b, c) {
		this.flashVerfiyMethod = c;
		if (h.FlashVars) {
			h.FlashVars = this.toFlashvarsString(h.FlashVars);
			if (h.FlashVars.length > 0) {
				h.src += "?" + h.FlashVars
			}
			delete(h.FlashVars)
		}
		var a = "";
		var f = "";
		var d = "";
		var g = "";
		if ($.browser.msie) {
			g = ' id="' + h.id + '" '
		}
		var f = "<object" + g + ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"  name="' + h.name + '" width="' + h.width + '" height="' + h.height + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
		f += '<param name="movie" value="' + h.src + '"></param>';
		f += '<param name="AllowScriptAccess" value="' + h.AllowScriptAccess + '"></param>';
		f += '<param name="wmode" value="' + h.wmode + '"></param>';
		var d = "<embed " + this.toAttributeString(h) + ' pluginspage="http://www.macromedia.com/go/getflashplayer" swliveconnect="true" type="application/x-shockwave-flash"></embed>';
		a = f + d;
		a += "</object>";
		if ($.browser.mozilla) {
			a = d
		}
		b[0].innerHTML = a;
		this.mediaElement = $("#" + h.id)[0];
		this._waitforPlayer()
	},
	_waitforPlayer: function () {
		if (this.elementReady == true) {
			return
		}
		var a = this;
		(function () {
			try {
				if (a.mediaElement == undefined) {
					setTimeout(arguments.callee, 500)
				} else {
					if (a.mediaElement[a.flashVerfiyMethod] == undefined) {
						setTimeout(arguments.callee, 500)
					} else {
						a.flashReadyListener()
					}
				}
			} catch(b) {
				console.log(b);
				setTimeout(arguments.callee, 500)
			}
		})()
	},
	_roundNumber: function (a, b) {
		if (a <= 0 || isNaN(a)) {
			return 0
		}
		return Math.round(a * Math.pow(10, b)) / Math.pow(10, b)
	}
};
try {
	if (PROJEKKTOR_CONFIG == undefined) {
		var PROJEKKTOR_CONFIG = []
	}
} catch(e) {}
if (typeof jQuery === "undefined") {
	alert("Projekktor Warning [1]: JQuery 1.4.1 or later required.")
} else {
	if ($.browser.msie) { (function () {
			if (!
			/*@cc_on!@*/
			0) {
				return
			}
			var e = "audio,video".split(",");
			for (var i = 0; i < e.length; i++) {
				document.createElement(e[i])
			}
		})();
		if (!Array.prototype.indexOf) {
			Array.prototype.indexOf = function (c, d) {
				for (var b = (d || 0), a = this.length; b < a; b++) {
					if (this[b] == c) {
						return b
					}
				}
				return - 1
			}
		}
	}
	window.PROJEKKTOR = window.$P = function () {
		window.PInstance = [];
		var a = arguments[0];
		if (!arguments.length) {
			var b = 0;
			$.each($("video.projekktor"), function (c, d) {
				b = window.PInstance.length;
				window.PInstance[b] = new projekktor_player();
				window.PInstance[b].initialize(d, b)
			});
			return
		}
	};
	$(document).ready(function () {
		PROJEKKTOR()
	})
}
function projekktor_player() {
	this.config = $.extend({
		plugins: ["projekktorControlbar", "projekktorLogo"],
		version: "0.7.10",
		cssClassPrefix: "pp",
		playerFlashMP4: "playerMP4.swf",
		playerFlashMP3: "playerMP3.swf",
		enableFlashFallback: true,
		desginGrid: "style/layout_grid.gif",
		designMode: false,
		volume: 0.5,
		poster: false,
		loop: false,
		autoplay: false,
		controls: false,
		disablePause: false,
		disallowSkip: false,
		disableFullscreen: false,
		playheadDomId: "playhead",
		timeleftDomId: "timeleft",
		loadedDomId: "loaded",
		scrubberDomId: "scrubber",
		playDomId: "play",
		pauseDomId: "pause",
		prevDomId: "prev",
		nextDomId: "next",
		fsexitDomId: "fsexit",
		fsenterDomId: "fsenter",
		vsliderDomId: "vslider",
		vmarkerDomId: "vmarker",
		vknobDomId: "vknob",
		muteDomId: "mute",
		vmaxDomId: "vmax",
		bufferingDomId: "buffering",
		startDomId: "start",
		controlsDomId: "controls",
		titleDomId: "title",
		timeDelimeter: " | ",
		controlsTemplate: "<div {fsexit}></div><div {fsenter}></div><div {play}></div><div {pause}></div><div {prev}></div><div {next}></div><div {title}></div><div {timeleft}></div><div {scrubber}><div {loaded}></div><div {playhead}></div></div><div {vslider}><div {vmarker}></div><div {vknob}></div></div><div {mute}></div><div {vmax}></div>",
		controlsTemplateFilter: {
			title: function (text, cPrefix) {
				return false
			},
			time: function (dur, elp, cPrefix) {
				return false
			}
		},
		logo: "",
		logoDelay: 4,
		canvasId: "canvas",
		bufferIconDelay: 50,
		messages: {
			0 : "An unknown error occurred. ",
			1 : "You aborted the video playback. ",
			2 : "A network error caused the video download to fail part-way. ",
			3 : "The video playback was aborted due to a corruption problem. ",
			4 : "The video could not be loaded, either because the server or network failed or because the format is not supported. ",
			5 : "Sorry, your browser does not support the media format of the requested clip. ",
			98 : "Invalid Playlist Data!",
			99 : "Click display to proceed. "
		},
		debug: false
	},
	(typeof PROJEKKTOR_CONFIG == "object") ? PROJEKKTOR_CONFIG: {});
	this._configBuffer = {};
	this.environment = {
		instanceIdx: 0,
		publicName: null,
		playerStyle: null,
		scrollTop: null,
		scrollLeft: null,
		bodyOverflow: null,
		inFullscreen: false,
		zIndex: "auto",
		playerDOM: {}
	};
	this.properties = {
		itemsOffset: false,
		itemsLimit: 10,
		currentItem: 0,
		sources: [],
		playlistServer: ""
	};
	this.platformPriority = ["native", "flash"];
	this.mediaTypes = {
		0 : {
			ext: "NaN",
			type: "none/none",
			model: "NA",
			platform: "native"
		},
		1 : {
			ext: "ogv",
			type: "video/ogg",
			model: "video",
			platform: "native"
		},
		2 : {
			ext: "m4v",
			type: "video/mp4",
			model: "video",
			platform: "flash"
		},
		3 : {
			ext: "webm",
			type: "video/webm",
			model: "video",
			platform: "native"
		},
		4 : {
			ext: "ogg",
			type: "video/ogg",
			model: "video",
			platform: "native"
		},
		5 : {
			ext: "anx",
			type: "video/ogg",
			model: "video",
			platform: "native"
		},
		6 : {
			ext: "jpg",
			type: "image/jpeg",
			model: "image",
			platform: "native"
		},
		7 : {
			ext: "gif",
			type: "image/gif",
			model: "image",
			platform: "native"
		},
		8 : {
			ext: "png",
			type: "image/png",
			model: "image",
			platform: "native"
		},
		9 : {
			ext: "flv",
			type: "video/x-flv",
			model: "flash",
			platform: "flash",
			fixed: true
		},
		10 : {
			ext: "flv",
			type: "video/flv",
			model: "videoflash",
			platform: "flash",
			fixed: true
		},
		11 : {
			ext: "mp4",
			type: "video/mp4",
			model: "videoflash",
			platform: "flash"
		},
		12 : {
			ext: "mov",
			type: "video/quicktime",
			model: "videoflash",
			platform: "flash"
		},
		13 : {
			ext: "youtube.com",
			type: "video/youtube",
			model: "youtube",
			platform: "flash",
			fixed: true
		},
		14 : {
			ext: "ogg",
			type: "audio/ogg",
			model: "audio",
			platform: "native"
		},
		15 : {
			ext: "oga",
			type: "audio/ogg",
			model: "audio",
			platform: "native"
		},
		16 : {
			ext: "mp3",
			type: "audio/mp3",
			model: "audioflash",
			platform: "flash"
		}
	};
	this.media = [];
	this.plugins = [];
	this.mediaGrid = {};
	this.playerObject = {};
	this._caller = {};
	this._bufferDelayTimer = null;
	this._isReady = false;
	this._isStarted = false;
	this._isPlaying = false;
	this._isWaiting = false;
	this._hasError = false;
	this.initialize = function (destDOM, myIndex) {
		var ref = this;
		this.properties.sources = this._getSourcesFromContainer($(destDOM));
		this.debug(this.properties.sources, "Source Obj");
		this.config.autoplay = ($(destDOM).attr("autoplay") !== "" && $(destDOM).attr("autoplay") !== undefined && $(destDOM).attr("autoplay") !== false);
		this.config.controls = ($(destDOM).attr("controls") !== "" && $(destDOM).attr("controls") !== undefined && $(destDOM).attr("controls") !== false);
		this.config.loop = ($(destDOM).attr("loop") !== "" && $(destDOM).attr("loop") !== undefined && $(destDOM).attr("loop") !== false);
		this.config.poster = ($(destDOM).attr("poster") !== "" && $(destDOM).attr("poster") !== undefined && $(destDOM).attr("poster") !== false) ? $(destDOM).attr("poster") : false;
		if ($.browser.msie) {
			var htmlTag = $(destDOM).parent().html().toLowerCase();
			var attr = ["autoplay", "controls", "loop"];
			for (var i = 0; i < attr.length; i++) {
				if (htmlTag.indexOf(attr[i]) == -1) {
					continue
				}
				this.config[attr[i]] = true
			}
		}
		if (this.config.designMode === true) {
			this.config.poster = this.config.desginGrid
		}
		this.environment.publicName = this._randomId(8);
		this.environment.instanceIdx = myIndex;
		this.environment.playerDom = this.drawPlayer(destDOM);
		this.mediaGrid = this._testMediaSupport();
		this.config.Me = destDOM;
		this.resizePluginCanvas(this.environment.playerDom);
		this.registerPlugins();
		for (var i in this.properties.sources) {
			if (this.properties.sources[i].type == "text/json") {
				this.debug(this.properties.sources[i].src, "Trying to load Playlist (index " + i + ")");
				$.ajax({
					dataType: "text",
					url: ref.properties.sources[i].src,
					success: function (data) {
						ref.properties.playlistServer = ref.properties.sources[i].src;
						ref.reelUpdate(data);
						ref.debug("", ref.properties.sources[i].src + " loaded")
					},
					error: function (data) {
						ref.debug("", "error loading " + ref.properties.sources[i].src)
					}
				});
				return
			}
		}
		this.debug(this.properties.sources, "Trying add single file to playlist.");
		this.reelUpdate({
			0 : {
				file: this.properties.sources
			}
		})
	};
	this.reelUpdate = function (data) {
		if (typeof data == "string") {
			try {
				data = $.parseJSON(data)
			} catch(e) {
				data = [{
					file: "none",
					type: "NA",
					errorCode: 98
				}]
			}
		}
		try {
			var setValue = null;
			for (var props in data.config) {
				this.config[props] = this._cleanValue(data.config[props])
			}
			delete(data.config)
		} catch(e) {}
		if (this.config.poster !== false && (this.config.autoplay !== true || this.config.designMode === true)) {
			this.media[this.media.length] = {
				file: this.config.poster,
				isposter: true
			}
		}
		for (var items in data) {
			if (data[items].file == undefined) {
				continue
			}
			this.media[this.media.length] = this._cleanValue(data[items])
		}
		this.debug(this.media, "Playlist");
		this._configBuffer = $.extend(true, {},
		this.config);
		this._bubbleEvent("playlist", {});
		this.playItem(this.properties.currentItem)
	};
	this.playItem = function (idx) {
		var ref = this;
		var mediaFile = "";
		var mediaType = "";
		var mediaModel = "playerObjectNA";
		var fileExt = "";
		var extTypes = {};
		var typesModels = {};
		var errorCode = (this.media[idx].errorCode != undefined) ? this.media[idx].errorCode: 5;
		var lastLevel = 100;
		this._isReady = false;
		this._hasError = false;
		if (this.media[idx]._VALIDATED !== true) {
			var extRegEx = [];
			for (var i in this.mediaTypes) {
				extRegEx.push(this.mediaTypes[i].ext);
				extTypes[this.mediaTypes[i].ext] = this.mediaTypes[i];
				typesModels[this.mediaTypes[i].type] = this.mediaTypes[i]
			}
			extRegEx = extRegEx.join("|");
			if (typeof this.media[idx].file == "string") {
				this.media[idx].file = [{
					src: this.media[idx].file
				}];
				if (typeof this.media[idx].type == "string") {
					this.media[idx].file = [{
						src: this.media[idx].file,
						type: this.media[idx].type
					}]
				}
			}
			var sourceObj = {};
			for (var index in this.media[idx].file) {
				sourceObj = this.media[idx].file[index];
				if (typeof sourceObj == "string") {
					sourceObj = {
						src: sourceObj
					}
				}
				if (sourceObj.src == undefined) {
					continue
				}
				try {
					fileExt = sourceObj.src.match(new RegExp(extRegEx))[0];
					fileExt = (!fileExt) ? "NaN": fileExt
				} catch(e) {
					fileExt = "NaN"
				}
				if (sourceObj.type === undefined || sourceObj.type === "") {
					if (extTypes[fileExt]) {
						$.extend(sourceObj, extTypes[fileExt])
					}
				} else {
					if (typesModels[sourceObj.type]) {
						$.extend(sourceObj, typesModels[sourceObj.type])
					}
				}
				if (lastLevel > this.platformPriority.indexOf(sourceObj.platform) && this.mediaGrid[sourceObj.type] != "NA") {
					lastLevel = this.platformPriority.indexOf(sourceObj.platform);
					try {
						mediaModel = "playerObject" + this.mediaGrid[sourceObj.type].toUpperCase()
					} catch(e) {
						mediaModel = "playerObjectNA"
					}
					mediaFile = sourceObj.src;
					mediaType = sourceObj.type
				}
				if (index === "src") {
					break
				}
			}
			if (typeof eval(mediaModel) !== "function") {
				mediaModel = "playerObjectNA";
				errorCode = 0
			}
		}
		this.properties.currentItem = idx;
		if (this.media[idx]._VALIDATED !== true) {
			if (sourceObj.title != undefined) {
				this.media[idx].title = sourceObj.title
			}
			this.media[idx].file = mediaFile;
			this.media[idx].mediaType = mediaType;
			this.media[idx].mediaModel = mediaModel;
			this.media[idx].errorCode = errorCode;
			this.media[idx]._VALIDATED = true
		}
		this.debug("", "Model: " + this.media[idx].mediaModel + " File:" + this.media[idx].file + " Priority:" + lastLevel);
		$.extend(this.config, this._configBuffer);
		$.extend(this.config, this.media[idx]);
		this.playerObject = new playerObject();
		this.playerObject = $.extend(true, {},
		new playerObject(), eval(this.media[idx].mediaModel).prototype);
		this.playerObject.init($.extend(true, {},
		{
			media: this.media[idx],
			caller: ref,
			environment: ref.environment,
			config: ref.config
		}));
		this._bubbleEvent("item", this.media[idx])
	};
	this.elementUpdateListener = function (type, value) {
		switch (type) {
		case "objectReady":
			this.addGUIListeners();
			this._bubbleEvent("objectReady", {});
			if (this.config.autoplay == true || this._isStarted == true) {
				this.playerObject.applyCommand("play")
			} else {
				this.showStartIcon()
			}
			this._isReady = true;
			if (this._hasError === true) {
				this.hideBufferIcon();
				this._bubbleEvent("error", {})
			}
			break;
		case "awaking":
			this.hideStartIcon();
			this.showBufferIcon();
			this._bubbleEvent("awaking", {});
			break;
		case "start":
			if (this._isStarted == false) {
				this._isStarted = true;
				this._bubbleEvent("start", {});
				break
			}
		case "play":
			if (this._isPlaying === false) {
				this._isPlaying = true;
				this._bubbleEvent("play", {});
				this.playerObject.applyCommand("volume", this.config.volume)
			}
			this.hideBufferIcon();
			break;
		case "pause":
			if (this.config.disablePause == true) {
				this.playerObject.applyCommand("play", 0);
				break
			}
			if (this._isPlaying == true) {
				this._isPlaying = false;
				this._bubbleEvent("pause", {})
			}
			break;
		case "seek":
			this._bubbleEvent("seek", {
				dest: value
			});
			break;
		case "testcard":
			this._isWaiting = false;
			this._hasError = true;
			this._bubbleEvent("testcard", {});
			this.hideBufferIcon();
			break;
		case "volume":
			this.config.volume = this.playerObject.getVolume();
			this._configBuffer.volume = this.playerObject.getVolume();
			this._bubbleEvent("volume", {});
			break;
		case "suspend":
			this._isWaiting = false;
			this.hideBufferIcon();
		case "progress":
			this._bubbleEvent("progress", {});
			break;
		case "time":
			this._bubbleEvent("time", {});
			break;
		case "fullscreen":
			if (this.config.disableFullscreen == true) {
				break
			}
			this.environment.inFullscreen = this.playerObject.getInFullscreen();
			this.drawFullscreen();
			this._bubbleEvent("fullscreen", {});
			break;
		case "canvas":
			this.resizePluginCanvas($("#" + this.environment.publicName));
			break;
		case "ended":
			this._bubbleEvent("ended", {});
			this.playNextItem();
			this.hideBufferIcon();
			break;
		case "waiting":
			if (this._isWaiting !== true) {
				this._bubbleEvent("waiting", {});
				this._isWaiting = true;
				this.showBufferIcon()
			}
			break;
		case "canplaythrough":
		case "canplay":
			if (this._isWaiting == true) {
				this._bubbleEvent("canplay", {});
				this._isWaiting = false;
				this.hideBufferIcon()
			}
			break
		}
	};
	this.addGUIListeners = function () {
		var ref = this;
		if (this.config.designMode === true) {
			return
		}
		$("#" + this.environment.publicName).click(function (event) {
			ref.displayClickListener(event)
		});
		$("#" + this.environment.publicName).dblclick(function (event) {
			ref.displayDblClickListener(event)
		});
		$("#" + this.environment.publicName).mousemove(function (event) {
			ref.displayMousemoveListener(event)
		})
	};
	this.removeGUIListeners = function () {
		$("#" + this.environment.publicName).unbind()
	};
	this.registerPlugins = function () {
		for (var i = 0; i < this.config.plugins.length; i++) {
			var pluginName = this.config.plugins[i];
			var pluginObj = $.extend(new projekktorPluginInterface(), eval(pluginName).prototype);
			pluginObj.player = this;
			pluginObj.config = this.config;
			pluginObj.playerDom = $("#" + this.environment.publicName + "_" + this.config.canvasId);
			pluginObj.initialize();
			this.plugins.push(pluginObj)
		}
	};
	this.unbindPlugins = function () {
		for (var j = 0; j < this.plugins.length; j++) {
			$(this.plugins[j]).unbind()
		}
	};
	this._bubbleEvent = function (eventType, data) {
		for (var i in this.plugins) {
			try {
				this.plugins[i][eventType + "Handler"](data)
			} catch(e) {}
		}
	};
	this.playPreviousItem = function (obj, data) {
		if (this._isReady == false) {
			return
		}
		this._isPlaying = false;
		this._bubbleEvent("previous", {});
		this.detachPlayerObject();
		var result = this.properties.currentItem - 1;
		if (this.media[result] === undefined) {
			result = this.media.length - 1
		}
		this.playItem(result)
	};
	this.playNextItem = function (obj, data) {
		if (this._isReady == false) {
			return
		}
		this._isPlaying = false;
		this._bubbleEvent("next", {});
		this.detachPlayerObject();
		var result = this.properties.currentItem + 1;
		if (this.media[result] === undefined) {
			result = 0;
			if (this.config.loop === false) {
				this._isStarted = false;
				this._bubbleEvent("done", {})
			}
		}
		this.playItem(result)
	};
	this.detachPlayerObject = function () {
		$(this).unbind();
		this.unbindPlugins();
		this.playerObject.destroy();
		this.removeGUIListeners();
		this.playerObject = null;
		this._bubbleEvent("detach", {})
	};
	this.displayClickListener = function (evt) {
		var ref = this;
		if (!this._isPlaying || !this._isStarted) {
			this.playerObject.applyCommand("play", false)
		} else {
			this.playerObject.applyCommand("pause", false)
		}
		evt.stopPropagation()
	};
	this.displayDblClickListener = function (evt) {
		var ref = this;
		if (!this._isStarted) {
			return
		} else {
			if (this.environment.inFullscreen) {
				this.playerObject.applyCommand("fullscreen", false)
			} else {
				this.playerObject.applyCommand("fullscreen", true)
			}
		}
		evt.stopPropagation()
	};
	this.displayMousemoveListener = function (evt) {
		this._bubbleEvent("mousemove", {});
		evt.stopPropagation()
	};
	this.keyListener = function (evt) {
		switch (evt.keyCode) {
		case 27:
			if (!this.playerObject.getInFullscreen()) {
				break
			}
			this.playerObject.applyCommand("fullscreen", false);
			break
		}
		evt.stopPropagation()
	};
	this.hideBufferIcon = function () {
		var ref = this;
		if (this._isStarted != true) {
			return
		}
		clearTimeout(this._bufferDelayTimer);
		var target = $("#" + this.environment.publicName + "_" + this.config.bufferingDomId);
		target.stop(true, true);
		target.fadeOut("fast")
	};
	this.showBufferIcon = function (instant) {
		var ref = this;
		clearTimeout(this._bufferDelayTimer);
		if (this._isWaiting == false && instant == false) {
			return
		}
		if (instant != true) {
			ref._bufferDelayTimer = setTimeout(function () {
				ref.showBufferIcon(true)
			},
			ref.config.bufferIconDelay);
			return
		}
		var target = $("#" + this.environment.publicName + "_" + this.config.bufferingDomId);
		target.stop(true, true);
		target.fadeIn("fast")
	};
	this.hideStartIcon = function () {
		var target = $("#" + this.environment.publicName + "_" + this.config.startDomId);
		target.hide()
	};
	this.showStartIcon = function (delay) {
		var target = $("#" + this.environment.publicName + "_" + this.config.startDomId);
		target.show()
	};
	this.drawPlayer = function (destDOM) {
		var result = $(document.createElement("div")).attr({
			id: this.environment.publicName,
			style: $(destDOM).attr("style"),
			"class": "projekktor"
		}).css("width", $(destDOM).attr("width") + "px").css("height", $(destDOM).attr("height") + "px");
		$(destDOM).replaceWith(result);
		var daPlayer = $(document.createElement("div")).appendTo(result).attr({
			id: this.environment.publicName + "_media"
		});
		$(document.createElement("div")).appendTo(result).attr({
			id: this.environment.publicName + "_" + this.config.canvasId
		});
		$(document.createElement("div")).appendTo(result).attr({
			id: this.environment.publicName + "_" + this.config.bufferingDomId,
			"class": this.config.cssClassPrefix + "buffering"
		});
		if (this.config.autoplay !== true) {
			$(document.createElement("div")).appendTo(result).attr({
				id: this.environment.publicName + "_" + this.config.startDomId,
				"class": this.config.cssClassPrefix + "start"
			})
		}
		try {
			$("#projekktorver").html("V" + this.config.version)
		} catch(e) {}
		return result
	};
	this.drawFullscreen = function () {
		var playerDom = $("#" + this.environment.publicName);
		var ref = this;
		if (this.environment.inFullscreen == true) {
			this.environment.playerStyle = playerDom.attr("style");
			this.environment.zIndex = playerDom.css("z-index");
			this.environment.bodyOverflow = $("body").css("overflow");
			this.environment.scrollTop = $(window).scrollTop();
			this.environment.scrollLeft = $(window).scrollLeft();
			$(window).scrollTop(0);
			$(window).scrollLeft(0);
			playerDom.attr("style", "position:absolute;display:block;top:0;left:0;width:100%;height:100%;z-index:9999;");
			$("body").css("overflow", "hidden");
			$(window).resize(function () {
				ref.resizePluginCanvas(playerDom)
			})
		} else {
			$(window).scrollTop(this.environment.scrollTop);
			$(window).scrollLeft(this.environment.scrollLef);
			$("body").css("overflow", this.environment.bodyOverflow);
			playerDom.attr("style", this.environment.playerStyle);
			playerDom.css("z-index", this.environment.zIndex);
			$(window).unbind("resize")
		}
		this.resizePluginCanvas($("#" + this.environment.publicName))
	};
	this.resizePluginCanvas = function (target) {
		$("#" + this.environment.publicName + "_" + this.config.canvasId).css({
			padding: 0,
			margin: 0,
			zIndex: 2,
			overflow: "hidden",
			position: "absolute",
			top: 0,
			left: 0,
			width: (target.width()) + "px",
			height: (target.height()) + "px"
		})
	};
	this.getItemCount = function () {
		return (this.config.poster === false || this.config.autoplay === true) ? this.media.length: this.media.length - 1
	};
	this.getIsAutoslide = function () {
		return this.playerObject.getIsAutoslide()
	};
	this.getIsStarted = function () {
		return this._isStarted
	};
	this.sendEvent = function (command, parameter) {
		switch (command) {
		case "next":
			if (this.config.disallowSkip == true) {
				break
			}
			this.playNextItem();
			break;
		case "previous":
			if (this.config.disallowSkip == true) {
				break
			}
			this.playPreviousItem();
			break;
		default:
			this.playerObject.applyCommand(command, parameter)
		}
	};
	this.getLoadProgress = function () {
		try {
			return this.playerObject.getLoadProgress()
		} catch(e) {
			return 0
		}
	};
	this.getKbPerSec = function () {
		try {
			return this.playerObject.getKbPerSec()
		} catch(e) {
			return 0
		}
	};
	this.getItemId = function () {
		if (this.config.trackId) {
			return this.config.trackId
		}
		if (this.properties.playlistServer != null) {
			return "pl" + this.properties.currentItem
		}
		return null
	};
	this.getLoadPlaybackProgress = function () {
		try {
			return this.playerObject.getLoadPlaybackProgress()
		} catch(e) {
			return 0
		}
	};
	this.getDuration = function () {
		try {
			return this.playerObject.getDuration()
		} catch(e) {
			return 0
		}
	};
	this.getPosition = function () {
		try {
			return this.playerObject.getPosition()
		} catch(e) {
			return 0
		}
	};
	this.getInFullscreen = function () {
		return this.environment.inFullscreen
	};
	this.getPublicName = function () {
		return this.environment.publicName
	};
	this.getIsPlaying = function () {
		return this._isPlaying
	};
	this.getIsPlaying = function () {
		return this._isPlaying
	};
	this.getMediaType = function () {
		return this.media[this.properties.currentItem].mediaType
	};
	this._testMediaSupport = function () {
		var result = [];
		var hasNativeAudio = false;
		var flashVerison = this._flashVersion().match(/\d+/g);
		var hasFlash = (flashVerison[0] > 0);
		var nativeElementType = "";
		for (i in this.mediaTypes) {
			result[this.mediaTypes[i]["type"]] = "NA";
			if (this.mediaTypes[i]["model"] == "image" && this.mediaTypes[i]["platform"] == "native") {
				result[this.mediaTypes[i]["type"]] = "image";
				continue
			}
			if (hasFlash == true && this.mediaTypes[i]["platform"] == "flash") {
				if (this.mediaTypes[i]["model"] == "flash") {
					if (this.config.enableFlashFallback == true) {
						result[this.mediaTypes[i]["type"]] = this.mediaTypes[i]["model"]
					}
				} else {
					result[this.mediaTypes[i]["type"]] = this.mediaTypes[i]["model"]
				}
			}
			if (this.mediaTypes[i]["fixed"] !== true) {
				if ((this.mediaTypes[i]["type"].indexOf("video") > -1 || this.mediaTypes[i]["type"].indexOf("audio") > -1)) {
					try {
						nativeElementType = (this.mediaTypes[i]["type"].indexOf("video") > -1) ? "video": "audio";
						var testObject = document.createElement(nativeElementType);
						if (testObject.canPlayType != false) {
							switch (testObject.canPlayType(this.mediaTypes[i]["type"])) {
							case "no":
								break;
							case "":
								break;
							case "maybe":
								if ($.browser.opera) {
									break
								}
							case "probably":
							default:
								result[this.mediaTypes[i]["type"]] = nativeElementType
							}
						}
					} catch(e) {}
				}
			}
		}
		this.debug(result, "Media Support:");
		return result
	};
	this._getSourcesFromContainer = function (target) {
		if (target == undefined) {
			return ""
		}
		var result = {};
		var i = 0;
		var poster = false;
		var title = "";
		if (target.attr("poster")) {
			poster = target.attr("poster")
		}
		if (target.attr("title")) {
			title = target.attr("title")
		}
		if (target.attr("src")) {
			result[i] = {
				src: target.attr("src"),
				type: target.attr("type"),
				poster: poster,
				title: title
			};
			i++
		}
		$(target).children().each(function () {
			if ($(this).attr("src")) {
				result[i] = {
					src: $(this).attr("src"),
					type: $(this).attr("type"),
					poster: poster,
					title: title
				};
				i++
			}
		});
		return result
	};
	this._randomId = function (length) {
		var chars = "abcdefghiklmnopqrstuvwxyz";
		var result = "";
		for (var i = 0; i < length; i++) {
			var rnum = Math.floor(Math.random() * chars.length);
			result += chars.substring(rnum, rnum + 1)
		}
		return result
	};
	this._flashVersion = function () {
		try {
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				try {
					axo.AllowScriptAccess = "always"
				} catch(e) {
					return "6,0,0"
				}
			} catch(e) {}
			return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]
		} catch(e) {
			try {
				if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
					return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]
				}
			} catch(e) {}
		}
		return "0,0,0"
	};
	this._cleanValue = function (value) {
		switch (value) {
		case "false":
			return false;
		case "true":
			return true;
		case "null":
			return null;
		case "undefined":
			return "";
		default:
			return value
		}
	};
	this.debug = function (data, desc) {
		if (this.config.debug == "console") {
			console.log(desc);
			console.log(data);
			return
		}
		if (this.config.debug !== true) {
			return
		}
		var result = "<pre><b>" + desc + "</b>\n";
		switch (typeof data) {
		case "undefined":
			break;
		case "object":
			var temp = "";
			if (temp == "") {
				temp = "";
				for (var i in data) {
					temp += i + " : " + data[i] + "\n"
				}
			}
			result += temp;
			break;
		case "string":
			result += data
		}
		result += "</pre>";
		try {
			$("#debug").prepend(result)
		} catch(e) {}
	}
};
