﻿var selectedMediaType = '';
var selectedVideoId = '';
var selectedVideoIdClientID = '';

function ShowThis(videoDesc, videoName, typeToDisplay,
        videoUrl, videoId, width, height)
{
    if (document.getElementById(selectedVideoIdClientID) != null)
    {
        document.getElementById(selectedVideoIdClientID).value = videoId;
    }
    else
    {
        alert ('selectedVideoIdClientID not found in the document.');
    }
    //////////////////set some basic info///////////////
    if (document.getElementById('CurrentVideoTitleDiv'))
    {
        document.getElementById('CurrentVideoTitleDiv').innerHTML = videoName;
    }
    if (document.getElementById('CurrentVideoDescriptionDiv'))
    {
        document.getElementById('CurrentVideoDescriptionDiv').innerHTML = videoDesc;
    }
    ////////////////////////////////////////////////////
    selectedMediaType   = typeToDisplay;
    selectedVideoId     = videoId;
    //alert ('selected id:' + selectedVideoId);
    switch (typeToDisplay)
    {
        case "flash":
            
            //Create dummy object for misdirected functions to find
            playerFunctions["Flash"].preparePlayer("playerdiv");
            ///////////////////////////////////////////////////////
            document.getElementById('contentdiv').innerHTML = playerFunctions["Flash"].createPlayerHTML('playerdiv',
                                                videoUrl, width,height, 'true');
            ///////////////////////////////////////////////////////
            //Recreate functions on correct object
            playerFunctions["Flash"].fixFlashFunctions("playerdiv");
                                                
            break;    
            
        case "wmv":
            //alert('h:' + height + ' w:' + width);
            document.getElementById('contentdiv').innerHTML = playerFunctions["Windows Media"].createPlayerHTML('playerdiv',
                                                videoUrl, width,height, 'true');
            break;
        
        default:
            //alert ('unhandled typetodisplay');
            break;
    }
}
