function AudioPlayer(id) {
	this.id 	= id;
	this.status = AudioPlayer.STOP;
}

AudioPlayer.STOP = 1;
AudioPlayer.PLAY = 2;
AudioPlayer.prototype.play = function (audio) {

	this.stop();
	
	var iframe = document.createElement('iframe');
	iframe.id = 'player_' + this.id;
	iframe.style.width = '0px';
	iframe.style.visibility = 'hidden';
	iframe.style.height = '0px';
	
	var body = document.getElementsByTagName('body')[0];
	if (body == null) {
		return;
	}
	
	body.appendChild(iframe);
	
    var ifrm = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe.contentDocument;
	
	
	var htmlEmbed = '<embed hidden="true" id="' + this.id + '" filename="' + audio+ '" src="' + audio+ '" pluginspage="http://www.microsoft.com/windows/mediaplayer/download/default.asp" type="application/x-mplayer2">';
							
	ifrm.document.write(htmlEmbed);
	
	this.status = AudioPlayer.PLAY;
	
	
};
AudioPlayer.prototype.stop = function () {
	
	var body = document.getElementsByTagName('body')[0];
	if (body == null) {
		return;
	}
	
	var iframeembed = document.getElementById('player_' + this.id);
	if ( iframeembed == null || iframeembed == '') {
		return;
	}
	
	body.removeChild(iframeembed);
	this.status = AudioPlayer.STOP;
};

AudioPlayer.prototype.playOrStop = function(audio) {
	if (this.status == AudioPlayer.STOP) {
		this.play(audio);
		return;
	}
	this.stop();
	
	
};
