beginImage1 = new Image(240,30)
beginImage1.src = "PPgraphics0/begin1.gif"
beginImage2 = new Image(240,30)
beginImage2.src = "PPgraphics0/begin2.gif"
beginImage3 = new Image(240,30)
beginImage3.src = "PPgraphics0/begin3.gif"
nextImage1 = new Image(240,30)
nextImage1.src = "PPgraphics0/show1.gif"
nextImage2 = new Image(240,30)
nextImage2.src = "PPgraphics0/show2.gif"
nextImage3 = new Image(240,30)
nextImage3.src = "PPgraphics0/show3.gif"



var drillType = 6
var isBlankLeft = false
var isBlankRight = false
var NoIsBlank = false
var drillStarted = false
var minCounter = 1
var maxCounter = 17
var COUNTER = 1
var lastDone = 0
var folderIndex = 0
function pp1() {
	checkPPNoforBlank(1)
	if (COUNTER < 100) {
	folderIndex = 0
	}
	else {
		if ((COUNTER > 99) && (COUNTER <200)) {
		folderIndex = 1}
		else {
		if ((COUNTER > 199) && (COUNTER <300)) {
		folderIndex = 2
		}

		}

	}
	document.pp1.src= "PPgraphics"+ folderIndex +"/" + COUNTER + "pp1.gif"
    document.ppMeaning.meaningString.value = " ";
    lastDone = 1
    if (NoIsBlank == true) {
    	pp2()
    }
    checkPPNoforBlank(2)
    if (NoIsBlank == true) {
    		pp2()
    }

    }   
function pp2() {
    document.pp2.src= "PPgraphics"+ folderIndex +"/" + COUNTER + "pp2.gif";
    lastDone = 2
    checkPPNoforBlank(3)
    if (NoIsBlank == true) {
    pp3()
    }

    }   
