var maxTries = 2
var tryCount = 0
var noCorrect = 0
var drillStarted = false
var itemFinished = false
var nextVisible = false
var changedSettings = false
var minCounter = 0
var maxCounter = 31
var itemNo=0
var startString = '<html><head><title>verbformU.html</title><meta http-equiv="Content-Type" content="text/html;charset=utf-8"><style type="text/css"> p {text-align: left; font-family: "Times New Roman", "Times", "Palatino";} span.form {font-size: 36pt; font-family: "New Athena Unicode","Cardo", "Lucida Grande", "Palatino Linotype", "Athena Unicode", "Arial"; color: red;} span.pp {font-size: 20pt; font-family: "New Athena Unicode","Cardo", "Lucida Grande", "Palatino Linotype", "Athena Unicode", "Arial"; color: blue;} span.multans {font-size: 20pt; font-family: "Times New Roman", "Times", "Palatino"; color: red;}  span.meaning {font-size: 20pt; color: blue;} </style></head><body bgcolor="#FFFFFF"><p>'
var endString = '</p></body></html>'
var myString=""
var nounState = "white"
var adjectiveState = "white"
var pronounState = "white"
var adjpronState = "white"
var omicronState = "white"
var alphaState = "white"
var vowadjState = "white"
var consonantState = "white"
var otherdeclState = "white"
var singularState = "white"
var pluralState = "white"
var dualState = "white"
var ouState = "white"
var asState = "white"
var hsState = "white"
var osState = "white"
var ousState = "white"
var ewsState = "white"
var othergenState = "white"
var nominativeState = "white"
var genitiveState = "white"
var dativeState = "white"
var accusativeState = "white"
var vocativeState = "white"
var masculineState = "white"
var feminineState = "white"
var neuterState = "white"
var mascneutState = "white"
var mascfemState = "white"
var mfnState = "white"
var navState = "white"
var nvState = "white"
var gdState = "white"
var nounPdgmList = "par1,par2,par3,par4,par5,par6,par7,par8,par9,par10,par11,par11,par12,par13,par14,par15,par16,par17,par18,"
var pronPdgmList = "par19,par20,par21,par22,par23,par24,par25,par26,"
var adjPdgmList = "par27,par28,par29,par30,par31,par32,par33,par34,par35,par36,par37,par38,par39,par40,par41,par42,"

function shiftNoun(){
	if (!((adjectiveState == "yellow")||(pronounState == "yellow")||(adjpronState == "yellow"))){
	switch(nounState) {
	case "white":
		document.noun.src = "graphics/nounblack.gif"
		nounState = "black"
		document.adjective.src = "graphics/adjectivewhite.gif"
		adjectiveState = "white"
		document.pronoun.src = "graphics/pronounwhite.gif"
		pronounState = "white"
		document.adjpron.src = "graphics/adjpronwhite.gif"
		adjpronState = "white"
		break
	case "black":
		document.noun.src = "graphics/nounwhite.gif"
		nounState = "white"
		break
	case "yellow":
		break
	}
	}
}
function shiftAdjective(){
if (!((nounState == "yellow")||(pronounState == "yellow")||(adjpronState == "yellow"))){
	switch(adjectiveState) {
	case "white":
		document.adjective.src = "graphics/adjectiveblack.gif"
		adjectiveState = "black"
		document.pronoun.src = "graphics/pronounwhite.gif"
		pronounState = "white"
		document.noun.src = "graphics/nounwhite.gif"
		nounState = "white"
		document.adjpron.src = "graphics/adjpronwhite.gif"
		adjpronState = "white"

		break
	case "black":
		document.adjective.src = "graphics/adjectivewhite.gif"
		adjectiveState = "white"
		break
	case "yellow":
		break
	}
}
}

function shiftPronoun(){
	if (!((nounState == "yellow")||(adjectiveState == "yellow")||(adjpronState == "yellow"))){
	switch(pronounState) {
	case "white":
		document.pronoun.src = "graphics/pronounblack.gif";
		pronounState = "black";
		document.noun.src = "graphics/nounwhite.gif";
		nounState = "white";
		document.adjective.src = "graphics/adjectivewhite.gif";
		adjectiveState = "white";
		document.adjpron.src = "graphics/adjpronwhite.gif"
		adjpronState = "white"
		break
	case "black":
		document.pronoun.src = "graphics/pronounwhite.gif";
		pronounState = "white";
		break
	case "yellow":
		break
	}
	}
}
function shiftAdjpron(){
if (!((nounState == "yellow")||(pronounState == "yellow")||(adjectiveState == "yellow"))){
	switch(adjpronState) {
	case "white":
		document.adjpron.src = "graphics/adjpronblack.gif"
		adjpronState = "black"
		document.adjective.src = "graphics/adjectivewhite.gif"
		adjectiveState = "white"
		document.pronoun.src = "graphics/pronounwhite.gif"
		pronounState = "white"
		document.noun.src = "graphics/nounwhite.gif"
		nounState = "white"

		break
	case "black":
		document.adjpron.src = "graphics/adjpronwhite.gif"
		adjpronState = "white"
		break
	case "yellow":
		break
	}
}
}

function setWhiteStates() {
 nounState = "white"
 adjectiveState = "white"
 pronounState = "white"
 adjpronState = "white"
 omicronState = "white"
 alphaState = "white"
 vowadjState = "white"
 consonantState = "white"
 otherdeclState = "white"
 singularState = "white"
 pluralState = "white"
 dualState = "white"
 ouState = "white"
 asState = "white"
 hsState = "white"
 osState = "white"
 ousState = "white"
 ewsState = "white"
 othergenState = "white"
 nominativeState = "white"
 genitiveState = "white"
 dativeState = "white"
 accusativeState = "white"
 vocativeState = "white"
 masculineState = "white"
 feminineState = "white"
 neuterState = "white"
 mascneutState = "white"
 mascfemState = "white"
 mfnState = "white"
 navState = "white"
 nvState = "white"
 gdState = "white"
	
}

	


function writeEmpty() {
	myString="";
	writeAndClose();

}

function writeAndClose(){

parent.nform.document.write(startString + myString + endString);
parent.nform.document.close();
}

