var opened = '';
window.addEvent('domready', function(){
	$$('.podcast').each(function(podcast, i){
		var container = new Element('div').inject(podcast);
		var element = new Element('div').setProperty('id', 'podcast_'+i).inject(container);
		swfobject.embedSWF('/podcasts/player.swf', 'podcast_'+i, '608', '480', '9.0.0', '/js/expressInstall.swf', {file:podcast.getElement('a').get('href')});
		var _popup = new Popup(container, {
			'title': ''/*,
			'onOpened': function(){
				opened = 'podcast_'+i;
				$('podcast_'+i).sendEvent("PLAY","true");
			},
			'onClose': function(){
				opened = '';
				$('podcast_'+i).sendEvent("STOP","true");
			}*/
		});
		podcast.getElements('a').addEvent('click', function(e){
			new Event(e).stop();
			_popup.open();
		});
	});
});
function playerReady(obj) {
	if (opened == obj['id']) {
		obj.sendEvent("PLAY","true");
	}
}
