// Define topic/opinion data referesh handler
// this refeshes the data that is effected by login/logout status
_log_in_out_data_refesh = function () {
  // Refresh the data
  HashListener.refresh();
};

_show_main_loading_message = function() {
    showLoading('topicContent');
};

// Most of the Topic class has already been defined in global.v22.js (for topic popup)
$.extend(Veri.Topic, {

    // hash params are sent to the controller via POST when
    // switching between opinion and topic pages.
    hashParamsMap : {'_pg' : 'page',
                     '_ur' : 'unread',
                     '_vw' : 'view',
                     '_pd' : 'period',
                     '_pl' : 'poll',
                     '_o1' : 'op1',
                     '_o2' : 'op2',
                     '_qr' : 'query'
    },

    loadOpinion: function(opts, firstRun, refresh, isDefault, changed)
    {
        if (!firstRun && !refresh) {
            // hash has changed: we need to go to topic page
            // (this means that the hash should always be the same as the POST params
            // on opinion page)
            Veri.Topic.backToTopic(true);
            return;
        }

        $("#topicContent").hide();
        $("#opinionContent").show();

        if (refresh) {
            // Load Opinion
            $("#opinionContent").fillFromAjax(
                        base_url + "/opinionService/opinionFullView/?topic=" + Veri.Topic.topicId 
                            + "&opinion=" + Veri.Topic.opinionHash,
                        Veri.Vote.enableInteractivity,
                        $.SHOW_LOADING_MESSAGE);
        } 
    }
});