function setWhiteButtons(){
	document.noun.src = "graphics/nounwhite.gif"
	document.adjective.src = "graphics/adjectivewhite.gif"
	document.pronoun.src = "graphics/pronounwhite.gif"
	document.adjpron.src = "graphics/adjpronwhite.gif"
	document.r1c1.src = "graphics/nominativewhite.gif"
	document.r2c1.src = "graphics/genitivewhite.gif"
	document.r3c1.src = "graphics/dativewhite.gif"
	document.r4c1.src = "graphics/accusativewhite.gif"
	document.r5c1.src = "graphics/vocativewhite.gif"
	document.r6c1.src = "graphics/nvwhite.gif"
	document.r7c1.src = "graphics/navwhite.gif"
	document.r8c1.src = "graphics/gdwhite.gif"
	document.r1c2.src = "graphics/singularwhite.gif"
	document.r2c2.src = "graphics/pluralwhite.gif"
	document.r3c2.src = "graphics/dualwhite.gif"
	document.r1c3.src = "graphics/masculinewhite.gif"
	document.r2c3.src = "graphics/femininewhite.gif"
	document.r3c3.src = "graphics/neuterwhite.gif"
	document.r4c3.src = "graphics/mascfemwhite.gif"
	document.r5c3.src = "graphics/mascneutwhite.gif"
	document.r6c3.src = "graphics/mfnwhite.gif"
	document.r1c4.src = "graphics/omicronwhite.gif"
	document.r2c4.src = "graphics/alphawhite.gif"
	document.r3c4.src = "graphics/vowadjwhite.gif"
	document.r4c4.src = "graphics/conswhite.gif"
	document.r5c4.src = "graphics/otherwhite.gif"
	document.r1c5.src = "graphics/ouwhite.gif"
	document.r2c5.src = "graphics/aswhite.gif"
	document.r3c5.src = "graphics/hswhite.gif"
	document.r4c5.src = "graphics/oswhite.gif"
	document.r5c5.src = "graphics/ouswhite.gif"
	document.r6c5.src = "graphics/ewswhite.gif"
	document.r7c5.src = "graphics/otherwhite.gif"
	
}

function showForm() {
	if (itemNo < maxCounter) {
		if (drillStarted == false) {
			drillStarted = true
		} else {
			
			itemNo += 1
			x = nDrillInfo[itemNo].exunit
			y = x.slice(0,2)
			if (parseInt(nDrillInfo[itemNo].diffunit, 10) > parseInt(y, 10)){
			itemNo += 1
			x = nDrillInfo[itemNo].exunit
			y = x.slice(0,2)
			if (parseInt(nDrillInfo[itemNo].diffunit, 10) > parseInt(y, 10)){
			itemNo += 1
				}
			
			}
			
			setWhiteButtons()	
			setWhiteStates()		 
		}
		tryCount = 0
		noCorrect = 0
		itemFinished = false
		myString = '<span class="form">&nbsp;&nbsp;&nbsp;' + nDrillInfo[itemNo].nform + '</span><span class="multans">&nbsp;&nbsp;' + nDrillInfo[itemNo].multans + '</span>'
		
		writeAndClose();
	}
}
function showFormType(){
	if (nDrillInfo[itemNo].formtype == "noun"){
		nounState = "yellow"
		document.noun.src = "graphics/nounyellow.gif"
	}
	if (nDrillInfo[itemNo].formtype == "adjective"){
		adjectiveState = "yellow"
		document.adjective.src = "graphics/adjectiveyellow.gif"
	}
	if (nDrillInfo[itemNo].formtype == "pronoun"){
		pronounState = "yellow"
		document.pronoun.src = "graphics/pronounyellow.gif"
	}
	if (nDrillInfo[itemNo].formtype == "adjpron"){
		adjpronState == "yellow"
		document.adjpron.src = "graphics/adjpronyellow.gif"
		if (adjectiveState =="black") {
		document.adjective.src = "graphics/adjectiveyellow2.gif"
		}
		if (pronounState =="black") {
		document.pronoun.src = "graphics/pronounyellow2.gif"
		}
	}
	
}


function checkFormType(){
	if ((nounState == "black")&&(nDrillInfo[itemNo].formtype == "noun")){
		nounState = "yellow"
		document.noun.src = "graphics/nounyellow.gif"
		noCorrect += 1
	}
	if ((adjectiveState == "black")&&(nDrillInfo[itemNo].formtype == "adjective")){
		adjectiveState = "yellow"
		document.adjective.src = "graphics/adjectiveyellow.gif"
		noCorrect += 1
	}
	if ((adjectiveState == "black")&&(nDrillInfo[itemNo].formtype == "adjpron")){
		adjpronState = "yellow"
		document.adjective.src = "graphics/adjectiveyellow2.gif"
		document.adjpron.src = "graphics/adjpronyellow.gif"
		noCorrect += 1
	}
	if ((pronounState == "black")&&(nDrillInfo[itemNo].formtype == "pronoun")){
		pronounState = "yellow"
		document.pronoun.src = "graphics/pronounyellow.gif"
		noCorrect += 1
	}
	if ((pronounState == "black")&&(nDrillInfo[itemNo].formtype == "adjpron")){
		adjpronState = "yellow"
		document.pronoun.src = "graphics/pronounyellow2.gif"
		document.adjpron.src = "graphics/adjpronyellow.gif"
		noCorrect += 1
	}
	if ((adjpronState == "black")&&(nDrillInfo[itemNo].formtype == "adjpron")){
		adjpronState = "yellow"
		document.adjpron.src = "graphics/adjpronyellow.gif"
		noCorrect += 1
	}
	
}

function showFormcase(){
		if (nDrillInfo[itemNo].formcase == "nom"){
			nominativeState = "yellow"
			document.r1c1.src = "graphics/nominativeyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "gen"){
			genitiveState = "yellow"
			document.r2c1.src = "graphics/genitiveyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "dat"){
			dativeState = "yellow"
			document.r3c1.src = "graphics/dativeyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "acc"){
			accusativeState = "yellow"
			document.r4c1.src = "graphics/accusativeyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "voc"){
			vocativeState = "yellow"
			document.r5c1.src = "graphics/vocativeyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "nv"){
			nvState = "yellow"
			if (nominativeState == "black") {
			
				document.r1c1.src = "graphics/nominativeyellow2.gif"
			
			}
			if (vocativeState == "black") {
			document.r5c1.src = "graphics/vocativeyellow2.gif"	
			}
			document.r6c1.src = "graphics/nvyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "nav"){
			navState = "yellow"
			if (nominativeState == "black") {
				document.r1c1.src = "graphics/nominativeyellow2.gif"	
			
			}
			if (accusativeState == "black") {
			document.r4c1.src = "graphics/accusativeyellow2.gif"	
			
			}
			if (vocativeState == "black") {
			document.r5c1.src = "graphics/vocativeyellow2.gif"	
			
			}
			if (nvState == "black") {
				document.r6c1.src = "graphics/nvyellow2.gif"	
			
			}
			document.r7c1.src = "graphics/navyellow.gif"
		}
		if (nDrillInfo[itemNo].formcase == "gd"){
			gdState = "yellow"
			if (genitiveState == "black") {
			
				document.r2c1.src = "graphics/genitiveyellow2.gif"
			
			}
			if (dativeState == "black") {
			document.r3c1.src = "graphics/dativeyellow2.gif"	
			}
			document.r8c1.src = "graphics/gdyellow.gif"
		}
}


