/*-------------------------------------------------------------------
Player javascript API
-------------------------------------------------------------------*/
function sendEvent(swf,typ,prm) { 
	thisMovie(swf).sendEvent(typ,prm); 
};
function getUpdate(typ,pr1,pr2,swf) {
	if(typ == "state" && swf == "jstest") {
		gid('stateshow').innerHTML = pr1;
	}
};
function loadFile(swf,obj) {
	thisMovie(swf).loadFile(obj); 
};
function getLength(swf) { 
	var len = thisMovie(swf).getLength(); 
	alert('the length of the playlist is: '+len);
};
function addItem(swf,obj,idx) {
	thisMovie(swf).addItem(obj,idx);
};
function removeItem(swf,idx) {
	thisMovie(swf).removeItem(idx);
};
function itemData(swf,idx) { 
	var obj = thisMovie(swf).itemData(idx);
	var txt = "";
	for(var i in obj) { 
		txt += i+": "+obj[i]+"\n";
	}
	alert(txt);
};
function thisMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};
function printTrace(str) {
	var itm = gid('tracecode');
	var txt = itm.innerHTML + str + '\n';
	itm.innerHTML = txt;
	itm.scrollTop = itm.scrollHeight;
};

function playVid(vid) {
	if (vid == '1')
	{
		loadFile('mpl',{file:'http://video.mrmethane.com/MrMethaneNorwayTv.flv'}); sendEvent('mpl','playpause');
	}
	else if(vid == '2')
	{
		loadFile('mpl',{file:'http://video.mrmethane.com/MrMethaneFartInterview.flv'}); sendEvent('mpl','playpause');
	}
	else if (vid == '3')
	{
		loadFile('mpl',{file:'http://video.mrmethane.com/MrMethaneFartsTheBlueDanube.flv'}); sendEvent('mpl','playpause');
	}
	else if (vid == '4')
	{
		loadFile('mpl',{file:'http://video.mrmethane.com/MrMethaneFartmanHowardStern.flv'}); sendEvent('mpl','playpause');
	}
	else if (vid == '5')
	{
		loadFile('mpl',{file:'http://video.mrmethane.com/MrMethaneLetsRipVideoAd.flv'}); sendEvent('mpl','playpause');
	}
}