

var advert = {
    change: function(a) {
        var rpl = ajax.exec('GET', '/application/api/advert.change.php', 'type=' + a.type + '&page=' + a.page_id + '&number=' + a.number + '&counter=' + a.counter + '&current=' + a.current.toString());
        var reply = ajax.eval(rpl);
        if (reply.error) return;

        window.setTimeout(
            function() {
                app.get('ads_display_' + a.counter).innerHTML = reply.view;
                a.current = reply.ids;
                return advert.change(a);
            },
            (a.time * 1000)
        );
    }
}

