var WIDTH  = '392'; // 412
var HEIGHT = '323'; // 340


function hideVid(id){
    document.getElementById(id).innerHTML='';
    document.getElementById(id).style.display='none';
    // document.getElementById('modal_screen').style.display='none';
    // document.body.style.overflow="auto";
}
function showVid(VIDEO,type){
    var embedObj = get_embedObj(VIDEO);
    if( $.browser.msie ) {
        prep_IE(VIDEO,embedObj);
    }
    else {
        var closeBar = prep_FF(VIDEO,type);
        document.getElementById(VIDEO).innerHTML = closeBar + embedObj;
        document.getElementById('showplayer').style.border='1px solid black';
    }
}
function prep_IE(VIDEO,embedObj){
        var vidWin = window.open("","vidWin",
            "left=100,top=100,toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=" + WIDTH + ",height=" + HEIGHT 
        );
        
        vidWin.document.open();
        vidWin.document.write( '<body>'+embedObj+'</body>' );
        vidWin.document.close();
        vidWin.document.body.style.margin ="0px";
}
function prep_FF(VIDEO,type){
    document.getElementById('page').style.visibility='hidden';
    document.getElementById(VIDEO).style.border='1px solid black';
    document.getElementById(VIDEO).style.backgroundColor='black';
    document.getElementById(VIDEO).style.marginTop='12px';
    document.getElementById(VIDEO).style.paddingTop='4px';
    document.getElementById(VIDEO).style.paddingBottom='0';
    document.getElementById(VIDEO).style.width= WIDTH +'px';
    document.getElementById(VIDEO).style.zIndex='3';
    document.getElementById(VIDEO).style.opacity='1';
    document.getElementById(VIDEO).style.display='block';
    if( type == 'hover' ) {
        //  document.body.style.overflow="hidden";
        // document.getElementById('modal_screen').style.display='block';
        document.getElementById(VIDEO).style.position='fixed';
        document.getElementById(VIDEO).style.top='91px';
    }
    else {
        document.getElementById(VIDEO).style.position='relative';
        document.getElementById(VIDEO).style.top='0px';
    }
    document.getElementById('page').style.visibility='visible';
    return '<div style="text-align:right;background-color:#eee;'
         +     'font-weight:normal;width:' + WIDTH + 'px;"'  + '>'
         +     '<a href="javascript:hideVid(' + "'" + VIDEO + "')"
         +     '">'
         +         'close video player'
         +     '</a>&nbsp;&nbsp;'
         +  '</div>';
}
function get_embedObj(VIDEO){
    var url =
          'http://blip.tv/scripts/flash/showplayer.swf?'
        + 'autostart=true&'
        + 'brandname=' +VIDEO+ '&'
        + 'brandlink=http%3A//' +VIDEO+ '.blip.tv/&'
        + 'showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&'
        + 'file=http%3A//' +VIDEO+ '.blip.tv/rss/flash%3Fsort%3Ddate%26nsfw%3Ddc&'
        + 'user=' +VIDEO+ '&'
        + 'showguidebutton=true&'
        + 'showsharebutton=true&'
        + 'showfsbutton=true&'
        + 'lightcolor=0xFFFFFF&'
        + 'backcolor=0xF3F7FC&'
        + 'frontcolor=0x1C467F&'
        + 'tabType2=guide&'
        + 'tabTitle2=PCM%20DS%20episodes&'
        + 'tabUrl2=http%3A//' +VIDEO+ '.blip.tv/rss&'
        + 'tabType3=guide&'
        + 'tabTitle3=my%20friends%20on%20blip.tv&'
        + 'tabUrl3=http%3A//blip.tv/rss%3Ffriends_of%3D' +VIDEO+ 
        +    '" width="' +WIDTH+ '" height="'+HEIGHT
        +    '" allowfullscreen="true" id="showplayer">'
        +    '<param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf?autostart=false&'
        + 'brandname=' +VIDEO+ '&'
        + 'brandlink=http%3A//' +VIDEO+ '.blip.tv/&'
        + 'showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&'
        + 'file=http%3A//' +VIDEO+ '.blip.tv/rss/flash%3Fsort%3Ddate%26nsfw%3Ddc&'
        + 'user=' +VIDEO+ '&'
        + 'showguidebutton=true&'
        + 'showsharebutton=true&'
        + 'showfsbutton=true&'
        + 'lightcolor=0xFFFFFF&'
        + 'backcolor=0xF3F7FC&'
        + 'frontcolor=0x1C467F&'
        + 'tabType2=guide&'
        + 'tabTitle2=PCM%20DS%20episodes&'
        + 'tabUrl2=http%3A//' +VIDEO+ '.blip.tv/rss&'
        + 'tabType3=guide&'
        + 'tabTitle3=my%20friends%20on%20blip.tv&'
        + 'tabUrl3=http%3A//blip.tv/rss%3Ffriends_of%3D' + VIDEO
    ;
    var embedObj =  '<object type            = "application/x-shockwave-flash"'        + '        id              = "showplayer"'        + '        width           = ' + WIDTH        + '        height          = ' + HEIGHT        + '        allowfullscreen = "true"'        + '        data            = "' + url + '"'        + '>'        + '    <param name="movie" value="' + url + '" />'        + '    <param name="quality" value="best" />'        + '</' + 'object>';
    return embedObj;
}

/* 

   <span id="pcmtv" class="videoPlayer" style="display:none"></span>
   <span id="pcmfieldclass" class="videoPlayer" style="display:none"></span>


 */
