glow.ready(function() {

    var episode_available = glow.dom.get("div.podcasts-cta-episode p");
	episode_available.each(function(i){
  		this == episode_available[i];
		var episode_available_text = glow.dom.get(this).text();
		if (episode_available_text == "No episodes available") {
			glow.dom.get(this).parent().parent().parent().remove();
		}
	});
	
	var download_href = glow.dom.get(".podcasts li p.podcast-cta-episode-download a");
	download_href.each(function(i){
  		this == download_href[i];
		if (i == 0) {
			var link_href = glow.dom.get(this).attr("href");
			var image_node_string = "<a href='" + link_href + "'><img class='podcast-img' src='http://www.bbc.co.uk/iplayer/syndication/icons/green/download_aliased_13.gif' alt='Podcast Download' /></a>"
			var image_node = glow.dom.create(image_node_string);
			glow.dom.get(this).before(image_node);
		}
	});	

	var podcasts_cta_div = glow.dom.get(".podcasts li div.podcasts-cta");
	podcasts_cta_div.each(function(i){
  		this == podcasts_cta_div[i];
		if (i == 1) {
			glow.dom.get(this).before("<h4 class='more'>MORE PODCASTS</h4>");
		}
	});	
	
});