function setEditor(){
	for(var instanceName in CKEDITOR.instances) {
	  CKEDITOR.remove(CKEDITOR.instances[instanceName]);
	}
	$( 'textarea' ).ckeditor({toolbar :
        [
			['Source','-','TextColor','-','FontSize'],
			['Bold','Italic','Underline'],
			['NumberedList','BulletedList','-','Indent', 'Outdent'],
			['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
			['Paste','PasteText','PasteFromWord'],
			['Undo','Redo','-','Find','Replace'],
			['Link','Unlink','Table', 'Image', 'Flash']			
		],
		fontSize_sizes :'10/10px;11/11px;12/12px;14/14px;16/16px;',
		font_names :'Arial/Arial; Georgia/Georgia; Verdana/Verdana;',
		colorButton_colors: '667A97,FF0000,000000',
		colorButton_enableMore: false,
		resize_enabled: false,
		removePlugins: 'elementspath',
		scayt_autoStartup: false,
		enterMode : CKEDITOR.ENTER_DIV,
		forceEnterMode: true,
		filebrowserBrowseUrl : 'js/kcfinder/browse.php?type=files',
	       filebrowserImageBrowseUrl : 'js/kcfinder/browse.php?type=images',
   		filebrowserFlashBrowseUrl : 'js/kcfinder/browse.php?type=flash',
   		filebrowserUploadUrl : 'js/kcfinder/upload.php?type=files',
   		filebrowserImageUploadUrl : 'js/kcfinder/upload.php?type=images',
   		filebrowserFlashUploadUrl : 'js/kcfinder/upload.php?type=flash'
		}).data("ckeditor");
}
function carrega_imagem(s_url, s_imagem, s_link, d_show) {
    window.KCFinder = {};
    window.KCFinder.callBack = function(url) {
        window.KCFinder = null;
        $("#"+s_url).val(url);
		$("#"+s_imagem).attr('href',url).html(url.substr(url.lastIndexOf('/')+1));
		$("#"+s_link).hide();
		$("#"+d_show).show();
    };
	if (s_url == 'arquivo'){
		window.open('js/kcfinder/browse.php?type=files', 'kcfinder_single', 'width=700,height=500,toolbar=0,resizable=0');
	}else{
    	window.open('js/kcfinder/browse.php?type=images', 'kcfinder_single', 'width=700,height=500,toolbar=0,resizable=0');
	}
}
function resetConfiguracao(s_url, s_imagem, s_link, d_show){
	$("#"+s_url).val('');
	$("#"+s_imagem).attr('href','').html('');
	$("#"+s_link).show();
	$("#"+d_show).hide();
}
