﻿function embedFlashMovie(filename) {
    var playerCount = $$(".flashMovie").length;
    var playerId = "flashMovie" + (playerCount + 1);
    var playerUrl = __portalRoot + "Resources/Thirdparty/flowplayer/flowplayer-3.1.5.swf";
    var movieUrl = __portalRoot + "FlashMovies/" + filename;
    var movieWidth = 448;
    var movieHeight = 252;
    
    var playerElement = jQuery("<div/>")
        .append(jQuery("<a/>", {
            "class": "flashMovie",
            id: playerId,
            href: movieUrl,
            css : { width: movieWidth + "px", height: movieHeight + "px" }
        }));
    document.write(playerElement.html());
    
    flowplayer(playerId, playerUrl, {
        clip: {
            autoPlay: false,
            autoBuffering: true,
            scaling: "fit"
        },
        
        canvas: {
            backgroundColor: "#000000",
            backgroundGradient: "none"
        },
        
        plugins: {
            controls: {
                autoHide: "always",
                opacity: 0.8,
                height: 24,
                borderRadius: '0',
                buttonColor: '#4d4d4d',
                buttonOverColor: '#247c9e',
                bufferColor: '#454545',
                progressColor: '#40a6ce',
                backgroundColor: '#262626',
                durationColor: '#9e9e9e',
                sliderColor: '#000000',
                timeBgColor: '#555555',
                timeColor: '#ffffff',
                tooltipColor: '#5F747C',
                tooltipTextColor: '#ffffff',
                volumeSliderColor: '#000000',
                backgroundGradient: 'none',
                bufferGradient: 'none',
                progressGradient: 'none',
                sliderGradient: 'none',
                volumeSliderGradient: 'none'
            }
        }
    });
}
