captcha = new Class({
	initialize:function() {
		if ($chk($('captcha'))) {
			$('captcha').addEvent('keyup', function() {
				this.setProperty('value', this.getValue().toUpperCase());
			});
		}
	},
	atualizar:function() {
		if ($chk($('captcha_img'))) {
			$('captcha_img').setProperty('src', '/captcha/carregando.gif');
			new Ajax('/atualizar_captcha/', {
				method:'get',
				onComplete:function(r) {
					$('captcha_img').setProperty('src', r);
					if ($chk($('captcha'))) {
						$('captcha').setProperty('value', '');
						$('captcha').focus();
					}
				}
			}).request();
		}
	}
});
