var uniChar=""
var infoWindow = null
var thisInfoString = ""
var drillStarted = false
var counter = 1
var index = 0
var minIndex = 0
var maxIndex = 26
var diacritic = 0
var answerFinished = false
var diacriticList = "άὰᾶἀἁἄἅἂἃἆἇέὲἐἑἔἕἒἓίὶῖἰἱἴἵἲἳἶἷόὸὀὁὄὅὂὃύὺῦὐὑὔὕὒὓὖὗώὼῶὠὡὤὥὢὣὦὧήὴῆἠἡἤἥἢἣἦἧᾴᾲᾷᾀᾁᾄᾅᾂᾃᾆᾇῄῂῇᾐᾑᾔᾕᾒᾓᾖᾗῴῲῷᾠᾡᾤᾥᾢᾣᾦᾧῥ"
var vowelList = "ραειουηωᾳῃῳ"
var aList = "αάὰᾶἀἁἄἅἂἃἆἇ"
var eList = "εέὲἐἑἔἕἒἓ"
var iList = "ιίὶῖἰἱἴἵἲἳἶἷ"
var oList = "οόὸὀὁὄὅὂὃ"
var uList = "υύὺῦὐὑὔὕὒὓὖὗ"
var vList = "ωώὼῶὠὡὤὥὢὣὦὧ"
var hList = "ηήὴῆἠἡἤἥἢἣἦἧ"
var asubList = "ᾳᾴᾲᾷᾀᾁᾄᾅᾂᾃᾆᾇ"
var hsubList = "ῃῄῂῇᾐᾑᾔᾕᾒᾓᾖᾗ"
var vsubList = "ῳῴῲῷᾠᾡᾤᾥᾢᾣᾦᾧ"
var diacr1List = "άέήίόύώᾴῄῴ"
var diacr2List = "ὰὲὴὶὸὺὼᾲῂῲ"
var diacr3List = "ᾶῆῖῦῶᾷῇῷ"
var diacr4List = "ἀἐἠἰὀὐὠᾀᾐᾠ"
var diacr5List = "ἁἑἡἱὁὑὡᾁᾑᾡῥ"
var diacr6List = "ἄἔἤἴὄὔὤᾄᾔᾤ"
var diacr7List = "ἅἕἥἵὅὕὥᾅᾕᾥ"
var diacr8List = "ἂἒἢἲὂὒὢᾂᾒᾢ"
var diacr9List = "ἃἓἣἳὃὓὣᾃᾓᾣ"
var diacr10List = "ἆἦἶὖὦᾆᾖᾦ"
var diacr11List = "ἇἧἷὗὧᾇᾗᾧ"
var diacriticAwaited = false
var currentChoice = ""
var startString = '<html><head><title>enggk_form.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"; font-size: 24pt; color: blue;} </style></head><body bgcolor="#ffffff"><p>&nbsp;&nbsp;&nbsp;&nbsp;'
var startString2 = '<html><head><title>Dictionary Info</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.lemma {font-size: 18pt; font-family: "New Athena Unicode", "Lucida Grande", "Palatino Linotype", "Athena Unicode", "Arial"; color: red;}  span.rest {line-height: 28pt;font-size: 24pt; font-family: "New Athena Unicode", "Lucida Grande", "Palatino Linotype", "Athena Unicode", "Arial"; color: red;} span.added {line-height: 24pt; font-size: 18pt;  color: blue;} span.meaning {font-size: 36pt; color: blue;} span.derivlabel {font-size: 20pt;  color: 00cc33;} span.derivs {font-size: 20pt;  color: 330000;}</style></head><body bgcolor="#FFFFFF"><p>'
var endString = '</font></p></body></html>'
var endString2 = '</p></body></html>'
var myString = ""
var infoWarning = false
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,"
var verbPdgmList4 = "verbpdgm1,verbpdgm2,verbpdgm3,verbpdgm4,verbpdgm5,verbpdgm6,verbpdgm7,verbpdgm8,verbpdgm9,verbpdgm10,verbpdgm11,verbpdgm12,verbpdgm13,verbpdgm14,verbpdgm15,verbpdgm16,verbpdgm17,verbpdgm18,verbpdgm19,verbpdgm20,verbpdgm21,"
var verbPdgmList5 = "verbpdgm22,verbpdgm23,verbpdgm24,verbpdgm25,verbpdgm26,verbpdgm27,verbpdgm28,verbpdgm29,verbpdgm30,verbpdgm31,verbpdgm32,verbpdgm33,verbpdgm34,verbpdgm35,verbpdgm36,verbpdgm37,verbpdgm38,verbpdgm39,verbpdgm40,verbpdgm41,verbpdgm42,verbpdgm43,verbpdgm44,verbpdgm45,"
var verbPdgmList6 = "verbpdgm46,verbpdgm47,verbpdgm48,verbpdgm49,verbpdgm50,verbpdgm51,verbpdgm52,verbpdgm53,verbpdgm54,verbpdgm55,verbpdgm56,verbpdgm57,verbpdgm58,verbpdgm59,verbpdgm60,verbpdgm61,verbpdgm62,verbpdgm63,verbpdgm64,verbpdgm65,verbpdgm66,"



