
var FlashButtonObjects = new Array();

function FlashButtonRegister( flashObject )
{	
	FlashButtonObjects[FlashButtonObjects.length] = flashObject;
}

function UpdateButtonFontStyle(FSVarName, FSValue)
{
	for(var i=0; i<FlashButtonObjects.length; i++)
	{
		FlashButtonObjects[i].SetVariable("FSVarName", FSVarName); // Passing a variable to Flash
		FlashButtonObjects[i].SetVariable("FSValue", FSValue); // Passing a variable to Flash
		FlashButtonObjects[i].SetVariable("UpdateFont", "DoUpdate");
	}
	
}

function stopOtherSongs(FlashID)
{
	for(var i=0; i<FlashButtonObjects.length; i++)
	{
		FlashButtonObjects[i].SetVariable("StopKey", FlashID);; // Passing a variable to Flash
		FlashButtonObjects[i].SetVariable("StopAction", FlashID);; // Passing a variable to Flash
	}

}

function writeFlashSongButtons(songIndex, fontColor , fontFamily , fontSize , fontWeight , textDecoration )
{
	textDecoration = (textDecoration == null?"underline":textDecoration);
	fontColor = (fontColor == null?"blue":fontColor);
	fontFamily = (fontFamily == null?"Arial":fontFamily);
	fontSize = (fontSize == null?"12":fontSize);
	fontWeight = (fontWeight == null?"bold":fontWeight);

document.write('<object id="song'+songIndex+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="55" height="23" align="middle">'
	+'<param name="allowScriptAccess" value="sameDomain" />'
	+'<param name="movie" value="flash/MP3Player.swf" />'
	+'<param name="quality" value="high" />'
	+'<param name="scale" value="exactfit" />'
	+'<param name="wmode" value="transparent" />'
	+'<param name="bgcolor" value="#ffffff" />'

	+'<PARAM NAME="FlashVars" VALUE="id=song'+songIndex
				      +'&ContentID='+songIndex
				      +'&textDecoration='+textDecoration
				      +'&fontWeight='+fontWeight
				      +'&fontSize='+fontSize
				      +'&fontFamily='+fontFamily
				      +'&color='+fontColor
				      +'&songIndex='+songIndex+'">'

	+'<embed src="flash/MP3Player.swf" FlashVars="id=song'+songIndex
                                              +'&ContentID='+songIndex
                                              +'&textDecoration='+textDecoration
                                              +'&fontWeight='+fontWeight
                                              +'&fontSize='+fontSize
                                              +'&fontFamily='+fontFamily
                                              +'&color='+fontColor
                                              +'&songIndex='+songIndex+'"'

	+' quality="high" scale="exactfit" wmode="transparent" bgcolor="#ffffff" width="55" height="23" name="song'+songIndex+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
	+'</object>');

	FlashButtonRegister(document.getElementById("song"+songIndex));
}