function checkFormcase(){
	
		if ((nominativeState == "black")&&(nDrillInfo[itemNo].formcase == "nom")){
			nominativeState = "yellow"
			document.r1c1.src = "graphics/nominativeyellow.gif"
		noCorrect += 1
		}
		if ((nominativeState == "black")&&(nDrillInfo[itemNo].formcase == "nv")){
			nvState = "yellow"
			nominativeState = "white"
			document.r1c1.src = "graphics/nominativeyellow2.gif"
			document.r6c1.src = "graphics/nvyellow.gif"
		noCorrect += 1
		}
		if ((nominativeState == "black")&&(nDrillInfo[itemNo].formcase == "nav")){
			navState = "yellow"
			nominativeState = "white"
			document.r1c1.src = "graphics/nominativeyellow2.gif"
			document.r7c1.src = "graphics/navyellow.gif"
		noCorrect += 1
		}
		if ((genitiveState == "black")&&(nDrillInfo[itemNo].formcase == "gen")){
			genitiveState = "yellow"
			document.r2c1.src = "graphics/genitiveyellow.gif"
		noCorrect += 1
		}
		if ((genitiveState == "black")&&(nDrillInfo[itemNo].formcase == "gd")){
			gdState = "yellow"
			genitiveState = "white"
			document.r2c1.src = "graphics/genitiveyellow2.gif"
			document.r8c1.src = "graphics/gdyellow.gif"
		noCorrect += 1
		}
		if ((dativeState == "black")&&(nDrillInfo[itemNo].formcase == "dat")){
			dativeState = "yellow"
			document.r3c1.src = "graphics/dativeyellow.gif"
		noCorrect += 1
		}
		if ((dativeState == "black")&&(nDrillInfo[itemNo].formcase == "gd")){
			gdState = "yellow"
			dativeState = "white"
			document.r3c1.src = "graphics/dativeyellow2.gif"
			document.r8c1.src = "graphics/gdyellow.gif"
		noCorrect += 1
		}
		if ((accusativeState == "black")&&(nDrillInfo[itemNo].formcase == "acc")){
			accusativeState = "yellow"
			document.r4c1.src = "graphics/accusativeyellow.gif"
		noCorrect += 1
		}
		if ((accusativeState == "black")&&(nDrillInfo[itemNo].formcase == "nav")){
			accusativeState = "white"
			navState = "yellow"
			document.r4c1.src = "graphics/accusativeyellow2.gif"
			document.r7c1.src = "graphics/navyellow.gif"
		noCorrect += 1
		}
		if ((vocativeState == "black")&&(nDrillInfo[itemNo].formcase == "voc")){
			vocativeState = "yellow"
			document.r5c1.src = "graphics/vocativeyellow.gif"
		noCorrect += 1
		}
		if ((vocativeState == "black")&&(nDrillInfo[itemNo].formcase == "nav")){
			vocativeState = "white"
			navState = "yellow"
			document.r5c1.src = "graphics/vocativeyellow2.gif"
			document.r7c1.src = "graphics/navyellow.gif"
		noCorrect += 1
		}
		if ((vocativeState == "black")&&(nDrillInfo[itemNo].formcase == "nv")){
			vocativeState = "white"
			nvState = "yellow"
			document.r5c1.src = "graphics/vocativeyellow2.gif"
			document.r6c1.src = "graphics/nvyellow.gif"
		noCorrect += 1
		}
		if ((nvState == "black")&&(nDrillInfo[itemNo].formcase == "nv")){
			
			nvState = "yellow"
			
			document.r6c1.src = "graphics/nvyellow.gif"
		noCorrect += 1
		}
		if ((nvState == "black")&&(nDrillInfo[itemNo].formcase == "nav")){
			
			nvState = "white"
			navState = "yellow"
			document.r7c1.src = "graphics/navyellow.gif"
			document.r6c1.src = "graphics/nvyellow2.gif"
		noCorrect += 1
		}
		if ((navState == "black")&&(nDrillInfo[itemNo].formcase == "nav")){
			
			navState = "yellow"
			
			document.r7c1.src = "graphics/navyellow.gif"
		noCorrect += 1
		}
		if ((gdState == "black")&&(nDrillInfo[itemNo].formcase == "gd")){
			gdState = "yellow"
			document.r8c1.src = "graphics/gdyellow.gif"
		noCorrect += 1
		}

}


function showNumber(){
	if (nDrillInfo[itemNo].number == "si"){
		singularState = "yellow"
		document.r1c2.src = "graphics/singularyellow.gif"
	}
	if (nDrillInfo[itemNo].number == "pl"){
		pluralState = "yellow"
		document.r2c2.src = "graphics/pluralyellow.gif"
	}
	if (nDrillInfo[itemNo].number == "dual"){
		dualState = "yellow"
		document.r3c2.src = "graphics/dualyellow.gif"
	}
}


function checkNumber(){
	if ((singularState == "black")&&(nDrillInfo[itemNo].number == "si")){
		singularState = "yellow"
		document.r1c2.src = "graphics/singularyellow.gif"
		noCorrect += 1
	}
	if ((pluralState == "black")&&(nDrillInfo[itemNo].number == "pl")){
		pluralState = "yellow"
		document.r2c2.src = "graphics/pluralyellow.gif"
		noCorrect += 1
	}
	if ((dualState == "black")&&(nDrillInfo[itemNo].number == "dual")){
		dualState = "yellow"
		document.r3c2.src = "graphics/dualyellow.gif"
		noCorrect += 1
	}
}

function showGentype(){
	if (nDrillInfo[itemNo].gentype == "ou"){
		ouState = "yellow"
		document.r1c5.src = "graphics/ouyellow.gif"
	}
	if (nDrillInfo[itemNo].gentype == "as"){
		asState = "yellow"
		document.r2c5.src = "graphics/asyellow.gif"
	}
	if (nDrillInfo[itemNo].gentype == "hs"){
		hsState = "yellow"
		document.r3c5.src = "graphics/hsyellow.gif"
	}
	if (nDrillInfo[itemNo].gentype == "os"){
		osState = "yellow"
		document.r4c5.src = "graphics/osyellow.gif"
	}
	if (nDrillInfo[itemNo].gentype == "ous"){
		ousState = "yellow"
		document.r5c5.src = "graphics/ousyellow.gif"
	}
	if (nDrillInfo[itemNo].gentype == "ews"){
		ewsState = "yellow"
		document.r6c5.src = "graphics/ewsyellow.gif"
	}
	if (nDrillInfo[itemNo].gentype == "othergen"){
		othergenState = "yellow"
		document.r7c5.src = "graphics/otheryellow.gif"
	}

} 

