var o;

function seto() {
	with(document.logic)
		o = [[f1,m1,c1,w1],[f2,m2,c2,w2],[f3,m3,c3,w3],[f4,m4,c4,w4]];
}

function cleartable() {
	for(i=0; i<4; i++) for(j=0; j<4; j++) o[i][j].value='0'; return false
}

// if you're here and deciphering the code,
// you're effectively peeking at the answers


function checklogic() {
	c = '134312421243'; p = ['','','',''];
	for (i=0; i<4; i++) {
		l = o[i][0].value-1; for (j=1; j<4; j++) p[l] += o[i][j].value
	}
	for (i=0; i<4; i++) if (p[i]=='' || p[i].indexOf('0')>=0) {
		alert('Finish filling it in first!'); return false
	}
	for (i=0; i<4; i++) if (p[i] != c.substring(i*3, (i+1)*3)) {
		alert('No, that\'s not the answer.  Better luck next time!');
		return false
	}
	alert('Well done, you\'ve solved it!'); return false
}
