	if(window.attachEvent){var B3_AddEvent=function(el,strEvent,funcPtr){el.attachEvent('on'+strEvent,funcPtr);};}else if(window.addEventListener){var B3_AddEvent=function(el,strEvent,funcPtr){el.addEventListener(strEvent,funcPtr,false);};}if(window.detachEvent){var B3_RemoveEvent=function(el,strEvent,funcPtr){el.detachEvent('on'+strEvent,funcPtr);};}else if(window.removeEventListener){var B3_RemoveEvent=function(el,strEvent,funcPtr){el.removeEventListener(strEvent,funcPtr,false);};}

	var b3_ghostplayer_elements = new Array();

	B3_AddEvent(window,'load',function()
	{
		window.flash = new SWFObject('b3ghostplayer.swf','b3ghostplayer','1','1','8','#FFFFFF','high','','','','width:1;height:1', '', '');
		window.flash.addParam('wmode', 'transparent');
		window.flash.addParam('allowScriptAccess', 'sameDomain');
		window.flash.addParam('swLiveConnect','true');
		window.flash.write('b3ghostplayer_placeholder');
		window.flash = null;
		window.b3_ghost_player_current = null;
	});

	function B3GhostPlayerInitialize() {
		for (var i = 0; i < b3_ghostplayer_elements.length; i++) {
			b3_ghostplayer_elements[i].element.innerHTML = b3_ghostplayer_elements[i].innerHTML;
		}
	}

	function B3WriteGhostPlayer(id, mp3) {
		var ghostplayerid = 'b3ghostplayer_' + id;
		var html = '<div id="' +ghostplayerid+ '" class="b3ghostplayer_play" onclick="B3GhostPlayerTogglePlay(\'' +ghostplayerid+ '\',\'' +mp3+ '\')"></div>';
		b3_ghostplayer_elements[b3_ghostplayer_elements.length] = { element:document.getElementById(id),innerHTML:html };
	}

	function B3GetFlashMovie(movieName) {
		  var isIE = navigator.appName.indexOf("Microsoft") != -1;
		  return (isIE) ? window[movieName] : document[movieName];
	}

	function B3GhostPlayerTogglePlay(id, mp3) {
		var self = document.getElementById(id);
		var player = B3GetFlashMovie('b3ghostplayer');
		if (self.className == 'b3ghostplayer_play') {
			self.className = 'b3ghostplayer_stop';
			player.getFlashToPlay(true,mp3);
			if (b3_ghost_player_current) {
				b3_ghost_player_current.className = 'b3ghostplayer_play';
			}
			b3_ghost_player_current = self;
		}
		else {
			self.className = 'b3ghostplayer_play';
			player.getFlashToPlay(false);
			b3_ghost_player_current = null;
		}
	}

	function B3GhostPlayerStop() {
		if (b3_ghost_player_current) {
			b3_ghost_player_current.className = 'b3ghostplayer_play';
		}
		b3_ghost_player_current = null;
	}
