function select_view_report_generator_row(id, table_rnd, mainid, get) {
    var open_row = true;
    if (($('#contents_ajax_table_body_'+table_rnd).find('tr.odd_selected').attr('id')=='contents_ajax_row_'+table_rnd+'_'+mainid) ||
        ($('#contents_ajax_table_body_'+table_rnd).find('tr.even_selected').attr('id')=='contents_ajax_row_'+table_rnd+'_'+mainid)) {
        open_row = false;
    }

    $('#contents_ajax_table_body_'+table_rnd).find('tr.odd_selected').removeClass('odd_selected').addClass('odd');
    $('#contents_ajax_table_body_'+table_rnd).find('tr.even_selected').removeClass('even_selected').addClass('even');

    if (open_row) {
        if ($('#contents_ajax_row_' + table_rnd + '_' + mainid).attr("class") == "odd") {
            $('#contents_ajax_row_' + table_rnd + '_' + mainid).removeClass('odd').addClass('odd_selected');
        } else {
            $('#contents_ajax_row_' + table_rnd + '_' + mainid).removeClass('even').addClass('even_selected');
        }
    }

    if (open_row) {
        $('.contents_ajax_single_row_div').hide();
        $('.contents_ajax_single_rows_tr').hide();		

        $('#contents_ajax_single_row_' + table_rnd + '_' + mainid).html('<br>');
        $('#contents_ajax_single_row_' + table_rnd + '_' + mainid).show();
        $('#contents_ajax_single_row_tr_' + table_rnd + '_' + mainid).show();

        //pod strokoj
        changeMain('contents_ajax_single_row_'+table_rnd+'_'+mainid,'report_generator.get_ajax_single_report_generator',id,mainid,get,table_rnd);
    } else {
        $('.contents_ajax_single_row_div').hide();
        $('.contents_ajax_single_rows_tr').hide();				
    }

    return false;
}

function select_sortmenu_report_generator(table_rnd, cell_id, sort_dir, div_name, get_go, get_param1, get_param2) {
    //making all TH - passive
    var tmp_th = document.getElementById('sortmenu_' + table_rnd).getElementsByTagName('th');
    
    for (var i = 0; i < tmp_th.length; i++) {
        //taking from all A arrows
        var tmp_but = document.getElementById('sortmenu_' + table_rnd).getElementsByTagName("th")[i].getElementsByTagName('a');

        if (tmp_th[i].className == 'sort_active') {
            tmp_th[i].className = 'sort_passive';
        }

        if (tmp_th[i].className == 'sort_passive') {
            for (var i2 = 0; i2 < tmp_but.length; i2++) {
                tmp_but[i2].style.backgroundImage = 'url(design/updown/updown_small.gif)';
                tmp_but[i2].title = sort_dir;

                if (sort_dir=="ASC") {
                    tmp_but[i2].onmouseover = function onmouseover(event) { this.style.backgroundImage = 'url(design/updown/updown_ASC_trans.gif)'; };
                    tmp_but[i2].onmouseout = function onmouseout(event) { this.style.backgroundImage = 'url(design/updown/updown_small.gif)'; };
                    tmp_but[i2].onmousedown = function onmousedown(event) { this.style.backgroundImage = 'url(design/updown/updown_ASC_solid.gif)'; };
                } else {
                    tmp_but[i2].onmouseover = function onmouseover(event) { this.style.backgroundImage = 'url(design/updown/updown_DESC_trans.gif)'; };
                    tmp_but[i2].onmouseout = function onmouseout(event) { this.style.backgroundImage = 'url(design/updown/updown_small.gif)'; }; 
                    tmp_but[i2].onmousedown = function onmousedown(event) { this.style.backgroundImage = 'url(design/updown/updown_DESC_solid.gif)'; }; 
                }
            }
        }
    }

    document.getElementById('sortmenu_' + table_rnd + '[' + cell_id + ']').className = 'sort_active';

    //making button hoverable
    var sel_but = document.getElementById('sortmenu_' + table_rnd + '[' + cell_id + '_a]');	
    if (sort_dir == "ASC") {
        sel_but.style.backgroundImage = "url(design/updown/updown_ASC_solid.gif)"; 
        sel_but.onmouseover = function onmouseover(event) { this.style.backgroundImage='url(design/updown/updown_DESC_ASC_solid.gif)'; };
        sel_but.onmouseout = function onmouseout(event) { this.style.backgroundImage='url(design/updown/updown_ASC_solid.gif)'; };
        sel_but.onmousedown = function onmousedown(event) { this.style.backgroundImage='url(design/updown/updown_DESC_solid.gif)'; };
    } else {
        sel_but.style.backgroundImage = "url(design/updown/updown_DESC_solid.gif)";
        sel_but.onmouseover = function onmouseover(event) { this.style.backgroundImage='url(design/updown/updown_ASC_DESC_solid.gif)'; };
        sel_but.onmouseout = function onmouseout(event) { this.style.backgroundImage='url(design/updown/updown_DESC_solid.gif)'; }; 
        sel_but.onmousedown = function onmousedown(event) { this.style.backgroundImage='url(design/updown/updown_ASC_solid.gif)'; }; 
    }

    //making this active box title different from others..
    if (sort_dir=="ASC") {
        sort_dir_new = 'DESC';
        sel_but.title = sort_dir_new;
    } else {
        sort_dir_new = 'ASC';
        sel_but.title = sort_dir_new;
    }

    changeMain(div_name, get_go, get_param1, get_param2, sort_dir, table_rnd);
}

