// JavaScript Document
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
  // alert(retValue);
   return retValue; // Return the trimmed string back to the user
}
var cnt = 0;
var arr_uebung_01 = new Array(
                                "das","das","das","der","die",
                                "der","der","das","das","die",
                                "die","der","der","die","die"
                              );

function Ergebnis_uebung_01(){
	cnt = 0;
	//alert(cnt +arr_uebung_01.length );
	for(i = 0,cnt=1;i<arr_uebung_01.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_01[i] + txtTrimedString)
		 if(arr_uebung_01[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
	
}
function Loesung_uebung_01(){
	
	for(i = 0,cnt=1;i<arr_uebung_01.length;i++){
		//alert('i :- '+i+'\ncnt :- '+cnt);
		if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  			 document.getElementById(cnt).value = arr_uebung_01[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		}
		 cnt = cnt + 1;
	}
	cnt = 0;
}
var arr_uebung_02 = new Array(
                              //Aufgabe 4
                              "die","der","der","die","die"                              
                              );

function Ergebnis_uebung_02(){
	cnt = 0;
	for(i = 0,cnt=16;i<arr_uebung_02.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_02[i] + txtTrimedString)
		 if(arr_uebung_02[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_02(){
	
	cnt = 0;
	
	for(i = 0,cnt=16;i<arr_uebung_02.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_02[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}
var arr_uebung_03 = new Array(
                              //Aufgabe 5 Gemüse
                              "die","die","der","die","der",
                              "die","die","die","die","der",
                              "der","der","die","der","die",
                              "der","die","die"
                              );

function Ergebnis_uebung_03(){
	cnt = 0;
	for(i = 0,cnt=21;i<arr_uebung_03.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_03[i] + txtTrimedString)
		 if(arr_uebung_03[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_03(){
	
	cnt = 0;
	
	for(i = 0,cnt=21;i<arr_uebung_03.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_03[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_04 = new Array(
                              //Aufgabe 9 Obst
                              "der","die","die","die","die",
                              "die","die","die","die","die",
                              "der","die"
                              );

function Ergebnis_uebung_04(){
	cnt = 0;
	for(i = 0,cnt=39;i<arr_uebung_04.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_04[i] + txtTrimedString)
		 if(arr_uebung_04[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_04(){
	
	cnt = 0;
	
	for(i = 0,cnt=39;i<arr_uebung_04.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_04[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_05 = new Array(
                              //Aufgabe 12 Beeren
                              "die","die","die","die","die",
                              "die","die"
                              );

function Ergebnis_uebung_05(){
	cnt = 0;
	for(i = 0,cnt=51;i<arr_uebung_05.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_05[i] + txtTrimedString)
		 if(arr_uebung_05[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_05(){
	
	cnt = 0;
	
	for(i = 0,cnt=51;i<arr_uebung_05.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_05[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_06 = new Array(
                              //Aufgabe 14 Salate
                              "der","der","der","der","der"
                              );

function Ergebnis_uebung_06(){
	cnt = 0;
	for(i = 0,cnt=58;i<arr_uebung_06.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_06[i] + txtTrimedString)
		 if(arr_uebung_06[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_06(){
	
	cnt = 0;
	
	for(i = 0,cnt=58;i<arr_uebung_06.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_06[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_07 = new Array(
                              //Aufgabe 15 Fleisch
                              "der","die","das","das","das",
                              "das","das","das"
                              );

function Ergebnis_uebung_07(){
	cnt = 0;
	for(i = 0,cnt=63;i<arr_uebung_07.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_07[i] + txtTrimedString)
		 if(arr_uebung_07[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_07(){
	
	cnt = 0;
	
	for(i = 0,cnt=63;i<arr_uebung_07.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_07[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_08 = new Array(
                              //Aufgabe 17 Fisch
                              "der","der","die","der","der"
                              );

function Ergebnis_uebung_08(){
	cnt = 0;
	for(i = 0,cnt=71;i<arr_uebung_08.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_08[i] + txtTrimedString)
		 if(arr_uebung_08[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_08(){
	
	cnt = 0;
	
	for(i = 0,cnt=71;i<arr_uebung_08.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_08[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_09 = new Array(
                              //Aufgabe 18 Wurstwaren
                              "die","die","die","der","die"
                              );

function Ergebnis_uebung_09(){
	cnt = 0;
	for(i = 0,cnt=76;i<arr_uebung_09.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_09[i] + txtTrimedString)
		 if(arr_uebung_09[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_09(){
	
	cnt = 0;
	
	for(i = 0,cnt=76;i<arr_uebung_09.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_09[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_10 = new Array(
                              //Aufgabe 19 Gewürze
                              "die","die","der","das","der"
                              );

function Ergebnis_uebung_10(){
	cnt = 0;
	for(i = 0,cnt=81;i<arr_uebung_10.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_10[i] + txtTrimedString)
		 if(arr_uebung_10[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_10(){
	
	cnt = 0;
	
	for(i = 0,cnt=81;i<arr_uebung_10.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_10[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_11 = new Array(
                              //Aufgabe 20 Süßwaren
                              "das","der","das","die","die"
                              );

function Ergebnis_uebung_11(){
	cnt = 0;
	for(i = 0,cnt=86;i<arr_uebung_11.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_11[i] + txtTrimedString)
		 if(arr_uebung_11[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_11(){
	
	cnt = 0;
	
	for(i = 0,cnt=86;i<arr_uebung_11.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_11[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}

var arr_uebung_12 = new Array(
                              //Aufgabe 21 Getränke
                               "das","die","der","der","die",
                               "die","der","das","der","der"
                              );

function Ergebnis_uebung_12(){
	cnt = 0;
	for(i = 0,cnt=91;i<arr_uebung_12.length;i++){
		 var txtVal = document.getElementById(cnt).value;
		 
		 var txtTrimedString = trim(txtVal);
		// alert(arr_uebung_12[i] + txtTrimedString)
		 if(arr_uebung_12[i] == txtTrimedString)
		   document.getElementById(cnt).style.backgroundColor = "#66FF33";
		 else
		   document.getElementById(cnt).style.backgroundColor = "#ff0033";
		   cnt = cnt + 1;
	}
}
function Loesung_uebung_12(){
	
	cnt = 0;
	
	for(i = 0,cnt=91;i<arr_uebung_12.length;i++){
		//alert(document.getElementById(cnt).style.backgroundColor);
         if((document.getElementById(cnt).style.backgroundColor == 'rgb(255, 0, 51)'||document.getElementById(cnt).style.backgroundColor == '')||document.getElementById(cnt).style.backgroundColor == '#ff0033'||document.getElementById(cnt).style.backgroundColor == '' ){
  		     document.getElementById(cnt).value = arr_uebung_12[i];
			 document.getElementById(cnt).style.backgroundColor = "#CCCCCC";
		 }
		 cnt = cnt + 1;
	}
}





