var nn6=document.getElementById&&!document.all;

var right = 0;
var wrong = 0;

function check_answer(text,answerHash,a2hash)
{
input = document.getElementById('v' + text).value.toLowerCase();

if (input == "")
	return;

subHash = hex_md5(input);
wasright = 0;
if (subHash == answerHash || subHash == a2hash)
	{
	document.getElementById('v' + text).style.background = "green";
//	document.getElementById('b' + text).disabled = true;
	document.getElementById('v' + text).disabled  = true;
	wasright = 1;
	right++;
	}
else
	{
	document.getElementById('v' + text).style.background = "red";
	wrong++;
	}


var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        try {
                xmlhttp = new XMLHttpRequest();
        } catch (e) {
                xmlhttp=false;
        }
}
if (!xmlhttp && window.createRequest) {
        try {
                xmlhttp = window.createRequest();
        } catch (e) {
                xmlhttp=false;
        }
}
xmlhttp.open("GET","utils/update_score.php?id=" + text + "&right=" + wasright,true);
xmlhttp.send(null);

updateStatus();
}

function updateStatus()
{
text = "Your Score: " + right + " right in " + (right + wrong) + " attempts";
nn6 ? document.getElementById("status").innerHTML = text : document.all.status.innerHTML = text;
}

