﻿function OnIsCurrentUserEditorComplete(result) {

    if (result) {
        $('#podcastList .podcast').prepend("<a class='remove'>Remove</a>");

        $('#podcastList .podcast').hover(function(e) {
            $(this).children('.remove').show();
        },
        function(e) {
            $(this).children('.remove').hide();
        });

        $('#podcastList .podcast .remove').click(function(e) {

            var channelId = parseInt($('.mainLink:first').attr('channelId'));
            var podcastId = parseInt($(this).parents('.podcast:first').attr('podcastId'));

            CastThree.ChannelService.RemovePodcastChannel(podcastId, channelId);
            
            $(this).parents('.podcast:first').fadeOut();
        });
    }
}

$(function() {
var channelId = parseInt($('.mainLink:first').attr('channelId'));

CastThree.ChannelService.IsCurrentUserEditor(channelId, OnIsCurrentUserEditorComplete);

});