var theNumOfWords = 0;var theNumOfAskWords = 0;function AddWord(){	var theForm = self.document.Eingabe;		if ((theForm.Wort == '')||(theForm.Genitiv.value == '')||(theForm.Uebersetzung.value == ''))	{		alert('Sie muessen alle Felder fuellen, bevor das Wort hinzugefuegt werden darf!');		return;	}	// if	theForm.WortFeld.value += '<param name="wort'+theNumOfWords++ +'" value="' +theForm.Wort.value+','+theForm.Genitiv.value+','+theForm.Genus.options[theForm.Genus.selectedIndex].value+','+ theForm.Deklination.options[theForm.Deklination.selectedIndex].value+','+ theForm.Uebersetzung.value+'" />\n';	theForm.Wort.value = '';	theForm.Genitiv.value = '';	theForm.Uebersetzung.value = '';}	// AddWordfunction GetAskWord(){	var theForm =  self.document.Eingabe;	var theAskWord = theForm.AskWord.value;	var theIndex = theForm.WortFeld.value.indexOf(theAskWord);	if (theIndex != -1)	{		for (i = theIndex-1;i>0;i--)		{			if (theForm.WortFeld.value.charAt(i) == "t")				break;		}	// for		theFirstIndex = i+1;		for (i=theFirstIndex;i<theIndex;i++)		{			if (theForm.WortFeld.value.charAt(i) == '"')				break;		}	// for		theLastIndex = i;		return theForm.WortFeld.value.substring(theFirstIndex,theLastIndex);	}	// if	else return -1;}	// GetAskWordfunction AddAskWord(){	var theForm = self.document.Eingabe;			var theAskWord = GetAskWord();	if (theAskWord < 0)	{		alert('Das Wort "' + theForm.AskWord.value + '" befindet sich nicht in der Woerterliste!\nEs kann daher nicht in die Aufgaben uebernommen werden!');		return;	}	// if	theForm.AskWortFeld.value += '<param name="ask'+theNumOfAskWords++ +'" value="' +theAskWord+','+theForm.AskKasus.options[theForm.AskKasus.selectedIndex].value+','+theForm.AskNumerus.options[theForm.AskNumerus.selectedIndex].value+','+ theForm.AskGenus.options[theForm.AskGenus.selectedIndex].value+','+theForm.AskDir.options[theForm.AskDir.selectedIndex].value+'" />\n';}	// AddAskWordfunction GetParams(){	var theForm = self.document.Eingabe;	var theText;	var theKasus;	theKasus = (theForm.nom.checked?'nom,':'')+(theForm.akk.checked?'akk,':'')+ (theForm.gen.checked?'gen,':'')+(theForm.dat.checked?'dat,':'') +(theForm.abl.checked?'abl,':'') +(theForm.vok.checked?'vok':'');	if (theKasus.charAt(theKasus.length-1) == ',')		theKasus = theKasus.substring(0,theKasus.length-1);	if (theKasus == '')	{		alert('Sie muessen mindestens einen Kasus auswaehlen!');		return '';	}	// if	theText = '<param name="short" value="' + theForm.Short.options[theForm.Short.selectedIndex].value + '" />\n';	theText += '<param name="modus" value="' + theForm.Modus.options[theForm.Modus.selectedIndex].value + '" />\n';	theText += '<param name="casus" value="'+theKasus+'" />\n';	 	theText += (theForm.esis.checked?'<param name="esis" value="on" />\n':'');		if (theForm.ziel.checked)	{		if ((theForm.minpercents.value < 1)||(theForm.minpercents.value > 101))		{			alert('Sie muessen bei den Prozenten eine Zahl zwischen 1 und 100 eingeben!');			return '';		}	// if		if (theForm.minexercices.value < 1)		{			alert('Sie muessen mindestens 1 Form als Ziel definieren!');			return '';		}	// if		theText += '<param name="ziel" value="' + theForm.minexercices.value + ',' + theForm.minpercents.value + '" />\n';	}	// if	return theText;}	// GetParamsfunction Get2000Year(theDate){	var theYear = theDate.getYear();		if (theYear < 1000)		theYear += 1900;			return theYear;}	// Get2000Yearfunction GetFooter(){	var theDate = new Date();	var theForm = self.document.Eingabe;	return '<hr /><p>Um die &Uuml;bung zu beenden, schliessen Sie bitte das Fenster.</p><hr /><p>Letzte &Auml;nderung: ' +theDate.getDate()+'.'+(1+theDate.getMonth())+'.'+Get2000Year(theDate)+ '</p>';}	// GetFooterfunction GetPrintData(){	var theForm = self.document.Eingabe;	var displayNumOfSolutions = theForm.displayNumOfSolutions.checked;	var useItalic = theForm.useItalic.checked;		var theText = "";		if (!((theForm.usePrint.checked)||(theForm.useFalsePrint.checked)||(theForm.useRandomPrint.checked)))		return theText;			theText = 	"<script language='JavaScript'>\n"+				"<!--\n";	// LiveConnect testen	theText += "var isLiveConnect;\n\n";	theText += "function TestLiveConnect()\n";	theText += "{\n";	theText += "isLiveConnect = false;\n";	theText += "try\n";	theText += "{\n";	theText += "document.Exercitium.GetRandomWord();\n";	theText += "}\n";	theText += "catch (error)\n";	theText += "{\n";	theText += "document.getElementById(999).innerHTML = \"\";\n";	theText += "return;\n";	theText += "}\n";	theText += "isLiveConnect = true;\n";	theText += "}\n";		if ((theForm.usePrint.checked)||(theForm.useFalsePrint.checked))	{				theText +=	"function PrintExercice(onlyFalse)\n" +					"{\n";		theText += "if (!isLiveConnect)\n" +					"{\n" +					"alert('Ihr Browser unterstuetzt die Verbindung zum Java-Applet nicht. Diese Funktion steht daher nicht zur Verfuegung.');\n" +					"return;\n" +					"}	// if\n";		theText +=		"var theNumOfExercices = -1;\n" +						"var theIndex = 1;\n" +						"var theText;\n" +								"if (onlyFalse)\n" +							"theNumOfExercices = document.Exercitium.GetNumOfRandomExercices();\n" +						"if (theNumOfExercices < 0)\n" +							"theNumOfExercices = document.Exercitium.GetNumOfExercices();\n" +								"var theDocument='<html><head><title>' + document.title + '</title></head><body>' + '<h1>' + document.title + '</h1><h3>Aufgaben</h3><p>';\n" +						"for (i=0;i<theNumOfExercices;i++)\n" +						"{\n" +							"theText = onlyFalse?document.Exercitium.GetFalseExercice(i,"+displayNumOfSolutions+","+useItalic+"):document.Exercitium.GetExercice(i,"+displayNumOfSolutions+","+useItalic+");\n" +										"if (theText != '')\n" +								"theDocument += (theIndex++) +'. ' + theText + '<br />';\n" +						"}	// for\n" +										"theDocument += '</p><hr /><h3>L&ouml;sungen</h3><p>';\n" +								"theIndex = 1;\n" +						"for (i=0;i<theNumOfExercices;i++)\n" +						"{\n" +							"theText = onlyFalse?document.Exercitium.GetFalseSolution(i,"+useItalic+"):document.Exercitium.GetSolution(i,"+useItalic+");\n" +									"if (theText != '')\n" +							"theDocument += (theIndex++) +'. ' + theText + '<br />';\n" +						"}	// for\n" +									"theDocument += '</p><hr /><div style="+'"text-align: right;"'+">&copy; by L. Hartmann, Hinwil 2006</div></body></html>';\n" +								"var theWindow = self.open('','Neues_Dokument');\n" +						"theWindow.document.write(theDocument);\n" +						"theWindow.document.close();\n" +							"}	// PrintExercice\n";	}	// if			if (theForm.useRandomPrint.checked)	{		theText += 	"function PrintRandomExercice()\n" +					"{\n";		theText += "if (!isLiveConnect)\n" +					"{\n" +					"alert('Ihr Browser unterstuetzt die Verbindung zum Java-Applet nicht. Diese Funktion steht daher nicht zur Verfuegung.');\n" +					"return;\n" +					"}	// if\n";		theText +=	"var theTempNumOfExercices = prompt('Bitte geben Sie die Anzahl Aufgaben ein!','20');\n" +							"if (theTempNumOfExercices == null)\n" +						"return;\n" + 							"var theNumOfExercices = parseInt(theTempNumOfExercices);\n" + 							"if (theNumOfExercices == NaN)\n" + 						"return;\n" +							"var theDocument = '<html><head><title>' + document.title + '</title></head><body>' + '<h1>' + document.title + '</h1><h3>Aufgaben</h3><p>';\n" +							"var theWords = new Array(theNumOfExercices);\n" +					"var theCNGs = new Array(theNumOfExercices);\n" +													"for (i=1;i<=theNumOfExercices;i++)\n" +					"{\n" +						"theWords[i-1] = document.Exercitium.GetRandomWord();\n" +						"theCNGs[i-1] = document.Exercitium.GetRandomForm(theWords[i-1]);\n" +						"theDocument += i+'. '+document.Exercitium.GetRandomExercice(theWords[i-1], theCNGs[i-1],"+displayNumOfSolutions+","+useItalic+") + '<br />';\n" +					"}	// for\n" +							"theDocument += '</p><hr /><h3>L&ouml;sungen</h3><p>';\n" +							"for (i=1;i<=theNumOfExercices;i++)\n" +						"theDocument += i+'. '+document.Exercitium.GetRandomSolution(theWords[i-1], theCNGs[i-1],"+useItalic+") + '<br />';\n" +								"theDocument += '</p><hr /><div style="+'"text-align: right;"'+">&copy; by L. Hartmann, Hinwil 2006</div></body></html>';\n" +							"var theWindow = self.open('','Neues_Dokument');\n" +					"theWindow.document.write(theDocument);\n" +					"theWindow.document.close();\n" +						"}	// PrintRandomExercice\n";	}	// if		theText += "document.write('<div id=\"999\" style=\"margin-top: 1em;\"><form>');\n";	if (theForm.usePrint.checked)		theText += "document.write('"+'<input type="button" value="&Uuml;bung drucken..." onClick="PrintExercice(false)" />'+" ');\n";	if (theForm.useFalsePrint.checked)		theText += "document.write('" +'<input type="button" value="Falsche drucken..." onClick="PrintExercice(true)" />'+" ');\n";	if (theForm.useRandomPrint.checked)		theText += "document.write('" +'<input type="button" value="Zuf&auml;llige &Uuml;bung drucken..." onClick="PrintRandomExercice()" />'+"');\n";	theText += "document.write('</form> <span style=\"font-size: 0.8em;\">(funktioniert nur mit \"LiveConnect\")</span></div>');\n" +			"// -->\n" +			"</" + "script>\n\n<hr />\n";	return theText;}	// GetPrintDatafunction CreateFile(){	var theForm = self.document.Eingabe;	var theParams = GetParams();	if (theParams == '')		return;		var theTitle = theForm.Titel.value;		if (theTitle == '')		theTitle = 'Exercitium-&Uuml;bung';	var theText = '<html><head><title>'+theTitle+'</title></head><body style="background-color: white;" onload="TestLiveConnect();"><h1>'+theTitle+'</h1><hr />'+ GetPrintData() +	'<applet name="Exercitium" code="Exercitium.class" alt="Exercitium (Java-Applet)" width="473" height="289" archive="'+theForm.javaurl.value+'Exercitium.jar">\n'+	theForm.WortFeld.value+'\n' +	theForm.AskWortFeld.value+'\n' +	theParams+'\nDas Applet "Exercitium" funktioniert nur, wenn Ihr Browser Java unterst&uuml;tzt.</applet>\n' +	'<p style="text-align: right; font-size: 0.8em;">&copy; by L. Hartmann, Hinwil 2006</p>'+	GetFooter()+'\n</body></html>';		var theWindow = self.open("","Neues_Dokument2");	theWindow.document.write(theText);	theWindow.document.close();}	// CreateFile