function checkGentype(){
	if ((ouState == "black")&&(nDrillInfo[itemNo].gentype == "ou")){
		ouState = "yellow"
		document.r1c5.src = "graphics/ouyellow.gif"
		noCorrect += 1
	}
	if ((asState == "black")&&(nDrillInfo[itemNo].gentype == "as")){
		asState = "yellow"
		document.r2c5.src = "graphics/asyellow.gif"
		noCorrect += 1
	}
	if ((hsState == "black")&&(nDrillInfo[itemNo].gentype == "hs")){
		hsState = "yellow"
		document.r3c5.src = "graphics/hsyellow.gif"
		noCorrect += 1
	}
	if ((osState == "black")&&(nDrillInfo[itemNo].gentype == "os")){
		osState = "yellow"
		document.r4c5.src = "graphics/osyellow.gif"
		noCorrect += 1
	}
	if ((ousState == "black")&&(nDrillInfo[itemNo].gentype == "ous")){
		ousState = "yellow"
		document.r5c5.src = "graphics/ousyellow.gif"
		noCorrect += 1
	}
	if ((ewsState == "black")&&(nDrillInfo[itemNo].gentype == "ews")){
		ewsState = "yellow"
		document.r6c5.src = "graphics/ewsyellow.gif"
		noCorrect += 1
	}
	if ((othergenState == "black")&&(nDrillInfo[itemNo].gentype == "othergen")){
		othergenState = "yellow"
		document.r7c5.src = "graphics/otheryellow.gif"
		noCorrect += 1
	}

} 
function showDecl(){
	if (nDrillInfo[itemNo].decl == "omicron"){
		omicronState = "yellow"
		document.r1c4.src = "graphics/omicronyellow.gif"
	}
	if (nDrillInfo[itemNo].decl == "alpha"){
		alphaState = "yellow"
		document.r2c4.src = "graphics/alphayellow.gif"
	}
	if (nDrillInfo[itemNo].decl == "vowadj"){
		vowadjState = "yellow"
		document.r3c4.src = "graphics/vowadjyellow.gif"
	}
	if (nDrillInfo[itemNo].decl == "consonant"){
		consonantState = "yellow"
		document.r4c4.src = "graphics/consyellow.gif"
	}
	if (nDrillInfo[itemNo].decl == "otherdecl"){
		otherdeclState = "yellow"
		document.r5c4.src = "graphics/otheryellow.gif"
	}
}
function checkDecl(){
	if ((omicronState == "black")&&(nDrillInfo[itemNo].decl == "omicron")){
		omicronState = "yellow"
		document.r1c4.src = "graphics/omicronyellow.gif"
		noCorrect += 1
	}
	if ((alphaState == "black")&&(nDrillInfo[itemNo].decl == "alpha")){
		alphaState = "yellow"
		document.r2c4.src = "graphics/alphayellow.gif"
		noCorrect += 1
	}
	if ((vowadjState == "black")&&(nDrillInfo[itemNo].decl == "vowadj")){
		vowadjState = "yellow"
		document.r3c4.src = "graphics/vowadjyellow.gif"
		noCorrect += 1
	}
	if ((consonantState == "black")&&(nDrillInfo[itemNo].decl == "consonant")){
		consonantState = "white"
		document.r4c4.src = "graphics/consyellow.gif"
		noCorrect += 1
	}
	if ((otherdeclState == "black")&&(nDrillInfo[itemNo].decl == "otherdecl")){
		otherdeclState = "yellow"
		document.r5c4.src = "graphics/otheryellow.gif"
		noCorrect += 1
	}
}

function showGender(){
	if (nDrillInfo[itemNo].gender == "m"){
		masculineState = "yellow"
		document.r1c3.src = "graphics/masculineyellow.gif"
	}
	if (nDrillInfo[itemNo].gender == "f"){
		feminineState = "yellow"
		document.r2c3.src = "graphics/feminineyellow.gif"
	}
	if (nDrillInfo[itemNo].gender == "n"){
		neuterState = "yellow"
		document.r3c3.src = "graphics/neuteryellow.gif"
	}
	if (nDrillInfo[itemNo].gender == "mascfem"){
		
		mascneutState = "yellow"
		if (masculineState == "black") {
			document.r1c3.src = "graphics/masculineyellow2.gif"
		}
		if (feminineState == "black") {
			document.r2c3.src = "graphics/feminineyellow2.gif"
		}

		document.r4c3.src = "graphics/mascfemyellow.gif"
	}
	if (nDrillInfo[itemNo].gender == "mascneut"){
		
		mascneutState = "yellow"
		if (masculineState == "black") {
			document.r1c3.src = "graphics/masculineyellow2.gif"
		}
		if (neuterState == "black") {
			document.r3c3.src = "graphics/neuteryellow2.gif"
		}

		document.r5c3.src = "graphics/mascneutyellow.gif"
	}
	if (nDrillInfo[itemNo].gender == "mfn"){
		mfnState = "yellow"
		if (masculineState == "black") {
			document.r1c3.src = "graphics/masculineyellow2.gif"
		}
		if (feminineState == "black") {
			document.r2c3.src = "graphics/feminineyellow2.gif"
		}
		if (neuterState == "black") {
			document.r3c3.src = "graphics/neuteryellow2.gif"
		}
		if (mascfemState == "black") {
			document.r4c3.src = "graphics/mascfemyellow2.gif"
		}
		if (mascneutState == "black") {
			document.r5c3.src = "graphics/mascneutyellow2.gif"
		}
		document.r6c3.src = "graphics/mfnyellow.gif"
	}


}

