	// some variables to save
	var currentPosition;
	var currentVolume;
	var currentItem;
	

	// 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,pid) {
		if(typ == "time") { currentPosition = pr1; }
		else if(typ == "volume") { currentVolume = pr1; }
		else if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100); }
		var id = document.getElementById(typ);
		id.innerHTML = typ+ ": "+Math.round(pr1);
		pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
		if(pid != "null") {
			document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
		}
	};


	function avPlay(id, play) {

		var img = 'fileadmin/template/res/na.png';
		var e = document.getElementById(id);
		if (!e) return;
		var fa = e.attributes.getNamedItem('flv');
		var ia = e.attributes.getNamedItem('flvp');

		if (ia && ia.nodeValue.length) img = ia.nodeValue;
		if (!fa) return;
		fn = fa.nodeValue;
		
		loadFile({file:fn, image:img}, play);
	}

	// These functions are caught by the feeder object of the player.
	function loadFile(obj,play) { 
		thisMovie("mpl").loadFile(obj); 
		if(play=="true") {
			thisMovie("mpl").sendEvent('playpause');
		}
	};

	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>"; 
		}
		//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];
		}
	};

	function txcFLVPlayerSetup(id) {
		var fid = 0;
		var s1 = new SWFObject("fileadmin/template/mediaplayer.swf","mpl","375","280","7");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("enablejs","true");
		s1.addVariable("javascriptid","mpl");
		s1.addVariable("autostart", "false");
		s1.addVariable("width","375");
		s1.addVariable("height","280");
		s1.addVariable("overstretch", "fit");
		s1.addVariable("linkfromdisplay", "false");
		s1.addVariable("usefullscreen", "false");
		s1.addVariable("file","video.flv");
		s1.addVariable("image","video.jpg");
		s1.addVariable("showicons", "true");
		s1.addVariable("showdownload", "false");
		s1.addVariable("displayheight", "280");

		img = 'fileadmin/template/res/na.png';
		e = document.getElementById('avlink'+fid);
		if (e) {
			fa = e.attributes.getNamedItem('flv');
			ia = e.attributes.getNamedItem('flvp');

			if (ia && ia.nodeValue.length) img = ia.nodeValue;
			if (fa) {
				fn = fa.nodeValue;

				s1.addVariable("file",fn);
				s1.addVariable("image",img);
			}
		}
		s1.write(id);
	}



