// // ------------ FLV VIDEO PLAYER -------------------- //
// http://www.jeroenwijering.com/extras/readme.html
// http://www.jeroenwijering.com/extras/javascript.html
// http://www.jeroenwijering.com/extras/


// ------------------------------------------------- //
// IF DELAY IS NEEDED - PAUSE VIDEO PLAYBACK UNITL VIDEO <DIV> LOADS INTO MEMORY [<a href="javascript:Flash_playFLV(203,'playitem');">]
	var delay = 1000;		// default to 1000 milliseconds
	function playFLV(flvID,flvCmd) {
		string="sendEvent('" + flvCmd + "'," + flvID + ");";
		setTimeout(string,delay);
	}


// JAVASCRIPT VIDEO PLAYER CONTROLS
	// some variables to save
	var currentPosition;
	var currentVolume;
	var currentItem;

// ------------------------------------------------- //
// IF NO DELAY NEEDED, CALL NORMAL FUNCTION [<a href="javascript:sendEvent(203,'playitem');">]
	// these functions are caught by the JavascriptView object of the player.
	function sendEvent(typ,prm) { thisMovie("mpl").sendEvent(typ,prm); };
	function getUpdate(typ,pr1,pr2) {
		if(typ == "time") { currentPosition = pr1; }
		else if(typ == "volume") { currentVolume = pr1; }
		else if(typ == "item") { getItemData(pr1); }
		var id = document.getElementById(typ);
		id.innerHTML = typ+ ": "+Math.round(pr1);
		pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
	};

	// These functions are caught by the feeder object of the player.
	function loadFile(obj) { thisMovie("mpl").loadFile(obj); };
	function addItem(obj,idx) { thisMovie("mpl").addItem(obj,idx); }
	function removeItem(idx) { thisMovie("mpl").removeItem(idx); }
	function getItemData(idx) {
		var obj = thisMovie("mpl").itemData(idx);
		var nodes = "";
		for(var i in obj) { 
			nodes += "<li>"+i+": "+obj[i]+"</li>"; 
		}
// DEBUG VIDEO - uncomment below tag and <ul id="data"> tag in *.asp file.
//		document.getElementById("data").innerHTML = nodes;
	};

	// This is a javascript handler for the player and is always needed.
	function thisMovie(movieName) {
	    if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	};