function checkGender(){
	if ((masculineState == "black")&&(nDrillInfo[itemNo].gender == "m")){
		masculineState = "yellow"
		document.r1c3.src = "graphics/masculineyellow.gif"
		noCorrect += 1
	}
	if ((masculineState == "black")&&(nDrillInfo[itemNo].gender == "mfn")){
		masculineState = "white"
		mfnState = "yellow"
		document.r1c3.src = "graphics/masculineyellow2.gif"
		document.r6c3.src = "graphics/mfnyellow.gif"
		noCorrect += 1
	}
	if ((masculineState == "black")&&(nDrillInfo[itemNo].gender == "mascfem")){
		masculineState = "white"
		mascfemState = "yellow"
		document.r1c3.src = "graphics/masculineyellow2.gif"
		document.r4c3.src = "graphics/mascfemyellow.gif"
		noCorrect += 1
	}
	if ((masculineState == "black")&&(nDrillInfo[itemNo].gender == "mascneut")){
		masculineState = "white"
		mascneutState = "yellow"
		document.r1c3.src = "graphics/masculineyellow2.gif"
		document.r5c3.src = "graphics/mascneutyellow.gif"
		noCorrect += 1
	}
	if ((feminineState == "black")&&(nDrillInfo[itemNo].gender == "f")){
		feminineState = "yellow"
		document.r2c3.src = "graphics/feminineyellow.gif"
		noCorrect += 1
	}
	if ((feminineState == "black")&&(nDrillInfo[itemNo].gender == "mascfem")){
		feminineState = "white"
		mascfemState = "yellow"
		document.r2c3.src = "graphics/feminineyellow2.gif"
		document.r4c3.src = "graphics/mascfemyellow.gif"
		noCorrect += 1
	}
	if ((feminineState == "black")&&(nDrillInfo[itemNo].gender == "mfn")){
		feminineState = "white"
		mfnState = "yellow"
		document.r2c3.src = "graphics/feminineyellow2.gif"
		document.r6c3.src = "graphics/mfnyellow.gif"
		noCorrect += 1
	}
	if ((neuterState == "black")&&(nDrillInfo[itemNo].gender == "n")){
		neuterState = "yellow"
		document.r3c3.src = "graphics/neuteryellow.gif"
		noCorrect += 1
	}
	if ((neuterState == "black")&&(nDrillInfo[itemNo].gender == "mfn")){
		neuterState = "white"
		mfnState = "yellow"
		document.r3c3.src = "graphics/neuteryellow2.gif"
		document.r6c3.src = "graphics/mfnyellow.gif"
		noCorrect += 1
	}
	if ((neuterState == "black")&&(nDrillInfo[itemNo].gender == "mascneut")){
		neuterState = "white"
		mascneutState = "yellow"
		document.r3c3.src = "graphics/neuteryellow2.gif"
		document.r5c3.src = "graphics/mascneutyellow.gif"
		noCorrect += 1
	}
	if ((mascfemState == "black")&&(nDrillInfo[itemNo].gender == "mascfem")){
		mascfemState = "yellow"
		document.r4c3.src = "graphics/mascfemyellow.gif"
		noCorrect += 1
	}
	if ((mascfemState == "black")&&(nDrillInfo[itemNo].gender == "mfn")){
		mascfemState = "white"
		mfnState = "yellow"
		document.r6c3.src = "graphics/mfnyellow.gif"
		document.r4c3.src = "graphics/mascfemyellow2.gif"
		noCorrect += 1
	}
	if ((mascneutState == "black")&&(nDrillInfo[itemNo].gender == "mascneut")){
		mascneutState = "yellow"
		document.r5c3.src = "graphics/mascneutyellow.gif"
		noCorrect += 1
	}
	if ((mascneutState == "black")&&(nDrillInfo[itemNo].gender == "mfn")){
		mascneutState = "white"
		mfnState = "yellow"
		document.r6c3.src = "graphics/mfnyellow.gif"
		document.r5c3.src = "graphics/mascneutyellow2.gif"
		noCorrect += 1
	}
	if ((mfnState == "black")&&(nDrillInfo[itemNo].gender == "mfn")){
		mfnState = "yellow"
		document.r6c3.src = "graphics/mfnyellow.gif"
		noCorrect += 1
	}


}

function showAnswer(){
	showFormType()
	showFormcase()
	showNumber()
	showGender()
	showDecl()
	showGentype()
	
	if (itemNo < maxCounter){
	document.mainactions.src = "graphics/next.gif"
	nextVisible = true
	itemFinished = true
	} 
	else {
	document.mainactions.src = "graphics/reset.gif"
	nextVisible = false
	drillStarted = false
	
	}


}


function checkAnswer(){
/*alert(tryCount)*/
	if (drillStarted == true) {
	tryCount += 1
	if (tryCount < maxTries) {
		checkFormType()
		checkFormcase()
		checkNumber()
		checkGender()
		checkDecl()
		checkGentype()
		checkIfFinished()
		if ((itemFinished == true)&&(itemNo < maxCounter)) {
			document.mainactions.src = "graphics/next.gif"
			nextVisible = true			
		}
		if ((itemFinished == true)&&(itemNo == maxCounter)) {
	document.mainactions.src = "graphics/reset.gif"
	nextVisible = false
	drillStarted = false
	
		}
	}

	if (tryCount == maxTries) {
		showAnswer()
	}
	}
}

function showDictform(){
	myString= '<span class="form">&nbsp;&nbsp;&nbsp;' + nDrillInfo[itemNo].nform + '</span><span class="multans">&nbsp;&nbsp;' + nDrillInfo[itemNo].multans + '</span><span class="meaning">&nbsp;&nbsp;&nbsp;from </span><span class="pp">';
	myString= myString + vInfo[nDrillInfo[itemNo].vocabpointer].lemma + '</span>'
	writeAndClose()
}
function showDictinfo(){
	myString= '<span class="form">&nbsp;&nbsp;&nbsp;' + nDrillInfo[itemNo].nform + '</span><span class="multans">&nbsp;&nbsp;' + nDrillInfo[itemNo].multans +'</span><span class="meaning">&nbsp;&nbsp;&nbsp;from </span><span class="pp">';
	myString= myString + vInfo[nDrillInfo[itemNo].vocabpointer].lemma + '&#x002c;' + '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+ vInfo[nDrillInfo[itemNo].vocabpointer].rest +'</span>&nbsp;&nbsp;&nbsp;<span class="meaning">' + vInfo[nDrillInfo[itemNo].vocabpointer].added + '</span>'
	writeAndClose()
}
function showdefinition(){
myString= '<span class="form">&nbsp;&nbsp;&nbsp;' + nDrillInfo[itemNo].nform + '</span><span class="multans">&nbsp;&nbsp;' + nDrillInfo[itemNo].multans +'</span><br /><span class="meaning">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + vInfo[nDrillInfo[itemNo].vocabpointer].meaning + '</span>'
	writeAndClose()
}

function shiftr1c1(){

	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(nominativeState) {
	case "white":
		document.r1c1.src = "graphics/nominativeblack.gif";
		nominativeState = "black";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		break
	}
	}
}

function shiftr2c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(genitiveState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitiveblack.gif";
		genitiveState = "black";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		break
	}
	}
}





function shiftr3c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(dativeState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativeblack.gif";
		dativeState = "black";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		break
	}
	}
}

function shiftr4c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(accusativeState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativeblack.gif";
		accusativeState = "black";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		break
	}
	}
}

function shiftr5c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(vocativeState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativeblack.gif";
		vocativeState = "black";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		break
	}
	}
}


