function insert_eins(aTag, eTag) {
  var input = document.forms['formtext1'].elements['inhalt_1'];
  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);
  }
  achtung_eins(3);
}

function insert_zwei(aTag, eTag) {
  var input = document.forms['formtext2'].elements['inhalt_2'];
  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);
  }
  achtung_zwei(3);
}


function aendern_eins(zustand, nummer){
	if(zustand=="on")
	   {
	   if(nummer==1){ document.all.icon1.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "Fett markieren"; }
	   if(nummer==2){ document.all.icon2.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "Unterstrichen markieren"; }
	   if(nummer==3){ document.all.icon3.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "Kursiv markieren"; }
	   if(nummer==4){ document.all.icon4.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "Formatierter Text"; }
	   if(nummer==5){ document.all.icon5.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "[*] für jede neue Zeile als Aufzählung"; }
	   if(nummer==6){ document.all.icon6.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "sehr grossse Überschrift"; }
	   if(nummer==7){ document.all.icon7.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "grosse Überschrift"; }
	   if(nummer==8){ document.all.icon8.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "Bild aus dem Web einfügen"; }
	   if(nummer==9){ document.all.icon9.style.backgroundColor = "yellow";document.all.infofeld_eins.value = "externen Link einfügen"; }
	   if(nummer==10){ document.all.icon10.style.backgroundColor = "yellow";document.all.infofeld_eins.value ="Link zur eigenen Seite"; }
	   }
	else{
		 if(nummer==1){ document.all.icon1.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==2){ document.all.icon2.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==3){ document.all.icon3.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==4){ document.all.icon4.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==5){ document.all.icon5.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==6){ document.all.icon6.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==7){ document.all.icon7.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==8){ document.all.icon8.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==9){ document.all.icon9.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	   if(nummer==10){ document.all.icon10.style.backgroundColor = "white";document.all.infofeld_eins.value = ""; }
	}
	
	  
}


function aendern_zwei(zustand, nummer){
	if(zustand=="on")
	   {
	   if(nummer==1){ document.all.zwei_icon1.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "Fett markieren"; }
	   if(nummer==2){ document.all.zwei_icon2.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "Unterstrichen markieren"; }
	   if(nummer==3){ document.all.zwei_icon3.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "Kursiv markieren"; }
	   if(nummer==4){ document.all.zwei_icon4.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "Formatierter Text"; }
	   if(nummer==5){ document.all.zwei_icon5.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "[*] für jede neue Zeile als Aufzählung"; }
	   if(nummer==6){ document.all.zwei_icon6.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "sehr grossse Überschrift"; }
	   if(nummer==7){ document.all.zwei_icon7.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "grosse Überschrift"; }
	   if(nummer==8){ document.all.zwei_icon8.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "Bild aus dem Web einfügen"; }
	   if(nummer==9){ document.all.zwei_icon9.style.backgroundColor = "yellow";document.all.infofeld_zwei.value = "externen Link einfügen"; }
	   if(nummer==10){ document.all.zwei_icon10.style.backgroundColor = "yellow";document.all.infofeld_zwei.value ="Link zur eigenen Seite"; }
	   }
	else{
		 if(nummer==1){ document.all.zwei_icon1.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==2){ document.all.zwei_icon2.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==3){ document.all.zwei_icon3.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==4){ document.all.zwei_icon4.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==5){ document.all.zwei_icon5.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==6){ document.all.zwei_icon6.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==7){ document.all.zwei_icon7.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==8){ document.all.zwei_icon8.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==9){ document.all.zwei_icon9.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	   if(nummer==10){ document.all.zwei_icon10.style.backgroundColor = "white";document.all.infofeld_zwei.value = ""; }
	}
	
	  
}




function achtung_eins(wert) {

if(wert==1 || wert==3) 
 {
  if (document.all)
      document.all.aendern_eins.style.backgroundColor = "red";


   else document.getElementById("aendern_eins").style.backgroundColor = "red";
    
 }

}


function achtung_zwei(wert) {

if(wert==1 || wert==3) 
 {
  if (document.all)
      document.all.aendern_zwei.style.backgroundColor = "red";


   else document.getElementById("aendern_zwei").style.backgroundColor = "red";
    
 }

}
