﻿function deletePlayer(theWrapper, thePlaceholder, thePlayerId) 
{ 
    swfobject.removeSWF(thePlayerId);
    var tmp=document.getElementById(theWrapper);
    if (tmp) { tmp.innerHTML = "<div id=" + thePlaceholder + "></div>"; }
}

function createPlayer(myDomain, thePlaceholder, thePlayerId, theFile, autostart, width, height) {
    var flashvars = 
    {
        file:theFile, 
        autostart:autostart,
        controlbar:"bottom"
    }
    var params = 
    {
        allowfullscreen:"true", 
        allowscriptaccess:"always",
        wmode:"opaque"
    }
    var attributes = 
    {
        id:thePlayerId,  
        name:thePlayerId
    }
    swfobject.embedSWF(myDomain + "/Masters/JWPlayer/player.swf", thePlaceholder, width, height, "9.0.115", myDomain + "/Masters/Script/SwfObject/expressinstall.swf", flashvars, params, attributes);
}

function initPlayer(myDomain, theWrapper, thePlaceholder, thePlayer, theFile, autostart, width, height) 
{ 
    deletePlayer(theWrapper, thePlaceholder, thePlayer); 
    createPlayer(myDomain,thePlaceholder, thePlayer, theFile, autostart, width, height);
}
function initAll(myDomain, theWrapper, thePlaceholder, thePlayer, theFile, autostart, width, height, name, dsc, nameHolder, dscHolder) 
{ 
    initPlayer(myDomain, theWrapper, thePlaceholder, thePlayer, theFile, autostart, width, height);
    var _name=document.getElementById(nameHolder);
    if (_name) { _name.innerHTML = name; }
    var _dsc =document.getElementById(dscHolder);
    if (_dsc) { _dsc.innerHTML = dsc; }
}