setInterval(function () {
    //get the divs that are to be updated via ajax.
    $('div[data-atisParent="true"][data-ajax="true"]').each(function () {
        var divId = $(this).attr('id');
        var langSelected = Cookies.get("_culture") ? Cookies.get("_culture") : "";
        //get the fresh content for the div id and update the contents.
        $.ajax('/cms/gethtmlcontent?divId=' + divId + "&lang=" + langSelected).done(function (data) {
            var div = $('#' + divId);
            if (data) {
                //empty the cms managed div.
                div.empty();

                //for each virtual div within the cms managed div.
                $.each(data, function (index, value) {
                    var className = value.region != null ? value.region + "Section" : "";
                    div.append($('<div data-atis="true">')
                       .attr('id', 'virtual-' + value.virtualDivId)
                       .attr('class', className)
                       .html(value.htmlContent));
                });

                // listener at regionContentFilter.js
                $(document).trigger("CmsContentRefreshed");
            }
        });
    });
    //every 30 seconds.
}, 30000);
