var Captcha = new function() {
	
	this.check = function(formInputElem) {

		sajax_call_callback('plg_capcha::ajaxCheck', this.callback, new Array(formInputElem.value));
	}
	
	this.callback = function(response) {

		switch (response) {
			case true:
				err_display = 'none';
				ok_display = 'block';
				break;

			default:
				err_display = 'block';
				ok_display = 'none';
				break;
		}

		getElement('captchaError').style.display	= err_display;
		getElement('captchaCorrect').style.display	= ok_display;
	}
	
	this.keyUp = function(formInputElem) {
		if (formInputElem.value.length == 6) {
			this.check(formInputElem);
		}
	}
}