// $RCSfile: captcha.js,v $
// $Source: /cvs/cyplonweb-dev/captcha/captcha.js,v $, $Revision: 1.3 $, $Date: 2009/12/08 15:04:58 $, $State: Exp $

function bpCaptcha() {
	var img = $('captchaimg');
	if(img) {
		var date = new Date();
		img.src = 'captcha/captcha.php?ts=' + date.getUTCMilliseconds();
	}
	return false;
}

function checkCaptcha() {
    var code = $('formcaptcha');
    var date = new Date();
    var ts = date.getUTCMilliseconds();
    var req = new Ajax.Request('ajax-captcha',
        {
            asynchronous: false,
            method: 'post',
            parameters: { 'formcaptcha': code.value, 'ts': ts }
        }
    );
    var resp = req.transport.responseText;
    return resp == 'true';
}