/*-------------------------------------------------------------------
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 createPlayer(theFile) {
	var s = new SWFObject("mediaplayer.swf","thePlayerId","300","455","7");
	s.addParam("allowfullscreen","true");
	s.addVariable("file","playlist.php");
	s.addVariable("width","300");
	s.addVariable("height","455");
   s.addParam("wmode","opaque");
	s.addVariable("displayheight","230");
	s.addVariable("overstretch","fit");
	s.addVariable('frontcolor','0x087AC1');
	s.addVariable('lightcolor','0x7cd301');
	s.addVariable("showicons","true");
	s.addVariable("autostart","true");
	s.addVariable("thumbsinplaylist","true");
	s.addVariable("enablejs","true");
	s.addVariable("javascriptid","thePlayerId");
	s.write("placeholder");
}



function createMusicPlayer(theFile) {
	var s = new SWFObject("mediaplayer.swf","thePlayerId","400","134","8");
	s.addParam("allowfullscreen","true");
	s.addVariable("file","musicplaylist.php?playfile="+theFile);
	s.addVariable("width","400");
	s.addVariable("height","134");
   s.addVariable("shuffle","false");
   s.addVariable("shownavigation","true");
   s.addVariable("showstop","true");
   s.addVariable("showdigits","true");
   s.addParam("wmode","transparent");
   s.addVariable("displaywidth","140");
	s.addVariable("overstretch","fit");
   s.addVariable("repeat","true");
	s.addVariable('frontcolor','0x087AC1');
	s.addVariable('lightcolor','0x7cd301');
	s.addVariable("showicons","true");
	s.addVariable("autostart","false");
	s.addVariable("thumbsinplaylist","true");
	s.addVariable("enablejs","true");
	s.addVariable("javascriptid","thePlayerId");
	s.write("placeholder");
}

function createProfilePlayer(theFile) {
	var s = new SWFObject("mediaplayer.swf","thePlayerId","400","134","8");
	s.addParam("allowfullscreen","true");
	s.addVariable("file","profileplaylist.php?userid="+theFile);
	s.addVariable("width","400");
	s.addVariable("height","134");
   s.addVariable("shuffle","false");
   s.addVariable("repeat","true");
   s.addVariable("shownavigation","true");
   s.addVariable("showstop","true");
   s.addVariable("showdigits","true");
   s.addParam("wmode","transparent");
   s.addVariable("displaywidth","140");
	s.addVariable("overstretch","fit");
	s.addVariable('frontcolor','0x087AC1');
	s.addVariable('lightcolor','0x7cd301');
	s.addVariable("showicons","true");
	s.addVariable("autostart","false");
	s.addVariable("thumbsinplaylist","true");
	s.addVariable("enablejs","true");
	s.addVariable("javascriptid","thePlayerId");
	s.write("placeholder");
}

function createFloatingPlayer(theFile) {
	var s = new SWFObject("mediaplayer.swf","thePlayerId","400","134","8");
	s.addParam("allowfullscreen","true");
	s.addVariable("file","profileplaylist.php?userid="+theFile);
	s.addVariable("width","400");
	s.addVariable("height","134");
   s.addVariable("shuffle","false");
   s.addVariable("repeat","true");
   s.addVariable("shownavigation","true");
   s.addVariable("showstop","true");
   s.addVariable("showdigits","true");
   s.addParam("wmode","transparent");
   s.addVariable("displaywidth","140");
	s.addVariable("overstretch","fit");
	s.addVariable('frontcolor','0x087AC1');
	s.addVariable('lightcolor','0x7cd301');
	s.addVariable("showicons","true");
	s.addVariable("autostart","true");
	s.addVariable("thumbsinplaylist","true");
	s.addVariable("enablejs","true");
	s.addVariable("javascriptid","thePlayerId");
	s.write("placeholder");
}
