function ImageCenter(url){
    this.url = url;
    if($("#imagecenter").length == 0){
        $("body").append("<div id='imagecenter' ><iframe id='imagecenter_iframe' src='"+this.url+"' frameborder='0' style='width:100%;height:100%; border:0px;'></iframe></div>")
        $("#imagecenter").dialog({
            autoOpen : false
        });
    }
    this.obj = $("#imagecenter");
    this.open = function() {        
        $('#imagecenter').dialog('option','width', 800 );
        $('#imagecenter').dialog('option','height', 450 );
        $('#imagecenter').dialog('option', 'title', "ImageCenter");
        $("#imagecenter").dialog("open");
    };
}

function AddImage(url,width_value)
{   
    var editor;
    editor = tinyMCE.get("tiny_mce");
    
    if(!editor) return;
    
    editor.dom.add(editor.getBody(), 'img', {
                style : {
                    
                },
                'width' : width_value,
                'class' : '',
                'src' : url
            }, "");
    editor.dom.add(editor.getBody(), 'p', {
                style : {
                    
                },
                'class' : ''
            }, "<br>");
    editor.dom.add(editor.getBody(), 'p', {
                style : {
                    
                },
                'class' : ''
            }, "<br>");
    //tinyMCE.get('tiny_mce').append("<p>Test</p>");
    //$("#return_tinymce").append("<p>Test</p>");
    //alert(url);
}
