function testcaptcha(captcha, hash) {
	mypostbody = "captcha=" + captcha;
	mypostbody = mypostbody + "&hash=" + hash;
	new Ajax.Request('testcaptcha.cfm', {method:'post', postBody:mypostbody, onSuccess:handlercaptchaFunc, onFailure:errFunc});
}

var handlercaptchaFunc = function(t) {
	//alert(t.responseText);
	if (t.responseText == 0) {
		newAudio('buzzthru.wav', 'sounderror', 12, 0);
		setTimeout("alert('Sorry, your response does not match the challenge.\\nTry again.');", 100);
	} else {
		newAudio('arrowhit.wav', 'soundsuccess', 12, 0);
		setTimeout("alert('Success - you responded correctly to the challenge.');", 100);
	}
}

var errFunc = function(t) {
  // alert('Error.\nStatus Code: ' + t.status + '.\nStatus Text: ' + t.statusText+'.' + t.responseText);
   $('captcha').innerHTML='Error.<br>Status Code: ' + t.status + '.<br>Status Text: ' + t.statusText+'.' + t.responseText;
}

function reloadcaptcha() {
	new Ajax.Request('loadcaptcha.cfm', {method:'post', postBody:'', onSuccess:reloadcaptchaFunc, onFailure:errFunc});
}

var reloadcaptchaFunc = function(t) {
	$('captcha').innerHTML = t.responseText;
}
