    var reloadPage = function(currentUrl, response)
    {
        // после логинизации
        if (response.loginOn) {
            doRedirect(currentUrl);
        } else {
            // после регистрации
            $("#registration").empty().append($("#regText").show());
            $("#registrationCandidate").html($("#registration").html());
        }
    }

    // смена капчи
    /*
    var changeCapture = function(formId)
    {
        var capcha = $("#" + formId + "_randomImage");
        if (capcha.attr('src').indexOf('?') != -1) {
            var arr = capcha.attr('src').split('?');
            if (arr[1].indexOf('&') != -1) {
                var arr2 = arr[1].split('&');
                var phpsessid = arr2[0];
            } else {
                var phpsessid = arr[1];
            }
            capcha.attr('src', '/antibot.php?' + phpsessid + '&u=' + Math.random());
        } else {
            capcha.attr('src', '/antibot.php?u=' + Math.random());
        }
        //$("#" + formId + "_randomImage").attr("src", '/antibot.php?u=' + Math.random());
    }
    */

    var toggleInfoUser = function ($this)
    {
        $('span,p').not( $($this).parent() ).removeClass('invert');
        if (! $('div.pointerReg').hasClass('borderBottom')) {
            $('div.pointerReg').toggleClass('borderBottom');
            $('div.userReg').removeClass('borderBottom');
        } else if ( $('#registration').css('display') == 'none') {
            $('div.pointerReg').removeClass('borderBottom');
        }
        $('div.regBlock').not( $('#registrationInfo') ).hide();
        $('#registrationInfo').toggle();
        $($this).parent().toggleClass('invert');
        return false;
    }

    var toggleRegUser = function ($this)
    {
        changeCapture("register-form");
        $('span,p').not( $($this).parent() ).removeClass('invert');
        if (! $('div.pointerReg').hasClass('borderBottom')) {
            $('div.pointerReg').toggleClass('borderBottom');
            $('div.userReg').removeClass('borderBottom');
        } else if ( $('#registrationInfo').css('display') == 'none') {
            $('div.pointerReg').removeClass('borderBottom');
        }
        $('div.regBlock').not( $('#registration') ).hide();
        $('#registration').toggle();
        $($this).parent().toggleClass('invert');
        return false;
    }

    var toggleInfoArtist = function ($this)
    {
        $('span,p').not( $($this).parent() ).removeClass('invert');
        if (! $('div.userReg').hasClass('borderBottom')) {
            $('div.userReg').toggleClass('borderBottom');
            $('div.pointerReg').removeClass('borderBottom');
        } else if ( $('#registrationCandidate').css('display') == 'none') {
            $('div.userReg').removeClass('borderBottom');
        }
        $('div.regBlock').not( $('#registrationPainterInfo') ).hide();
        $('#registrationPainterInfo').toggle();
        $($this).parent().toggleClass('invert');
        return false;
    }

    var toggleRegArtist = function ($this)
    {
        changeCapture("register-form-candidate");
        $('span,p').not( $($this).parent() ).removeClass('invert');
        if (! $('div.userReg').hasClass('borderBottom')) {
            $('div.userReg').toggleClass('borderBottom');
            $('div.pointerReg').removeClass('borderBottom');
        } else if ( $('#registrationPainterInfo').css('display') == 'none') {
            $('div.userReg').removeClass('borderBottom');
        }
        $('div.regBlock').not( $('#registrationCandidate') ).hide();
        $('#registrationCandidate').toggle();
        $($this).parent().toggleClass('invert');
        return false;
    }