function pp3() {
    document.pp3.src= "PPgraphics"+ folderIndex +"/" + COUNTER + "pp3.gif";
    lastDone = 3
    if (drillType == 3) {
     var ppMeaning = meanings[COUNTER-1]
    var myString = '<FONT SIZE="+1" COLOR="#0000FF" FACE="palatino">MEANING: </FONT>'
    var myString2 = '<FONT SIZE="+1" COLOR="#0000FF" FACE="palatino">ppMeaning</FONT>'
    
    document.ppMeaning.meaningString.value = ppMeaning
    }   
    if (drillType !== 3) {
		checkPPNoforBlank(4)
		if (NoIsBlank == true) {
			pp4()
		}
	}  

}   
function pp4() {
	document.pp4.src= "PPgraphics"+ folderIndex +"/" + COUNTER + "pp4.gif";
    lastDone = 4
    checkPPNoforBlank(5)
	if (NoIsBlank == true) {
		pp5()
	}
}   
function pp5() {
	document.pp5.src= "PPgraphics"+ folderIndex +"/" + COUNTER + "pp5.gif";
    lastDone = 5
    checkPPNoforBlank(6)
	if (NoIsBlank == true) {
		pp6()
	}
}   
function pp6() {
	document.pp6.src= "PPgraphics"+ folderIndex +"/" + COUNTER + "pp6.gif";
    lastDone = 6
    var ppMeaning = meanings[COUNTER-1]
    var myString = '<FONT SIZE="+1" COLOR="#0000FF" FACE="palatino">MEANING: </FONT>'
    var myString2 = '<FONT SIZE="+1" COLOR="#0000FF" FACE="palatino">ppMeaning</FONT>'
    document.ppMeaning.meaningString.value = ppMeaning
}   
function setStart(form) {
	startUnitNo = form.drillstart.options[form.drillstart.selectedIndex].value;
	endUnitNo = form.drillend.options[form.drillend.selectedIndex].value;
<!-- 	alert(startUnitNo + " " + COUNTER) -->
	if (startUnitNo == 8){
		minCounter = 1
		}
	if (startUnitNo == 9){
		minCounter = 18
		}
	if (startUnitNo == 10){
		minCounter = 27
		}
	if (startUnitNo == 11){
		minCounter = 32
		}
	if (startUnitNo == 13){
		minCounter = 48
		}
	if (startUnitNo == 16){
		minCounter = 66
		}
	if (startUnitNo == 17){
		minCounter = 78
		}
	if (startUnitNo == 18){
		minCounter = 83
		}
	if (startUnitNo == 19){
		minCounter = 88
		}
	if (startUnitNo == 23){
		minCounter = 94
		}
	if (startUnitNo == 24){
		minCounter = 120
		}
	if (startUnitNo == 26){
		minCounter = 134
		}
	if (startUnitNo == 27){
		minCounter = 143
		}
	if (startUnitNo == 28){
		minCounter = 149
		}
	if (startUnitNo == 29){
		minCounter = 167
		}
	if (startUnitNo == 30){
		minCounter = 182
		}
	if (startUnitNo == 32){
		minCounter = 189
		}
	if (startUnitNo == 33){
		minCounter = 207
		}
	if (startUnitNo == 34){
		minCounter = 226
		}
	if (startUnitNo == 37){
		minCounter = 233
		}
	if (startUnitNo == 38){
		minCounter = 240
		}
	if (startUnitNo == 39){
		minCounter = 254
		}
	if (startUnitNo == 40){
		minCounter = 267
		}
	if (startUnitNo == 41){
		minCounter = 275
		}
	if (parseInt(startUnitNo) > parseInt(endUnitNo)) {
	form.drillend.options[form.drillstart.selectedIndex].selected = true
	setEnd(form)
		}
	plainBegin();
	disableNext();
	if ((drillType==3)||(drillType==6)) {
	clearPPs()
	}
	else {
	clearPPs2()
	}
	drillStarted = false
<!-- 	alert("mincounter is " + minCounter + " and maxCounter is " + maxCounter) -->
}
function setEnd(form) {
	startUnitNo = form.drillstart.options[form.drillstart.selectedIndex].value;
	endUnitNo = form.drillend.options[form.drillend.selectedIndex].value;
<!-- 	alert(endUnitNo + " " + minCounter); -->
	if (parseInt(endUnitNo) >= parseInt(startUnitNo)) {
	
		if (endUnitNo == 8){
			maxCounter = 17
			}
		if (endUnitNo == 9){
			maxCounter = 26
			}
		if (endUnitNo == 10){
			maxCounter = 31
			}
		if (endUnitNo == 11){
			maxCounter = 47
			}
		if (endUnitNo == 13){
			maxCounter = 65
			}
		if (endUnitNo == 16){
			maxCounter = 77
			}
		if (endUnitNo == 17){
			maxCounter = 82
			}
		if (endUnitNo == 18){
			maxCounter = 87
			}
		if (endUnitNo == 19){
			maxCounter = 93
			}
		if (endUnitNo == 23){
			maxCounter = 119
			}
		if (endUnitNo == 24){
			maxCounter = 133
			}
		if (endUnitNo == 26){
			maxCounter = 142
			}
		if (endUnitNo == 27){
			maxCounter = 148
			}
		if (endUnitNo == 28){
			maxCounter = 166
			}
		if (endUnitNo == 29){
			maxCounter = 181
			}
		if (endUnitNo == 30){
			maxCounter = 188
			}
		if (endUnitNo == 32){
			maxCounter = 206
			}
		if (endUnitNo == 33){
			maxCounter = 225
			}
		if (endUnitNo == 34){
			maxCounter = 232
			}
		if (endUnitNo == 37){
			maxCounter = 239
			}
		if (endUnitNo == 38){
			maxCounter = 253
			}
		if (endUnitNo == 39){
			maxCounter = 266
			}
		if (endUnitNo == 40){
			maxCounter = 274
			}
		if (endUnitNo == 41){
			maxCounter = 281
			}
	}
	else {
			alert("End unit cannot be lower than start unit.");
			form.drillend.options[form.drillstart.selectedIndex].selected = true
			setEnd(form)
			}
	plainBegin();
	disableNext();
	if ((drillType==3)||(drillType==6)) {
	clearPPs()
	}
	else {
	clearPPs2()
	}
	drillStarted = false
	}
function boldBegin() {
	if (drillStarted == false) {
	document.begin.src = "PPgraphics0/begin2.gif"
	}
}
function boldNext() {
	if (drillStarted == true) {
	document.next.src = "PPgraphics0/show2.gif"
	}
}
function disableBegin() {
	if (drillStarted == false) { 
	document.begin.src = "PPgraphics0/begin3.gif"
	}
}
function plainBegin() {
	document.begin.src = "PPgraphics0/begin1.gif"
}
function plainNext() {
	if (drillStarted == true) { 
	document.next.src = "PPgraphics0/show1.gif"
	}
}
function disableNext() {
	document.next.src = "PPgraphics0/show3.gif"
}
function clearPPs(){
		document.pp1.src= "PPgraphics0/empty.gif";
		document.pp2.src= "PPgraphics0/empty.gif";
		document.pp3.src= "PPgraphics0/empty.gif";
	if (drillType == 6) {
		document.pp4.src= "PPgraphics0/empty.gif";
		document.pp5.src= "PPgraphics0/empty.gif";
		document.pp6.src= "PPgraphics0/empty.gif";
		}
		document.ppMeaning.meaningString.value = " "
}
function begindrill() {
	if (drillStarted == false) {
	drillStarted = true;
	clearPPs();
	COUNTER = minCounter;
	 	plainNext();
	 pp1() ;
	}    
}   

