var req;
function reload(){
    this.Update = function(){
        var loc = encodeURIComponent(window.location.href);
        
        req = new Ajax.Request('reloadCaptcha.php', {
            onSuccess: function(Response){
                document.getElementById('captcha').innerHTML = Response.responseText;
            },
            onLoading: function(){
            },
            onFailure: function(){
                alert('fail');
            }
        });
    }
    
}

var captcha = new reload();

function reloadCaptcha(){
    captcha.Update();
}