﻿function deletePlayer1(theWrapper, thePlaceholder, thePlayerId) { 
        swfobject.removeSWF(thePlayerId);
        var tmp=document.getElementById(theWrapper);
        window.alert(tmp);
        if (tmp) { tmp.innerHTML = "<div id=" + thePlaceholder + "></div>"; }
}


function createPlayer1(theFileName, thePlaceholder, thePlayerId, theFile, autostrt, thePhoto) {
        var flashvars = {
                file:theFile, 
                autostart:autostrt,
                image:thePhoto
        }
        var params = {
                allowfullscreen:"true", 
                allowscriptaccess:"always"
        }
        var attributes = {
                id:thePlayerId,  
                name:thePlayerId
        }
        swfobject.embedSWF(theFileName, thePlaceholder, "320", "267", "9.0.115", false, flashvars, params, attributes);
        //swfobject.createSWF(theFileName, thePlaceholder, "320", "267", "9.0.115", false, flashvars, params, attributes);
}

function initPlayer1(theFileName, theFile, thePhoto, AutoStrt) {
        deletePlayer1('wrapper', 'placeholder1', 'player1');
        createPlayer1(theFileName, 'placeholder1', 'player1', theFile, AutoStrt, thePhoto);
    }

    function intPlayer(theFile, thePlayer, go) {
        var s = new SWFObject(thePlayer, "player1", "320", "267", "7");
        s.addParam("allowfullscreen", "true");
        s.addVariable("file", theFile);
        s.addVariable("width", "320");
        s.addVariable("id", "player3");
        s.addVariable("height", "267");
        s.addVariable("displayheight", "267");
        s.addVariable("overstretch", "fit");
        if (go) { s.addVariable("autostart", "true"); }
        s.write("video2");
    }


    function delPlayer(theWrapper, thePlaceholder, thePlayerId, thePlayer) {
        swfobject.removeSWF(thePlayerId);
        var tmp = document.getElementById(theWrapper);
        if (tmp) { tmp.innerHTML = "<div id=" + thePlaceholder + "></div>"; }
    }


    function crtPlayer(thePlaceholder, thePlayerId, theFile, thePhoto, thePlayer, autoPly) {
        var flashvars = {
            file: theFile,
            autostart: autoPly,
            image: thePhoto
        }
        var params = {
            allowfullscreen: "true",
            allowscriptaccess: "always"
        }
        var attributes = {
            id: thePlayerId,
            name: thePlayerId
        }
        swfobject.embedSWF(thePlayer, thePlaceholder, "320", "267", "9.0.115", false, flashvars, params, attributes);
    }


    function iPlayer(thePlayer, theFile, thePhoto, autoPly) {
        delPlayer('wrapper', 'placeholder1', 'player1', thePlayer);
        crtPlayer('placeholder1', 'player1', theFile, thePhoto, thePlayer, autoPly);
    }