function shiftr6c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(nvState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvblack.gif";
		nvState = "black";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		break
	}
	}
}
function shiftr7c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(navState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navblack.gif";
		navState = "black";
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		
		break
	case "black":
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		break
	}
	}
}
function shiftr8c1(){
	if (!((nominativeState == "yellow")||(genitiveState == "yellow")||(dativeState == "yellow")||(vocativeState == "yellow")||(accusativeState == "yellow")||(nvState == "yellow")||(navState == "yellow")||(gdState == "yellow"))){
	switch(gdState) {
	case "white":
		document.r1c1.src = "graphics/nominativewhite.gif";
		nominativeState = "white";
		document.r2c1.src = "graphics/genitivewhite.gif";
		genitiveState = "white";
		document.r3c1.src = "graphics/dativewhite.gif";
		dativeState = "white";
		document.r4c1.src = "graphics/accusativewhite.gif";
		accusativeState = "white";
		document.r5c1.src = "graphics/vocativewhite.gif";
		vocativeState = "white";
		document.r6c1.src = "graphics/nvwhite.gif";
		nvState = "white";
		document.r7c1.src = "graphics/navwhite.gif";
		navState = "white";
		document.r8c1.src = "graphics/gdblack.gif";
		gdState = "black";
		
		break
	case "black":
		document.r8c1.src = "graphics/gdwhite.gif";
		gdState = "white";
		break
	}
	}
}


function shiftr1c3() {
	if (!((masculineState == "yellow")||(feminineState == "yellow")||(neuterState == "yellow")||(mascfemState == "yellow")||(mascneutState == "yellow")||(mfnState == "yellow"))){
		switch(masculineState) {
		case "white":
		document.r1c3.src = "graphics/masculineblack.gif";
		masculineState = "black";
		document.r2c3.src = "graphics/femininewhite.gif";
		feminineState = "white";
		document.r3c3.src = "graphics/neuterwhite.gif";
		neuterState = "white";
		document.r4c3.src = "graphics/mascfemwhite.gif";
		mascfemState = "white";
		document.r5c3.src = "graphics/mascneutwhite.gif";
		mascneutState = "white";
		document.r6c3.src = "graphics/mfnwhite.gif";
		mfnState = "white";
		break
		case "black":
		document.r1c3.src = "graphics/masculinewhite.gif";
		masculineState = "white";
		break
		}
	}
}

function shiftr2c3() {
	if (!((masculineState == "yellow")||(feminineState == "yellow")||(neuterState == "yellow")||(mascfemState == "yellow")||(mascneutState == "yellow")||(mfnState == "yellow"))){
		switch(feminineState) {
		case "white":
		document.r1c3.src = "graphics/masculinewhite.gif";
		masculineState = "white";
		document.r2c3.src = "graphics/feminineblack.gif";
		feminineState = "black";
		document.r3c3.src = "graphics/neuterwhite.gif";
		neuterState = "white";
		document.r4c3.src = "graphics/mascfemwhite.gif";
		mascfemState = "white";
		document.r5c3.src = "graphics/mascneutwhite.gif";
		mascneutState = "white";
		document.r6c3.src = "graphics/mfnwhite.gif";
		mfnState = "white";
		break
		case "black":
		document.r2c3.src = "graphics/femininewhite.gif";
		feminineState = "white";
		break
		}
	}
}

function shiftr3c3() {
	if (!((masculineState == "yellow")||(feminineState == "yellow")||(neuterState == "yellow")||(mascfemState == "yellow")||(mascneutState == "yellow")||(mfnState == "yellow"))){
		switch(neuterState) {
		case "white":
		document.r1c3.src = "graphics/masculinewhite.gif";
		masculineState = "white";
		document.r2c3.src = "graphics/femininewhite.gif";
		feminineState = "white";
		document.r3c3.src = "graphics/neuterblack.gif";
		neuterState = "black";
		document.r4c3.src = "graphics/mascfemwhite.gif";
		mascfemState = "white";
		document.r5c3.src = "graphics/mascneutwhite.gif";
		mascneutState = "white";
		document.r6c3.src = "graphics/mfnwhite.gif";
		mfnState = "white";
		break
		case "black":
		document.r3c3.src = "graphics/neuterwhite.gif";
		neuterState = "white";
		break
		}
	}
}

function shiftr4c3() {
	if (!((masculineState == "yellow")||(feminineState == "yellow")||(neuterState == "yellow")||(mascfemState == "yellow")||(mascneutState == "yellow")||(mfnState == "yellow"))){
		switch(mascfemState) {
		case "white":
		document.r1c3.src = "graphics/masculinewhite.gif";
		masculineState = "white";
		document.r2c3.src = "graphics/femininewhite.gif";
		feminineState = "white";
		document.r3c3.src = "graphics/neuterwhite.gif";
		neuterState = "white";
		document.r4c3.src = "graphics/mascfemblack.gif";
		mascfemState = "black";
		document.r5c3.src = "graphics/mascneutwhite.gif";
		mascneutState = "white";
		document.r6c3.src = "graphics/mfnwhite.gif";
		mfnState = "white";
		break
		case "black":
		document.r4c3.src = "graphics/mascfemwhite.gif";
		masculineState = "white";
		break
		}
	}
}

function shiftr5c3() {
	if (!((masculineState == "yellow")||(feminineState == "yellow")||(neuterState == "yellow")||(mascfemState == "yellow")||(mascneutState == "yellow")||(mfnState == "yellow"))){
		switch(mascneutState) {
		case "white":
		document.r1c3.src = "graphics/masculinewhite.gif";
		masculineState = "white";
		document.r2c3.src = "graphics/femininewhite.gif";
		feminineState = "white";
		document.r3c3.src = "graphics/neuterwhite.gif";
		neuterState = "white";
		document.r4c3.src = "graphics/mascfemwhite.gif";
		mascfemState = "white";
		document.r5c3.src = "graphics/mascneutblack.gif";
		mascneutState = "black";
		document.r6c3.src = "graphics/mfnwhite.gif";
		mfnState = "white";
		break
		case "black":
		document.r5c3.src = "graphics/mascneutwhite.gif";
		mascneutState = "white";
		break
		}
	}
}

function shiftr6c3() {
	if (!((masculineState == "yellow")||(feminineState == "yellow")||(neuterState == "yellow")||(mascfemState == "yellow")||(mascneutState == "yellow")||(mfnState == "yellow"))){
		switch(mfnState) {
		case "white":
		document.r1c3.src = "graphics/masculinewhite.gif";
		masculineState = "white";
		document.r2c3.src = "graphics/femininewhite.gif";
		feminineState = "white";
		document.r3c3.src = "graphics/neuterwhite.gif";
		neuterState = "white";
		document.r4c3.src = "graphics/mascfemwhite.gif";
		mascfemState = "white";
		document.r5c3.src = "graphics/mascneutwhite.gif";
		mascneutState = "white";
		document.r6c3.src = "graphics/mfnblack.gif";
		mfnState = "black";
		break
		case "black":
		document.r6c3.src = "graphics/mfnwhite.gif";
		mfnState = "white";
		break
		}
	}
}


