var theNumOfWords = 0;var theNumOfAskWords = 0;function AddWord(){	var theForm = self.document.Eingabe;		if ((theForm.Wort == '')||(theForm.Sing.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.Sing.value+','+((theForm.Perf.value=="")?"-":theForm.Perf.value)+','+((theForm.PVP.value=="")?"-":theForm.PVP.value)+','+theForm.Konjugation.options[theForm.Konjugation.selectedIndex].value+','+(theForm.deponens.checked?'d':(theForm.intransitiv.checked?'i':'t'))+','+ theForm.Uebersetzung.value+'" />\n';	theForm.Wort.value = '';	theForm.Sing.value = '';	theForm.Perf.value = '';	theForm.PVP.value = '';	theForm.Uebersetzung.value = '';	theForm.intransitiv.checked = false;	theForm.deponens.checked = false;}	// 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 thePerson, theModus, theTempus, theGenus;			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	thePerson = theForm.AskPerson.options[theForm.AskPerson.selectedIndex].value;	theTempus = theForm.AskTempus.options[theForm.AskTempus.selectedIndex].value;	theModus = theForm.AskModus.options[theForm.AskModus.selectedIndex].value;	theGenus = theForm.AskGenus.options[theForm.AskGenus.selectedIndex].value;		if ((theModus == 'konj') &&((theTempus == 'fut')||(theTempus == 'perffut')))	{		alert('Es gibt keinen Konjunktiv Futur (bzw. Perfektfutur)!');		return;	}	// if		if ((theModus == 'imper') &&((thePerson != '2')||(theTempus != 'praes')||(theGenus != 'akt')))	{		alert('Der Imperativ kommt nur in der 2. Sg. oder Pl. des Praesens aktiv vor!');		return;	}	// if			theForm.AskWortFeld.value += '<param name="ask'+theNumOfAskWords++ +'" value="' +theAskWord+','+thePerson+','+theForm.AskNumerus.options[theForm.AskNumerus.selectedIndex].value+','+ theModus+','+ theTempus+','+ theGenus+','+theForm.AskDir.options[theForm.AskDir.selectedIndex].value+'" />\n';}	// AddAskWordfunction GetWeights(){	var theForm = self.document.Eingabe;		if ((!theForm.praes.checked && (parseInt(theForm.praesens.value) != 0))||		(!theForm.impf.checked && (parseInt(theForm.imperfekt.value) != 0))||		(!theForm.perf.checked && (parseInt(theForm.perfekt.value) != 0))||		(!theForm.perffut.checked && (parseInt(theForm.perfektfutur.value) != 0))||		(!theForm.plqpf.checked && (parseInt(theForm.plusquamperfekt.value) != 0))||		(!theForm.fut.checked && (parseInt(theForm.futur.value) != 0)))	{		alert('Sie haben Tempora fuer die gewichtete Abfrage verwendet, die Sie sonst nicht ausgewaehlt haben!');		return -1;	}	// if		if ((!theForm.ind.checked && (parseInt(theForm.indikativ.value) != 0))||		(!theForm.konj.checked && (parseInt(theForm.konjunktiv.value) != 0))||		(!theForm.imper.checked && (parseInt(theForm.imperativ.value) != 0)))	{		alert('Sie haben Modi fuer die gewichtete Abfrage verwendet, die Sie sonst nicht ausgewaehlt haben!');		return -1;		}	// if	if ((!theForm.akt.checked && (parseInt(theForm.aktiv.value) != 0))||		(!theForm.mediopass.checked && (parseInt(theForm.mediopassiv.value) != 0)))	{		alert('Sie haben ein Genus verbi fuer die gewichtete Abfrage verwendet, das Sie sonst nicht ausgewaehlt haben!');		return -1;		}	// if			if (parseInt(theForm.praesens.value) + parseInt(theForm.imperfekt.value) + parseInt(theForm.futur.value) + parseInt(theForm.perfekt.value) + parseInt(theForm.plusquamperfekt.value) + parseInt(theForm.perfektfutur.value) != 100)	{		alert('Die Prozentzahlen fuer Tempora muessen zusammen 100 ergeben!');		return -1;	}	// if		if (parseInt(theForm.indikativ.value) + parseInt(theForm.konjunktiv.value) + parseInt(theForm.imperativ.value) != 100)	{		alert('Die Prozentzahlen fuer Modi muessen zusammen 100 ergeben!');		return -1;	}	// if		if (parseInt(theForm.aktiv.value) + parseInt(theForm.mediopassiv.value) != 100)	{		alert('Die Prozentzahlen fuer Genera muessen zusammen 100 ergeben!');		return -1;	}	// if		return '<param name="tempora" value="' + parseInt(theForm.praesens.value) + ','+ parseInt(theForm.imperfekt.value) + ',' + parseInt(theForm.futur.value) + ',' + parseInt(theForm.perfekt.value) + ',' + parseInt(theForm.plusquamperfekt.value) + ',' + parseInt(theForm.perfektfutur.value) + '" />\n<param name="modi" value="' + parseInt(theForm.indikativ.value) + ',' + parseInt(theForm.konjunktiv.value) + ',' + parseInt(theForm.imperativ.value) + '" />\n<param name="genera" value="' + parseInt(theForm.aktiv.value) + ',' + parseInt(theForm.mediopassiv.value) + '" />';}	// GetWeightsfunction GetParams(){	var theForm = self.document.Eingabe;	var theText;	var theFormen, theTempus, theModus, theGenus;	theFormen = (theForm.Pers.checked?'3. Pers,':'');		theTempus = (theForm.praes.checked?'praes,':'')+(theForm.impf.checked?'impf,':'')+ (theForm.fut.checked?'fut,':'')+(theForm.perf.checked?'perf,':'') +(theForm.plqpf.checked?'plqpf,':'') +(theForm.perffut.checked?'perffut,':'');	if (theTempus == '')	{		alert('Sie muessen mindestens ein Tempus auswaehlen!');		return '';	}	// if	theModus = (theForm.ind.checked?'ind,':'')+(theForm.konj.checked?'konj,':'')+ (theForm.imper.checked?'imper,':'');	if (theModus == '')	{		alert('Sie muessen mindestens einen Modus auswaehlen!');		return '';	}	// if	theGenus = (theForm.akt.checked?'akt,':'')+(theForm.mediopass.checked?'mediopass,':'');	if (theGenus == '')	{		alert('Sie muessen mindestens ein Genus verbi auswaehlen!');		return '';	}	// if		if (((theForm.imper.checked) && (!theForm.ind.checked) && (!theForm.konj.checked))&& ((!theForm.akt.checked)||(!theForm.praes.checked)||(theForm.Pers.checked)))	{		alert('Sie koennen den Modus "Imperativ" nur verwenden, wenn gleichzeitig "Praesens" und "Aktiv" eingestellt und die "3. Person" nicht eingestellt sind!');		return '';	}	// if			theFormen += theTempus + theModus + theGenus;	if (theFormen.charAt(theFormen.length-1) == ',')		theFormen = theFormen.substring(0,theFormen.length-1);	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="formen" value="'+theFormen+'" />\n';	 	 if (theForm.useWeights.checked)	 {	 	var theWeights;	 		 	theWeights = GetWeights();	 		 	if (theWeights == -1)	 		return '';	 			 	theText += theWeights;	 }	// if	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	theText += '<param name="book" value="' + theForm.book.value + '" />\n';	theText += '<param name="lesson" value="' + theForm.lesson.value + '" />\n';	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.Verba.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.Verba.GetNumOfRandomExercices();\n" +						"if (theNumOfExercices < 0)\n" +							"theNumOfExercices = document.Verba.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.Verba.GetFalseExercice(i,"+displayNumOfSolutions+","+useItalic+"):document.Verba.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.Verba.GetFalseSolution(i,"+useItalic+"):document.Verba.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.Verba.GetRandomWord();\n" +						"theCNGs[i-1] = document.Verba.GetRandomAsk(theWords[i-1]);\n" +						"theDocument += i+'. '+document.Verba.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.Verba.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 = 'Verba-&Uuml;bung';	var theText = '<html><head><title>'+theTitle+'</title></head><body style="background-color: white;" onload="TestLiveConnect();"><h1>'+theTitle+'</h1><hr />'+ GetPrintData() +	'<applet name="Verba" code="Verba.class" alt="Verba (Java-Applet)" width="553" height="289" archive="'+theForm.javaurl.value+'Verba.jar">\n'+	theForm.WortFeld.value+'\n' +	theForm.AskWortFeld.value+'\n' +	theParams+'\nDas Applet "Verba" 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function SelectAll(){	var theForm = self.document.Eingabe;		theForm.praes.checked = true;	theForm.impf.checked = true;	theForm.perf.checked = true;	theForm.plqpf.checked = true;	theForm.fut.checked = true;	theForm.perffut.checked = true;		theForm.imper.checked = true;	theForm.ind.checked = true;	theForm.konj.checked = true;		theForm.akt.checked = true;	theForm.mediopass.checked = true;		theForm.Pers.checked = false;}	// SelectAll