function toggle(id) {
  if ( document.getElementById(id).style.display=="none")
    document.getElementById(id).style.display="";
  else
    document.getElementById(id).style.display="none";
}

function testThis(str){
	alert (str);	
}
var currentPosition;
var currentVolume;
var currentItem;

		// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm) { thisMovie("playlist").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 loadPlaylist(obj) { $('#player_holder').css('position','static');thisMovie("playlist").loadFile(obj); };
	function loadFile(obj) { $('#player_holder').css('visibility','visible').css('height','330px');thisMovie("playlist").loadFile(obj); };
	function addItem(obj,idx) { thisMovie("playlist").addItem(obj,idx); }
	function removeItem(idx) { thisMovie("playlist").removeItem(idx); }
	function getItemData(idx) {
		var obj = thisMovie("playlist").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];
	}
};
