// JavaScript Document
var listen = "none";

function player(option, id, url, width, sid, outsource)
{
	if (outsource != undefined) {
		top.window.status = ':))))';
		add_str = '_out'; }
	else add_str = '';
	if (option == 'show' && listen == 'none') { // shows the player
		TrackName = document.getElementById(id).innerHTML; // copy contents of the <td>...</td>
		document.getElementById(id).innerHTML = '<table cellpadding="0" cellspacing="0" align="center" width="'+width+'" height="30" bgcolor="#F5F5F5"><tr><td width="260" align="right"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="250" height="32"><param name="movie" value="/player'+add_str+'.swf?xxx='+url+'&sid='+sid+'" /><param name="quality" value="high" /><embed src="/player'+add_str+'.swf?xxx='+url+'&sid='+sid+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="32"></embed></object></td><td align="left"><a href="javascript:player(\'hide\', \''+id+'\', \''+url+'\', \''+width+'\', \''+sid+'\');"><img border="0" src="/templates/Stability/images/close_pl.gif" alt="close"/></a></td></tr></table>';
		listen = id;
		temp   = TrackName;
		}
	else if (listen != 'none' && option == 'show'){ // something listening
		document.getElementById(listen).innerHTML = temp;
		TrackName = document.getElementById(id).innerHTML; // copy contents of the <td>...</td>
		document.getElementById(id).innerHTML = '<table cellpadding="0" cellspacing="0" align="center" width="'+width+'" height="30" bgcolor="#F5F5F5"><tr><td width="260" align="right"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="250" height="32"><param name="movie" value="/player'+add_str+'.swf?xxx='+url+'&sid='+sid+'" /><param name="quality" value="high" /><embed src="/player'+add_str+'.swf?xxx='+url+'&sid='+sid+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="32"></embed></object></td><td align="left"><a href="javascript:player(\'hide\', \''+id+'\', \''+url+'\', \''+width+'\', \''+sid+'\');"><img border="0" src="/templates/Stability/images/close_pl.gif" alt="close"/></a></td></tr></table>';
		listen = id;
		temp   = TrackName;
	}
	else // option == 'hide'
	{
		document.getElementById(id).innerHTML = TrackName;	// returns the contents of the <td>...</td>
	}
}

player_listening = false;

function modern_player(action, containerId, url, width)
{
	if (action=='hide' || player_listening)
	{
		document.getElementById(player_container).innerHTML = player_replacement;//
	}
	
	if (action=='show')
	{
		url = escape(url);
		var target = document.getElementById(containerId);
		player_replacement = target.innerHTML;
		
		var height = parseInt(width*0.0833);
		
		var player_code = '';
		player_code+= '<table cellpadding=0 cellspacing=0><tr><td>';
		player_code+= ' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		player_code+= ' 		codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
		player_code+= ' 		width="'+width+'" height="'+height+'">';
		player_code+= ' 	<param name="movie" value="/wplay.swf?soundFile='+url+'&autostart=yes" > ';
		player_code+= ' 	<param name="quality" value="high"> '; 
		player_code+= ' 	<embed src="/wplay.swf?soundFile='+url+'&autostart=yes" quality="high" '; 
		player_code+= ' 		pluginspage="http://www.macromedia.com/go/getflashplayer" ';
		player_code+= '		type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"> ';
		player_code+= ' </object>';
		player_code+= '</td><td valign=middle>';
		player_code+= '<a href="javascript:modern_player(\'hide\', \''+containerId+'\',\'\',\'\');"><img border="0" src="/templates/Stability/images/close_pl.gif" alt="close"/></a>';
		player_code+= '</td></tr></table>';
		
		target.innerHTML = player_code;
		
		player_container = containerId;
		player_listening = true;
	}
}