
var Taxonomia = {

    loading: false,

    // -------------------------------------------------------------------------
    loadContent: function(secc, tema, subt, pag) {

        if(typeof secc === 'undefined' || secc === '0') {
            return;
        }
        if(typeof tema === 'undefined' || tema === '0') {
            tema = '';
        }
        if(typeof subt === 'undefined' || subt === '0') {
            subt = '';
        }
        if(typeof pag === 'undefined') {
            pag = '1';
        }
        var url = '/prontus_df/site/tax/port/fid_general/portinterior_'+secc+'_'+tema+'_'+subt+'_'+pag+'.html';
        Taxonomia.loadURLTax(url);
    },

    // -------------------------------------------------------------------------
    loadContentOpinion: function(secc, tema, subt, pag) {

        if(typeof secc === 'undefined' || secc === '0') {
            return;
        }
        if(typeof tema === 'undefined' || tema === '0') {
            tema = '';
        }
        if(typeof subt === 'undefined' || subt === '0') {
            subt = '';
        }
        if(typeof pag === 'undefined') {
            pag = '1';
        }
        var url = '/prontus_df/site/tax/port/fid_columnista/portinterior_'+secc+'_'+tema+'_'+subt+'_'+pag+'.html';
        Taxonomia.loadURLTax(url);
    },

    // -------------------------------------------------------------------------
    loadURLTax: function(url) {

        if(Taxonomia.loading) {
            return;
        }
        Taxonomia.loading = true;
        $('#tax-content').parent().find('.loading').show();
        $('#tax-content').hide();
        setTimeout(function() {
        $('#tax-content').load(url, function(responseText, textStatus) {
            $('#tax-content').parent().find('.loading').hide();
            $('#tax-content').fadeIn();
            if(textStatus == 'success') {
                //TODO hacer que los clicks de la paginación carguen acá mismo
                $('#artics-content .paginacion a').click(function() {
                    Taxonomia.loadURLTax($(this).attr('href'));
                    return false;
                });
            } else {
                $(this).html('No se pudo cargar la taxonomía');
            }
            Taxonomia.loading = false;
        });
        }, 500);
    }
};

