<!--
var i = 0;
var j = 0;
var rows = "";
var columns = "";
var display = "";
var answerKey = 'Please Click the "Make Worksheet" button first.';
var lessonList = new Array();
var hatArray = [];
var usableLetters = ["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"];
var upperLimit = "";
var lowerLimit = "";
var hatIndex = ""
var result = "";
var developer = "false";
//*******************************************Alpha Functions****************************************************
function Alpha04() {
	var operator = new Array();
	operator[0] = 0;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha05() {
	var operator = new Array();
	operator[0] = 1;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha07() {
	var operator = new Array();
	operator[0] = 2;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha08() {
	var operator = new Array();
	operator0Choices = new Array(0, 1, 2);
	operator[0] = operator0Choices[Math.floor(Math.random() * 3)];
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemAnswer = operator[firstOperatorIndex] + operator[secondOperatorIndex];
	answerKey += operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex] + " = " + problemAnswer;
	var unknownPosition = (Math.floor(Math.random() * 2));
	operator[unknownPosition] = "___";
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex] + " = " + problemAnswer;
	display += problemText;
}
function Alpha09() {
	var operator = new Array();
	operator[0] = 9;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha10() {
	var operator = new Array();
	operator[0] = 8;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha12() {
	var operator = Math.floor(Math.random() * 10);
	problemText = operator + " + " + operator;
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha14() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 9);
	operator[1] = operator[0] + 1;
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha15() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 10);
	operator[1] = 10 - operator[0];
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha16() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 10);
	operator[1] = 9 - operator[0];
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha17() {
	var problemSet = new Array("3 + 5", "4 + 7", "5 + 7", "5 + 3", "7 + 4", "7 + 5");
	var problemIndex = Math.floor(Math.random() * 6);
	problemText = problemSet[problemIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha19() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 2);
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	//to keep things simple, subtraction problems will be built first as addition
	//problems, then the order of the operators will be switched
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha20() {
	var operator = new Array();
	operator[0] = 2;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha21() {
	var operator = new Array();
	operator[0] = 9;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = 0;
	var	secondOperatorIndex = 1;
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha22() {
	var operator = new Array();
	operator[0] = 8;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = 0;
	var	secondOperatorIndex = 1;
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha23() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 10);
	operator[1] = operator[0];
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha24() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 11);
	operator[1] = 10 - operator[0];
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha25() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 10);
	operator[1] = 9 - operator[0];
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha26() {
	var problemSet = new Array("7 - 4", "7 - 3", "8 - 5", "8 - 3");
	var problemIndex = Math.floor(Math.random() * 4);
	problemText = problemSet[problemIndex];
	problemAnswer = eval(problemText);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Alpha27() {
	var operator = new Array();
	operator[0] = 7;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = 0;
	var	secondOperatorIndex = 1;
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha28() {
	var operator = new Array();
	operator[0] = 6;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = 0;
	var	secondOperatorIndex = 1;
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha29() {
	var operator = new Array();
	operator[0] = 5;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = 0;
	var	secondOperatorIndex = 1;
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);

	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
function Alpha30() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 2) + 3;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = 0;
	var	secondOperatorIndex = 1;
	problemText = operator[firstOperatorIndex] + " + " + operator[secondOperatorIndex];
	problemSum = eval(problemText);
	display += problemSum + " - " + operator[firstOperatorIndex] + " = ";	
	problemAnswer = operator[secondOperatorIndex];
	answerKey += problemSum + " - " + operator[firstOperatorIndex] + " = " + problemAnswer;
}
//*******************************************Beta Functions****************************************************
function Beta03() {
	firstNumber = pickFromRange(5, 30);
	answerSymbol = pickFromList(["<", "=", ">"]);
	switch(answerSymbol) {
		case ">": 
			secondNumber = pickFromRange(1, (firstNumber - 1));
			break;
		case "=":
			secondNumber = firstNumber;
			break;
		case "<":
			secondNumber = pickFromRange((firstNumber + 1), 30);
			break;
	}
	
	//I don't want the numbers to be expanded every time, so I'm creating a "filter" variable that makes it happen part of the time
	filter1 = pickFromList([1, 1, 1, 2, 2]); //these lines reduce it some, but they are reduced further by the 2 lines below, as well.
	filter2 = pickFromList([1, 1, 1, 2, 2]);
	
	firstNumber = (filter1 == 1 && firstNumber <= 18) ? expand(firstNumber) : firstNumber;
	secondNumber = (filter2 ==1 && secondNumber <= 18) ? expand(secondNumber) : secondNumber;
	
	display += '<table><tr><td>' + firstNumber + '</td><td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>' + secondNumber + '</td></tr></table>';
	answerKey += '<table><tr><td>' + firstNumber + '</td><td class="numerator">&nbsp;' + answerSymbol + '&nbsp;</td><td>' + secondNumber + '</td></tr></table>';
}
//round to nearest 10
function Beta04() {
	numberToRound = pickFromRange(11, 89);
	roundedNumber = schoolRound(numberToRound, 10);
	if(numberToRound == roundedNumber) {
		Beta04();
		return(null);
	}
	
	display += '<table><tr><td colspan="3" width="33%">Round to nearest 10:</td></tr><tr><td colspan="3">&nbsp;</td></tr><tr><td width="33%"></td><td>' + numberToRound + '&nbsp;&rarr;&nbsp;<td class="numerator" width="34%"></td></tr></table>';
	answerKey += '<table><tr><td colspan="3" width="33%">Round to nearest 10:</td></tr><tr><td colspan="3">&nbsp;</td></tr><tr><td width="33%"></td><td>' + numberToRound + '&nbsp;&rarr;&nbsp;<td class="numerator" width="34%">' + roundedNumber + '</td></tr></table>';
}

function Beta05() {
	var topDigits = new Array();
		for (var ii = 0; ii < topDigits.length; ii ++) {
			topDigits[ii] = null;
		}
	var bottomDigits = new Array();
		for (var ii = 0; ii < bottomDigits.length; ii ++) {
			bottomDigits[ii] = null;
		}
	topDigits.length = 0;
	bottomDigits.length = 0;
	var topNumber = 0;
	var bottomNumber = 0;
		for (d = 0; d < 3; d++) {//loop 3 times
			topDigits[d] = (Math.floor(Math.random() * 9)) + 1;//pick a number between 1 and 9, inclusive
			topNumber += topDigits[d] * Math.pow(10, d);//build top addend
		}
		for (d = 0; d < 3; d++) {//loop 3 times
			bottomDigits[d] = (Math.floor(Math.random() * (8 - topDigits[d]))) + 1;//pick a digit limited in size by the corresponding top digit
			bottomNumber += bottomDigits[d] * Math.pow(10, d);//build bottom addend
		}
	problemAnswer = topNumber + bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta07() {
	var topDigits = new Array();
		for (var ii = 0; ii < topDigits.length; ii ++) {
			topDigits[ii] = null;
		}
	var bottomDigits = new Array();
		for (var ii = 0; ii < bottomDigits.length; ii ++) {
			bottomDigits[ii] = null;
		}
	topDigits.length = 0;
	bottomDigits.length = 0;
	var topNumber = 0;
	var bottomNumber = 0;
		for (d = 0; d < 2; d++) {//loop 2 times
			topDigits[d] = (Math.floor(Math.random() * (9 - (d * 2)))) + 1;//pick a number between 1 and 9 the first time, and between 1 and 7 the second time.
			                                                                 //the first time d is 0, so subtracting it from 8 has no effect, the second time it does.
			topNumber += topDigits[d] * Math.pow(10, d);//build top number
		}
		bottomDigits[0] = (Math.floor(Math.random() * (topDigits[0]))) + (10 - topDigits[0]);//pick a digit that will force a carry
		bottomNumber += bottomDigits[0] * Math.pow(10, 0);//build bottom number (units place)
		bottomDigits[1] = (Math.floor(Math.random() * (9 - topDigits[1])));//pick a digit that will not force a second carry.
		bottomNumber += bottomDigits[1] * Math.pow(10, 1);//build bottom number (tens place)
	problemAnswer = topNumber + bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta11() {
	var topNumber = (Math.floor(Math.random() * 890) + 100);
	var bottomNumber = (Math.floor(Math.random() * (990 - topNumber)) + 10);
	problemAnswer = topNumber + bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta13() {
	var row1 = (Math.floor(Math.random() * 100) + 1);
	var row2 = (Math.floor(Math.random() * 100) + 1);
	var row3 = (Math.floor(Math.random() * 100) + 1);
	var row4 = (Math.floor(Math.random() * 100) + 1);
	var problemAnswer = row1 + row2 + row3 + row4;
	display += '<table><tr><td></td><td align="right">' + row1 + '</td></tr>';
	display += '<tr><td></td><td align="right">' + row2 + '</td></tr>';
	display += '<tr><td></td><td align="right">' + row3 + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + row4 + '</td></tr>';
	display += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + row1 + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + row2 + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + row3 + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + row4 + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta16() {
	var topNumber = (Math.floor(Math.random() * 890) + 100);
	var bottomNumber = (Math.floor(Math.random() * 890) + 100);
	problemAnswer = topNumber + bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta18() {
	var row1 = (Math.floor(Math.random() * 1000) + 1);
	var row2 = (Math.floor(Math.random() * 1000) + 1);
	var row3 = (Math.floor(Math.random() * 1000) + 1);
	var row4 = (Math.floor(Math.random() * 1000) + 1);
	var problemAnswer = row1 + row2 + row3 + row4;
	display += '<table><tr><td></td><td align="right">' + row1 + '</td></tr>';
	display += '<tr><td></td><td align="right">' + row2 + '</td></tr>';
	display += '<tr><td></td><td align="right">' + row3 + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + row4 + '</td></tr>';
	display += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + row1 + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + row2 + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + row3 + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + row4 + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta19() {
	var row1 = (Math.floor(Math.random() * 10000) + 1);
	var row2 = (Math.floor(Math.random() * 10000) + 1);
	var row3 = (Math.floor(Math.random() * 10000) + 1);
	var row4 = (Math.floor(Math.random() * 10000) + 1);
	var problemAnswer = row1 + row2 + row3 + row4;
	display += '<table><tr><td></td><td align="right">' + row1 + '</td></tr>';
	display += '<tr><td></td><td align="right">' + row2 + '</td></tr>';
	display += '<tr><td></td><td align="right">' + row3 + '</td></tr>';
	display += '<tr><td>+</td><td align="right">' + row4 + '</td></tr>';
	display += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + row1 + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + row2 + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + row3 + '</td></tr>';
	answerKey += '<tr><td>+</td><td align="right">' + row4 + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta20() {
	var topDigits = new Array();
		for (var ii = 0; ii < topDigits.length; ii ++) {
			topDigits[ii] = null;
		}
	var bottomDigits = new Array();
		for (var ii = 0; ii < bottomDigits.length; ii ++) {
			bottomDigits[ii] = null;
		}
	topDigits.length = 0;
	bottomDigits.length = 0;
	var topNumber = 0;
	var bottomNumber = 0;
		for (d = 0; d < 3; d++) {//loop 3 times
			topDigits[d] = (Math.floor(Math.random() * 9)) + 1;//pick a digit between 1 and 9, inclusive
			topNumber += topDigits[d] * Math.pow(10, d);//build top number
		}
		for (d = 0; d < 3; d++) {//loop 3 times
			bottomDigits[d] = (Math.floor(Math.random() * (topDigits[d] - 1))) + 1;//pick a digit limited in size by the corresponding top digit
			bottomNumber += bottomDigits[d] * Math.pow(10, d);//build bottom number
		}
	problemAnswer = topNumber - bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta22() {
	var topDigits = new Array();
		for (var ii = 0; ii < topDigits.length; ii ++) {
			topDigits[ii] = null;
		}
	var bottomDigits = new Array();
		for (var ii = 0; ii < bottomDigits.length; ii ++) {
			bottomDigits[ii] = null;
		}
	topDigits.length = 0;
	bottomDigits.length = 0;
	var topNumber = 0;
	var bottomNumber = 0;
		for (d = 0; d < 2; d++) {//loop 2 times
			topDigits[d] = (Math.floor(Math.random() * 8)) + 1;//pick a number between 1 and 9, inclusive
			topNumber += topDigits[d] * Math.pow(10, d);//build top number
		}
		bottomDigits[0] = (Math.floor(Math.random() * (8 - topDigits[0]))) + (topDigits[0] + 1);//pick a digit greater than the corresponding top digit
		bottomNumber += bottomDigits[0] * Math.pow(10, 0);//build bottom number
		bottomDigits[1] = (Math.floor(Math.random() * (topDigits[1])));//pick a digit less than the corresponding top digit
		bottomNumber += bottomDigits[1] * Math.pow(10, 1);//build bottom number
	problemAnswer = topNumber - bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta24() {
	var topNumber = Math.floor(Math.random() * 900) + 100;
	var bottomNumber = Math.floor(Math.random() * (topNumber - 100)) + 100;
	problemAnswer = topNumber - bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta26() {
	var topNumber = Math.floor(Math.random() * 9000) + 1000;
	var bottomNumber = Math.floor(Math.random() * (topNumber - 100)) + 100;
	problemAnswer = topNumber - bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Beta28() {
	var topNumber = Math.floor(Math.random() * 90000) + 10000;
	var bottomNumber = Math.floor(Math.random() * (topNumber - 100)) + 100;
	problemAnswer = topNumber - bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>-</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
//*******************************************Gamma Functions***************************************************
function Gamma02() {
	var operator = new Array();
	operator[0] = Math.floor(Math.random() * 2);
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma04() {
	var operator = new Array();
	operator[0] = 2;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma06() {
	var operator = new Array();
	operator[0] = 5;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma08() {
	var letterValue = pickFromRange(1, 10);
	var coefficient = pickFromList([2, 5, 10]);
	var letter = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
	var change = pickFromList(["yes"], ["no"]);
	if (change == "yes"){
		var oldLetterValue = letterValue;
		letterValue = coefficient;
		coefficient = oldLetterValue
	}
	
	display += coefficient + letter + " = " + (coefficient * letterValue);
	answerKey += coefficient + " x " + letterValue + " = " + (coefficient * letterValue);
}
function Gamma10() {
	var operator = new Array();
	operator[0] = 9;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma12() {
	var operator = new Array();
	operator[0] = 3;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma14() {
	var operator = new Array();
	operator[0] = 6;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma16() {
	var operator = new Array();
	operator[0] = 4;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma18() {
	var operator = new Array();
	operator[0] = 7;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma20() {
	var operator = new Array();
	operator[0] = 8;
	operator[1] = Math.floor(Math.random() * 10);
	var firstOperatorIndex = (Math.floor(Math.random() * 2));
	if (firstOperatorIndex == 0) {
		secondOperatorIndex = 1;
	}else{
		secondOperatorIndex = 0;
	}//end if
	problemText = operator[firstOperatorIndex] + " x " + operator[secondOperatorIndex];
	problemText2 = operator[firstOperatorIndex] + " * " + operator[secondOperatorIndex];
	problemAnswer = eval(problemText2);
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Gamma21() {
	var topDigits = new Array();
		for (var ii = 0; ii < topDigits.length; ii ++) {
			topDigits[ii] = null;
		}	topDigits.length = 0;
	var topNumber = 0;
	var bottomNumber = (Math.floor(Math.random() * 3)) + 2;
		for (d = 0; d < 3; d++) {//loop 3 times
			topDigits[d] = (Math.floor(Math.random() * Math.floor(9 / bottomNumber))) + 1;//pick a digit limited in size by the bottom number
			if ((d > 0) && (topDigits[d] == topDigits[d - 1])) { // We're working from right to left here...
				topDigits[d] = topDigits[d] - 1;                   // this if statement prevents the same digit from being picked 2 times in a row,
			}                                                     // and also allows the first (100's) digit to be zero
			topNumber += topDigits[d] * Math.pow(10, d);//build top multiplier
		}
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;<br><br></td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Gamma23() {
	var topDigits = new Array();
		for (var ii = 0; ii < topDigits.length; ii ++) {
			topDigits[ii] = null;
		}
	var bottomDigits = new Array();
		for (var ii = 0; ii < bottomDigits.length; ii ++) {
			bottomDigits[ii] = null;
		}
	topDigits.length = 0;
	bottomDigits.length = 0;
	var topNumber = 0;
	var bottomNumber = 0;
	var largeDigit = 0;
		for (d = 0; d < 2; d++) {//loop 2 times
			bottomDigits[d] = (Math.floor(Math.random() * 4)) + 1;//pick a number between 1 and 4, inclusive
			bottomNumber += bottomDigits[d] * Math.pow(10, d);//build bottom multiplier
		}
		if (bottomDigits[0] > bottomDigits[1]) {
			largeDigit = bottomDigits[0];
			}else{
			largeDigit = bottomDigits[1];
		}
		for (d = 0; d < 2; d++) {//loop 2 times
			topDigits[d] = (Math.floor(Math.random() * Math.floor(9 / largeDigit))) + 1;//pick a digit limited in size by the larger of the 2 top digits
			topNumber += topDigits[d] * Math.pow(10, d);//build top multiplier
		}
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Gamma24() {
	var topNumber = (Math.floor(Math.random() * 90) + 10);
	var bottomNumber = (Math.floor(Math.random() * 90) + 10);
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Gamma251() {
	var topNumber = (Math.floor(Math.random() * 900) + 100);
	var bottomNumber = (Math.floor(Math.random() * 90) + 10);
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Gamma252() {
	var topNumber = (Math.floor(Math.random() * 900) + 100);
	var bottomNumber = (Math.floor(Math.random() * 900) + 100);
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Gamma281() {
	var topNumber = (Math.floor(Math.random() * 9000) + 1000);
	var bottomNumber = (Math.floor(Math.random() * 990) + 10);
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
function Gamma282() {
	var topNumber = (Math.floor(Math.random() * 9000) + 1000);
	var bottomNumber = (Math.floor(Math.random() * 9990) + 10);
	problemAnswer = topNumber * bottomNumber;
	display += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	display += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	display += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	display += '<tr><td></td><td align="right">&nbsp;</td></tr></table>';
	
	answerKey += '<table><tr><td></td><td align="right">' + topNumber + '</td></tr>';
	answerKey += '<tr><td>x</td><td align="right">' + bottomNumber + '</td></tr>';
	answerKey += '<tr><td  height="1" colspan="2"><img src="http://www.mathusee.com/images/worksheet/blackpixel.gif" width="100%" height="100%"></td></tr>';
	answerKey += '<tr><td></td><td align="right">' + problemAnswer + '</td></tr></table>';
}
//*******************************************Delta Functions***************************************************
function Delta02() {
	factor1 = Math.floor(Math.random() * 2) + 1;
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta03() {
	factor1 = 10;
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta04() {
	var choices = new Array(3, 5);
	factor1 = choices[Math.floor(Math.random() * 2)];
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta06() {
	factor1 = 9;
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta08() {
	factor1 = 6;
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta10() {
	factor1 = 4;
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta12() {
	var choices = new Array(7, 8);
	factor1 = choices[Math.floor(Math.random() * 2)];
	factor2 = Math.floor(Math.random() * 10) + 1;
	product = factor1 * factor2;
	problemText = product + " &divide; " + factor1;
	problemAnswer = factor2;
	display += problemText + " = ";
	answerKey += problemText + " = " + problemAnswer;
}
function Delta151() { //standard notation to expanded notation
	var expandedNotation = "";	
	var digits = new Array();
	var numberOfDigits = (Math.floor(Math.random() * 7) + 4);
	digits.length = 0;
	digits[0] = (Math.floor(Math.random() * 9) + 1); //set first digit to something other than 0
	expandedNotation += digits[0] + " x " + Math.pow(10, (numberOfDigits - 1)) + "<br>";
	thisProblem = digits[0]  *  Math.pow(10, (numberOfDigits - 1));
	var multiplier = Math.pow(10, (numberOfDigits + 1));
	for (jj = 1; jj < numberOfDigits; jj ++) { //set remaining digits to a number 0 - 9
		digits[jj] = Math.floor(Math.random() * 10);
		expandedNotation += " + " + digits[jj] + " x " + Math.pow(10, ((numberOfDigits - 1) - jj)) + "<br>";
		thisProblem += digits[jj]  *  Math.pow(10, ((numberOfDigits - 1) - jj));
	}
	display += eval(thisProblem) + " = ";
	answerKey += expandedNotation;
}
function Delta152() { //expanded notation to standard notation
	
}
function Delta16() {
	divisor = Math.floor(Math.random() * 8) + 2;
	quotient = Math.floor(Math.random() * 9) + 1;
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td> r. ' + remainder + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta18() {
	divisor = Math.floor(Math.random() * 8) + 2;
	quotient = Math.floor(Math.random() * (Math.floor(100/divisor) - 9)) + 10;
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td> r. ' + remainder + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta19() {
	divisor = Math.floor(Math.random() * 8) + 2;
	quotient = Math.floor(Math.random() * (Math.floor(999/divisor) - 109)) + 100;
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td> r. ' + remainder + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta20() {
	divisor = Math.floor(Math.random() * 8) + 2;
	quotient = Math.floor(Math.random() * (Math.floor(999/divisor)));
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td>';//next line has numerator of remainder: 
	answerKey += '<table class="smallfraction"><tr><td class="numerator">' + remainder + '</td></tr>';//next line has denominator of remainder:
	answerKey += '<tr><td>' + divisor + '</td></tr></table>';//next line closes the top row of this problem's table:
	answerKey += '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta22() {
	divisor = Math.floor(Math.random() * 11) + 10;
	quotient = Math.floor(Math.random() * 31) + 20;
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td>';//next line has numerator of remainder: 
	answerKey += '<table class="smallfraction"><tr><td class="numerator">' + remainder + '</td></tr>';//next line has denominator of remainder:
	answerKey += '<tr><td>' + divisor + '</td></tr></table>';//next line closes the top row of this problem's table:
	answerKey += '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta23() {
	divisor = Math.floor(Math.random() * 9) + 2;
	quotient = Math.floor(Math.random() * (9999/divisor));
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td>';//next line has numerator of remainder: 
	answerKey += '<table class="smallfraction"><tr><td class="numerator">' + remainder + '</td></tr>';//next line has denominator of remainder:
	answerKey += '<tr><td>' + divisor + '</td></tr></table>';//next line closes the top row of this problem's table:
	answerKey += '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta24() {
	divisor = Math.floor(Math.random() * 90) + 10;
	quotient = Math.floor(Math.random() * (9999/divisor));
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td>';//next line has numerator of remainder: 
	answerKey += '<table class="smallfraction"><tr><td class="numerator">' + remainder + '</td></tr>';//next line has denominator of remainder:
	answerKey += '<tr><td>' + divisor + '</td></tr></table>';//next line closes the top row of this problem's table:
	answerKey += '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta25() {
	divisor = Math.floor(Math.random() * 800) + 100;
	quotient = Math.floor(Math.random() * (100000/divisor));
	remainder = Math.floor(Math.random() * (divisor - 1)) + 1;
	dividend = (divisor * quotient) + remainder;
	display += '<table cellpadding="1"><tr><td></td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td>';//next line has numerator of remainder: 
	answerKey += '<table class="smallfraction"><tr><td class="numerator">' + remainder + '</td></tr>';//next line has denominator of remainder:
	answerKey += '<tr><td>' + divisor + '</td></tr></table>';//next line closes the top row of this problem's table:
	answerKey += '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
}
function Delta27() {
	factor1 = pickFromRange(1, 6);
	factor2 = pickFromRange(1, 8);
	product = factor1 * factor2;
	numerator = pickFromRange(1, (factor2 - 1));
	denominator = factor2;
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator + '</td><td rowspan="2" valign="center">&nbsp;&nbsp;of ' + product + ' =</td></tr><tr><td>' + denominator + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator + '</td><td rowspan="2" valign="center">&nbsp;&nbsp;of ' + product + ' = ' + ((product/denominator) * numerator) + '</td></tr><tr><td>' + denominator + '</td></tr></table>';
}
function Delta28() {
	var arabic = pickFromRange(399, 1);
	var roman = romanize(arabic);
	var direction = pickFromRange(2, 1)
	
	if(direction == 1){
		display += '<table cellpadding="1"><tr><td>' + arabic + " = </td></tr></table>";
		answerKey += '<table cellpadding="1"><tr><td>' + arabic + " = " + roman + "</td></tr></table>";
	} else {
		display += '<table cellpadding="1"><tr><td>' + roman + " = </td></tr></table>";
		answerKey += '<table cellpadding="1"><tr><td>' + roman + " = " + arabic + "</td></tr></table>";
	}
}
function Delta30() {
	var arabic = pickFromRange(3999, 400);
	var roman = romanize(arabic);
	var direction = pickFromRange(2, 1)
	
	if(direction == 1){
		display += '<table cellpadding="1"><tr><td>' + arabic + " = </td></tr></table>";
		answerKey += '<table cellpadding="1"><tr><td>' + arabic + " = " + roman + "</td></tr></table>";
	} else {
		display += '<table cellpadding="1"><tr><td>' + roman + " = </td></tr></table>";
		answerKey += '<table cellpadding="1"><tr><td>' + roman + " = " + arabic + "</td></tr></table>";
	}
}
//*****************************************************Epsilon Functions******************************************************************
function Epsilon03() {
	var operator = new Array("+", "-");
	thisOperator = operator[Math.floor(Math.random() * 2)]
	denominator = Math.floor(Math.random() * 5) + 2;
	addend1 = Math.floor(Math.random() * (denominator - 1)) + 1;
	addend2 = Math.floor(Math.random() * (denominator - addend1)) + 1;
	addSum = addend1 + addend2;
	if (thisOperator == "+") {
		numerator1 = addend1;
		numerator2 = addend2;
		numerator3 = addSum;
	}else{
		numerator1 = addSum;
		numerator2 = addend1;
		numerator3 = addend2;
	}
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;' + thisOperator + '&nbsp;</td>';
	display += '<td class="numerator">' + numerator2 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + denominator + '</td><td>' + denominator + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;' + thisOperator + '&nbsp;</td>';
	answerKey += '<td class="numerator">' + numerator2 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	answerKey += '<td class="numerator">' + numerator3 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td><td>' + denominator + '</td><td>' + denominator + '</td></tr></table>';
}
function Epsilon05() {
	var operator = new Array("+", "&#8211;");
	var denom2Choices = new Array();
	for (var k = 0; k < denom2Choices.length; k++) {
		denom2Choices[k] = 0;
	}
	denom2Choices.length = 0;
	thisOperator = operator[Math.floor(Math.random() * 2)];
	denominator1 = Math.floor(Math.random() * 5) + 2;
	for (var k = 0; k < 5; k++) {	
		if (denominator1 != (k + 2)) {
			denom2Choices[denom2Choices.length] = (k + 2);
		}
	}
	denominator2 = denom2Choices[Math.floor(Math.random() * 3) + 1]
	denominator3 = denominator2 * denominator1;
	addend1 = Math.floor(Math.random() * Math.floor(denominator1 / 2)) + 1;
	addend2 = Math.floor(Math.random() * Math.floor((denominator2 - ((denominator2 * addend1) / denominator1)))) + 1;
	addSum = (addend1 * denominator2) + (addend2 * denominator1);
	if (thisOperator == "+") {
		numerator1 = addend1;
		numerator2 = addend2;
		numerator3 = addSum;
	}else{
		if ((addend1 / denominator1) > (addend2 / denominator2)) {
			numerator1 = addend1;
			numerator2 = addend2;
			}else{
			numerator1 = addend2;
			numerator2 = addend1;
			dTemp1 = denominator1;
			dTemp2 = denominator2;
			denominator1 = dTemp2;
			denominator2 = dTemp1;			
		}		
		numerator3 = (numerator1 * denominator2) - (numerator2 * denominator1);		
	}
	for (f = 6; f > 1; f--) {
		if ((denominator1 % f == 0) && (denominator2 % f == 0)) { //reduce, if possible...they are using least common denom in this lesson
			denominator3 = denominator3 / f;
			numerator3 = numerator3 / f;
		}
	}
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;' + thisOperator + '&nbsp;</td>';
	display += '<td class="numerator">' + numerator2 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;' + thisOperator + '&nbsp;</td>';
	answerKey += '<td class="numerator">' + numerator2 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	if (numerator3 == 0) {
		answerKey += '<td rowspan="2" valign="middle">' + 0 + '</td></tr>';
		answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td></tr></table>';
	}else{
		answerKey += '<td class="numerator">' + numerator3 + '</td></tr>';
		answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>' + denominator3 + '</td></tr></table>';
	}
}
function Epsilon06() {
	var operator = new Array("+", "&#8211;");
	var denom2Choices = new Array();
	for (var k = 0; k < denom2Choices.length; k++) {
		denom2Choices[k] = 0;
	}
	denom2Choices.length = 0;
	thisOperator = operator[Math.floor(Math.random() * 2)];
	denominator1 = Math.floor(Math.random() * 5) + 2;
	for (var k = 0; k < 5; k++) {	
		if (denominator1 != (k + 2)) {
			denom2Choices[denom2Choices.length] = (k + 2);
		}
	}
	denominator2 = denom2Choices[Math.floor(Math.random() * 3) + 1]
	denominator3 = denominator2 * denominator1;
	addend1 = Math.floor(Math.random() * Math.floor(denominator1 / 2)) + 1;
	addend2 = Math.floor(Math.random() * Math.floor((denominator2 - ((denominator2 * addend1) / denominator1)))) + 1;
	addSum = (addend1 * denominator2) + (addend2 * denominator1);
	if (thisOperator == "+") {
		numerator1 = addend1;
		numerator2 = addend2;
		numerator3 = addSum;
	}else{
		if ((addend1 / denominator1) > (addend2 / denominator2)) {
			numerator1 = addend1;
			numerator2 = addend2;
			}else{
			numerator1 = addend2;
			numerator2 = addend1;
			dTemp1 = denominator1;
			dTemp2 = denominator2;
			denominator1 = dTemp2;
			denominator2 = dTemp1;			
		}		
		numerator3 = (numerator1 * denominator2) - (numerator2 * denominator1);
	}
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;' + thisOperator + '&nbsp;</td>';
	display += '<td class="numerator">' + numerator2 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;' + thisOperator + '&nbsp;</td>';
	answerKey += '<td class="numerator">' + numerator2 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	if (numerator3 == 0) {
		answerKey += '<td rowspan="2" valign="middle">' + 0 + '</td></tr>';
		answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td></tr></table>';
	}else{
		answerKey += '<td class="numerator">' + numerator3 + '</td></tr>';
		answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>' + denominator3 + '</td></tr></table>';
	}
}
/**Note for Lesson: There are three methods given in the chapter for adding three fractions, and the first two will give unreduced fractions. The answers here are coming up all reduced.**/
function Epsilon08() { 
	denominator1 = Math.floor(Math.random() * 4) + 2;
	denominator2 = Math.floor(Math.random() * 4) + 6;
	denominator3 = Math.floor(Math.random() * 7) + 2;
	numerator1 = Math.floor(Math.random() * (denominator1 - 1)) + 1;
	numerator2 = Math.floor(Math.random() * (denominator2 - 1)) + 1;
	numerator3 = Math.floor(Math.random() * (denominator3 - 1)) + 1;
	for (f = 9; f > 1; f--) {
		if ((denominator1 % f == 0) && (numerator1 % f == 0)) { //reduce fraction1
			denominator1 = denominator1 / f;
			numerator1 = numerator1 / f;
		}// end if
	}// end for	
	for (f = 9; f > 1; f--) {
		if ((denominator2 % f == 0) && (numerator2 % f == 0)) { //reduce fraction2
			denominator2 = denominator2 / f;
			numerator2 = numerator2 / f;
		}// end if
	}// end for	
	for (f = 9; f > 1; f--) {
		if ((denominator3 % f == 0) && (numerator3 % f == 0)) { //reduce fraction3
			denominator3 = denominator3 / f;
			numerator3 = numerator3 / f;
		}// end if
	}// end for	
	
	sumDenominator = denominator1 * denominator2 * denominator3;
	sumNumerator = (numerator1 * denominator2 * denominator3) + (numerator2 * denominator1 * denominator3) + (numerator3 * denominator1 * denominator2);
	
	for (f = 9; f > 1; f--) {
		if ((sumDenominator % f == 0) && (sumNumerator % f == 0)) { //reduce answer
			sumDenominator = sumDenominator / f;
			sumNumerator = sumNumerator / f;
		}// end if
	}// end for	
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	display += '<td rowspan="2" valign="middle"> + </td>';
	display += '<td class="numerator">' + numerator2 + '</td>';
	display += '<td rowspan="2" valign="middle"> + </td>';
	display += '<td class="numerator">' + numerator3 + '</td>';
	display += '<td rowspan="2" valign="middle"> = </td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>' + denominator3 + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	answerKey += '<td rowspan="2" valign="middle"> + </td>';
	answerKey += '<td class="numerator">' + numerator2 + '</td>';
	answerKey += '<td rowspan="2" valign="middle"> + </td>';
	answerKey += '<td class="numerator">' + numerator3 + '</td>';
	answerKey += '<td rowspan="2" valign="middle"> = </td>';
	answerKey += '<td class="numerator">' + sumNumerator + '</td></tr>';
	answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>' + denominator3 + '</td><td align="center">' + sumDenominator + '</td></tr></table>';
}// end function

function Epsilon09() {
	denominator1 = Math.floor(Math.random() * 9) + 2;
	denominator2 = Math.floor(Math.random() * 9) + 2;
	numerator1 = Math.floor(Math.random() * (denominator1 - 1)) + 1;
	numerator2 = Math.floor(Math.random() * (denominator2 - 1)) + 1;
	for (f = 9; f > 1; f--) {
		if ((denominator1 % f == 0) && (numerator1 % f == 0)) { //reduce fraction1
			denominator1 = denominator1 / f;
			numerator1 = numerator1 / f;
		}// end if
	}// end for	
	for (f = 9; f > 1; f--) {
		if ((denominator2 % f == 0) && (numerator2 % f == 0)) { //reduce fraction2
			denominator2 = denominator2 / f;
			numerator2 = numerator2 / f;
		}// end if
	}// end for	
	
	productDenominator = denominator1 * denominator2;
	productNumerator = numerator1 * numerator2;
	
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;x&nbsp;</td>';
	display += '<td class="numerator">' + numerator2 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;x&nbsp;</td>';
	answerKey += '<td class="numerator">' + numerator2 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	answerKey += '<td class="numerator">' + productNumerator + '</td></tr>';
	answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td align="center">' + productDenominator + '</td></tr></table>';
}// end function
function Epsilon10() {
	denominator1 = Math.floor(Math.random() * 9) + 2;
	denominator2 = Math.floor(Math.random() * 9) + 2;
	numerator1 = Math.floor(Math.random() * (denominator1 - 1)) + 1;
	numerator2 = Math.floor(Math.random() * (denominator2 - 1)) + 1;
	for (f = 9; f > 1; f--) {
		if ((denominator1 % f == 0) && (numerator1 % f == 0)) { //reduce fraction1
			denominator1 = denominator1 / f;
			numerator1 = numerator1 / f;
		}// end if
	}// end for	
	for (f = 9; f > 1; f--) {
		if ((denominator2 % f == 0) && (numerator2 % f == 0)) { //reduce fraction2
			denominator2 = denominator2 / f;
			numerator2 = numerator2 / f;
		}// end if
	}// end for	
	
	quotientNumerator = numerator1 * denominator2;
	quotientDenominator = denominator1 * numerator2;
	
	display += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;&divide;&nbsp;</td>';
	display += '<td class="numerator">' + numerator2 + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + numerator1 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;&divide;&nbsp;</td>';
	answerKey += '<td class="numerator">' + numerator2 + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	if ((quotientNumerator / quotientDenominator) == (Math.floor(quotientNumerator / quotientDenominator))) {//if the fraction divides evenly, express as whole number.	
		answerKey += '<td valign="center" rowspan="2">' + (quotientNumerator / quotientDenominator) + '</td></tr>';
		answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td></tr></table>';
	}else{
		answerKey += '<td class="numerator">' + quotientNumerator + '</td></tr>';
		answerKey += '<tr><td>' + denominator1 + '</td><td>' + denominator2 + '</td><td align="center">' + quotientDenominator + '</td></tr></table>';
	}
}// end function
function Epsilon12() {//this one is used for lesson 13, as well. Students are being taught a different process, but the results are the same.
	denominator = Math.floor(Math.random() * 8) + 2;
	numerator = Math.floor(Math.random() * (denominator - 1)) + 1;
	factor = Math.floor(Math.random() * 9) + 2;
	problemDenominator = denominator * factor;
	problemNumerator = numerator * factor;
	answerDenominator = problemDenominator;
	answerNumerator = problemNumerator;	
	for (f = 10; f > 1; f--) {
		if ((answerDenominator % f == 0) && (answerNumerator % f == 0)) { //reduce fraction2
			answerDenominator = answerDenominator / f;
			answerNumerator = answerNumerator / f;
		}// end if
	}// end for	
	display += '<table cellpadding="1"><tr><td class="numerator">' + problemNumerator + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td>' + problemDenominator + '</td><td>&nbsp;</td></tr></table>';
		
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + problemNumerator + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	answerKey += '<td class="numerator">' + answerNumerator + '</td></tr>';
	answerKey += '<tr><td>' + problemDenominator + '</td><td>' + answerDenominator + '</td></tr></table>';
}
function Epsilon15() {
	wholeNumber = Math.floor(Math.random() * 5) + 1;
	mixDenominator = Math.floor(Math.random() * 5) + 2;
	mixNumerator = Math.floor(Math.random() * (mixDenominator - 1)) + 1;	
	for (f = 8; f > 1; f--) {
		if ((mixDenominator % f == 0) && (mixNumerator % f == 0)) { //reduce fraction
			mixDenominator = mixDenominator / f;
			mixNumerator = mixNumerator / f;
		}// end if
	}// end for	
	improperNumerator = (mixDenominator * wholeNumber) + mixNumerator;
	improperDenominator = mixDenominator;
	if ((Math.floor(Math.random() * 2) + 1) == 1) {//Pick a number between 1 and 2. If it's 1, mix-imp: if not, imp-mix.
	display += '<table cellpadding="1"><tr><td rowspan="2" valign="middle">' + wholeNumber + '</td>';
	display += '<td class="numerator" align="center">' + mixNumerator + '</td>';
	display += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td><td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<tr><td align="center">' + mixDenominator + '</td><td>&nbsp;</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td rowspan="2" valign="middle">' + wholeNumber + '</td>';
	answerKey += '<td class="numerator" align="center">' + mixNumerator + '</td>';
	answerKey += '<td rowspan="2" valign="middle">&nbsp;=&nbsp;</td><td class="numerator" align="center">' + improperNumerator + '</td></tr>';
	answerKey += '<tr><td align="center">' + mixDenominator + '</td><td align="center">' + improperDenominator + '</td></tr></table>';
	}else{
	display += '<table cellpadding="1"><tr><td class="numerator">' + improperNumerator + '</td><td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	display += '<td rowspan="2">&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>';
	display += '<td align="center">' + improperDenominator + '</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td class="numerator">' + improperNumerator + '</td><td rowspan="2" valign="middle">&nbsp;=&nbsp;</td>';
	answerKey += '<td rowspan="2">' + wholeNumber + '</td><td class="numerator" align="center">' + mixNumerator + '</td></tr>';
	answerKey += '<td align="center">' + improperDenominator + '</td><td>' + mixDenominator + '</td></tr></table>';
	}
}
function Epsilon17() {
	wholeAddend1 = Math.floor(Math.random() * 10) + 1;
	wholeAddend2 = Math.floor(Math.random() * 10) + 1;
	denominator = Math.floor(Math.random() * 8) + 3;
	numAddend1 = Math.floor(Math.random() * (denominator - 2)) + 1;
	numAddend2 = Math.floor(Math.random() * (denominator - (numAddend1 + 1))) + 1;
	wholeSum = wholeAddend1 + wholeAddend2;
	numSum = numAddend1 + numAddend2;
	if (((Math.floor(Math.random() * 2) + 1) == 1)) {//if it's 1, add: if it's 2, subtract
	display += '<table><tr><td align="right">'//open main table and first cell
	display += '<table cellpadding="1"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">+&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">&nbsp;</td><td>&nbsp;</td></tr>';
	display += '<tr><td>&nbsp;</td></tr></table>';
	display += '</td></tr></table>';//close main table
	
	answerKey += '<table><tr><td align="right">'//open main table and first cell
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">+&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr></table><br>';//close main table
	}else{
	display += '<table><tr><td align="right">'//open main table and first cell
	display += '<table cellpadding="1"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">-&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">&nbsp;</td><td>&nbsp;</td></tr>';
	display += '<tr><td>&nbsp;</td></tr></table>';
	display += '</td></tr></table>';//close main table
	
	answerKey += '<table><tr><td align="right">'//open main table and first cell
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">-&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr></table><br>';//close main table
	}
}
function Epsilon18() {
	wholeAddend1 = Math.floor(Math.random() * 9) + 2;
	wholeAddend2 = Math.floor(Math.random() * 10) + 1;
	denominator = Math.floor(Math.random() * 8) + 3;
	numAddend1 = Math.floor(Math.random() * (denominator - 1)) + 1;
	numAddend2 = Math.floor(Math.random() * (numAddend1)) + (denominator - numAddend1);
	wholeSum = wholeAddend1 + wholeAddend2 + 1;
	numSum = (numAddend1 + numAddend2) - denominator;
	denomSum = denominator;//denominator needs to be preserved for the problem itself, so make a copy to be reduced in the final answer
	
	for (f = 10; f > 1; f--) {
		if ((denomSum % f == 0) && (numSum % f == 0)) { //reduce fraction
			denomSum = denomSum / f;
			numSum = numSum / f;
		}// end if
	}// end for	
	
	display += '<table><tr><td align="right">'//open main table and first cell
	display += '<table cellpadding="1"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">+&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">&nbsp;</td><td>&nbsp;</td></tr>';
	display += '<tr><td>&nbsp;</td></tr></table>';
	display += '</td></tr></table>';//close main table
	
	answerKey += '<table><tr><td align="right">'//open main table and first cell
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">+&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	if (numSum != 0) {//if the numerator of the answer isn't 0, we need to express the fraction
		answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
		answerKey += '<tr><td>' + denomSum + '</td></tr></table>';
	}else{//if the numerator of the answer is 0, we don't need to express the fraction
		answerKey += '<table cellpadding="1"><tr><td>' + wholeSum + '</td><td>&nbsp;&nbsp;&nbsp;</td></tr></table>';
	}
	answerKey += '</td></tr></table><br>';//close main table
}
function Epsilon19() {
	wholeAddend1 = Math.floor(Math.random() * 9) + 2;
	wholeAddend2 = Math.floor(Math.random() * 10) + 1;
	denominator = Math.floor(Math.random() * 8) + 3;
	numAddend1 = Math.floor(Math.random() * (denominator - 1)) + 1;
	numAddend2 = Math.floor(Math.random() * (numAddend1 - 1)) + (denominator - numAddend1) + 1;
	wholeSum = wholeAddend1 + wholeAddend2 + 1;
	numSum = (numAddend1 + numAddend2) - denominator;
	denomDiff = denominator;//denominator needs to be preserved for the problem itself, so make a copy to be reduced in the final answer
	
	for (f = 10; f > 1; f--) {
		if ((denomDiff % f == 0) && (numAddend1 % f == 0)) { //reduce fraction
			denomDiff = denomDiff / f;
			numAddend1 = numAddend1 / f;
		}// end if
	}// end for	
	
	display += '<table><tr><td align="right">';//open main table and first cell
	display += '<table cellpadding="1"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">-&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>';
	display += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">&nbsp;</td><td>&nbsp;</td></tr>';
	display += '<tr><td>&nbsp;</td></tr></table>';
	display += '</td></tr></table>';//close main table
	
	answerKey += '<table><tr><td align="right">'//open main table and first cell
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">-&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';
	answerKey += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	answerKey += '<tr><td>' + denomDiff + '</td></tr></table>';
	answerKey += '</td></tr></table><br>';//close main table
}
function Epsilon21() {
	wholeAddend1 = Math.floor(Math.random() * 9) + 2;
	wholeAddend2 = Math.floor(Math.random() * 10) + 1;
	denominator1 = Math.floor(Math.random() * 8) + 3;
	denominator2 = Math.floor(Math.random() * 8) + 3;
	denomSum = denominator1 * denominator2;
	numAddend1 = Math.floor(Math.random() * (denominator1 - (Math.ceil(denominator1 / 2)))) + (Math.ceil(denominator1 / 2));
	numAddend2 = Math.floor(Math.random() * (denominator2 - (Math.ceil(denominator2 / 2)))) + (Math.ceil(denominator2 / 2));
	wholeSum = wholeAddend1 + wholeAddend2 + 1;
	numSum = ((numAddend1 * denominator2) + (numAddend2 * denominator1)) - (denominator1 * denominator2);
	reducedDenom = denomSum;//make a copy, so that I don't change denomSum...I'll need it
	for (f = 10; f > 1; f--) {
		if ((reducedDenom % f == 0) && (numSum % f == 0)) { //reduce fraction
			reducedDenom = reducedDenom / f;
			numSum = numSum / f;
		}// end if
	}// end for	
	
	display += '<table><tr><td align="right">'//open main table and first cell
	display += '<table cellpadding="1" align="right"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	display += '<tr><td>' + denominator1 + '</td></tr></table>';
	display += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">+&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	display += '<tr><td>' + denominator2 + '</td></tr></table>';
	display += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	display += '<table cellpadding="1" align="right"><tr><td rowspan="2">&nbsp;</td><td>&nbsp;</td></tr>';
	display += '<tr><td>&nbsp;</td></tr></table>';
	display += '</td></tr></table>';//close main table
	
	answerKey += '<table><tr><td align="right">'//open main table and first cell
	answerKey += '<table cellpadding="1" align="right"><tr><td rowspan="2">' + wholeAddend1 + '</td><td class="numerator" align="center">' + numAddend1 + '</td></tr>';
	answerKey += '<tr><td>' + denominator1 + '</td></tr></table>';
	answerKey += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">+&nbsp;</td><td rowspan="2">' + wholeAddend2 + '</td><td class="numerator" align="center">' + numAddend2 + '</td></tr>';
	answerKey += '<tr><td>' + denominator2 + '</td></tr></table>';
	answerKey += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	if (numSum != 0) {//if the numerator of the answer isn't 0, we need to express the fraction
		answerKey += '<table cellpadding="1" align="right"><tr><td rowspan="2">' + wholeSum + '</td><td class="numerator" align="center">' + numSum + '</td></tr>';
		answerKey += '<tr><td>' + reducedDenom + '</td></tr></table>';
	}else{//if the numerator of the answer is 0, we don't need to express the fraction
		answerKey += '<table cellpadding="1" align="right"><tr><td>' + wholeSum + '</td><td>&nbsp;&nbsp;&nbsp;</td></tr></table>';
	}
	answerKey += '</td></tr></table><br>';//close main table
}
function Epsilon22() {
	whole1 = Math.floor(Math.random() * 8) + 3;
	whole2 = Math.floor(Math.random() * (whole1 - 2)) + 1;
	denominator1 = Math.floor(Math.random() * 8) + 3;
	denominator2 = Math.floor(Math.random() * 8) + 3;
	denomDiff = denominator1 * denominator2;
	num1 = Math.floor(Math.random() * (denominator1 - (Math.floor(denominator1 / 2)))) + 1;
	num2 = Math.floor(Math.random() * (denominator2 - (Math.ceil(denominator2 / 2)))) + (Math.ceil(denominator2 / 2));
	wholeDiff = (whole1 - whole2) - 1;
	numDiff = ((num1 * denominator2) - (num2 * denominator1)) + (denominator1 * denominator2);
	reducedDenom = denomDiff;//make a copy, so that I don't change denomSum...I'll need it
	for (f = 10; f > 1; f--) {
		if ((reducedDenom % f == 0) && (numDiff % f == 0)) { //reduce fraction
			reducedDenom = reducedDenom / f;
			numDiff = numDiff / f;
		}// end if
	}// end for	
	
	display += '<table><tr><td align="right">'//open main table and first cell
	display += '<table cellpadding="1" align="right"><tr><td rowspan="2">' + whole1 + '</td><td class="numerator" align="center">' + num1 + '</td></tr>';
	display += '<tr><td>' + denominator1 + '</td></tr></table>';
	display += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">-&nbsp;</td><td rowspan="2">' + whole2 + '</td><td class="numerator" align="center">' + num2 + '</td></tr>';
	display += '<tr><td>' + denominator2 + '</td></tr></table>';
	display += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	display += '<table cellpadding="1"><tr><td rowspan="2">&nbsp;</td><td>&nbsp;</td></tr>';
	display += '<tr><td>&nbsp;</td></tr></table>';
	display += '</td></tr></table>';//close main table
	
	answerKey += '<table><tr><td align="right">'//open main table and first cell
	answerKey += '<table cellpadding="1" align="right"><tr><td rowspan="2">' + whole1 + '</td><td class="numerator" align="center">' + num1 + '</td></tr>';
	answerKey += '<tr><td>' + denominator1 + '</td></tr></table>';
	answerKey += '</td></tr><tr><td class="numerator" align="right">'//open 2nd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">-&nbsp;</td><td rowspan="2">' + whole2 + '</td><td class="numerator" align="center">' + num2 + '</td></tr>';
	answerKey += '<tr><td>' + denominator2 + '</td></tr></table>';
	answerKey += '</td></tr><tr><td align="right">';//open 3rd cell of main table
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + wholeDiff + '</td><td class="numerator" align="center">' + numDiff + '</td></tr>';
	answerKey += '<tr><td>' + reducedDenom + '</td></tr></table>';
	answerKey += '</td></tr></table>';//close main table
}
function Epsilon23() {
	whole1 = Math.floor(Math.random() * 6) + 1;
	whole2 = Math.floor(Math.random() * 6) + 1;
	denom1 = Math.floor(Math.random() * 5) + 2;
	denom2 = Math.floor(Math.random() * 5) + 2;
	num1 = Math.floor(Math.random() * (denom1 - 1)) + 1;
	num2 = Math.floor(Math.random() * (denom2 - 1)) + 1;
	for (f = 10; f > 1; f--) {
		if ((denom1 % f == 0) && (num1 % f == 0)) { //reduce fraction1
			denom1 = denom1 / f;
			num1 = num1 / f;
		}// end if
	}// end for	
	for (f = 10; f > 1; f--) {
		if ((denom2 % f == 0) && (num2 % f == 0)) { //reduce fraction2
			denom2 = denom2 / f;
			num2 = num2 / f;
		}// end if
	}// end for	
	NumQ = ((denom1 * whole1) + num1) * denom2;
	DenomQ = ((denom2 * whole2) + num2) * denom1;
	wholeAnswer = Math.floor(NumQ / DenomQ);
	numAnswer = (NumQ % DenomQ);
	denomAnswer = DenomQ;
	for (f = 10; f > 1; f--) {
		if ((denomAnswer % f == 0) && (numAnswer % f == 0)) { //reduce answer fraction
			denomAnswer = denomAnswer / f;
			numAnswer = numAnswer / f;
		}// end if
	}// end for		
	display += '<table cellpadding="1"><tr><td rowspan="2">' + whole1 + '</td><td class="numerator">' + num1 + '</td>';
	display += '<td rowspan="2">&nbsp;&divide;&nbsp;' + whole2 + '</td><td class="numerator">' + num2 + '</td><td rowspan="2">&nbsp;=</td></tr>';
	display += '<tr><td>' + denom1 + '</td><td>' + denom2 + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + whole1 + '</td><td class="numerator">' + num1 + '</td>';
	answerKey += '<td rowspan="2">&nbsp;&divide;&nbsp;' + whole2 + '</td><td class="numerator">' + num2 + '</td><td rowspan="2">&nbsp;=&nbsp;</td>';
	if (wholeAnswer != 0) {
		answerKey += '<td rowspan="2">' + wholeAnswer + '</td>';//whole number part of answer
	}
	if(numAnswer != 0) {
		answerKey += '<td class="numerator">' + numAnswer + '</td>';//numerator part of answer...if it's 0, don't display
	}
	answerKey += '</tr>';//end top row
	answerKey += '<tr><td>' + denom1 + '</td><td>' + denom2 + '</td>';
	if(numAnswer != 0) {
		answerKey += '<td>' + denomAnswer + '</td>';//denominator part of answer...if numerator is 0, don't display
	}
	answerKey += '</tr></table>&nbsp;&nbsp;';//close table	
}
function Epsilon25() {
	whole1 = Math.floor(Math.random() * 4) + 1;
	whole2 = Math.floor(Math.random() * 4);
	whole3 = Math.floor(Math.random() * 3) + 1;
	denom1 = Math.floor(Math.random() * 4) + 2;
	denom2 = Math.floor(Math.random() * 4) + 3;
	denom3 = Math.floor(Math.random() * 4) + 2;
	num1 = Math.floor(Math.random() * (denom1 - 1)) + 1;
	num2 = Math.floor(Math.random() * (denom2 - 1)) + 1;
	num3 = Math.floor(Math.random() * (denom3 - 1)) + 1;
	for (f = 6; f > 1; f--) {
		if ((denom1 % f == 0) && (num1 % f == 0)) { //reduce fraction1
			denom1 = denom1 / f;
			num1 = num1 / f;
		}// end if
	}// end for	
	for (f = 6; f > 1; f--) {
		if ((denom2 % f == 0) && (num2 % f == 0)) { //reduce fraction2
			denom2 = denom2 / f;
			num2 = num2 / f;
		}// end if
	}// end for	
	for (f = 6; f > 1; f--) {
		if ((denom3 % f == 0) && (num3 % f == 0)) { //reduce fraction3
			denom3 = denom3 / f;
			num3 = num3 / f;
		}// end if
	}// end for	
	numProduct = ((denom1 * whole1) + num1) * ((denom2 * whole2) + num2) * ((denom3 * whole3) + num3);
	denomProduct = denom1 * denom2 * denom3;
	for (f = 6; f > 1; f--) {
		if ((denomProduct % f == 0) && (numProduct % f == 0)) { //reduce answer fraction
			denomProduct = denomProduct / f;
			numProduct = numProduct / f;
		}// end if
	}// end for	
	wholeAnswer = Math.floor(numProduct / denomProduct);
	numAnswer = (numProduct % denomProduct);
	denomAnswer = denomProduct;
	display += '<table cellpadding="1"><tr><td rowspan="2">' + whole1 + '</td><td class="numerator">' + num1 + '</td>';
	display += '<td rowspan="2">&nbsp;x&nbsp;';
	if (whole2 != 0) {
		display += whole2; //make this conditional
	}
	display += '</td><td class="numerator">' + num2 + '</td><td rowspan="2">&nbsp;x&nbsp;' + whole3 + '</td>';
	display += '<td class="numerator">' + num3 + '</td><td rowspan="2">&nbsp;=&nbsp;</td></tr>';
	display += '<tr><td>' + denom1 + '</td><td>' + denom2 + '</td><td>' + denom3 + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + whole1 + '</td><td class="numerator">' + num1 + '</td>';
	answerKey += '<td rowspan="2">&nbsp;x&nbsp;';
	if (whole2 != 0) {
		answerKey += whole2;
	}
	answerKey += '</td><td class="numerator">' + num2 + '</td><td rowspan="2">&nbsp;x&nbsp;' + whole3 + '</td>';
	answerKey += '<td class="numerator">' + num3 + '</td><td rowspan="2">&nbsp;=&nbsp;' 
	if (wholeAnswer != 0) {
		answerKey += wholeAnswer;
	}
	answerKey += '</td>'
	if (numAnswer != 0) {
		answerKey += '<td class="numerator">' + numAnswer + '</td>';
	}
	answerKey += '</tr>';
	answerKey += '<tr><td>' + denom1 + '</td><td>' + denom2 + '</td><td>' + denom3 + '</td>';
	if (numAnswer != 0) {
		answerKey += '<td>' + denomAnswer + '</td>';
	}
	answerKey += '</tr></table>';
}
function Epsilon29() {
	var denomChoices = new Array(2, 4, 5, 10)
	denom = denomChoices[Math.floor(Math.random() * 4)];
	num = Math.floor(Math.random() * denom) + 1;
	decimal = (100 / denom) * num;
	display += '<table cellpadding="0"><tr><td class="numerator">' + num + '</td>';
	display += '<td rowspan="2">&nbsp;=&nbsp;</td>';
	display += '<td class="numerator">&nbsp;</td>';
	display += '<td rowspan="2">&nbsp;=&nbsp;</td>';
	display += '<td rowspan="2" class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>%</td></tr>';
	display += '<tr><td>' + denom + '</td><td>100</td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td class="numerator">' + num + '</td>';
	answerKey += '<td rowspan="2">&nbsp;=&nbsp;</td>';
	answerKey += '<td class="numerator">' + decimal  + '</td>';
	answerKey += '<td rowspan="2">&nbsp;=&nbsp;</td>';
	answerKey += '<td rowspan="2">' + decimal + '%</td></tr>';
	answerKey += '<tr><td>' + denom + '</td><td>100</td></tr></table>';
}
////////////////////////////////////////////////////////////////////////////////////
//                                 Zeta Functions                                 //
////////////////////////////////////////////////////////////////////////////////////
//W stands for whole, and D stands for decimal
function Zeta04() {
	decimalPlaces = Math.floor(Math.random() * 2) + 1;
	addend1 = ((Math.floor(Math.random() * 999) + 1) / 100).toFixed(decimalPlaces);
	addend2 = ((Math.floor(Math.random() * 999) + 1) / 100).toFixed(decimalPlaces);
	sum = (parseFloat(addend1) + parseFloat(addend2)).toFixed(decimalPlaces);
	display += '<table cellpadding="0"><tr><td align="right">' + addend1 + '</td></tr>';
	display += '<tr><td align="right" class="numerator">+ ' + addend2 + '</td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td align="right">' + addend1 + '</td></tr>';
	answerKey += '<tr><td align="right" class="numerator">+ ' + addend2 + '</td></tr>';
	answerKey += '<tr><td align="right">' + sum + '</td></tr></table>';
}
function Zeta05() {
	decimalPlaces = Math.floor(Math.random() * 2) + 1;
	addend1 = ((Math.floor(Math.random() * 999) + 1) / 100).toFixed(decimalPlaces);
	addend2 = ((Math.floor(Math.random() * 999) + 1) / 100).toFixed(decimalPlaces);
	sum = (parseFloat(addend1) + parseFloat(addend2)).toFixed(decimalPlaces);
	display += '<table cellpadding="0"><tr><td align="right">' + sum + '</td></tr>';
	display += '<tr><td align="right" class="numerator">- ' + addend2 + '</td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td align="right">' + sum + '</td></tr>';
	answerKey += '<tr><td align="right" class="numerator">- ' + addend2 + '</td></tr>';
	answerKey += '<tr><td align="right">' + addend1 + '</td></tr></table>';
}
function Zeta08() {
	var prefix_1_index = '';
	var prefix_2_index = '';
	prefixes = Array("k", "h", "dk", "", "d", "c", "m");
	units = Array("g", "m", "L");
	quantity = Math.floor(Math.random() * 49) + 1;
	
	prefix_1_index = pickFromRange(5, 0);
    prefix_2_index = pickFromRange(6, prefix_1_index + 1);	
    	
	power = prefix_2_index - prefix_1_index;
	multiplier = Math.pow(10, power);
	unit_index = Math.floor(Math.random() * 3);
	prefix_1 = prefixes[prefix_1_index];
	prefix_2 = prefixes[prefix_2_index];
	unit_abbrev = units[unit_index];
	
	display += '<table cellpadding="0"><tr><td align="left">' + quantity + ' ' + prefix_1 + unit_abbrev + ' = _____ ' + prefix_2 + unit_abbrev + '<br><br><br></td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td align="left">' + quantity + ' ' + prefix_1 + unit_abbrev + ' = ' + (Math.floor(quantity * multiplier * 1000000) / 1000000) + ' ' + prefix_2 + unit_abbrev + '<br><br><br></td></tr></table>'; //'
}
function Zeta09() {
	factor1W = Math.floor(Math.random() * 99) + 1;
	factor2W = Math.floor(Math.random() * 99) + 1;
	productW = factor1W * factor2W;
	factor1D = (factor1W / 10).toFixed(1);
	factor2D = (factor2W / 10).toFixed(1);
	productD = ((factor1W * factor2W) / 100).toFixed(2);
	display += '<table cellpadding="0"><tr><td align="right">' + factor1D + '</td></tr>';
	display += '<tr><td align="right" class="numerator">x ' + factor2D + '</td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td align="right">' + factor1D + '</td></tr>';
	answerKey += '<tr><td align="right" class="numerator">x ' + factor2D + '</td></tr>';
	answerKey += '<tr><td align="right">' + productD + '</td></tr></table>';
}
function Zeta10() {
	factor1W = Math.floor(Math.random() * 999) + 1;
	factor2W = Math.floor(Math.random() * 999) + 1;
	productW = factor1W * factor2W;
	factor1D = (factor1W / 100).toFixed(2);
	factor2D = (factor2W / 100).toFixed(2);
	productD = ((factor1W * factor2W) / 10000).toFixed(4);
	display += '<table cellpadding="0"><tr><td></td><td>' + factor1D + '</td></tr>';
	display += '<tr><td>x&nbsp;</td><td class="numerator">' + factor2D + '</td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td></td><td>' + factor1D + '</td></tr>';
	answerKey += '<tr><td>x&nbsp;</td><td class="numerator">' + factor2D + '</td></tr>';
	answerKey += '<tr><td></td><td>' + productD + '</td></tr></table>';
}
function Zeta14() {
	decimalPlaces1 = Math.floor(Math.random() * 3) + 1;
	decimalPlaces2 = Math.floor(Math.random() * 3) + 1;
	placeValue1 = Math.pow(10, decimalPlaces1);	
	placeValue2 = Math.pow(10, decimalPlaces2);
	factor1W = Math.floor(Math.random() * 999) + 1;
	factor2W = Math.floor(Math.random() * 999) + 1;
	productW = factor1W * factor2W;
	factor1D = (factor1W / placeValue1).toFixed(decimalPlaces1);
	factor2D = (factor2W / placeValue2).toFixed(decimalPlaces2);
	productD = ((factor1W * factor2W) / (placeValue1 * placeValue2)).toFixed(decimalPlaces1 + decimalPlaces2);
	display += '<table cellpadding="0"><tr><td></td><td align="right">' + factor1D + '</td></tr>';
	display += '<tr><td>x&nbsp;</td><td class="baseline">' + factor2D + '</td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td></td><td align="right">' + factor1D + '</td></tr>';
	answerKey += '<tr><td>x&nbsp;</td><td class="baseline">' + factor2D + '</td></tr>';
	answerKey += '<tr><td></td><td align="right">' + productD + '</td></tr></table>';
}
function Zeta15() {
	var prefix_1_index = '';
	var prefix_2_index = '';
	prefixes = Array("k", "h", "dk", "", "d", "c", "m");
	units = Array("g", "m", "L");
	quantity = Math.floor(Math.random() * 49) + 1;
	
	prefix_2_index = pickFromRange(5, 0);
    prefix_1_index = pickFromRange(6, prefix_2_index + 1);	
    	
	power = prefix_2_index - prefix_1_index;
	multiplier = Math.pow(10, power);
	unit_index = Math.floor(Math.random() * 3);
	prefix_1 = prefixes[prefix_1_index];
	prefix_2 = prefixes[prefix_2_index];
	unit_abbrev = units[unit_index];
	
	display += '<table cellpadding="0"><tr><td align="left">' + quantity + ' ' + prefix_1 + unit_abbrev + ' = _____ ' + prefix_2 + unit_abbrev + '<br><br><br></td></tr></table>';
	
	answerKey += '<table cellpadding="0"><tr><td align="left">' + quantity + ' ' + prefix_1 + unit_abbrev + ' = ' + (Math.floor(quantity * multiplier * 1000000) / 1000000) + ' ' + prefix_2 + unit_abbrev + '<br><br><br></td></tr></table>'; //'
}
function Zeta17() {
	var places = (Math.floor(Math.random() * 3) + 1);
	divisor = Math.floor(Math.random() * 8) + 2;
	quotient = ((Math.floor(Math.random() * 897) + 2) / (Math.pow(10, places)));
	dividend = (divisor * quotient).toFixed(places);
	display += '<table cellpadding="1"><tr><td>A</td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td></tr></table>';  	
}
function Zeta18() { 
	var places = (Math.floor(Math.random() * 3) + 1);
	divisor = ((Math.floor(Math.random() * 33) + 2) / (Math.pow(10, places))).toFixed(places);
	quotient = (Math.floor(Math.random() * 847) + 2) * (Math.pow(10, places));
	dividend = Math.round(divisor * quotient);
	display += '<table cellpadding="1"><tr><td>A</td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>'; 
}
function Zeta19() {
	var digit = pickFromRange(9, 1);
	var tenPower = pickFromList([10, 100, 1000]);
	var factor1 = digit / tenPower;
	var factor2 = pickFromRange(500, 25);
	var product = Math.round(factor1 * factor2 * tenPower) / tenPower;
	var letter = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
	
	display += '<table cellpadding="1"><tr><td>' + factor1 + letter + ' = ' + product + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td align="center">' + factor1 + letter + ' = ' + product + '</td></tr>';
	answerKey += '<tr><td align="center">' + letter + ' = ' + product + ' &divide; ' + factor1 + '</td></tr>';
	answerKey += '<tr><td align="center">' + letter + ' = ' + factor2 + '</td></tr></table>';
}
function Zeta20() { 
	var divisorPlaces = (Math.floor(Math.random() * 2) + 1);
	var quotientPlaces = (Math.floor(Math.random() * 2) + 1);
	divisor = ((Math.floor(Math.random() * 33) + 2) / (Math.pow(10, divisorPlaces))).toFixed(divisorPlaces);
	quotient = (Math.floor(Math.random() * 847) + 2) / (Math.pow(10, quotientPlaces)).toFixed(quotientPlaces);
	dividend = Math.round((divisor * quotient) * (Math.pow(10, (divisorPlaces + quotientPlaces)))) / (Math.pow(10, (divisorPlaces + quotientPlaces)));
	display += '<table cellpadding="1"><tr><td>A</td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>'; 
}
function Zeta211() { //quotient comes out even
	var divisorPlaces = (Math.floor(Math.random() * 2));
	var quotientPlaces = (Math.floor(Math.random() * 3) + 2);
	var divisorChoices = new Array(2, 4, 5, 8);
	divisor = ((divisorChoices[Math.floor(Math.random() * 4)]) / (Math.pow(10, divisorPlaces))).toFixed(divisorPlaces);
	quotient = (Math.floor(Math.random() * 847) + 2) / (Math.pow(10, quotientPlaces)).toFixed(quotientPlaces);
	dividend = Math.round((divisor * quotient) * (Math.pow(10, (divisorPlaces + quotientPlaces)))) / (Math.pow(10, (divisorPlaces + quotientPlaces)));
	display += '<table cellpadding="1"><tr><td>A</td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>'; 
}
function Zeta212() { //round to the nearest 100th
	var divisorPlaces = (Math.floor(Math.random() * 3));
	var dividendPlaces = (Math.floor(Math.random() * 3) + 1);
	var divisorChoices = new Array(3, 6, 7, 9);
	divisor = ((divisorChoices[Math.floor(Math.random() * 4)]) / (Math.pow(10, divisorPlaces))).toFixed(divisorPlaces);
	dividend = (Math.floor(Math.random() * 847) + 56) / (Math.pow(10, dividendPlaces)).toFixed(dividendPlaces);
	quotient = Math.round((dividend / divisor) * (Math.pow(10, 2))) / (Math.pow(10, 2));
	display += '<table cellpadding="1"><tr><td>B</td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>'; 
}
function Zeta213() { //quotient repeats
	var divisorPlaces = (Math.floor(Math.random() * 2));
	var dividendPlaces = (Math.floor(Math.random() * 3) + 1);
	var divisorChoices = new Array(3, 6, 7, 9, 11);
	var divisor = ((divisorChoices[Math.floor(Math.random() * 4)]) / (Math.pow(10, divisorPlaces))).toFixed(divisorPlaces);
	var dividend = (Math.floor(Math.random() * 847) + 56) / (Math.pow(10, dividendPlaces)).toFixed(dividendPlaces);
	var quotient = "" + (dividend / divisor) + "q";
	if ((dividend * Math.pow(10, dividendPlaces)) % (divisor * Math.pow(10, divisorPlaces)) == 0) {
		quotient = ((dividend * Math.pow(10, dividendPlaces)) / (divisor * Math.pow(10, divisorPlaces))).toFixed(0) / (Math.pow(10, (dividendPlaces + divisorPlaces)));
		quotient = "" + quotient + "q";
	}
	var possibleRepeats = new Array();
	for (var p = 0; p < possibleRepeats.length; p++) { //
		possibleRepeats[p] == null;                      // reset array
	}                                                    //
	possibleRepeats.length = 0; 
	if (Math.pow(10, divisorPlaces) * divisor == 3) {
		possibleRepeats.length = 3;
		possibleRepeats[0] = "q";
		possibleRepeats[1] = "3";
		possibleRepeats[2] = "6";
	}
	if (Math.pow(10, divisorPlaces) * divisor == 6) {
		possibleRepeats.length = 6;
		possibleRepeats[0] = "q";
		possibleRepeats[1] = "66";
		possibleRepeats[2] = "33";
		possibleRepeats[3] = "q";
		possibleRepeats[4] = "66";
		possibleRepeats[5] = "33";
	}
	if (Math.pow(10, divisorPlaces) * divisor == 7) {
		possibleRepeats.length = 7;
		possibleRepeats[0] = "q";
		possibleRepeats[1] = "142857";
		possibleRepeats[2] = "285714";
		possibleRepeats[3] = "428571";
		possibleRepeats[4] = "571428";
		possibleRepeats[5] = "714285";
		possibleRepeats[6] = "857142";
	}
	if (Math.pow(10, divisorPlaces) * divisor == 9) {
		possibleRepeats.length = 9;
		possibleRepeats[0] = "q";
		possibleRepeats[1] = "11";
		possibleRepeats[2] = "22";
		possibleRepeats[3] = "33";
		possibleRepeats[4] = "44";
		possibleRepeats[5] = "55";
		possibleRepeats[6] = "66";
		possibleRepeats[7] = "77";
		possibleRepeats[8] = "88";
	}
	if (Math.pow(10, divisorPlaces) * divisor == 11) {
		possibleRepeats.length = 11;
		possibleRepeats[0] = "q";
		possibleRepeats[1] = "09";
		possibleRepeats[2] = "18";
		possibleRepeats[3] = "27";
		possibleRepeats[4] = "36";
		possibleRepeats[5] = "45";
		possibleRepeats[6] = "54";
		possibleRepeats[7] = "63";
		possibleRepeats[8] = "72";
		possibleRepeats[9] = "81";
		possibleRepeats[10] = "90";
	}
	var repeatedDigits = possibleRepeats[Math.round(Math.pow(10, dividendPlaces) * dividend) % (Math.pow(10, divisorPlaces) * divisor)];
	if (repeatedDigits == "q") { //try again if it's a non-repeating decimal
		Zeta213();
	}else{
	quotient = quotient.split(repeatedDigits)[0];
	if (repeatedDigits.charAt(0) == repeatedDigits.charAt(1)) {
		repeatedDigits = repeatedDigits.charAt(0);
	}
	display += '<table cellpadding="1"><tr><td>C</td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>';  
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '<span style="text-decoration:overline">' + repeatedDigits + '</span></td></tr>';
	answerKey += '<tr><td>' + divisor + ' </td><td class="divsign" align="right"> ' + dividend + '</td></tr></table>'; 
	}
}
function Zeta214() { // fractional remainders
	var factors = new Array(1, 10, 100);
	var factor = factors[Math.floor(Math.random() * 3)];
	var preQuotient = (Math.floor(Math.random() * 9999) + 1);
	var preDivisor = Math.floor(Math.random() * 11) + 2;
	var remainder = Math.floor(Math.random() * (preDivisor - 1)) + 1;
	var preDividend = Math.round((preQuotient * preDivisor) + remainder);
	var divisor = preDivisor / factor;
	var dividend = preDividend / factor;
	var quotient = preQuotient;
	display += '<table cellpadding="1"><tr><td>D</td><td></td><td></td></tr>';
	display += '<tr><td>' + divisor + ' </td><td class="divsign"> ' + dividend + '</td><td></td></tr></table>';  
	
	var numerator = remainder;
	var denominator = preDivisor;	
	
	for (f = 12; f > 1; f--) {
		if ((numerator % f == 0) && (denominator % f == 0)) { //reduce fraction1
			denominator = denominator / f;
			numerator = numerator / f;
		}// end if
	}// end for	
	
	answerKey += '<table cellpadding="1"><tr><td></td></td><td align="right">' + quotient + '</td><td>';//next line has numerator of remainder: 
	answerKey += '<table class="smallfraction"><tr><td class="numerator">' + numerator + '</td></tr>';//next line has denominator of remainder:
	answerKey += '<tr><td>' + denominator + '</td></tr></table>';//next line closes the top row of this problem's table:
	answerKey += '</td></tr>';
	answerKey += '<tr><td>' + preDivisor + ' </td><td class="divsign"> ' + preDividend + '</td><td></td></tr></table>';  
}
function Zeta22() { //copied from Zeta19() with modifications
	var digit = pickFromRange(9, 1);
	var tenPower = pickFromList([10, 100, 1000]);
	var factor1 = digit / tenPower;
	var factor2 = pickFromRange(500, 25);
	var addedNumber = pickFromRange(400, 1) / 100;
	var product = Math.round(factor1 * factor2 * tenPower) / tenPower;
	var productPlusAddedNumber = Math.round((product + addedNumber) * 1000) / 1000;
	var letter = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
	
	display += '<table cellpadding="1"><tr><td>' + factor1 + letter + ' + ' + addedNumber + ' = ' + productPlusAddedNumber + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td align="center">' + factor1 + letter + ' + ' + addedNumber + ' = ' + productPlusAddedNumber + '</td></tr>';
	answerKey += '<tr><td align="center">' + factor1 + letter + '+' + addedNumber + '-' + addedNumber + '=' + productPlusAddedNumber +  '-' + addedNumber + '</td></tr>';
	answerKey += '<tr><td align="center">' + factor1 + letter + ' = ' + product + '</td></tr>';
	answerKey += '<tr><td align="center">' + letter + ' = ' + product + ' &divide; ' + factor1 + '</td></tr>';
	answerKey += '<tr><td align="center">' + letter + ' = ' + factor2 + '</td></tr></table>';
}
function Zeta23() { // fraction to decimal then percent
	var denominator = Math.floor(Math.random() * 12) + 5;
	var numerator = Math.floor(Math.random() * (denominator - 3)) + 2;
	
	for (f = 12; f > 1; f--) {
		if ((numerator % f == 0) && (denominator % f == 0)) { //reduce fraction1
			denominator = denominator / f;
			numerator = numerator / f;
		}// end if
	}// end for	
	
	display += '<table cellpadding="1"><tr><td>E</td><td colspan="2"></td><td></td></tr>';
	display += '<tr><td rowspan="2"></td><td class="numerator">' + numerator + '</td><td rowspan="2"> =</td></tr>';
	display += '<tr><td>' + denominator + '</td></tr></table>'; 
	
	var quotient = Math.floor((numerator / denominator) * 100);
	var remainder = Math.round((((numerator / denominator) * 100) - quotient) * denominator);
	var numeratorCode = "";
	var denominatorCode = "";
	var reducedRemainder = remainder;
	var reducedDenominator = denominator;
	
	for (f = 15; f > 1; f--) {
		if ((reducedRemainder % f == 0) && (reducedDenominator % f == 0)) { //reduce fraction
			reducedDenominator = reducedDenominator / f;
			reducedRemainder = reducedRemainder / f;
		}// end if
	}// end for	
	
	if (remainder != 0) { //code for numerator: close existing table cell, open another with style "numerator", insert numerator, close cell, and then open a new cell with rowspan of "2"
		numeratorCode = '</td><td class="numerator" align="center">' + reducedRemainder + '</td><td rowspan="2">';
	}		
	if (remainder != 0) { //code for denominator: create a table cell containing the denominator
		denominatorCode = '<td align="center">' + reducedDenominator + '</td>';
	}	
	
	answerKey += '<table cellpadding="1"><tr><td align="center" class="numerator">' + numerator + '</td><td rowspan="2"> = .' + quotient + numeratorCode + ' = ' + quotient + numeratorCode + '%</td></tr>';
	answerKey += '<tr><td align="center">' + denominator + '</td>' + denominatorCode + denominatorCode + '</tr></table>';
}
function Zeta24() {
	var denominators = new Array(10, 100, 100, 100, 1000, 1000, 1000);
	var denominator = denominators[Math.floor(Math.random() * 7)];
	var problem = (Math.floor((Math.random() * (denominator - 1)) + 1)) / denominator;
	var problemAsText = problem.toString().split(".")[1];
	var numerator = problem * denominator;	
	var reducedNumerator = problem * denominator;
	var reducedDenominator = denominator;
	var reducedNumeratorCode = "";
	var reducedDenominatorCode = "";
	var reduced = false;
		
	for (f = 32; f > 1; f--) {
		if ((reducedNumerator % f == 0) && (reducedDenominator % f == 0)) { //reduce fraction
			reducedDenominator = Math.round(reducedDenominator / f);
			reducedNumerator = Math.round(reducedNumerator / f);
			reduced = true;
		}// end if
	}// end for
	
	if (reduced == true) {
		reducedNumeratorCode = '<td rowspan="2"> = </td><td class="numerator">' + reducedNumerator + '</td>';
		reducedDenominatorCode = '<td align="center">' + reducedDenominator + '</td>';
	}
	
	display += '<table cellpadding="1"><tr><td>F</td><td></td></tr>';
	display += '<tr><td></td><td>.' + problemAsText + ' =</td></tr></table>'; //manipulated the number as a string to get rid of leading zeros before the decimal
	
	answerKey += '<table cellpadding="1"><tr><td rowspan="2">.' + problemAsText + ' =</td><td class="numerator">' + Math.round(numerator) + '</td>' + reducedNumeratorCode + '</tr>';
	answerKey += '<td align="center">' + denominator + '</td>' + reducedDenominatorCode + '</tr></table>';
}
//****************************************************************************************************************************//
//                                                    PreAlgebra Functions                                                    //
//****************************************************************************************************************************//
function PreAlgebra01() {
	var addends = new Array();
	addends.length = 2;
	addends[0] = Math.floor((Math.random() * 59) - 29);
	addends[1] = Math.floor((Math.random() * 59) - 29);
	for (var addendIndex = 0; addendIndex <= 1; addendIndex ++) { //Check both numbers, to make sure they are not 0.
		if (addends[addendIndex] == 0) {
			addends[addendIndex] = (addends[addendIndex] - (Math.floor(Math.random() * 29) + 1));
		}
	}
	if ((addends[0] >= 0) && (addends[1] >= 0)) { //Check to be sure the numbers are not both positive. If they are, change one.
		var addendToChange = Math.floor(Math.random() * 2);
		addends[addendToChange] = (addends[addendToChange] * -1);
	}
	
	display += '<table cellpadding="1"><tr><td>(' + addends[0] + ') + (' + addends[1] + ') = </td></tr></table>';
	answerKey += '<table cellpadding="1"><tr><td>(' + addends[0] + ') + (' + addends[1] + ') = ' + (addends[0] + addends[1]) + '</td></tr></table>';
}
function PreAlgebra02() {
	var addends = new Array();
	addends.length = 2;
	addends[0] = Math.floor((Math.random() * 59) - 29);
	addends[1] = Math.floor((Math.random() * 59) - 29);
	for (var addendIndex = 0; addendIndex <= 1; addendIndex ++) { //Check both numbers, to make sure they are not 0.
		if (addends[addendIndex] == 0) {
			addends[addendIndex] = (addends[addendIndex] - (Math.floor(Math.random() * 29) + 1));
		}
	}
	if ((addends[0] >= 0) && (addends[1] >= 0)) { //Check to be sure the numbers are not both positive. If they are, change one.
		var addendToChange = Math.floor(Math.random() * 2);
		addends[addendToChange] = (addends[addendToChange] * -1);
	}
	
	display += '<table cellpadding="1"><tr><td>(' + addends[0] + ') - (' + addends[1] + ') = </td></tr></table>';
	answerKey += '<table cellpadding="1"><tr><td>(' + addends[0] + ') - (' + addends[1] + ') = ' + (addends[0] - addends[1]) + '</td></tr></table>';
}
function PreAlgebra03() {
	var factors = new Array();
	factors.length = 2;
	factors[0] = Math.floor((Math.random() * 39) - 19);
	factors[1] = Math.floor((Math.random() * 39) - 19);
	for (var factorIndex = 0; factorIndex <= 1; factorIndex ++) { //Check both numbers, to make sure they are not 0.
		if (factors[factorIndex] == 0) {
			factors[factorIndex] = (factors[factorIndex] - (Math.floor(Math.random() * 19) + 1));
		}
	}
	if ((factors[0] >= 0) && (factors[1] >= 0)) { //Check to be sure the numbers are not both positive. If they are, change one.
		var factorToChange = Math.floor(Math.random() * 2);
		factors[factorToChange] = (factors[factorToChange] * -1);
	}
	
	display += '<table cellpadding="1"><tr><td>(' + factors[0] + ') x (' + factors[1] + ') = </td></tr></table>';
	answerKey += '<table cellpadding="1"><tr><td>(' + factors[0] + ') x (' + factors[1] + ') = ' + (factors[0] * factors[1]) + '</td></tr></table>';
}
function PreAlgebra04() {
	var factors = new Array();
	factors.length = 2;
	factors[0] = Math.floor((Math.random() * 29) - 15);
	factors[1] = Math.floor((Math.random() * 29) - 15);
	for (var factorIndex = 0; factorIndex <= 1; factorIndex ++) { //Check both numbers, to make sure they are not 0.
		if (factors[factorIndex] == 0) {
			factors[factorIndex] = (factors[factorIndex] - (Math.floor(Math.random() * 15) + 1));
		}
	}
	if ((factors[0] >= 0) && (factors[1] >= 0)) { //Check to be sure the numbers are not both positive. If they are, change one.
		var factorToChange = Math.floor(Math.random() * 2);
		factors[factorToChange] = (factors[factorToChange] * -1);
	}
	
	var product = (factors[0] * factors[1]);
	display += '<table cellpadding="1"><tr><td>(' + product + ') &divide; (' + factors[1] + ') = </td></tr></table>';
	answerKey += '<table cellpadding="1"><tr><td>(' + product + ') &divide; (' + factors[1] + ') = ' + (product / factors[1]) + '</td></tr></table>';
} //'
function PreAlgebra05() {
	var types = new Array("whole", "whole", "fraction");
	var type = types[Math.floor(Math.random() * 3)];	
	if (type == "whole") {
		var base = Math.floor(Math.random() * 29) + 2;
		var exponents = new Array(5, 4, 3, 3, 3, 2, 2, 2, 2);
		var exponent = exponents[Math.floor(Math.random() * 9)];
		while (Math.pow(base, exponent) > 1000) { 
			base = Math.floor(base * .9);// I don't want the answer to be too large: if it is, I'll make the base smaller.
		}
		display += '<table cellpadding="1"><tr><td>' + base + '<sup>' + exponent + '</sup> = </td></tr></table>';		
		answerKey += '<table cellpadding="1"><tr><td>' + base + '<sup>' + exponent + '</sup> = ' + Math.pow(base, exponent) + '</td></tr></table>';
	} else { //(If type is fraction...)
		var denominator = Math.floor(Math.random() * 7) + 5;
		var numerator = Math.floor(Math.random() * (denominator - 6) + 5);
		var exponent = Math.floor(Math.random() * 6) + 2;
		for (f = 12; f > 1; f--) {
			if ((numerator % f == 0) && (denominator % f == 0)) { //reduce fraction
				denominator = Math.round(denominator / f);
				numerator = Math.round(numerator / f);
			}// end if
		}// end for
		while (Math.pow(denominator, exponent) >= 1000) { 
			exponent = exponent - 1;// I don't want the answer to be too large: if it is, I'll make the exponent smaller.
		}
		display += '<table cellpadding="1"><tr><td rowspan="2">(</td><td class="numerator">' + numerator + '</td><td rowspan="2">)</td><td rowspan="2"><sup>' + exponent + '</sup> = </td></tr>';
		display += '<tr><td align="center">' + denominator + '</td></tr></table>';
		answerKey += '<table cellpadding="1"><tr><td rowspan="2">(</td><td class="numerator">' + numerator + '</td><td rowspan="2">)</td><td rowspan="2"><sup>' + exponent + '</sup> = </td><td class="numerator">' + Math.pow(numerator, exponent) + '</td></tr>';
		answerKey += '<tr><td align="center">' + denominator + '</td><td>' + Math.pow(denominator, exponent) + '</td></tr></table>';
	}
}
function PreAlgebra07() {
	var types = new Array("whole", "whole", "whole", "fraction", "fraction");
	var type = types[Math.floor(Math.random() * 5)];
	var openers = new Array("-", "(-", "-(-", "-(");
	var opener = openers[Math.floor(Math.random() * 4)];
	if (type == "fraction") {
		opener = openers[Math.floor(Math.random() * 3) + 1]; // If this is a fraction problem, don't pick the first option for opening string: "-"
	}
	var closer = "";
	if (opener != "-") { // if the opener is anything other than "-", define the closer as ")".
		closer = ")";
	}
		if (type == "whole") { //whole numbers get one treatment...     
		var base = Math.floor(Math.random() * 29) + 1;
		var exponents = new Array(3, 3, 3, 2, 2, 2, 2);
		var exponent = exponents[Math.floor(Math.random() * 7)];
		while ((Math.pow(base, exponent) > 1000) || (Math.pow(base, exponent) < -1000)) { 
		var reducer = (Math.floor(Math.random() * 7) + 3) / 10;
			base = Math.floor(base * reducer);// I don't want the answer to be too large: if it is, I'll make the base smaller.
		}
	var correctedBase = base;
	if ((opener == "(-") || (opener == "-(-")) {
		correctedBase = base * -1;
	}
	var finalFactor = 1;
	if (opener != "(-") {
		finalFactor = -1;
	}
		display += '<table cellpadding="1"><tr><td>' + opener + base + closer + '<sup>' + exponent + '</sup> = </td></tr></table>';		
		answerKey += '<table cellpadding="1"><tr><td>' + opener + base + closer + '<sup>' + exponent + '</sup> = ' + (Math.pow(correctedBase, exponent) * finalFactor) + '</td></tr></table>';
	} else { //(If type is fraction...)
		var denominator = Math.floor(Math.random() * 7) + 5;
		var numerator = Math.floor(Math.random() * (denominator - 6) + 5);
		var exponent = Math.floor(Math.random() * 6) + 2;
		for (f = 12; f > 1; f--) {
			if ((numerator % f == 0) && (denominator % f == 0)) { //reduce fraction
				denominator = Math.round(denominator / f);
				numerator = Math.round(numerator / f);
			}// end if
		}// end for
		while (Math.pow(denominator, exponent) >= 700) { 
			exponent = exponent - 1;// I don't want the answer to be too large: if it is, I'll make the exponent smaller.
		}
		var answerSign = "";
		if ((opener == "-(") || ((opener == "-(-") && (exponent % 2 == 0)) || ((opener == "(-") && (exponent % 2 != 0))){
			answerSign = "&#8211"; // This is the code for an en-dash, or something along that line. I'm using it as the conditional subtraction sign.
		}
		display += '<table cellpadding="1"><tr><td rowspan="2">' + opener + '</td><td class="numerator">' + numerator + '</td><td rowspan="2">' + closer + '</td><td rowspan="2"><sup>' + exponent + '</sup> = </td></tr>';
		display += '<tr><td align="center">' + denominator + '</td></tr></table>';
		answerKey += '<table cellpadding="1"><tr><td rowspan="2">' + opener + '</td><td class="numerator">' + numerator + '</td><td rowspan="2">' + closer + '</td><td rowspan="2"><sup>' + exponent + '</sup><sub>&nbsp;</sub>= ' + answerSign + '</td><td class="numerator">' + Math.pow(numerator, exponent) + '</td></tr>';
		answerKey += '<tr><td align="center">' + denominator + '</td><td>' + Math.pow(denominator, exponent) + '</td></tr></table>';
	}
}
function PreAlgebra08() {
	var problemTypes = new Array("perfectSquares", "squaredNumbers", "perfectSquares", "perfectSquares", "squaredLetters", "perfectSquares");
	var problemType = Math.floor(Math.random() * 6);
	//next line temporary, for testing:
	//problemType = 0;
	if (problemTypes[problemType] == "perfectSquares") {
		var squareRoot = Math.floor(Math.random() * 13) + 1; // Pick a number from 1 to 13
		var imageSource = 'http://www.mathusee.com/images/worksheet/' + squareRoot + '.gif';
	}
	if (problemTypes[problemType] == "squaredNumbers") {		
		var squareRoot = Math.floor(Math.random() * 20) + 1; // Pick a number from 1 to 20
		var imageSource = 'http://www.mathusee.com/images/worksheet/' + squareRoot + 'S.gif';
	}
	if (problemTypes[problemType] == "squaredLetters") {		
		var squareRoot = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
		var imageSource = 'http://www.mathusee.com/images/worksheet/' + squareRoot + '2.gif';
	}
	
	display += '<table cellpadding="1"><tr><td><img src="' + imageSource + '"></img></td><td>&nbsp;=</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td><img src="' + imageSource + '"></img></td><td>&nbsp;=&nbsp;' + squareRoot + '</td></tr></table>';
}
function PreAlgebra09() {
	var solution = pickFromRange(0, 75);
	var letter = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
	var adder = pickFromRange(-50, 50);
	var coefficient = pickFromRange(-5, 25); //coefficient of the variable, on the right side of the equation to begin with
	var numOperator = (adder >= 0) ? " + ": " - ";
	var letOperator = (coefficient >= 0) ? " + ": " - ";
	
	if((Math.abs(coefficient) <= 2) || (Math.abs(adder) <= 2)) {
		PreAlgebra09();
		return(null);
	}	
	
	var firstAdd = pickFromList(["letterFirst", "numberFirst"]);
	var numberPresented = solution + adder;
	
	if(firstAdd == "numberFirst" || 1==1) { //I'm doing this for now, to eliminate errors generated in the "else" block
	
	display += '<table cellpadding="1"><tr><td>' + (coefficient + 1) + letter + numOperator +  Math.abs(adder)  + '</td><td>=</td><td>' + (adder + solution) + letOperator + (Math.abs(coefficient) + letter) + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td>' + (coefficient + 1) + letter + numOperator +  Math.abs(adder)  + '</td><td>=</td><td>' + (adder + solution) + letOperator + (Math.abs(coefficient) + letter) + '</td></tr>';
	answerKey += '<tr><td align="right">' + (coefficient + 1) + letter + '</td><td>=</td><td>' + solution + letOperator + (Math.abs(coefficient) + letter) + '</td><td></td></tr>';
	answerKey += '<tr><td align="right">' +  letter + '</td><td>=</td><td>' + solution + '</td></tr></table>';
	
	} else {
	
	display += '<table cellpadding="1"><tr><td>' + (coefficient + 1) + letter + numOperator +  Math.abs(adder)  + '</td><td>=</td><td>' + (Math.abs(coefficient) + letter) + numOperator + Math.abs(adder + solution) + '</td></tr></table>';
	
	answerKey += '<table cellpadding="1"><tr><td>' + (coefficient + 1) + letter + numOperator +  Math.abs(adder)  + '</td><td>=</td><td>' + (Math.abs(coefficient) + letter) + numOperator + Math.abs(adder + solution) + '</td></tr>';
	answerKey += '<tr><td align="right">' + (coefficient + 1) + letter + '</td><td>=</td><td>' + (Math.abs(coefficient) + letter) + numOperator + solution + '</td><td></td></tr>';
	answerKey += '<tr><td align="right">' +  letter + '</td><td>=</td><td>' + solution + '</td></tr></table>';	
	
	}
}
function PreAlgebra13() {
	var letter = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
	var solution = pickFromRange(-10, 16);
	var lastMult = pickFromList([-5, -4, -3, -2, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
	var halfSolved = (solution * lastMult);
	var firstAdder = pickFromRange(-15, 15);
	var secondAdder = pickFromRange(-15, 15);
	var additor1 = (firstAdder >= 1) ? '+' : ''; //"additor" is the sign used to signify addition. If the number is negative, it comes with its own subtraction sign.
	var additor2 = (secondAdder >= 1) ? '+' : '';
	var additor3 = ((lastMult+secondAdder) >= 1) ? '+' : ''; 
	var additor4 = ((halfSolved+firstAdder) >= 1) ? '+' : ''; 
	var additor5 = (halfSolved >= 1) ? '+' : '';
	//alert(additor4);
	var whichFirst = pickFromList(["number", "letter"]);
	
	if((solution == 0) || (firstAdder == 0) || (secondAdder == 0) || (Math.abs(lastMult+secondAdder) <= 2) || (Math.abs(secondAdder <= 2)) || ((halfSolved+firstAdder) == 0)) {
		PreAlgebra13();
		return(null);
	}
		
	display += '<table cellpadding="1">';
	answerKey += '<table cellpadding="1">';
	
	if(whichFirst == "number") {
	
		display += '<tr><td align="right">' + (lastMult+secondAdder)+letter + additor1 + firstAdder + '</td><td align="center"> = </td><td align="left">' + (halfSolved+firstAdder) + additor2 + secondAdder+letter +'</td></tr>';
		
		answerKey += '<tr><td colspan="2" align="right">' + (lastMult+secondAdder)+letter + additor1 + firstAdder + '</td><td align="center"> = </td><td align="left" colspan="2">' + (halfSolved+firstAdder) + additor2 + secondAdder+letter +'</td></tr><tr></tr>';
		answerKey += '<tr><td colspan="2" align="right">' + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + halfSolved + additor2 + secondAdder+letter+'</td></tr><tr></tr>';
	} else {
	
		display += '<tr><td align="right">' + firstAdder + additor3 + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left">' + secondAdder+letter + additor4 + (halfSolved+firstAdder)+'</td></tr>';
		
		answerKey += '<tr><td colspan="2" align="right">' + firstAdder + additor3 + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + secondAdder+letter + additor4 + (halfSolved+firstAdder)+'</td></tr><tr></tr>';
		answerKey += '<tr><td colspan="2" align="right">' + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + secondAdder+letter + additor4 +halfSolved+'</td></tr><tr></tr>';
	}	
	
	display += '</table>';
	
	answerKey += '<tr><td colspan="2" align="right">' + lastMult+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + halfSolved + ' </td></tr><tr></tr>';
	answerKey += '<tr><td align="center" class="numerator">1</td><td rowspan="2"> x ' + lastMult+letter + '</td><td align="right" rowspan="2"> = </td><td class="numerator">1</td><td align="left" rowspan="2"> x ' + halfSolved + ' </td></tr><tr><td align="center">' + lastMult + '</td><td align="center">' + lastMult + '</td></tr>';
	answerKey += '<tr><td align="right" colspan="2">' +  letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + solution + '</td></tr></table><br>';	
}

function PreAlgebra14() {
	
	var letter = pickFromList(["A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "T", "U", "V", "W", "X", "Y", "Z"]);
	var solution = pickFromRange(-10, 16);
	var lastMult = pickFromList([-5, -4, -3, -2, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
	var halfSolved = (solution * lastMult);
	var firstAdder = pickFromRange(-64, 90);
	var secondAdder = pickFromRange(-90, 70);
	var additor1 = (firstAdder >= 1) ? '+' : ''; //"additor" is the sign used to signify addition. If the number is negative, it comes with its own subtraction sign.
	var additor2 = (secondAdder >= 1) ? '+' : '';
	var additor3 = ((lastMult+secondAdder) >= 1) ? '+' : ''; 
	var additor4 = ((halfSolved+firstAdder) >= 1) ? '+' : ''; 
	var additor5 = (halfSolved >= 1) ? '+' : '';
	//alert(additor4);
	var whichFirst = pickFromList(["number", "letter"]);
	
	if((solution == 0) || (firstAdder == 0) || (secondAdder == 0) || (Math.abs(lastMult+secondAdder) <= 10) || (Math.abs(secondAdder <= 10)) || ((halfSolved+firstAdder) == 0)) {
		PreAlgebra14();
		return(null);
	}
		
	display += '<table cellpadding="1" style="font-size:18px">';
	answerKey += '<table cellpadding="1">';
	
	squareExpression1 = makeSquareExpression(firstAdder);
	squareExpression2 = makeSquareExpression(halfSolved+firstAdder);
	
	rectExpression1 = makeRectExpression(firstAdder);
	rectExpression2 = makeRectExpression(halfSolved+firstAdder)
	
	if(whichFirst == "number") {
		display += '<tr><td align="right" valign="bottom">' + (lastMult+secondAdder)+letter + additor1 + rectExpression1 + '</td><td align="center" valign="bottom"> = </td><td align="left" valign="bottom">' + squareExpression2 + additor2 + secondAdder+letter +'</td></tr>';
		
		answerKey += '<tr><td align="right" colspan="3" valign="bottom">' + (lastMult+secondAdder)+letter + additor1 + rectExpression1 + '</td><td align="center" valign="bottom"> = </td><td align="left" colspan="2">' + squareExpression2 + additor2 + secondAdder+letter +'</td></tr>';
		answerKey += '<tr><td colspan="3" align="right" valign="bottom">' + (lastMult+secondAdder)+letter + additor1 + firstAdder + '</td><td align="center"> = </td><td align="left" colspan="2">' + (halfSolved+firstAdder) + additor2 + secondAdder+letter +'</td></tr><tr></tr>';
		answerKey += '<tr><td colspan="3" align="right">' + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + halfSolved + additor2 + secondAdder+letter+'</td></tr><tr></tr>';
	} else {
		display += '<tr><td align="right" valign="bottom">' + squareExpression1 + additor3 + (lastMult+secondAdder)+letter + '</td><td align="center" valign="bottom"> = </td><td align="left" valign="bottom">' + secondAdder+letter + additor4 + rectExpression2+'</td></tr>';
		
		
		answerKey += '<tr><td align="right" valign="bottom" colspan="3">' + squareExpression1 + additor3 + (lastMult+secondAdder)+letter + '</td><td align="center" valign="bottom"> = </td><td align="left" colspan="2" valign="bottom">' + secondAdder+letter + additor4 + rectExpression2 +'</td></tr>';
		answerKey += '<tr><td colspan="3" align="right" valign="bottom">' + firstAdder + additor3 + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + secondAdder+letter + additor4 + (halfSolved+firstAdder)+'</td></tr><tr></tr>';
		answerKey += '<tr><td colspan="3" align="right" valign="bottom">' + (lastMult+secondAdder)+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + secondAdder+letter + additor4 +halfSolved+'</td></tr><tr></tr>';
	}	
	
	display += '</table>';
	
	answerKey += '<tr><td colspan="3" valign="bottom" align="right">' + lastMult+letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + halfSolved + ' </td></tr><tr></tr>';
	answerKey += '<tr><td rowspan="2" width="100%">&nbsp;</td><td align="center" class="numerator" valign="bottom">1</td><td rowspan="2" align="right">&nbsp;x&nbsp;' + lastMult+letter + '</td><td align="right" rowspan="2"> = </td><td class="numerator">1</td><td align="left" rowspan="2">&nbsp;x&nbsp;' + halfSolved + ' </td></tr><tr><td align="center">' + lastMult + '</td><td align="center">' + lastMult + '</td></tr>';
	answerKey += '<tr><td align="right" valign="bottom" colspan="3">' +  letter + '</td><td align="center"> = </td><td align="left" colspan="2">' + solution + '</td></tr></table><br>';
	
}

function PreAlgebra16() {
	var centigradeSeed = pickFromRange(50, -2);
	var centigradeValue = (centigradeSeed * 5);
	var addMore = (pickFromRange(100, 0) >= 88) ? true : false;
	if (addMore) {
		var addend = pickFromRange(5, 1);
		centigradeValue += addend;
	}
		dividedByFive = centigradeValue / 5;
		timesNine = (dividedByFive * 10) - dividedByFive;
		plusThirtyTwo = timesNine + 32;
		
		display += '<table cellpadding="1" style="font-size:18px"><tr><td>' + centigradeValue + '&deg; C = </td><td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td><td>F</td></tr></table>';		
		answerKey += '<table cellpadding="1" style="font-size:18px"><tr><td>' + centigradeValue + '&deg; C &divide; 5 = ' + dividedByFive + '<br>' + dividedByFive + ' x 9 = ' + timesNine + '<br>' + timesNine + ' + 32 = ' + plusThirtyTwo + '&deg; F</td></tr></table>'; 
		
}

function PreAlgebra17() {
	var centigradeSeed = pickFromRange(50, -2);
	var centigradeValue = (centigradeSeed * 5);
	var addMore = (pickFromRange(100, 0) >= 88) ? true : false;
	if (addMore) {
		var addend = pickFromRange(5, 1);
		centigradeValue += addend;
	}
		dividedByFive = centigradeValue / 5;
		timesNine = (dividedByFive * 10) - dividedByFive;
		plusThirtyTwo = timesNine + 32;
		
		display += '<table cellpadding="1" style="font-size:18px"><tr><td>' + plusThirtyTwo + '&deg; F = </td><td class="numerator">&nbsp;&nbsp;&nbsp;&nbsp;</td><td>C</td></tr></table>';		
		answerKey += '<table cellpadding="1" style="font-size:18px"><tr><td>' + plusThirtyTwo + '&deg; F - 32 = ' + timesNine + '<br>' + timesNine + ' &divide; 9 = ' + dividedByFive + '<br>' + dividedByFive + ' x 5 = ' + centigradeValue + '&deg; C</td></tr></table>'; 
		
}

//build "ending lesson" selection list:
function selectObjectBuilder(starting) {
	window.document.forms[0].endLesson.options.length = 0;
   window.document.forms[0].endLesson.options.length = (starting.length - starting.selectedIndex);
	for (var ii = 0; ii < window.document.forms[0].endLesson.length; ii ++) {
		window.document.forms[0].endLesson.options[ii].text = window.document.forms[0].startLesson.options[ii + starting.selectedIndex].text;
		window.document.forms[0].endLesson.options[ii].value = ii + starting.selectedIndex + 1;
	}
}

function checkSelection(starting, ending) {
	//empty out lessonList array
	for (var k = 0; k < lessonList.length; k ++) {
		lessonList[k] = null;
		lessonList.length = 0;
		}
if(developer == "false") {
	var j = 0;
		for (i = starting.selectedIndex; i < ending.value; i++) {
			if (starting.options[i].value != "") {
				lessonList[j] = starting.options[i].value;
				j ++;
			}//end inner if
		}// end for	
} else { 
alert('hi')
}	
}//end function

function chooseLessons() {
	chosenLesson = lessonList[(Math.floor(Math.random() * (lessonList.length)))];
	return chosenLesson;
}

function generate() {
var chosenLesson = chooseLessons();
eval(chosenLesson);
}
function generate20() {
tr_td_height = 151;
display = "";
answerKey = "";
	var rows = parseInt(document.getElementById("rows").value);
	var columns = parseInt(document.getElementById("columns").value);
	display += '<table width="100%">';//open table	
	//Conditionally, Add Message at the top:
	var toggle = lessonList.toString();
	if ((toggle.indexOf("Zeta17") != -1) || (toggle.indexOf("Zeta18") != -1) || (toggle.indexOf("Zeta20") != -1) || (toggle.indexOf("Zeta21") != -1) || (toggle.indexOf("Zeta23") != -1) || (toggle.indexOf("Zeta24") != -1)) {
		display += '<tr style="font-size:small"><td colspan="' + columns + '">';
		display += '<ul>';
		display += '<li>A: Quotient comes out even.</li>';
		display += '<li>B: Round to 100ths.</li>';
		display += '<li>C: Repeated decimals.</li>';
		display += '<li>D: Fractional remainder.</li>';
		display += '<li>E: Change to decimal then to percent.</li>';
		display += '<li>F: Change decimal to fraction.</li>';
		display += '</ul>';
		display += '</td></tr>';
	}
	if ((toggle.indexOf("Gamma21") != -1) || (toggle.indexOf("Gamma23") != -1) || (toggle.indexOf("Gamma24") != -1) || (toggle.indexOf("Gamma25") != -1) || (toggle.indexOf("Gamma28") != -1) || (toggle.indexOf("Beta") != -1)) {
		tr_td_height = 200;
	}
	//End of conditional message
	answerKey += '<table width="100%" class="answerKey">';//open table
	for (var i = 0; i < rows; i++) { 
		display += '<tr height="' + tr_td_height + '">';//open row
		answerKey += '<tr height="' + tr_td_height + '">';//open row
		for (var j = 0; j < columns; j++) { 
				if((toggle.indexOf("Delta30") != -1) && (j == 0)) {
					j = 1;
				} 
			display += '<td width="' + (100 / columns) + '%" height="' + tr_td_height + '">';//open cell
			answerKey += '<td width="' + (100 / columns) + '%" height="' + tr_td_height + '">';//open cell
				 generate();//insert problem
			display += '</td>';//end of cell
			answerKey += '</td>';//end of cell
		}
		display += '</tr>';//end of row
		answerKey += '</tr>';//end of row
	}
	display += '</table>';//end of table
	answerKey += '</table>';//end of table
//we don't need it to write to the existing window...
//document.getElementById("display").innerHTML = display + answerKey;
//open window for worksheet, and write to it

//re-enable these lines after testing:
//********************************************************************************
worksheetWindow = window.open("", "page_a","scrollbars,resizable,width=720,menubar");
worksheetWindow.focus();
worksheetWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="/wp-includes/css/worksheet.css" rel="stylesheet" type="text/css">');
worksheetWindow.document.write('<title>Printable Worksheet</title></head><body class="style1">');
worksheetWindow.document.write('<table width="100%"><tr><td width="27"></td><td align="center">');
worksheetWindow.document.write('<form><input type="button" value="Print this page" onClick="window.print()"></form>');
worksheetWindow.document.write(display);
worksheetWindow.document.write('</td></tr></table>');
worksheetWindow.document.write('</body></html>');
worksheetWindow.document.close();
}
function makeAnswerKey() {
answerWindow = window.open("", "page_b","scrollbars,resizable,width=720,menubar");
answerWindow.focus();
answerWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="/wp-includes/css/worksheet.css" rel="stylesheet" type="text/css">');
answerWindow.document.write('<title>Printable Answer Key</title></head><body>');
answerWindow.document.write('<table width="100%"><tr><td width="27"></td><td align="center">Answer Key<br>');
answerWindow.document.write('<form><input type="button" value="Print this page" onClick="window.print()"></form>');
answerWindow.document.write(answerKey);
answerWindow.document.write('</td></tr></table>');
answerWindow.document.write('</body></html>');
answerWindow.document.close();
}
//*********************************************************************************

//Pick or convert a number Functions:
//*********************************************************************************
function pickFromRange(upperLimit, lowerLimit) {
	result = Math.floor(Math.random() * ((upperLimit + 1) - lowerLimit)) + lowerLimit;
	return result;
}
 
function pickFromList(hatArray) {
	hatIndex = pickFromRange((hatArray.length - 1), 0);
	return(hatArray[hatIndex]);
}
function romanize (num) {
	if (!+num)
		return false;
	var	digits = String(+num).split(""),
		key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
		       "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
		       "","I","II","III","IV","V","VI","VII","VIII","IX"],
		roman = "",
		i = 3;
	while (i--)
		roman = (key[+digits.pop() + (i * 10)] || "") + roman;
	return Array(+digits.join("") + 1).join("M") + roman;
}

//*********************************************************************************

//Add complexity: take a number, and expand it into an expression with an exponent
//*********************************************************************************
 function makeSquareExpression(simpleNumber) {
 	if(simpleNumber <= 0) {
 		wholeRoot = Math.floor(Math.sqrt(simpleNumber*-1));
		largestSquare = Math.pow(wholeRoot, 2);
		firstAddend = pickFromRange((wholeRoot - 1), 1);
		secondAddend = wholeRoot - firstAddend;
		thirdAddend = (simpleNumber+largestSquare==0) ? '': (simpleNumber+largestSquare);
		newExpression = '-(' + firstAddend + '+' + secondAddend + ')<sup>2</sup>' + thirdAddend;
		return(newExpression);
	} else {
 		wholeRoot = Math.floor(Math.sqrt(simpleNumber));
		largestSquare = Math.pow(wholeRoot, 2);
		firstAddend = pickFromRange((wholeRoot - 1), 1);
		secondAddend = wholeRoot - firstAddend;
		thirdAddend = (simpleNumber-largestSquare==0) ? '': '+' + (simpleNumber-largestSquare);
		newExpression = '(' + firstAddend + '+' + secondAddend + ')<sup>2</sup>' + thirdAddend;
		return(newExpression);
	} 
 }

//*********************************************************************************

//Add complexity: take a number, and expand it into an expression with multiplication
//*********************************************************************************
 function makeRectExpression(simpleNumber) {
 	wholeRoot = Math.floor(Math.sqrt(Math.abs(simpleNumber)));
	firstFactor = pickFromRange(2, wholeRoot);
	secondFactor = Math.floor(simpleNumber / firstFactor);
	remainder = simpleNumber - (firstFactor * secondFactor);
	newExpression = (secondFactor <= 0) ? '+' + firstFactor + '&nbsp;<b>&middot;</b>&nbsp;' + secondFactor + '+' + remainder: '' + firstFactor + '&nbsp;<b>&middot;</b>&nbsp;' + secondFactor + '+' + remainder;
	return(newExpression);
 }

//Add complexity: take a number, and expand it into an expression with addition
//*********************************************************************************
  function expand(passedNumber) {
  	firstAddend = pickFromRange(1, (passedNumber-1));
	secondAddend = passedNumber-firstAddend;
	newExpression = '' + firstAddend + '&nbsp;+&nbsp;' + secondAddend;
	return(newExpression);
  }

//round, as taught in school
	function schoolRound(numberToRound, toNearest) { //toNearest is nearest "10", "100", etc.
		remainder = numberToRound % toNearest;
		roundedNumber = numberToRound - remainder; //subtract the remainder
		if (remainder >= 5) {
			roundedNumber = roundedNumber + toNearest; //if the remainder is greater than or equal to 5, it will be the next higher instead
		}
		return(roundedNumber);
	}

//-->

