// Global variables.var hiLiteColor = '#ff3';var normalColor = 'white';var domCompliant = (document.getElementById);function initFocus() {	document.forms[0].elements[0].focus();	}function enter(thisId) {	if (domCompliant) {		nodeObj = document.getElementById(thisId);		nodeObj.style.backgroundColor = hiLiteColor;		}	}function exit(thisId) {	if (domCompliant) {		nodeObj = document.getElementById(thisId);		nodeObj.style.backgroundColor = normalColor;		}	}function clearSolutions(matrix, size) {	offSet = size * size + size + 2;	for (i = 0; i < size; i++) matrix[i+offSet].value = '';	}function validMatrix(matrix, size) {	limit = size * size + size;	valid = true;	i = 0;	while (i < limit && valid) {		elementName = matrix[i].name;		valid = !isNaN(matrix[i].value);		i++;		}	if (!valid) {		row = elementName.substring(1);		col = elementName.substring(0,1);		if (col == 's') variable = '"equal to" part'		else variable = col.toUpperCase() + ' coefficient';		alert('Oops! Must have a number in the ' + variable + ' of row ' + row + '.');		matrix[element].focus();		}	return valid;	}function gcf(a, b) {	if (a < b) t = a, a = b, b = t;	remainder = a % b;	while (remainder != 0 ) {		a = b;		b = remainder;		remainder = a % b;		}	return b;	}function formatFraction(sign, n, d) {	maxDigits = document.forms[1].limit.value;	if (isNaN(maxDigits)) maxDigits = 2;	maxDigits = (Math.floor(maxDigits));	if (maxDigits < 0) maxDigits = -maxDigits;	document.forms[1].limit.value = maxDigits;	maxSize = Math.pow(10,maxDigits);	if ((n < maxSize) && (d < maxSize)) value = (sign * n) + '/' + d	else value = sign * n / d;	return value;	}function reduce(n, d) {	if (d == 0) return 'No Solution';	if ((n / d) == Math.floor(n / d)) return n / d;	else {		sign = (n * d) / Math.abs(n * d);		n = Math.abs(n);		d = Math.abs(d);		cd = gcf(n,d);		value = formatFraction(sign, n/cd, d/cd);		return value;		}	}
