<script type="text/javascript" src="http://{$smarty.server.HTTP_HOST}/skins/default/tiny_mce/tiny_mce_gzip.js"></script>
<script type="text/javascript">

function mce_init()
{
	if (typeof tinyMCE=="object") tinyMCE.execCommand('mceToggleEditor',false,'{$field}');
	else{
	tinyMCE_GZ.init({
		themes : "advanced",
		plugins : "safari,table,advimage,advlink,inlinepopups,preview,media,contextmenu,paste,template",
		languages : "ru",
		disk_cache : true
	}, function() {
		tinyMCE.init({
				remove_script_host : true,
				document_base_url : "/",
				mode : "exact",
				elements : "{$field}",
				theme : "advanced",
				document_base_url : "/",
				language : "ru",
				content_css : "{foreach $css as $item}{$item.path}{if !$item@last},{/if}{/foreach}",
				plugins : "safari,table,advimage,advlink,inlinepopups,preview,media,contextmenu,paste,template",
				theme_advanced_buttons1_add_before : "newdocument,separator",
				theme_advanced_buttons1_add : "fontsizeselect",
				theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
				theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,",
				theme_advanced_buttons3_add_before : "tablecontrols,separator",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				extended_valid_elements : "hr[class|width|size|noshade]",
				file_browser_callback : "tinyBrowser",
				paste_use_dialog : false,
				theme_advanced_resizing : true,
				theme_advanced_resize_horizontal : true,
				apply_source_formatting : true,
				force_br_newlines : false,
				forced_root_block : '', // Needed for 3.x
				force_p_newlines : true,	
				relative_urls : false,
				theme_advanced_statusbar_location:"bottom"
		});
	});
}
}
	
 function tinyBrowser (field_name, url, type, win) {
    var cmsURL = "/skins/default/tiny_mce/plugins/tinybrowser/tinybrowser.php";
    if (cmsURL.indexOf("?") < 0) {
        //add the type as the only query parameter
        cmsURL = cmsURL + "?type=" + type;
    }
    else {
        //add the type as an additional query parameter
        // (PHP session ID is now included if there is one at all)
        cmsURL = cmsURL + '&'+'type=' + type;
    }

    tinyMCE.activeEditor.windowManager.open({
        file : cmsURL,
        title : 'Tiny Browser',
        width : 770, 
        height : 480,
        resizable : "yes",
		  scrollbars : "yes",
        inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
        close_previous : "no"
    }, {
        window : win,
        input : field_name
    });
    return false;
  }
	
	</script>
	<div style="margin:10px 0px; cursor:pointer"><a href="javascript:mce_init();">[Включить/выключить панель визуального редактирования]</a></div>