function init_tinymce() {
	tinyMCE.init({
	mode : "textareas",
	editor_deselector : "norichtext",
	plugins : "preview",
	theme : "advanced",
	theme_advanced_buttons1 : "formatselect,bold,italic,underline,strikethrough,separator,forecolor,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,preview,code,ibrowser",
	theme_advanced_buttons2 :"",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "",
	theme_advanced_blockformats : "p,h1,h2,h3,h4,",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	content_css : "_templates/seminare_editor.css"
});
}

function redirect_new(msg, url) {
	if (msg != '')
		if ( !confirm(msg) ) return false;

	window.open(url);
}
function redirect_self(msg, url) {
	if (msg != '')
		if ( !confirm(msg) ) return false;

	self.location.href = url;
}

function edit_value(msg, value, link) {
	var new_value = prompt(msg, value);
	if(new_value == '') return false;
	
	self.location.href = link + '&value=' + new_value;
}

function open_popup (url,width,height) {
 fenster = window.open(url, url, "width="+width+",height="+height+",status=no,scrollbars=yes,resizable=yes");
 fenster.focus();
}

function page_jump (linkform, linkfield, link) {
	if (document.forms[linkform].elements[linkfield].value != '') {
		document.location.href = link;
		return true;
	} else {
		return false;
	}
}

function switchDisplay(id) {
	
	
	if (tinyMCE.getInstanceById(id) == null)
		tinyMCE.execCommand('mceAddControl', false, id);
	else
		tinyMCE.execCommand('mceRemoveControl', false, id);
		
	state = (document.getElementById(id).style.display == 'block') ? 'none' : 'block';
	document.getElementById(id).style.display = state;
}

function toggleDisplay(nr)
{
	if (document.layers)
	{
		current = (document.layers[nr].display == 'none') ? 'block' : 'none';
		document.layers[nr].display = current;
	}
	else if (document.all)
	{
		current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
		document.all[nr].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
		document.getElementById(nr).style.display = vista;
	}
}

function findObject(n, d) {
	var p,i,x;  
	if(!d) 
		d=document; 
	if((p=n.indexOf("?")) > 0 && parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
  	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=findObject(n,d.layers[i].document);
  	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

function changeProp(objName,theProp,theValue) {
	var obj = findObject(objName);
	if (obj && (theProp.indexOf("style.")==-1 || obj.style)) {
		if (theValue == true || theValue == false)
			eval("obj."+theProp+"="+theValue);
		else 
			eval("obj."+theProp+"='"+theValue+"'");
  	}
}
