function PodcastPlayer(obj) {
    this.keyname = obj.keyname;
    this.emp = obj.empSettings;
    this.template = obj.template;
    return this; //allow chained syntax
}
PodcastPlayer.prototype = {
    url : {
            base  : "http://www.bbc.co.uk/podcasts/series/",
            latest: "/episode1",
            suffix: ".xml"
     }, 
     constructUrl : function(section) {
         return this.url.base + this.keyname + section + this.url.suffix;
     },
     buildLatest : function() {
         if (!this.keyname || !this.emp || typeof this.emp.write == "undefined") return false; //fail early
         var obj = this; //capture object reference in the scope chain for callback
         var url = this.constructUrl(this.url.latest);
         var type = "latest";
         this.checkMetaFile(url, obj, type);
     },
     checkMetaFile : function(url, obj, type) {
         var request = glow.net.get(url, {
             onLoad : function(response) { obj.checkResponse(response, 'latest'); },
             onError: function(response) { obj.error(response); } //url with no episodes generates a 500
         });
     },
     checkResponse : function(response, type) {
         //Random url's currently return a response 200 with an errormessage tag, defensively code around this
         var xml = response.xml();
         var rootNodeName = xml.documentElement.nodeName;
         if      (rootNodeName == "errormessage") { this.error(response); } //random url returns an xml doc
         else if (rootNodeName == "playlist"    ) { this.embed(type);     }
     },
     error : function(response) {
         //console.log(response);
         //do nothing
     },
     embed : function(type) {
         this.emp.setPlaylist(this.constructUrl(this.url[type]));
         if (!this.template) {
             this.emp.write();
         }
         else {
             //apply template
             var parsedHtml = glow.lang.interpolate(this.template.html, this.template.data);
             glow.dom.create(parsedHtml)[this.template.glowInsertType](this.template.domId);
             this.emp.setDomId(this.template.data.playerId);
             this.emp.write();
         }
     }
}