

var countup = 0;
function showsolution() {
var allInputs = document.getElementsByTagName("input");
for (var i =0; i < 5; i++) {
	for (var j =0; j < 5; j++) {
if (allInputs[countup].type=="text") {
//allInputs[countup].style.color = inputlettersol;
allInputs[countup].value = solutions[countup];
allInputs[countup].style.color = '#000000';
//allInputs[countup].style.fontSize = "14pt";
allInputs[countup].style.fontStyle = "normal";
}
countup = countup + 1;
}
}
countup = 0;
}

function showsindiv() {
var thisone = document.getElementById("show00");
var that = thisone.innerHTML;
alert (that);
thisone.style.background = "#ccffcc";

}

function checksolution() {
var allInputs = document.getElementsByTagName("input");
for (var i =0; i < 5; i++) {
	for (var j =0; j < 5; j++) {
if (allInputs[countup].type=="text") {

if (solutions[countup] == allInputs[countup].value) {

}
else {
//alert (solutions[i][j]);
var mistakes = "1";
}
}
countup = countup + 1;
}
}
countup = 0;
if (!mistakes) {
alert ("Congratulations! You got the answer right!");
}
else {
alert ("Sorry, your answer is not currently correct");
}
mistakes = 0;
}

function resetgrid() {

var allInputs = document.getElementsByTagName("input");
for (var i =0; i < 5; i++) {
	for (var j =0; j < 5; j++) {
if (allInputs[countup].type=="text") {
allInputs[countup].value = '';
}
countup = countup + 1;
}
}
countup = 0;
}

function helpcell() {

}
function savelastmove() {

}

//
var font, fcolor, setcheckval;
function showmistakes(thisrow,thiscol) {
// nb re lower case
if (thisrow == "9") {
}

else {
var thisref = document.getElementById("cell"+thisrow+thiscol);
//alert (thisref.value.length);
if (thisref.value.length > 1)  {
// update font size to smaller
thisref.style.fontSize = "10pt";
} // greater than 1
else {
thisref.style.fontSize = "14pt";
}
}

var allInputs = document.getElementsByTagName("input");
if (document.sudokucheck.iswrong.checked) {
font = 'italic';
setcheckval = 1;

}
else {
font = 'normal';
setcheckval = 0;
}
var usehere = -1;
for (var i =0; i < 5; i++) {
for (var j = 0; j < 5; j++) {
usehere = usehere + 1;
if (allInputs[usehere].type=="text") {
if (allInputs[usehere].value != "") {
if (allInputs[usehere].value == solutions[usehere]) {
allInputs[usehere].style.fontStyle = "normal";
allInputs[usehere].style.color = "black";
}
else {
//
if (allInputs[usehere].value.length < 2) {
allInputs[usehere].style.fontStyle = font;
if (setcheckval) {
allInputs[usehere].style.color = "black";
}
//
}
else {
allInputs[usehere].style.fontStyle = "normal";
allInputs[usehere].style.color = "black";
						}
					}
				}

			}

		}
	}
usehere = 0;
}

