function mceInit()
{
	$('#contenttext').tinymce({
		script_url : 'js/tinymce/jscripts/tiny_mce/tiny_mce.js',
		mode : "exact",
		language : 'de',
		theme : "advanced",
		entity_encoding : "named",
		width:560,
		height:300,
		force_br_newlines : true,
		force_p_newlines : false,
		plugins : "table, imagemanager",
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect,", 
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image, insertimage,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor,removeformat", 
		theme_advanced_buttons3 : "tablecontrols",
		theme_advanced_toolbar_location : "top", 
		theme_advanced_toolbar_align : "center", 
		theme_advanced_resizing : true,
		file_browser_callback : "mcImageManager.filebrowserCallBack",
		content_css : "css/mce.css",
	});
}

function toggleEditText(b)
{
	if(!isMceInit)
	{
		mceInit();
		isMceInit = true;	
	}	
	
	if(b)
	{
		
	}
	else
	{

	}	
	
	toggleEditor("contenttext");
}

function toggleEditor(id) 
{ 
	if (!tinyMCE.get(id))
		tinyMCE.execCommand('mceAddControl', false, id);
	else
	{
		tinyMCE.execCommand('mceRemoveControl', false, id); 
		if(site == "news" )
		{
			$("#news").html($("#contenttext").html());		
		}
	}

}

function saveText()
{

	$.post('php/save.php', { seite: seite, page:page, text: $("#contenttext").html()}, function(data)
	{
		window.location.href = window.location.href;
	});
	
}






