﻿function openRecordedShows(p,w,cid) {
    var recordedProgramCallback = function(v) {
        var i = document.getElementById('recordedTab');
        if (i != null) {
            i.innerHTML = v;
        }
    }
    openAsyncUrl('../services/branding.shows.aspx?type=recorded&customerId=' + cid + '&w=' + w + '&p=' + p, recordedProgramCallback);
}
function openPopularShows(p,w,cid) {
    var popularProgramCallback = function(v) {
        var i = document.getElementById('popularTab');
        if (i != null) {
            i.innerHTML = v;
        }
    }
    openAsyncUrl('../services/branding.shows.aspx?type=popular&customerId='+ cid +'&w=' + w + '&p=' + p, popularProgramCallback);
}

function openShows(t, p, w, cid) {
    switch (t) {
        case 'recorded':
            openRecordedShows(p,w,cid);
            break;
        case 'popular':
            openPopularShows(p,w, cid);
            break;
    }
}
function jmTab(s, img) {
    showTab('liveTab', 'none');
    showTab('recordedTab', 'none');
    showTab('popularTab', 'none');
    deactivate('tdLive');
    deactivate('tdRecorded');
    deactivate('tdPopular');
    switch (s.toUpperCase()) {
        case 'LIVE':
            showTab('liveTab', 'inline-block');
            activate('tdLive');
            if (plugin != null) {
                plugin.Content.slApplication.TryToSwitchLive();
            }
            break;
        case 'POPULAR':
            activate('tdPopular');
            showTab('popularTab', 'inline-block');
            break;
        case 'RECORDED':
            activate('tdRecorded');
            showTab('recordedTab', 'inline-block');
            break;
    }
}
function imageMouseOver(o) {
    if (o.src != o.getAttribute('selectedsrc')) {
        o.setAttribute('src2', o.src);
        o.src = o.getAttribute('selectedsrc');
    }
}
function imageMouseOut(o) {
    if (o.src != o.getAttribute('src2')) {
        o.src = o.getAttribute('src2');
    }
}

function showTab(la, s) {
    var l = document.getElementById(la);
    if ((l != null) && (l.style.display != s)) {
        l.style.display = s;
    }
}
function deactivate(im) {
    var img = document.getElementById(im);
    if (img != null) {
        img.className = 'tab';
    }
}
function activate(im) {
    var img = document.getElementById(im);
    if (img != null) {
        img.className = 'selectedtab';
    }
}    