function checkPPNoforBlank(n) {
	var blankList = ",2pp5,2pp6,5pp5,5pp6,7pp5,8pp6,10pp4,13pp5,13pp6,17pp5,17pp6,22pp4,22pp5,22pp6,23pp4,23pp6,24pp3,24pp4,24pp5,24pp6,25pp2,25pp3,25pp4,25pp5,25pp6,26pp3,26pp4,26pp5,26pp6,28pp3,28pp4,28pp5,28pp6,30pp5,30pp6,32pp5,33pp5,33pp6,37pp4,39pp4,39pp6,40pp4,40pp6,41pp3,41pp4,43pp5,43pp6,44pp4,44pp6,45pp3,45pp4,45pp5,46pp4,46pp6,47pp4,47pp6,48pp3,48pp4,48pp5,48pp6,51pp4,51pp6,53pp4,53pp5,53pp6,54pp4,54pp5,54pp3,55pp3,55pp4,55pp5,55pp6,56pp4,57pp4,57pp6,59pp5,59pp6,63pp4,64pp3,64pp4,68pp4,68pp5,68pp6,70pp5,70pp6,71pp5,72pp4,75pp5,75pp6,79pp4,79pp6,81pp4,84pp5,84pp6,85pp4,85pp5,85pp6,87pp5,87pp6,90pp4,90pp5,90pp6,92pp4,92pp5,93pp4,93pp5,93pp6,115pp4,116pp5,117pp2,117pp3,117pp4,117pp5,117pp6,118pp2,118pp3,118pp4,118pp5,118pp6,119pp2,119pp3,119pp4,119pp5,119pp6,120pp5,120pp6,124pp5,124pp6,130pp5,130pp6,131pp5,131pp6,133pp3,133pp4,139pp4,142pp4,142pp6,143pp5,145pp4,145pp5,145pp6,146pp3,146pp4,146pp5,146pp6,147pp3,147pp4,147pp5,147pp6,152pp5,152pp6,153pp5,153pp6,155pp4,156pp4,157pp3,157pp4,157pp5,158pp3,158pp4,158pp5,159pp6,160pp3,160pp5,160pp6,161pp3,161pp4,162pp2,162pp4,162pp5,162pp6,165pp5,165pp6,166pp4,166pp5,166pp6,168pp4,168pp5,168pp6,171pp5,171pp6,172pp4,173pp4,175pp4,178pp4,182pp5,182pp6,184pp6,185pp4,185pp5,186pp4,187pp3,187pp4,193pp3,192pp4,193pp4,193pp6,199pp4,199pp5,199pp6,200pp5,202pp5,202pp6,203pp4203pp6,205pp5,206pp6,207pp4,209pp5,209pp6,210pp5,210pp6,212pp6,213pp6,214pp4,214pp5,217pp3,217pp4,217pp5,218pp4,218pp5,218pp6,221pp4,221pp5,221pp6,224pp4,227pp5,227pp6,228pp3,228pp4,228pp5,228pp6,231pp4,232pp6,233pp5,233pp6,234pp5,234pp6,237pp4,238pp4,243pp3,243pp4,243pp5,245pp4,247pp5,247pp6,248pp5,248pp6,249pp3,249pp4,250pp4,250pp6,251pp3,251pp4,251pp5,251pp6,252pp4,252pp5,252pp6,256pp6,257pp5,257pp6,258pp3,258pp4,258pp5,258pp6,259pp3,259pp4,259pp5,259pp6,260pp3,260pp5,263pp4,263pp5,267pp4,268pp5,269pp2,269pp3,269pp4,269pp5,269pp6,270pp2,270pp3,270pp4,270pp5,270pp6,271pp2,271pp3,271pp4,271pp5,271pp6,272pp5,272pp6,273pp5,273pp6,274pp3,274pp5,276pp5,276pp6,277pp3,277pp5,277pp6,281pp3,281pp4"
	var PPTest = "," + COUNTER + "pp" + n
	//alert(isBlank)
	 if (blankList.indexOf(PPTest) !== -1){
	 NoIsBlank = true
	 }
	 else {
	 NoIsBlank = false
	 }
}

