function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
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=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}


function insert(aTag, eTag, formname, elementname) {
	var input = document.forms[formname].elements['CMS_VAR['+elementname+']'];
	input.focus();

	/* für Internet Explorer */
	if(typeof document.selection != 'undefined') {
		/* Einfügen des Formatierungscodes */
		var range = document.selection.createRange();
		var insText = range.text;
		range.text = aTag + insText + eTag;

		/* Anpassen der Cursorposition */
		range = document.selection.createRange();

		if (insText.length == 0) {
			range.move('character', -eTag.length);
		}
		else {
			range.moveStart('character', aTag.length + insText.length + eTag.length);
		}

		range.select();
	}

	/* für neuere auf Gecko basierende Browser */
	else if(typeof input.selectionStart != 'undefined') {
		/* Einfügen des Formatierungscodes */
		var start = input.selectionStart;
		var end = input.selectionEnd;
		var insText = input.value.substring(start, end);
		input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);

		/* Anpassen der Cursorposition */
		var pos;

		if (insText.length == 0) {
			pos = start + aTag.length;
		}
		else {
			pos = start + aTag.length + insText.length + eTag.length;
		}

		input.selectionStart = pos;
		input.selectionEnd = pos;
	}

	/* für die übrigen Browser */
	else {
		/* Abfrage der Einfügeposition */
		var pos;
		var re = new RegExp('^[0-9]{0,3}$');

		while(!re.test(pos)) {
			pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
		}

		if(pos > input.value.length) {
			pos = input.value.length;
		}

		/* Einfügen des Formatierungscodes */
		var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
		input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
	}
}

function showlinklayer(showlayer, id) {
	document.getElementById("linkkein_"+id).style.visibility = "hidden";
	document.getElementById("linkintern_"+id).style.visibility = "hidden";
	document.getElementById("linkextern_"+id).style.visibility = "hidden";
	document.getElementById("linkpopup_"+id).style.visibility = "hidden";
	document.getElementById(showlayer).style.visibility = "visible";
}

function show_that(jname,jpos,jmark,jmax)
{
	//document.write("Name: "+jname+" POS: "+jpos+" Mark: "+jmark+" MAX: "+jmax);
	for(i=1;i<=jmax;i++)
	{document.getElementById(jname+"_"+jpos+"_"+i).style.display='none';}	
	document.getElementById(jname+"_"+jpos+"_"+jmark).style.display='';
}


function show_more_settings (id)
{
	document.getElementById('hiddn_'+id).style.display='';
	document.getElementById('c_lnk_'+id).style.display='';
	document.getElementById('o_lnk_'+id).style.display='none';
}

function show_less_settings (id)
{
	document.getElementById('hiddn_'+id).style.display='none';
	document.getElementById('c_lnk_'+id).style.display='none';
	document.getElementById('o_lnk_'+id).style.display='';
}

function menue(id)
{
	for(i=1;i<=5;i++)
	{
		document.getElementById('buta'+i).style.display='none';
		document.getElementById('buti'+i).style.display='';
		document.getElementById('men'+i).style.display='none';	
	}
	
	document.getElementById('buti'+id).style.display='none';
	document.getElementById('buta'+id).style.display='';
	document.getElementById('men'+id).style.display='';		
}

function execCommand (command) {
   if (document.execCommand) {
     if (a.P.contains(document.selection.createRange().parentElement()))
       document.execCommand(command);
   }
}

function changecolor(tablerowid, reset, restore_color)
{
	theCells = document.getElementById(tablerowid).getElementsByTagName('td');
	rowCellsCnt = theCells.length;

	for (c = 0; c < rowCellsCnt; c++)
	{
		if (reset == false)
		{
			theCells[c].style.backgroundColor = '#C6D6EA';
		}
		else
		{
			theCells[c].style.backgroundColor = restore_color;
		}
	}
}


