	function HandleKeyDown(theEvent)
	{
		if (typeof theEvent == 'undefined')		// Microsoft
			theKey = window.event.keyCode;
		else									// sonst
        	theKey = theEvent.which;

        theChar = String.fromCharCode(theKey);

        if ((theKey == 13)||(theKey == 3)||(theChar == ' '))
        {
			StartExercice(theBook);
        	return false;
        }	// if
        
        switch(theChar)
        {
        	case 'I':	document.input.elements['type'][0].checked = true; return false;
        	case 'Z':	document.input.elements['type'][1].checked = true; return false;
        	case 'A':	document.input.elements['type'][2].checked = true; return false;
        }	// switch
        return true;
        	
	}	// HandleKeyDown

	document.onkeydown = HandleKeyDown;

	function StartExercice(theBook)
	{
		theType = document.input.elements['type'];
		
		if (theType[0].checked)
			theFile = 'verba.php';
		else if (theType[1].checked)
			theFile = 'formen_zuordnen.php';
		else if (theType[2].checked)
			theFile = 'print.php';
		else
			theFile = 'index.php';
			
		theLessons = '';
		
		isChecked = false;

		for (i=0;i<theNumOfCheckboxes;i++)
		{
			if (document.input.elements['checkbox_'+i].checked)
			{
				isChecked = true;
				break;
			}	// if
		}	// for
		
		if (!isChecked)
		{
			alert('Bitte mindestens eine Lektion anklicken!');
			return;
		}	// if
		
		for (i=0;i<theNumOfCheckboxes;i++)
		{
			if (document.input.elements['checkbox_'+i].checked)
			{
				if (theLessons != '')
					theLessons = theLessons+',';
			
				theLessons = theLessons + document.input.elements['checkbox_'+i].value;
			}	// if
		}	// for
						
		theQuery = '?pfad='+theBook+'&lektion='+theLessons;
		window.open('../'+theFile+theQuery,'_self');
		
	}	// StartExercice