function showChar(x){
	if (counter==1){
	document.char1.src="graphics/" + x + "char.gif"
	}
	if (counter==2){
	document.char2.src="graphics/" + x + "char.gif"
	}
	if (counter == 3){
	document.char3.src="graphics/" + x + "char.gif"
	}
	if (counter == 4){
	document.char4.src="graphics/" + x + "char.gif"
	}
	if (counter == 5){
	document.char5.src="graphics/" + x + "char.gif"
	}
	if (counter == 6){
	document.char6.src="graphics/" + x + "char.gif"
	}
	if (counter == 7){
	document.char7.src="graphics/" + x + "char.gif"
	}
	if (counter == 8){
	document.char8.src="graphics/" + x + "char.gif"
	}
	if (counter == 9){
	document.char9.src="graphics/" + x + "char.gif"
	}
	if (counter == 10){
	document.char10.src="graphics/" + x + "char.gif"
	}
	if (counter == 11){
	document.char11.src="graphics/" + x + "char.gif"
	}
	if (counter == 12){
	document.char12.src="graphics/" + x + "char.gif"
	}
	if (counter == 13){
	document.char13.src="graphics/" + x + "char.gif"
	}
	if (counter == 14){
	document.char14.src="graphics/" + x + "char.gif"
	}
	if (counter == 15){
	document.char15.src="graphics/" + x + "char.gif"
	}
	if (counter == 16){
	document.char16.src="graphics/" + x + "char.gif"
	}

}

function showRedChar(x){
	if (counter==1){
	document.char1.src="graphics/" + x + "red.gif"
	}
	if (counter==2){
	document.char2.src="graphics/" + x + "red.gif"
	}
	if (counter == 3){
	document.char3.src="graphics/" + x + "red.gif"
	}
	if (counter == 4){
	document.char4.src="graphics/" + x + "red.gif"
	}
	if (counter == 5){
	document.char5.src="graphics/" + x + "red.gif"
	}
	if (counter == 6){
	document.char6.src="graphics/" + x + "red.gif"
	}
	if (counter == 7){
	document.char7.src="graphics/" + x + "red.gif"
	}
	if (counter == 8){
	document.char8.src="graphics/" + x + "red.gif"
	}
	if (counter == 9){
	document.char9.src="graphics/" + x + "red.gif"
	}
	if (counter == 10){
	document.char10.src="graphics/" + x + "red.gif"
	}
	if (counter == 11){
	document.char11.src="graphics/" + x + "red.gif"
	}
	if (counter == 12){
	document.char12.src="graphics/" + x + "red.gif"
	}
	if (counter == 13){
	document.char13.src="graphics/" + x + "red.gif"
	}
	if (counter == 14){
	document.char14.src="graphics/" + x + "red.gif"
	}
	if (counter == 15){
	document.char15.src="graphics/" + x + "red.gif"
	}
	if (counter == 16){
	document.char16.src="graphics/" + x + "red.gif"
	}

}
function showYellowChar(x){
	if (counter==1){
	document.char1.src="graphics/" + x + "yellow.gif"
	}
	if (counter==2){
	document.char2.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 3){
	document.char3.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 4){
	document.char4.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 5){
	document.char5.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 6){
	document.char6.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 7){
	document.char7.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 8){
	document.char8.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 9){
	document.char9.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 10){
	document.char10.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 11){
	document.char11.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 12){
	document.char12.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 13){
	document.char13.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 14){
	document.char14.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 15){
	document.char15.src="graphics/" + x + "yellow.gif"
	}
	if (counter == 16){
	document.char16.src="graphics/" + x + "yellow.gif"
	}
	diacriticAwaited = true
}

