function doSection (section,chgif){
	if(section == "cats_data"){
		e = document.getElementsByTagName("DIV");
		s = document.getElementsByName(section);
		c = document.getElementsByName(chgif);
		if(document.getElementById("switchbutton").value == "Alle öffnen"){
			count = 0;
			for(var i=0;i<e.length;i++){
				if(e[i].className == "cat_data"){
					e[i].style.display="";
					c[count].src="/images/up.png";
					count++;
				}
			}
			document.getElementById("switchbutton").value="Alle schließen";
		}else{
			count = 0;
			for(var i=0;i<e.length;i++){
				if(e[i].className == "cat_data"){
					e[i].style.display="none";
					c[count].src="/images/down.png";
					count++;
				}
			}
			document.getElementById("switchbutton").value="Alle öffnen";
		}
		return false;
	}else{
		if (document.getElementById(section).style.display=="none"){
			document.getElementById(section).style.display="";document.getElementById(chgif).src="/images/up.png"
			document.getElementById(section).style.display=="none"
		}else{
			document.getElementById(section).style.display="none";document.getElementById(chgif).src="/images/down.png"}
		return false;				
	}		
}

function showOpt(visi)
{
	var tmp = document.getElementsByTagName('div');
	for (var i=0;i<tmp.length;i++)
	{
		if(tmp[i].className == 'fm-opt')
		{
			tmp[i].style.display = (tmp[i].style.display == 'block') ? 'none' : 'block';
		}
	}
	return false;
}

function targetnew(href)
{
	window.open(href);
	return false;
}
function popnew(href, windowname)
{
	if(windowname=='') {windowname='default'}
 	fenster = window.open(href, windowname, "width=800,height=600,status=no,scrollbars=yes,resizable=no");
	fenster.focus();
	return false;
}

function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}

function insert(aTag, eTag) {
  var input = document.forms['formular'].elements['text'];
  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 imgswap(img_id, to) {            
	 document.getElementById(img_id).src = to;     
}

function printimg(title,img){
	imagetoprint=window.open('','newwin');
	imagetoprint.document.write('<html><head><title>'+title+'</title></head><body onload="window.print();" ><img src="'+img+'" /></body></html>');
	imagetoprint.document.close();
}