Hello,
I want to update the output of ReturnPlayer function with this new code.

Code JavaScript:
<div id="mediaplayer">JW Player goes here</div>
 
 
<script type="text/javascript" src="jwplayer.js"></script>
<script type="text/javascript">
    jwplayer("mediaplayer").setup({
        flashplayer: "player.swf",
        file: "video.mp4",
        image: "preview.jpg"
    });
</script>


This code does not work:

Code JavaScript:
var JWEmbem = "<div id='mediaplayer'>JW Player goes here</div>";
var JWEmbem += "<script type='text/javascript'>";
var JWEmbem += "jwplayer('mediaplayer').setup({";
var JWEmbem += "flashplayer: '" + JWplayer + "',";
var JWEmbem += "file: '" + fileUrl + "',";
 
 
if(previewUrl != ''){
  var JWEmbem += "image: '" + previewUrl + "'";
}
 
 
var JWEmbem += "width: '" + width + "',";
var JWEmbem += "height: '" + height + "',";
 
 
if (selectskin != 'default') {
   var JWEmbem += "skin:" + CKEDITOR.plugins.get('jwplayer').path + "jwplayer/skin/" + selectskin + ".zip "
}		
var JWEmbem += "});";		
var JWEmbem += "</script>";

What am I doing wrong? Thanks.


Code JavaScript:
 
    function ReturnPlayer() {
        var fileUrl = CKEDITOR.dialog.getCurrent().getContentElement('info', 'video_url').getValue();
		var previewUrl = CKEDITOR.dialog.getCurrent().getContentElement('info', 'preview_url').getValue();
        var width = CKEDITOR.dialog.getCurrent().getContentElement('info', 'width').getValue();
        var height = CKEDITOR.dialog.getCurrent().getContentElement('info', 'height').getValue();
        var auto = CKEDITOR.dialog.getCurrent().getContentElement('info', 'auto').getValue();
        var skin = '';
        var selectskin = CKEDITOR.dialog.getCurrent().getContentElement('info', 'skin').getValue();
        if (selectskin != 'default') {
            skin = "&skin=" + CKEDITOR.plugins.get('jwplayer').path + "jwplayer/skin/" + selectskin + ".zip "
        }
 
		var JWEmbem = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'" + " width='" + width + "' height='" + height + "'>" + " <param name='movie' value='" + JWplayer + "'>" + " <param name='allowfullscreen' value='true'>" + " <param name='allowscriptaccess' value='always'>" + " <param name='flashvars' value='file=" + fileUrl + "&autostart=" + auto + "'>";
 
		if (selectskin != 'default') {
            JWEmbem += "<param name='flashvars' value='" + skin + "'>"
        }
 
		var preview = '';
 
		if(previewUrl != ''){
		  preview = "&image=" + previewUrl;
		}
 
        JWEmbem += " <embed id='player1' name='player1'";
        JWEmbem += " width='" + width + "' height='" + height + "'" + " src='" + JWplayer + "' allowscriptaccess='always'" + " allowfullscreen='true' flashvars='file=" + fileUrl + preview + skin + "&autostart=" + auto + "'/>" + "</object>";
 
		return JWEmbem
    }