function shiftr1c2(){
	if (!((pluralState == "yellow")||(singularState == "yellow")||(dualState == "yellow"))){
	switch(singularState) {
	case "white":
		document.r1c2.src = "graphics/singularblack.gif";
		singularState = "black";
		document.r2c2.src = "graphics/pluralwhite.gif";
		pluralState = "white";
		document.r3c2.src = "graphics/dualwhite.gif";
		dualState = "white";
		
		break
	case "black":
		document.r1c2.src = "graphics/singularwhite.gif";
		singularState = "white";
		break
	}
	}

}

function shiftr2c2(){
	if (!((pluralState == "yellow")||(singularState == "yellow")||(dualState == "yellow"))){
	switch(pluralState) {
	case "white":
		document.r1c2.src = "graphics/singularwhite.gif";
		singularState = "white";
		document.r2c2.src = "graphics/pluralblack.gif";
		pluralState = "black";
		document.r3c2.src = "graphics/dualwhite.gif";
		dualState = "white";
		
		break
	case "black":
		document.r2c2.src = "graphics/pluralwhite.gif";
		pluralState = "white";
		break
	}
	}

}
function shiftr3c2(){
	if (!((pluralState == "yellow")||(singularState == "yellow")||(dualState == "yellow"))){
	switch(dualState) {
	case "white":
		document.r1c2.src = "graphics/singularwhite.gif";
		singularState = "white";
		document.r2c2.src = "graphics/pluralwhite.gif";
		pluralState = "white";
		document.r3c2.src = "graphics/dualblack.gif";
		dualState = "black";
		
		break
	case "black":
		document.r3c2.src = "graphics/dualwhite.gif";
		dualState = "white";
		break
	}
	}

}

function shiftr1c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(ouState) {
		case "white":
		document.r1c5.src = "graphics/oublack.gif";
		ouState = "black";
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		case "black":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		break
		}
	}

}




function shiftr2c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(asState) {
		case "white":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		document.r2c5.src = "graphics/asblack.gif";
		asState = "black";
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		case "black":
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		break
		}
	}

}

function shiftr3c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(hsState) {
		case "white":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		document.r3c5.src = "graphics/hsblack.gif";
		hsState = "black";
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		case "black":
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		break
		}
	}

}

function shiftr4c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(osState) {
		case "white":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		document.r4c5.src = "graphics/osblack.gif";
		osState = "black";
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		case "black":
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		break
		}
	}

}

function shiftr5c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(ousState) {
		case "white":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		document.r5c5.src = "graphics/ousblack.gif";
		ousState = "black";
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		case "black":
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		break
		}
	}

}

function shiftr6c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(ewsState) {
		case "white":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		document.r6c5.src = "graphics/ewsblack.gif";
		ewsState = "black";
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		case "black":
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		break
		}
	}

}
function shiftr7c5() {
if (!((ouState=="yellow")||(asState=="yellow")||(hsState=="yellow")||(osState=="yellow")||(ousState=="yellow")||(ewsState=="yellow")||(othergenState=="yellow"))){
		switch(othergenState) {
		case "white":
		document.r1c5.src = "graphics/ouwhite.gif";
		ouState = "white";
		document.r2c5.src = "graphics/aswhite.gif";
		asState = "white";
		document.r3c5.src = "graphics/hswhite.gif";
		hsState = "white";
		document.r4c5.src = "graphics/oswhite.gif";
		osState = "white";
		document.r5c5.src = "graphics/ouswhite.gif";
		ousState = "white";
		document.r6c5.src = "graphics/ewswhite.gif";
		ewsState = "white";
		document.r7c5.src = "graphics/otherblack.gif";
		othergenState = "black";
		break
		case "black":
		document.r7c5.src = "graphics/otherwhite.gif";
		othergenState = "white";
		break
		}
	}

}


function shiftr1c4() {
	if (!((omicronState == "yellow")||(alphaState == "yellow")||(vowadjState == "yellow")||(consonantState == "yellow")||(otherdeclState == "yellow"))){
		switch(omicronState) {
		case "white":
		document.r1c4.src = "graphics/omicronblack.gif";
		omicronState = "black";
		document.r2c4.src = "graphics/alphawhite.gif";
		alphaState = "white";
		document.r3c4.src = "graphics/vowadjwhite.gif";
		vowadjState = "white";
		document.r4c4.src = "graphics/conswhite.gif";
		consonantState = "white";
		document.r5c4.src = "graphics/otherwhite.gif";
		otherdeclState = "white";
		break
		case "black":
		document.r1c4.src = "graphics/omicronwhite.gif";
		omicronState = "white";
		break
		}
	}
}

function shiftr2c4() {
	if (!((omicronState == "yellow")||(alphaState == "yellow")||(vowadjState == "yellow")||(consonantState == "yellow")||(otherdeclState == "yellow"))){
		switch(alphaState) {
		case "white":
		document.r1c4.src = "graphics/omicronwhite.gif";
		omicronState = "white";
		document.r2c4.src = "graphics/alphablack.gif";
		alphaState = "black";
		document.r3c4.src = "graphics/vowadjwhite.gif";
		vowadjState = "white";
		document.r4c4.src = "graphics/conswhite.gif";
		consonantState = "white";
		document.r5c4.src = "graphics/otherwhite.gif";
		otherdeclState = "white";
		break
		case "black":
		document.r2c4.src = "graphics/alphawhite.gif";
		alphaState = "white";
		break
		}
	}
}

function shiftr3c4() {
	if (!((omicronState == "yellow")||(alphaState == "yellow")||(vowadjState == "yellow")||(consonantState == "yellow")||(otherdeclState == "yellow"))){
		switch(vowadjState) {
		case "white":
		document.r1c4.src = "graphics/omicronwhite.gif";
		omicronState = "white";
		document.r2c4.src = "graphics/alphawhite.gif";
		alphaState = "white";
		document.r3c4.src = "graphics/vowadjblack.gif";
		vowadjState = "black";
		document.r4c4.src = "graphics/conswhite.gif";
		consonantState = "white";
		document.r5c4.src = "graphics/otherwhite.gif";
		otherdeclState = "white";
		break
		case "black":
		document.r3c4.src = "graphics/vowadjwhite.gif";
		vowadjState = "white";
		break
		}
	}
}

