function metaLink(theLink) { opener.location.href = theLink; } var NOWPLAYING = { getCurrentMediaObj : function(){ try { return RadioPlayerObj.currentMedia; } catch(e) { WriteToLog("error calling getCurrentMediaObj"); } }, getNowPlayingArtist : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("Author"); } catch(e) { WriteToLog("error calling getNowPlayingArtist"); } }, getNowPlayingIsAmgArtist : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("AmgArtist"); } catch(e) { WriteToLog("error calling getNowPlayingIsAmgArtist"); } }, getNowPlayingArtistId : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("ArtistId"); } catch(e) { WriteToLog("error calling getNowPlayingArtistId"); } }, getNowPlayingArtistUrlAlias : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("ArtistUrlAlias"); } catch(e) { WriteToLog("error calling getNowPlayingArtistUrlAlias"); } }, getNowPlayingTitle : function(){ try { return RadioPlayerObj.currentMedia.name; } catch(e) { WriteToLog("error calling getNowPlayingTitle"); } }, getTrackId : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("CPTrackID"); } catch(e) { WriteToLog("error calling getTrackId"); } }, getNowPlayingAlbum : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("AlbumTitle"); } catch(e) { WriteToLog("error calling getNowPlayingAlbum"); } }, getNowPlayingIsAmgAlbum : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("AmgAlbum"); } catch(e) { WriteToLog("error calling getNowPlayingIsAmgAlbum"); } }, getNowPlayingAlbumId : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("AlbumId"); } catch(e) { WriteToLog("error calling getNowPlayingAlbumId"); } }, getNextUpArtist : function() { try { for(var i=0; i < (RadioPlayerObj.currentPlaylist.count); i++){ if (RadioPlayerObj.currentmedia.isIdentical(RadioPlayerObj.currentPlaylist.item(i))){ if (i+1 < (RadioPlayerObj.currentPlaylist.count)) { return RadioPlayerObj.currentPlaylist.item(i+1).getItemInfo("Author"); } else { return "NONE"; } } } } catch(e) { WriteToLog("error calling getNextUpArtist"); } }, getNextUpArtistId : function() { try { for(var i=0; i < (RadioPlayerObj.currentPlaylist.count); i++){ if (RadioPlayerObj.currentmedia.isIdentical(RadioPlayerObj.currentPlaylist.item(i))){ if (i+1 < RadioPlayerObj.currentPlaylist.count) { return RadioPlayerObj.currentPlaylist.item(i+1).getItemInfo("ArtistId"); } } } } catch(e) { WriteToLog("error calling getNextUpArtistId"); } }, getNextUpTitle : function() { try { for(var i=0; i < (RadioPlayerObj.currentPlaylist.count); i++){ if (RadioPlayerObj.currentmedia.isIdentical(RadioPlayerObj.currentPlaylist.item(i))){ if (i+1 < RadioPlayerObj.currentPlaylist.count) { return RadioPlayerObj.currentPlaylist.item(i+1).getItemInfo("Title"); } else { return "NONE"; } } } } catch(e) { WriteToLog("error calling getNextUpTitle"); } }, playlistCount : function() { try { return RadioPlayerObj.currentPlaylist.count; } catch(e) { WriteToLog("error calling playlistCount"); } }, playlistCurrentItemCount : function() { for (var i = 0; i < RadioPlayerObj.currentPlaylist.count; i++){ if (RadioPlayerObj.currentmedia.isIdentical(RadioPlayerObj.currentPlaylist.item(i))){ return (i + 1); } } return ""; }, getNextEntrytype : function() { try { for(var i=0; i < (RadioPlayerObj.currentPlaylist.count); i++){ if (RadioPlayerObj.currentmedia.isIdentical(RadioPlayerObj.currentPlaylist.item(i))){ if (i+1 < RadioPlayerObj.currentPlaylist.count) { return RadioPlayerObj.currentPlaylist.item(i+1).getItemInfo("entrytype"); } else { return "NONE"; } } } } catch(e) { WriteToLog("error calling getNextEntrytype"); } }, getNextCanSkip : function() { try { return RadioPlayerObj.controls.isAvailable("next"); } catch(e) { WriteToLog("error calling getNextCanSkip"); } }, playNextUp : function() { try { if(RadioPlayerObj.controls.isAvailable('Next') && (TrackSkips < 10)){ // send reporting call RadioReporting.Send(true); RadioPlayerObj.controls.next(); WriteToLog("NEXT method called on player"); TrackSkips++; } if(TrackSkips>=10){ // disable next button $("BtnNext").DisableOrEnableImg(false); } if (RadioPlayerObj.controls.isAvailable('Play')){ RadioPlayerObj.controls.play();} } catch(e) { WriteToLog("error calling playNextUp"); } }, getStationObj : function(){ try { return RadioPlayerObj.currentPlaylist; } catch(e) { WriteToLog("error calling getStationObj"); } }, getStationName : function(){ try { return RadioPlayerObj.currentPlaylist.name; } catch(e) { WriteToLog("error calling getStationName"); } }, getStationId : function(){ try { return RadioPlayerObj.currentPlaylist.getItemInfo("CPRadioID"); } catch(e) { WriteToLog("error calling getStationId, Error" + e.number + " :" + e.message + " :" + e.description) } }, currentStationId : "", getTrackAvailable : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("Available"); } catch(e) { WriteToLog("error calling getTrackAvailable"); } }, getArtistAvailable : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("ArtistAvailable"); } catch(e) { WriteToLog("error calling ArtistAvailable"); } }, init : function(){ try { this.currentStationId = NOWPLAYING.getStationId(); } catch(e) { WriteToLog("error calling init"); } }, getPlayState : function(){ try { return RadioPlayerObj.playState ; } catch(e) { WriteToLog("error calling getPlayState"); } }, entrytype : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("entrytype"); } catch(e) { WriteToLog("error calling entrytype"); } }, getStartUrl : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("startUrl"); } catch(e) { WriteToLog("error calling getStartUrl"); } }, getEndUrl : function(){ try { return RadioPlayerObj.currentMedia.getItemInfo("endUrl"); } catch(e) { WriteToLog("error calling getStartUrl"); } }, hasCoAd : function(){ try { if ((RadioPlayerObj.currentMedia.getItemInfo("coAd")) && (RadioPlayerObj.currentMedia.getItemInfo("coAd")!= "undefined")){ return true; } else { return false; } } catch(e) { WriteToLog("error calling hasCoAd"); } }, displayCoAd : function(displayType){ try { var adTag = RadioPlayerObj.currentMedia.getItemInfo("coAd"); WriteToLog("coAd : " + adTag.substr(0,20)); var adFrame = document.all.adFrame; if (displayType == 'load'){ adFrame.src = adTag; } else { //adFrame.src = "/sitewide/img/spacer.gif"; } } catch (e) { WriteToLog("error in display_coAd: " + e.description); } }, display : function() { var charlimit = characterLimit; try { var trackTitle = this.getNowPlayingTitle(); if(this.entrytype()=="promo"){ trackTitle = "URGE Radio"; } if (trackTitle.length > charlimit) { trackTitle = trackTitle.substr(0,charlimit); trackTitle = trackTitle.concat("..."); } var artistName = this.getNowPlayingArtist(); var artistNameTitle = artistName; if (this.entrytype()=="promo"){ artistName = " "; } if (artistName.length > charlimit) { artistName = artistName.substr(0,charlimit); artistName = artistName.concat("..."); } var albumTitle = this.getNowPlayingAlbum(); if (albumTitle.length > charlimit) { albumTitle = albumTitle.substr(0,charlimit); albumTitle = albumTitle.concat("..."); } var nextUpArtist = this.getNextUpArtist(); var nextUpArtistTitle = nextUpArtist; if (nextUpArtist.length > 30) { nextUpArtist = albumTitle.substr(0,charlimit); nextUpArtist = albumTitle.concat("..."); } var stationName = this.getStationName(); if (stationName.length > charlimit) { stationName = stationName.substr(0,charlimit); stationName = stationName.concat("..."); } // this will have to be replaced with the actual image url var AlbumImgSrc = "images/album_placeholder_75.gif"; var ThisAlbumId = this.getNowPlayingAlbumId(); if(ThisAlbumId!=""){ AlbumImgSrc = "http://" + urgeStage + "/sitewide/dataservices/images/?type=album&id=" + this.getNowPlayingAlbumId(); } var errorImg = "http://" + urgeStage + "/sitewide/img/images/spacer.gif"; // get links for artist and album var npArtistLink = artistLink; var artistUrlAlias = this.getNowPlayingArtistUrlAlias(); npArtistLink = npArtistLink.replace(/{artistUrlAlias}/gi, artistUrlAlias); var npAlbumLink = albumLink; npAlbumLink = npAlbumLink.replace(/{artistUrlAlias}/gi, artistUrlAlias); npAlbumLink = npAlbumLink.replace(/{albumId}/gi, this.getNowPlayingAlbumId()); var np = "