CKEDITOR.dialog.add('flv', function (editor) {

    var escape = function (value) {
        return value;
    };
    return {
        title: '插入Flv视频',
        resizable: CKEDITOR.DIALOG_RESIZE_BOTH,
        minWidth: 450,
        minHeight: 150,
        contents: [{
            id: 'info',
            label: '常规',
            accessKey: 'P',
            elements: [
                {
                    type: 'hbox',
                    widths: ['80%', '20%'],
                    children: [{
                        id: 'src',
                        type: 'text',
                        label: '源文件'
                    }, {
                        type: 'button',
                        id: 'browse',
                        filebrowser: 'info:src',
                        hidden: true,
                        align: 'center',
                        label: '浏览服务器',
                        style:'margin-top:-200px'
                    }]
                },
                {
                    type: 'hbox',
                    widths: ['35%', '35%', '30%'],
                    children: [{
                        type: 'text',
                        label: '视频宽度',
                        id: 'mywidth',
                        'default': '660px',
                        style: 'width:50px'
                    }, {
                        type: 'text',
                        label: '视频高度',
                        id: 'myheight',
                        'default': '400px',
                        style: 'width:50px'
                    }, {
                        type: 'select',
                        label: '自动播放',
                        id: 'myloop',
                        required: true,
                        'default': 'true',
                        items: [['是', 'true'], ['否', 'false']]
                    }]//children finish
                },
                {
                    type: 'hbox',
                    widths: ['100%'],
                    children: [{
                        type: 'text',
                        label: '支持格式：',
                        id: 'mywidth2',
                        'default': 'flv、mp4、swf、mp3、acc、jpg、png、gif',
                        style: 'margin-top:10px;'
                    }]//children finish
                }
                //, {
//type:　'textarea',
//style:　'width:100%;height:220px',
//label:　'预览',
//id:　'code'
//}
            ]
        }, {
            id: 'Upload',
            hidden: true,
            filebrowser: 'uploadButton',
            label: '上传',
            elements: [{
                type: 'file',
                id: 'upload',
                label: '上传',
                size: 38
            },
            {
                type: 'fileButton',
                id: 'uploadButton',
                label: '发送到服务器',
                filebrowser: 'info:src',
                'for': ['Upload', 'upload']//'page_id', 'element_id' 
            }]
        }],
        onOk: function () {
            mywidth = this.getValueOf('info', 'mywidth');
            myheight = this.getValueOf('info', 'myheight');
            myloop = this.getValueOf('info', 'myloop');
            mysrc = this.getValueOf('info', 'src');
            html = '' + escape(mysrc) + '';
            //editor.insertHtml("<pre　class=\"brush:"　+　lang　+　";\">"　+　html　+　"</pre>");
            editor.insertHtml("<embed height=" + myheight + " width=" + mywidth + " autostart=" + myloop + " flashvars=\"file=" + html + "\" allowfullscreen=\"true\" allowscriptaccess=\"always\" bgcolor=\"#ffffff\" src=\"/images/jwplayer.swf?autostart=" + myloop + "\"></embed>");
        },
        onLoad: function () {
        }
    };
});