function checkPPforBlank() {
	var blankList = ",2pp5,2pp6,5pp5,5pp6,7pp5,8pp6,10pp4,13pp5,13pp6,17pp5,17pp6,22pp4,22pp5,22pp6,23pp4,23pp6,24pp3,24pp4,24pp5,24pp6,25pp2,25pp3,25pp4,25pp5,25pp6,26pp3,26pp4,26pp5,26pp6,28pp3,28pp4,28pp5,28pp6,30pp5,30pp6,32pp5,33pp5,33pp6,37pp4,39pp4,39pp6,40pp4,40pp6,41pp3,41pp4,43pp5,43pp6,44pp4,44pp6,45pp3,45pp4,45pp5,46pp4,46pp6,47pp4,47pp6,48pp3,48pp4,48pp5,48pp6,51pp4,51pp6,53pp4,53pp5,53pp6,54pp4,54pp5,54pp3,55pp3,55pp4,55pp5,55pp6,56pp4,57pp4,57pp6,59pp5,59pp6,63pp4,64pp3,64pp4,68pp4,68pp5,68pp6,70pp5,70pp6,71pp5,72pp4,75pp5,75pp6,79pp4,79pp6,81pp4,84pp5,84pp6,85pp4,85pp5,85pp6,87pp5,87pp6,90pp4,90pp5,90pp6,92pp4,92pp5,93pp4,93pp5,93pp6,115pp4,116pp5,117pp2,117pp3,117pp4,117pp5,117pp6,118pp2,118pp3,118pp4,118pp5,118pp6,119pp2,119pp3,119pp4,119pp5,119pp6,120pp5,120pp6,124pp5,124pp6,130pp5,130pp6,131pp5,131pp6,133pp3,133pp4,139pp4,142pp4,142pp6,143pp5,145pp4,145pp5,145pp6,146pp3,146pp4,146pp5,146pp6,147pp3,147pp4,147pp5,147pp6,152pp5,152pp6,153pp5,153pp6,155pp4,156pp4,157pp3,157pp4,157pp5,158pp3,158pp4,158pp5,159pp6,160pp3,160pp5,160pp6,161pp3,161pp4,162pp2,162pp4,162pp5,162pp6,165pp5,165pp6,166pp4,166pp5,166pp6,168pp4,168pp5,168pp6,171pp5,171pp6,172pp4,173pp4,175pp4,178pp4,182pp5,182pp6,184pp6,185pp4,185pp5,186pp4,187pp3,187pp4,193pp3,192pp4,193pp4,193pp6,199pp4,199pp5,199pp6,200pp5,202pp5,202pp6,203pp4203pp6,205pp5,206pp6,207pp4,209pp5,209pp6,210pp5,210pp6,212pp6,213pp6,214pp4,214pp5,217pp3,217pp4,217pp5,218pp4,218pp5,218pp6,221pp4,221pp5,221pp6,224pp4,227pp5,227pp6,228pp3,228pp4,228pp5,228pp6,231pp4,232pp6,233pp5,233pp6,234pp5,234pp6,237pp4,238pp4,243pp3,243pp4,243pp5,245pp4,247pp5,247pp6,248pp5,248pp6,249pp3,249pp4,250pp4,250pp6,251pp3,251pp4,251pp5,251pp6,252pp4,252pp5,252pp6,256pp6,257pp5,257pp6,258pp3,258pp4,258pp5,258pp6,259pp3,259pp4,259pp5,259pp6,260pp3,260pp5,263pp4,263pp5,267pp4,268pp5,269pp2,269pp3,269pp4,269pp5,269pp6,270pp2,270pp3,270pp4,270pp5,270pp6,271pp2,271pp3,271pp4,271pp5,271pp6,272pp5,272pp6,273pp5,273pp6,274pp3,274pp5,276pp5,276pp6,277pp3,277pp5,277pp6,281pp3,281pp4"
	var leftTest = "," + COUNTER + "pp" + leftNo
	var rightTest = "," + COUNTER + "pp" + rightNo
	//alert(isBlank)
	 if (blankList.indexOf(leftTest) !== -1){
	 isBlankLeft = true
	 }
	 else {
	 isBlankLeft = false
	 }
	 if (blankList.indexOf(rightTest) !== -1){
	 isBlankRight = true
	 }
	 else {
	 isBlankRight = false
	 }
}

