﻿function addFlashMoviePlayer(objId, objMovie, objWidth, objHeight, objClass, objLogo, objImage, objLink, objAutoStart, objLinkFromDisplay, objShowBar) {
    // Required parameters: objId, objMovie, objWidth, objHeight
    var playerId = "";
    playerId = "mpswf_" + objId;
    document.write('<div id="' + objId + '" class="' + objClass + '">');
    var objLocation = location.href.substr(0, location.href.lastIndexOf('/') + 1);
    var so = new SWFObject('flash/MediaPlayer.swf', playerId, objWidth, objHeight, '7');
    so.addParam('allowfullscreen', 'true');
    so.addParam('allowscriptaccess', 'always');
    so.addVariable('javascriptid', playerId);
    so.addVariable('autostart', objAutoStart);
    so.addVariable('showdigits', 'false');
    // Local file or stream?
    if (objMovie.substr(0, 4) == "http" || objMovie.substr(0, 3) == "mms") {
        so.addVariable('file', objMovie);
    }
    else {
        so.addVariable('file', objLocation + objMovie);
    }
    if (objImage) {
        so.addVariable('image', objLocation + objImage);
    }
    so.addVariable('height', objHeight);
    so.addVariable('width', objWidth);
    so.addVariable('backcolor', '0x222222');
    so.addVariable('frontcolor', '0x000000');
    so.addVariable('lightcolor', '0x3995AF');
    if (objLogo) {
        so.addVariable('logo', objLocation + objLogo);
    }
    so.addVariable('enablejs', 'true');
    if (objLink) {
        so.addVariable('link', objLink);
    }
    so.addVariable('linkfromdisplay', objLinkFromDisplay);
    so.addVariable('shownavigation', objShowBar);
    so.write(objId);
    playerId = document.getElementById(playerId);
    document.write('</div>');
}