// Generated from /ajax.phtml?showstub=true&objectname=CommonController, DO NOT EDIT!
if(typeof(CommonController) == 'undefined')
    CommonController = new Object();

Object.extend(CommonController,
{
    _callback5b343be322c33: "/ajax.phtml",

    _getJSON: function(r, j)
    {
        j = (j || r.headerJSON || r.responseJSON);
        if(j == null)
            return null;
        if(j.errors || j.failed)
        {
            var f = function(a, c)
            {
                var e = $(c);
                if(a.length > 0)
                {
                    var s = '<ul>';
                    $(a).each(function(e){ s += '<li>'+e+'</li>'; });
                    s += '</ul>';
                    if(e){ e.update(s); e.show(); }
                }
                else
                {
                    if(e){ e.hide(); }
                }
            }
            if(!j.errors)
            {
                j.errors = {error: [], warning: [], info: []}
                if(j.failed)
                    j.errors.error[0] = j.message;
            }

            f(j.errors.error, 'globuleError');
            f(j.errors.warning, 'globuleWarning');
            f(j.errors.info, 'globuleInfo');
        }
        return j;
    },

    _proxy: function(callbackurl, methodName, args, sync)
    {
        var targs = $H();
        for(var i = 0; i < args.length-1; i++){ targs.set('args[' + i + ']', args[i]); }
        callback = args[args.length-1];
        var ar = new Ajax.Request(callbackurl + '?method=' + methodName,
        {
            method: 'post',
            asynchronous: (!sync),
            parameters: targs,
            onComplete: (sync)?null:callback,
            onException: function(request, e){console.debug(request, e);}
        });
        if(sync)
            return new Ajax.Response(ar);
    },

    _getCountries: function(){ this._proxy(this._callback5b343be322c33, '_getCountries', arguments, false); },
    _getCountries_sync: function(){ return this._proxy(this._callback5b343be322c33, '_getCountries', arguments, true); },

    _t: ''
});
// End of generated code