google.load("swfobject", "2.1");

function createPlayer(object_id, video_file, preview_file, width, height) {
    var playlist;
    (video_file.indexOf('xml') != -1) ? playlist = 'bottom': playlist = 'none'; // show playlist if .xml file passed in (instead of .flv)
    var flashvars = {
            file: video_file, 
            image: preview_file,
            autostart: "false",
            playlist: 'bottom',
            playlistsize: 180,
            backcolor: "efefef",
            frontcolor: "333333",
            lightcolor: "fefefe",
            screencolor: "ffffff",
            provider: 'http'
    }
    var params = {
            allowfullscreen: "true", 
            allowscriptaccess: "always",
            wmode: "opaque"
    }
    var attributes = {
            id: "player_" + object_id,  
            name: "player_" + object_id,
            'class': "center",
            style: "width: " + width + "px"
    }
    swfobject.embedSWF("/template/swf/jwplayer.swf", object_id, width, height, "9.0.115", false, flashvars, params, attributes);
}