/* Schwar's uber JavaScript FLV player controls... */

var currentPosition;
var currentVolume;
var currentItem;
var currentState;

// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm) { try { thisMovie("mpl").sendEvent(typ,prm); }catch(e){ alert('This button will not work until this page is viewed on the Internet.'); } };
function getUpdate(typ,pr1,pr2,pid) {
	if(typ == "time") { currentPosition = pr1; }
	else if(typ == "volume") { currentVolume = pr1; }	
	else if(typ == "state") {
		currentState = pr1;
		if (currentState == 2) {
			swapIt('playButton', 'pause');
		}
		else {	
			swapIt('playButton', 'play');	
		}
	}
	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>)";
	}
}

// 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 swapIt(id, newclass) {
	if (document.getElementById) {
		document.getElementById(id).className = newclass;
	}
}
