// podcast.js


window.addEvent('domready', function() {
	
	// listen links
	$$('a.listen').addEvent('click', function() {
		loadPodcast(this.id);
	});
	
	// download links
	$$('a.download').addEvent('click', function() {
		downloadPodcast(this.id);
	});
	
	
});

// load a podcast into the player
function loadPodcast(podcast) { // podcast consists of 'name|url'
	// find the podcast
	podcast = podcast.split('|');
	var name = podcast[0];
	var file = podcast[1];
	// reset the name and player
	$('podcast_name').setHTML(name);
	$('podcast_audio').setHTML('<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="220" height="20"><param name="movie" value="/_swf/podcast_player.swf?file='+file+'" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="/_swf/podcast_player.swf?file='+file+'" width="220" height="20" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed></object>');
	// scroll so we can see the player
	new Fx.Scroll(window).toTop();
	// fix flash if necessary
	if (window.ie) {
		fixFlash();
	}
}


