
document.write('<script type="text/javascript" src="' + getParam('sJsStatic') + 'jscript/player/flowplayer/flowplayer.js?v=' + getParam('sVersion') + '"></script>');

Phpfox.player =
{
	aParams: {},
	
	load: function(aParams)
	{
		if (document.getElementById(aParams['id']) === null)
		{
			return false;
		}
		
		this.aParams = aParams;
		
		var sCall = '$f(\'' + this.aParams['id'] + '\', {src: \'' + getParam('sJsStatic') + 'jscript/player/flowplayer/flowplayer.swf\', wmode: \'transparent\', zIndex: -1},{';
		switch (this.aParams['type'])
		{
			case 'video':
				sCall += 'clip: {';
				sCall += 'url: \'' + this.aParams['play'] + '\',';
				sCall += 'autoBuffering: true,';
				if (isset(this.aParams['auto']))
				{
					sCall += 'autoPlay: ' + this.aParams['auto'];
				}
				sCall = rtrim(sCall, ',');
				sCall += '}';
				break;
			case 'music':
				sCall += 'clip: {';
				if (!empty(this.aParams['play']))
				{
					sCall += 'url: \'' + this.aParams['play'] + '\',';
				}
				if (isset(this.aParams['on_finish']))
				{				
					sCall += 'onFinish: ' + this.aParams['on_finish'] + ','
				}				
				if (isset(this.aParams['on_start']))
				{				
					sCall += 'onStart: ' + this.aParams['on_start'] + ','
				}								
				sCall = rtrim(sCall, ',');
				sCall += '},';
				sCall += 'plugins: {';
				sCall += 'audio: {';
				sCall += 'url: \'' + getParam('sJsStatic') + 'jscript/player/flowplayer/flowplayer.audio.swf\'';
				sCall += '}';
				sCall += '}';
				break;
			default:
				p('Not a valid call.');
				break;
		}
		sCall += '});';

		eval(sCall);
		
		return this;
	},
	
	play: function(sId, sPath)
	{		
		p('#' + sId + ' Playnig song: ' + sPath);
		
		$('#' + sId).show();
		
		$f(sId).play(sPath);		
		
		return false;
	}
}