var thePlayerWin=null;


function send(data) {
    theData=data;
}

function launchPlayer(doc)
{
    send(doc);
    if (doc==null) {
        doc = '?type=audio&id=bogus';
    }
    // check if player open
    if (thePlayerWin!=null && !thePlayerWin.closed)
        {
            //setTimeout(thePlayerWin.addPlaylistItem(doc), 2000);
            thePlayerWin.addPlaylistItem(doc);
            thePlayerWin.focus();
        }
    else
        {
            thePlayerWin=window.open("http://www.kcrw.com/media-player/mediaPlayer2.html"+doc,
                                     "_player",
                                     "height=640,width=880,status=no,toolbar=no,menubar=no,location=no");
        }
    return false;
}

function bookmarkItem(doc) {
    send(doc);
    // check if player open
    if (thePlayerWin!=null && !thePlayerWin.closed)
        {
            thePlayerWin.bookmarkItem(doc);
            thePlayerWin.focus();
        }
    else
        {
            thePlayerWin=window.open("http://www.kcrw.com/media-player/mediaPlayer2.html"+doc,
                                     "_player" ,
                                     "height=640,width=880,status=no,toolbar=no,menubar=no,location=no");
        }
}

function bookmarkProgram(id) {
    bookmarkItem('?id='+id+'&showitem=false');
    return false;
}
function bookmarkShow(id) {
    bookmarkItem('?id='+id+'&showitem=true');
    return false;
}
    