// Wimpy Player with JavaScript Controller
// Version 1.0
// by Mike Gieson info@wimpyplayer.com
// http://www.wimpyplayer.comx
// ©2002-2005 plaino, inc.
//
// Please refer to the "readme.txt" file for explainations.
//
wimpySwf = "wimpy.swf";
wimpyConfigFile = "";
trackPlays = "";
voteScript = "";
defaultImage = "";
startPlayingOnload = "yes";
shuffleOnLoad = "yes";
randomOnLoad = "yes";
displayDownloadButton = "no";
startOnTrack = "";
autoAdvance = "yes";
popUpHelp = "yes";
scrollInfoDisplay = "yes";
infoDisplayTime = "3";
bufferAudio = "3";
theVolume = "100";
defaultVisualExt = "jpg";
randNum = 1;
//
// DO NOT EDIT BELOW HERE //
//
function makeWimpyPlayer(wimpyApp, wimpySkin, theWidth, theHeight, theBkgdColor, thePlaylist){
	//
	myuid = new Date().getTime();
	flashProxy = new FlashProxy(myuid, 'JavaScriptFlashGateway.swf');
	//
	AmyConfigs = Array();
	//
	if(wimpyApp){
		AmyConfigs[AmyConfigs.length] = "wimpyApp="+wimpyApp;
	}
	//
	AmyConfigs[AmyConfigs.length] = "wimpySkin="+wimpySkin;
	AmyConfigs[AmyConfigs.length] = "trackPlays="+trackPlays;
	AmyConfigs[AmyConfigs.length] = "voteScript="+voteScript;
	AmyConfigs[AmyConfigs.length] = "defaultImage="+defaultImage;
	AmyConfigs[AmyConfigs.length] = "startPlayingOnload="+startPlayingOnload;
	AmyConfigs[AmyConfigs.length] = "shuffleOnLoad="+shuffleOnLoad;
	AmyConfigs[AmyConfigs.length] = "randomOnLoad="+randomOnLoad;
	AmyConfigs[AmyConfigs.length] = "displayDownloadButton="+displayDownloadButton;
	AmyConfigs[AmyConfigs.length] = "startOnTrack="+startOnTrack;
	AmyConfigs[AmyConfigs.length] = "autoAdvance="+autoAdvance;
	AmyConfigs[AmyConfigs.length] = "popUpHelp="+popUpHelp;
	AmyConfigs[AmyConfigs.length] = "scrollInfoDisplay="+scrollInfoDisplay;
	AmyConfigs[AmyConfigs.length] = "infoDisplayTime="+infoDisplayTime;
	AmyConfigs[AmyConfigs.length] = "bufferAudio="+bufferAudio;
	AmyConfigs[AmyConfigs.length] = "theVolume="+theVolume;
	AmyConfigs[AmyConfigs.length] = "defaultVisualExt="+defaultVisualExt;
	AmyConfigs[AmyConfigs.length] = "forceXMLplaylist=yes";
	myConfigs = AmyConfigs.join("&");
	randNum++;
	flashVersion = "6,0,47,0";
	//
	if(theBkgdColor != false){
		bkgdColor = theBkgdColor
		tptBkgd_param = "";
		tptBkgd_embed = "";
	} else {
		bkgdColor = "000000";
		tptBkgd_param = '<param name="wmode" value="transparent" />';
		tptBkgd_embed = 'wmode="transparent" ';
	}
	//
	js2wimpy_param = '<param name="flashvars" value="lcId='+myuid+'"/>';
	js2wimpy_embed = 'flashvars="lcId='+myuid+'" ';
	//
	if(wimpyConfigFile.length > 4){
		altString = '&wimpyConfigs='+wimpyConfigFile;
	} else {
		altString = "&"+myConfigs;
	}
	if(thePlaylist){
		writePlaylist = "&playlist="+thePlaylist;
	} else {
		writePlaylist = "";
	}
	queryString = wimpySwf +'?x='+randNum+altString+writePlaylist;
	flashCode = '';
	
	//flashCode += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+'" width="'+theWidth+'" height="'+theHeight+'">';
	flashCode += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+'" width="'+theWidth+'" height="'+theHeight+'" name="wimpy'+randNum+'" id="wimpy'+randNum+'">';

	flashCode += '<param name="movie" value="'+queryString+'" />';
	flashCode += '<param name="loop" value="false" />';
	flashCode += '<param name="menu" value="false" />';
	flashCode += '<param name="quality" value="high" />';
	flashCode += '<param name="scale" value="noscale" />';
	flashCode += '<param name="salign" value="lt" />';
	flashCode += '<param name="bgcolor" value="'+bkgdColor+'" />';
	flashCode += tptBkgd_param;
	flashCode += js2wimpy_param;
	
	//flashCode += '<embed src="'+queryString+'" width="'+theWidth+'" height="'+theHeight+'" bgcolor="'+bkgdColor+'" loop="false" menu="false" quality="high" scale="noscale" salign="lt" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+tptBkgd_embed+js2wimpy_embed+'/></object>';
	flashCode += '<embed src="'+queryString+'" width="'+theWidth+'" height="'+theHeight+'" bgcolor="'+bkgdColor+'" loop="false" menu="false" quality="high" scale="noscale" salign="lt" name="wimpy'+randNum+'" id="wimpy'+randNum+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+tptBkgd_embed+js2wimpy_embed+'/></object>';

	document.write(flashCode);
	//document.write('<textarea name="textarea" cols="30" rows="5" wrap="VIRTUAL">'+flashCode+'</textarea>');
}