function checkForVowelMatch(n){
//alert('checkforvowelmatch called')
//alert(n,m)
z = engGkInfo[index].answer.charAt(counter-1)
if (aList.indexOf(z) != -1) {
	if (n == "a") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (eList.indexOf(z) != -1) {
	if (n == "e") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (iList.indexOf(z) != -1) {
	if (n == "i") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (hList.indexOf(z) != -1) {
	if (n == "h") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (oList.indexOf(z) != -1) {
	if (n == "o") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (uList.indexOf(z) != -1) {
	if (n == "u") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (vList.indexOf(z) != -1) {
	if (n == "v") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (asubList.indexOf(z) != -1) {
	if (n == "asub") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (hsubList.indexOf(z) != -1) {
	if (n == "hsub") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (vsubList.indexOf(z) != -1) {
	if (n == "vsub") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}
if (z == "ῥ") {
	if (n == "r") {
		showYellowChar(n)
	} else {
		showRedChar(n)
	}
}



}



function checkCharChoice(n,m) {
//alert(n + ", " + m)
diacriticAwaited = false
z = engGkInfo[index].answer.charAt(counter-1) 
//alert(z)

/* first, if the correct letter is a vowel or rho with diacritic */
if (diacriticList.indexOf(z) != -1) {
	if (vowelList.indexOf(m) != -1){
	checkForVowelMatch(n)
	} else {
	showRedChar(n)
	}
	
}

/* second, if the correct letter is not a vowel or rho with diacritic */

if (diacriticList.indexOf(z) == -1) {

	if ((m != z) && !(((n == "w") && (z == "σ")) ||((n == "s") && (z == "ς")))){
	
		showRedChar(n)
	}
	
	 
	if (m == z) {
		//alert('m,z,n: ' +m +z +n)
		showChar(n)
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		}
/* 	 */
/* 	if ((n == "asub") || (n == "hsub") || (n == "vsub")){ */
/* 		if (((z == "&")&&(n == "asub")) ||((z == "ÔøΩ")&&(n == "hsub")) || ((z == "ÔøΩ")&&(n == "vsub"))) { */
/* 		showChar(n) */
/* 		counter++ */
/* 		if (counter > engGkInfo[index].answer.length) { */
/* 		answerFinished = true */
/* 		document.images[counter-1].src = "graphics/check.gif" */
/* 		}else { */
/* 		document.images[counter-1].src = "graphics/gray.gif" */
/* 		} */
/* 		}else{ */
/* 		showRedChar(n) */
/* 		} */
/* 	} */
	if (((n == "w") && (z == "σ")) ||((n == "s") && (z == "ς"))) {
		showYellowChar(n)
		window.setTimeout("fixSigma()",500)
	}
	
	}
}

function fixSigma() {
	z = engGkInfo[index].answer.charAt(counter-1)
	if (z=="σ") {
	showChar("s")
	}
	if (z=="ς") {
	showChar("w")
	}
	counter++
	if (counter > engGkInfo[index].answer.length) {
	answerFinished = true
	document.images[counter-1].src = "graphics/check.gif"
	}else {
	document.images[counter-1].src = "graphics/gray.gif"
	}
}

function firstString(){
if (drillStarted == false) {
for (var i=0;i<= 15; i++ ){
	document.images[i].src = "graphics/blankchar.gif"
	}
document.char1.src = "graphics/gray.gif"
index = minIndex
counter = 1
/* 	if ((isMac == -1)&&(navigator.appName == "Netscape")){ */
/* 		if (netscapeSkipList.indexOf("," + index + ",") != -1) { */
/* 		index++ */
/* 		} */
/* 	} */
answerFinished = false
drillStarted = true
myString = "1. " + engGkInfo[index].engString
writeAndClose()
}
}


function nextString(){
if (drillStarted == true) {
	if (index < maxIndex){
	for (var i=0;i<= 15; i++ ){
		document.images[i].src = "graphics/blankchar.gif"
	}
	document.char1.src = "graphics/gray.gif"
	counter = 1
	index++
	
/* 	if ((isMac == -1)&&(navigator.appName == "Netscape")){ */
/* 	 */
/* 		if (netscapeSkipList.indexOf("," + index + ",") != -1) { */
/* 		index++ */
/* 		} */
/* 	} */
	answerFinished = false
	myString = (index - minIndex +1) + ". " + engGkInfo[index].engString
	writeAndClose()
	}else {
	alert("End of this set.")
	}
	}
}

function setDiacritic(x){
if (diacriticAwaited == true) {
	diacritic = x
	z = engGkInfo[index].answer.charAt(counter-1) 

	if ((diacritic == "1") && (diacr1List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "1.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}

	if ((diacritic == "2") && (diacr2List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "2.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}

	if ((diacritic == "3") && (diacr3List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "3.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
	if ((diacritic == "4") && (diacr4List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "4.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}

	if ((diacritic == "5") && (diacr5List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "5.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
/* 	if ((diacritic == "5") && (currentChoice == "r")){ */
/* 		document.images[counter-1].src = "graphics2/r5.gif" */
/* 		counter++ */
/* 		if (counter > engGkInfo[index].answer.length) { */
/* 		answerFinished = true */
/* 		document.images[counter-1].src = "graphics/check.gif" */
/* 		}else { */
/* 		document.images[counter-1].src = "graphics/gray.gif" */
/* 		} */
/* 		 */
/* 		diacriticAwaited = false */
/* 	} */
	if ((diacritic == "6") && (diacr6List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "6.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
	if ((diacritic == "7") && (diacr7List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "7.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
	if ((diacritic == "8") && (diacr8List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "8.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
	if ((diacritic == "9") && (diacr9List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "9.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
	if ((diacritic == "10") && (diacr10List.indexOf(z) != -1)){
		//alert(currentChoice)
		document.images[counter-1].src = "graphics2/" + currentChoice + "10.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"
		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}
	if ((diacritic == "11") && (diacr11List.indexOf(z) != -1)){
		document.images[counter-1].src = "graphics2/" + currentChoice + "11.gif"
		counter++
		if (counter > engGkInfo[index].answer.length) {
		answerFinished = true
		document.images[counter-1].src = "graphics/check.gif"

		}else {
		document.images[counter-1].src = "graphics/gray.gif"
		}
		
		diacriticAwaited = false
	}

	if ((diacriticAwaited == true) && (currentChoice != "r")){
		document.images[counter-1].src = "graphics2/" + currentChoice + x + "yellow.gif"
	}
	}
}

function typechar(x){

	currentChoice = x
	
	if (answerFinished == false) {
		if (currentChoice=="b") {uniChar="β"}
		if (currentChoice=="c") {uniChar="ψ"}
		if (currentChoice=="d") {uniChar="δ"}
		if (currentChoice=="f") {uniChar="φ"}
		if (currentChoice=="g") {uniChar="γ"}
		if (currentChoice=="j") {uniChar="ξ"}
		if (currentChoice=="k") {uniChar="κ"}
		if (currentChoice=="l") {uniChar="λ"}
		if (currentChoice=="m") {uniChar="μ"}
		if (currentChoice=="n") {uniChar="ν"}
		if (currentChoice=="p") {uniChar="π"}
		if (currentChoice=="r") {uniChar="ρ"}
		if (currentChoice=="s") {uniChar="σ"}
		if (currentChoice=="t") {uniChar="τ"}
		if (currentChoice=="w") {uniChar="ς"}
		if (currentChoice=="x") {uniChar="χ"}
		if (currentChoice=="y") {uniChar="θ"}
		if (currentChoice=="z") {uniChar="ζ"}
		if (currentChoice=="a") {uniChar="α"}
		if (currentChoice=="asub") {uniChar="ᾳ"}
		if (currentChoice=="e") {uniChar="ε"}
		if (currentChoice=="h") {uniChar="η"}
		if (currentChoice=="hsub") {uniChar="ῃ"}
		if (currentChoice=="i") {uniChar="ι"}
		if (currentChoice=="o") {uniChar="ο"}
		if (currentChoice=="u") {uniChar="υ"}
		if (currentChoice=="v") {uniChar="ω"}
		if (currentChoice=="vsub") {uniChar="ῳ"}
		if (currentChoice=="_") {uniChar="_"}
		checkCharChoice(currentChoice,uniChar)
	}
}

function setUnit(form) {

	unitNo = form.unit.options[form.unit.selectedIndex].value;
	if (unitNo == 3) {
		minIndex = 0
		maxIndex = 26
	}
	if (unitNo == 4) {
		minIndex = 27
		maxIndex = 56
	}
	if (unitNo == 5) {
		minIndex = 57
		maxIndex = 86
	}
	if (unitNo == 6) {
		minIndex = 87
		maxIndex = 109
	}
	if (unitNo == 7) {
		minIndex = 110
		maxIndex = 119
	}
	if (unitNo == 8) {
		minIndex = 120
		maxIndex = 150
	}
	if (unitNo == 9) {
		minIndex = 151
		maxIndex = 160
	}
	if (unitNo == 10) {
		minIndex = 161
		maxIndex = 171
	}
	if (unitNo == 11) {
		minIndex = 172
		maxIndex = 201
	}
	if (unitNo == 12) {
		minIndex = 202
		maxIndex = 216
	}
	if (unitNo == 13) {
		minIndex = 217
		maxIndex = 254
	}
	if (unitNo == 14) {
		minIndex = 255
		maxIndex = 284
	}
	if (unitNo == 15) {
		minIndex = 285
		maxIndex = 299
	}
	if (unitNo == 16) {
		minIndex = 300
		maxIndex = 330
	}
	if (unitNo == 17) {
		minIndex = 331
		maxIndex = 341
	}
	if (unitNo == 18) {
		minIndex = 342
		maxIndex = 361
	}
	if (unitNo == 19) {
		minIndex = 362
		maxIndex = 397
	}
	if (unitNo == 20) {
		minIndex = 398
		maxIndex = 421
	}
	if (unitNo == 21) {
		minIndex = 422
		maxIndex = 436
	}
	if (unitNo == 22) {
		minIndex = 437
		maxIndex = 458
	}
	if (unitNo == 23) {
		minIndex = 459
		maxIndex = 482
	}
	if (unitNo == 24) {
		minIndex = 483
		maxIndex = 502
	}
	if (unitNo == 25) {
		minIndex = 503
		maxIndex = 514
	}
	if (unitNo == 26) {
		minIndex = 515
		maxIndex = 544
	}
	if (unitNo == 27) {
		minIndex = 545
		maxIndex = 556
	}
	if (unitNo == 28) {
		minIndex = 557
		maxIndex = 566
	}
	if (unitNo == 29) {
		minIndex = 567
		maxIndex = 593
	}
	if (unitNo == 30) {
		minIndex = 594
		maxIndex = 611
	}
	if (unitNo == 31) {
		minIndex = 612
		maxIndex = 631
	}
	if (unitNo == 32) {
		minIndex = 632
		maxIndex = 650
	}
	if (unitNo == 33) {
		minIndex = 651
		maxIndex = 673
	}
	if (unitNo == 34) {
		minIndex = 674
		maxIndex = 685
	}
	if (unitNo == 35) {
		minIndex = 686
		maxIndex = 706
	}
	if (unitNo == 36) {
		minIndex = 707
		maxIndex = 716
	}
	if (unitNo == 37) {
		minIndex = 717
		maxIndex = 732
	}
	if (unitNo == 38) {
		minIndex = 733
		maxIndex = 743
	}
	if (unitNo == 39) {
		minIndex = 744
		maxIndex = 755
	}
	if (unitNo == 40) {
		minIndex = 756
		maxIndex = 779
	}
	if (unitNo == 41) {
		minIndex = 780
		maxIndex = 803
	}
	if (unitNo == 42) {
		minIndex = 804
		maxIndex = 837
	}
	counter = 1
for (var i=0;i<= 15; i++ ){
	document.images[i].src = "graphics/blankchar.gif"
	}
	drillStarted = false
	writeEmpty()
}

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

}



function showAnswer() {
	if ((drillStarted==true)&& (counter <= engGkInfo[index].answer.length) ){
		while (answerFinished==false) {
		showOneLetter()
		}
	}
}
function showOneLetter(){

	if ((drillStarted==true)&& (counter <= engGkInfo[index].answer.length) ){
	
	z = engGkInfo[index].answer.charAt(counter-1) 
	
		if (diacriticList.indexOf(z) == -1) {
			//alert (z)
			switch (z){
			case "ᾳ":
				showChar("asub")
				break
			case "ῃ":
				showChar("hsub")
				break
			case "ῳ":
				showChar("vsub")
				break
			case "α":
				showChar("a")
				break
			case "α":
				showChar("a")
				break
			case "β":
				showChar("b")
				break
			case "ψ":
				showChar("c")
				break
			case "δ":
				showChar("d")
				break
			case "ε":
				showChar("e")
				break
			case "φ":
				showChar("f")
				break
			case "γ":
				showChar("g")
				break
			case "η":
				showChar("h")
				break
			case "ι":
				showChar("i")
				break
			case "ξ":
				showChar("j")
				break
			case "κ":
				showChar("k")
				break
			case "λ":
				showChar("l")
				break
			case "μ":
				showChar("m")
				break
			case "ν":
				showChar("n")
				break
			case "ο":
				showChar("o")
				break
			case "π":
				showChar("p")
				break
			case "ρ":
				showChar("r")
				break
			case "σ":
				showChar("s")
				break
			case "τ":
				showChar("t")
				break
			case "υ":
				showChar("u")
				break
			case "ω":
				showChar("v")
				break
			case "ς":
				showChar("w")
				break
			case "χ":
				showChar("x")
				break
			case "θ":
				showChar("y")
				break
			case "ζ":
				showChar("z")
				break
			case "_":
				showChar("_")
				break
			}
			counter++
			
			if (counter > engGkInfo[index].answer.length) {
			answerFinished = true
			document.images[counter-1].src = "graphics/check.gif"
			
			}else {
			document.images[counter-1].src = "graphics/gray.gif"
			}
		}
		if (diacriticList.indexOf(z) != -1) {
		
			if (aList.indexOf(z) != -1) {
		 		n = "a"
				}
			if (eList.indexOf(z) != -1) {
		 		n = "e"
				}
			if (hList.indexOf(z) != -1) {
		 		n = "h"
				}
			if (iList.indexOf(z) != -1) {
		 		n = "i"
				}
			if (oList.indexOf(z) != -1) {
		 		n = "o"
				}
			if (uList.indexOf(z) != -1) {
		 		n = "u"
				}
			if (vList.indexOf(z) != -1) {
		 		n = "v"
				}
			if (asubList.indexOf(z) != -1) {
		 		n = "asub"
				}
			if (hsubList.indexOf(z) != -1) {
		 		n = "hsub"
				}
			if (vsubList.indexOf(z) != -1) {
		 		n = "vsub"
				}
			if (z == "ῥ"){
				n = "r"
				}
			if (diacr1List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "1.gif"
				}
			if (diacr2List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "2.gif"
				}
			if (diacr3List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "3.gif"
				}
			if (diacr4List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "4.gif"
				}
			if (diacr5List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "5.gif"
				}
			if (diacr6List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "6.gif"
				}
			if (diacr7List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "7.gif"
				}
			if (diacr8List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "8.gif"
				}
			if (diacr9List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "9.gif"
				}
			if (diacr10List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "10.gif"
				}
			if (diacr11List.indexOf(z) != -1) {
		 		document.images[counter-1].src = "graphics2/" + n + "11.gif"
				}
			
			
			counter++
			
			if (counter > engGkInfo[index].answer.length) {
			answerFinished = true
			document.images[counter-1].src = "graphics/check.gif"
			
			}else {
			document.images[counter-1].src = "graphics/gray.gif"
			}
		}
		
		
		
	}

}



function writeAndClose(){

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

function openPdgm() {
if (drillStarted == true) {
	z = engGkInfo[index].pdgm 
	//alert(z)
	if (z.charAt(0) != "p") {
		vbpno = z.substring(3)
		//alert(vbpno)
	var pdgmtest = "verbpdgm" + vbpno + ","
	if (verbPdgmList4.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtables4BOM.html#verbpdgm" + vbpno 
	}

	if (verbPdgmList5.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtables5BOM.html#verbpdgm" + vbpno 
	}

	if (verbPdgmList6.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtables6BOM.html#verbpdgm" + vbpno
	}
	//alert(whichOne)
		window.open(whichOne,"Paradigms", "width=760,height=550,scrollbars=yes,resizable=yes,menubar=yes")
			} else {
	//alert('else called')
	var pdgmtest = engGkInfo[index].pdgm  + ","
	if (nounPdgmList.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtablesBOM.html#" + engGkInfo[index].pdgm  
	}

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

	if (adjPdgmList.indexOf(pdgmtest) !== -1) {
	
	whichOne = "../paradigmsU/paradigmtables3BOM.html#" + engGkInfo[index].pdgm  
	}
	//alert(whichOne)
		window.open(whichOne,"Paradigms", "width=760,height=550,scrollbars=yes,resizable=yes,menubar=yes")
		
	}
}
}

function openInstr() {
  popupWin = window.open('enggk_instrU.html', 'Instructions', 'width=350,height=350,resizable=yes,scrollbars=yes')

}

function openInfo() {
	
		if (!infoWindow || infoWindow.closed){
			infoWindow = window.open("","","width=320,height=80,resizable=yes,menubar=yes")
			if (!infoWindow.opener) {
			infoWindow.opener = window
			}
			createThisString()
			infoString = startString2 + thisInfoString + endString2
			
	
			infoWindow.document.write(infoString)
			infoWindow.document.close()
		}else {
		createThisString()
		infoString = startString2 + thisInfoString + endString2
			
	
		infoWindow.document.write(infoString)
		infoWindow.document.close()
			infoWindow.focus()
		}
		
	

}

function createThisString() {
	x = engGkInfo[index].vocabpointer
		thisInfoString= '<span class="lemma">'  + vInfo[x].lemma + ', ' +  vInfo[x].rest +'</span>&nbsp;&nbsp;&nbsp;<span class="added">'+ vInfo[x].added + '</span>'
//alert(thisInfoString)	
}