function shiftr4c4() {
	if (!((omicronState == "yellow")||(alphaState == "yellow")||(vowadjState == "yellow")||(consonantState == "yellow")||(otherdeclState == "yellow"))){
		switch(consonantState) {
		case "white":
		document.r1c4.src = "graphics/omicronwhite.gif";
		omicronState = "white";
		document.r2c4.src = "graphics/alphawhite.gif";
		alphaState = "white";
		document.r3c4.src = "graphics/vowadjwhite.gif";
		vowadjState = "white";
		document.r4c4.src = "graphics/consblack.gif";
		consonantState = "black";
		document.r5c4.src = "graphics/otherwhite.gif";
		otherdeclState = "white";
		break
		case "black":
		document.r4c4.src = "graphics/conswhite.gif";
		consonantState = "white";
		break
		}
	}
}

function shiftr5c4() {
	if (!((omicronState == "yellow")||(alphaState == "yellow")||(vowadjState == "yellow")||(consonantState == "yellow")||(otherdeclState == "yellow"))){
		switch(otherdeclState) {
		case "white":
		document.r1c4.src = "graphics/omicronwhite.gif";
		omicronState = "white";
		document.r2c4.src = "graphics/alphawhite.gif";
		alphaState = "white";
		document.r3c4.src = "graphics/vowadjwhite.gif";
		vowadjState = "white";
		document.r4c4.src = "graphics/conswhite.gif";
		consonantState = "white";
		document.r5c4.src = "graphics/otherblack.gif";
		otherdeclState = "black";
		break
		case "black":
		document.r5c4.src = "graphics/otherwhite.gif";
		otherdeclState = "white";
		break
		}
	}
}

function setTries(form) {

	maxTries = form.tries.options[form.tries.selectedIndex].value;

	tryCount = 0
}

function setUnit(form) {

	unitNo = form.unit.options[form.unit.selectedIndex].value;
	if (unitNo == 3) {
		minCounter = 0
		maxCounter = 31
	}
	if (unitNo == 4) {
		minCounter = 32
		maxCounter = 63		
	}
	if (unitNo == 5) {
		minCounter = 64
		maxCounter = 96
	}
	if (unitNo == 6) {
		minCounter = 97
		maxCounter = 116	
	}
	if (unitNo == 7) {
		minCounter = 117
		maxCounter = 140	
	}
	if (unitNo == 8) {
		minCounter = 141
		maxCounter = 161	
	}
	if (unitNo == 9) {
		minCounter = 162
		maxCounter = 184	
	}
	if (unitNo == 10) {
		minCounter = 185
		maxCounter = 206	
	}
	if (unitNo == 11) {
		minCounter = 207
		maxCounter = 227	
	}
	if (unitNo == 12) {
		minCounter = 228
		maxCounter = 248	
	}
	if (unitNo == 13) {
		minCounter = 249
		maxCounter = 268	
	}
	if (unitNo == 14) {
		minCounter = 269
		maxCounter = 292	
	}
	if (unitNo == 15) {
		minCounter = 293
		maxCounter = 324	
	}
	if (unitNo == 16) {
		minCounter = 325
		maxCounter = 345		
	}
	if (unitNo == 17) {
		minCounter = 346
		maxCounter = 366	
	}
	if (unitNo == 18) {
		minCounter = 367
		maxCounter = 389	
	}
	if (unitNo == 19) {
		minCounter = 390
		maxCounter = 411
	}
	if (unitNo == 20) {
		minCounter = 412
		maxCounter = 433
	}
	if (unitNo == 21) {
		minCounter = 434
		maxCounter = 458
	}
	if (unitNo == 22) {
		minCounter = 459
		maxCounter = 493
	}
	if (unitNo == 23) {
		minCounter = 494
		maxCounter = 518
	}
	if (unitNo == 24) {
		minCounter = 519
		maxCounter = 538
	}
	if (unitNo == 25) {
		minCounter = 539
		maxCounter = 566
	}
	if (unitNo == 26) {
		minCounter = 567
		maxCounter = 588
	}
	if (unitNo == 27) {
		minCounter = 589
		maxCounter = 608
	}
	if (unitNo == 28) {
		minCounter = 609
		maxCounter = 630
	}
	if (unitNo == 29) {
		minCounter = 631
		maxCounter = 653
	}
	if (unitNo == 30) {
		minCounter = 654
		maxCounter = 684
	}
	if (unitNo == 31) {
		minCounter = 685
		maxCounter = 706
	}
	if (unitNo == 32) {
		minCounter = 707
		maxCounter = 727
	}
	if (unitNo == 33) {
		minCounter = 728
		maxCounter = 749
	}
	if (unitNo == 34) {
		minCounter = 750
		maxCounter = 770
	}
	if (unitNo == 35) {
		minCounter = 771
		maxCounter = 791
	}
	if (unitNo == 36) {
		minCounter = 792
		maxCounter = 812
	}
	if (unitNo == 37) {
		minCounter = 813
		maxCounter = 836
	}
	if (unitNo == 38) {
		minCounter = 837
		maxCounter = 858
	}
	if (unitNo == 39) {
		minCounter = 859
		maxCounter = 881
	}
	if (unitNo == 40) {
		minCounter = 882
		maxCounter = 905
	}
	if (unitNo == 41) {
		minCounter = 906
		maxCounter = 927
	}
	if (unitNo == 42) {
		minCounter = 928
		maxCounter = 960
	}
	itemNo = minCounter
	drillStarted = false
	writeEmpty()
	setWhiteStates()
	setWhiteButtons()
		document.mainactions.src = "graphics/start.gif"
}

function mainActions() {
	switch(drillStarted) {
	case false:
		writeEmpty()
		setWhiteButtons()
		setWhiteStates()
		document.mainactions.src = "graphics/check.gif"
		nextVisible = false
		itemNo = minCounter
		showForm()
		break

	case true:
		if (nextVisible == false){
			
			checkAnswer()			
		}
		else{
			document.mainactions.src = "graphics/check.gif"
			nextVisible = false
			showForm()
		}
		break
	}
}

function checkIfFinished() {
	
		if (noCorrect == 6) {
			itemFinished = true
		}

}

function openParadigms() {
	var pdgmtest = nDrillInfo[itemNo].pdgm + ","
	if (nounPdgmList.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtablesBOM.html#" + nDrillInfo[itemNo].pdgm 
	}

	if (pronPdgmList.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtables2BOM.html#" + nDrillInfo[itemNo].pdgm 
	}

	if (adjPdgmList.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtables3BOM.html#" + nDrillInfo[itemNo].pdgm 
	}

	
	 
	window.open(whichOne,"Paradigms", "width=660,height=450,scrollbars=yes,resizable=yes,menubar=yes")
	

}