function clear_search_thesaurus(textarea_id, checkbox_name) {
    $("INPUT[@name=" + checkbox_name + "][type='checkbox']").attr('checked', false);
    $('#' + textarea_id).val('');
}

function concept_click(this_checkbox, concept_mainid, concept_label, textarea_id, related_id) {
    if (this_checkbox.checked == true){
        $('#' + textarea_id).val($('#' + textarea_id).val() + concept_label + '; ');
    } else {
        $('#' + textarea_id).val($('#' + textarea_id).val().replace(concept_label + '; ',''));
    }
    if (concept_mainid != '') {
        ajax(related_id, 'thesaurus.get_ajax_call_search_thesaurus_related', concept_mainid);
    }
}

function search_thesaurus_tree(input_id, div_id) {
    var search = '';
    search = $('#' + input_id).val();
    $('#' + div_id).html('<img src="design/icons/loading10x10.gif"/>');
    ajax(div_id, 'thesaurus.get_ajax_call_search_thesaurus_tree', search);
}

function explode_thesaurus_field(field_id, this_but) {
    this_but.onclick = function() {
        implode_thesaurus_field(field_id, this_but);
        return false;
    };
    $('#full_thesaurus_field_' + field_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    
    $('#full_thesaurus_field_' + field_id + '_children').show();
    ajax('full_thesaurus_field_' + field_id + '_children', 'thesaurus.get_ajax_call_explode_field', field_id);
}

function implode_thesaurus_field(field_id, this_but) {
    this_but.onclick = function() {
        explode_thesaurus_field(field_id, this_but);
        return false;
    };
    $('#full_thesaurus_field_' + field_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_field_' + field_id + '_children').hide();
}

function explode_thesaurus_theme(theme_id, this_but) {
    this_but.onclick = function() {
        implode_thesaurus_theme(theme_id, this_but);
        return false;
    };    
    $('#full_thesaurus_theme_' + theme_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_theme_' + theme_id + '_children').show();
    ajax('full_thesaurus_theme_' + theme_id + '_children', 'thesaurus.get_ajax_call_explode_theme', theme_id);
}

function implode_thesaurus_theme(theme_id, this_but) {
    this_but.onclick = function() {
        explode_thesaurus_theme(theme_id, this_but);
        return false;
    };
    $('#full_thesaurus_theme_' + theme_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_theme_' + theme_id + '_children').hide();
}

function explode_thesaurus_concept(concept_id, this_but) {
    this_but.onclick = function() {
        implode_thesaurus_concept(concept_id, this_but);
        return false;
    };    
    $('#full_thesaurus_concept_' + concept_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_concept_' + concept_id + '_children').show();
    ajax('full_thesaurus_concept_' + concept_id + '_children', 'thesaurus.get_ajax_call_explode_concept', concept_id);
}

function implode_thesaurus_concept(concept_id, this_but) {
    this_but.onclick = function() {
        explode_thesaurus_concept(concept_id, this_but);
        return false;
    };
    $('#full_thesaurus_concept_' + concept_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_concept_' + concept_id + '_children').hide();
}

/* ------------------------------ */

function explode_thesaurus_browse_field(field_id, this_but) {
    this_but.onclick = function() {
        implode_thesaurus_browse_field(field_id, this_but);
        return false;
    };    
    $('#full_thesaurus_browse_field_' + field_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_browse_field_' + field_id + '_toggle_image').attr('src','design/icons/toggle-small-collapse.png');
    $('#full_thesaurus_browse_field_' + field_id + '_children').show();
    ajax('full_thesaurus_browse_field_' + field_id + '_children', 'thesaurus.get_ajax_call_explode_browse_field', field_id);
}

function implode_thesaurus_browse_field(field_id, this_but) {
    this_but.onclick = function() {
        explode_thesaurus_browse_field(field_id, this_but);
        return false;
    };
    $('#full_thesaurus_browse_field_' + field_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_browse_field_' + field_id + '_toggle_image').attr('src','design/icons/toggle-small.png');
    $('#full_thesaurus_browse_field_' + field_id + '_children').hide();
}

function explode_thesaurus_browse_theme(theme_id, this_but) {
    this_but.onclick = function() {
        implode_thesaurus_browse_theme(theme_id, this_but);
        return false;
    };    
    $('#full_thesaurus_browse_theme_' + theme_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_browse_theme_' + theme_id + '_toggle_image').attr('src','design/icons/toggle-small-collapse.png');
    $('#full_thesaurus_browse_theme_' + theme_id + '_children').show();
    ajax('full_thesaurus_browse_theme_' + theme_id + '_children', 'thesaurus.get_ajax_call_explode_browse_theme', theme_id);
}

function implode_thesaurus_browse_theme(theme_id, this_but) {
    this_but.onclick = function() {
        explode_thesaurus_browse_theme(theme_id, this_but);
        return false;
    };
    $('#full_thesaurus_browse_theme_' + theme_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_browse_theme_' + theme_id + '_toggle_image').attr('src','design/icons/toggle-small.png');
    $('#full_thesaurus_browse_theme_' + theme_id + '_children').hide();
}

function explode_thesaurus_browse_concept(concept_id, this_but) {
    this_but.onclick = function() {
        implode_thesaurus_browse_concept(concept_id, this_but);
        return false;
    };    
    $('#full_thesaurus_browse_concept_' + concept_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_browse_concept_' + concept_id + '_toggle_image').attr('src','design/icons/toggle-small-collapse.png');
    $('#full_thesaurus_browse_concept_' + concept_id + '_children').show();
    ajax('full_thesaurus_browse_concept_' + concept_id + '_children', 'thesaurus.get_ajax_call_explode_browse_concept', concept_id);
}

function implode_thesaurus_browse_concept(concept_id, this_but) {
    this_but.onclick = function() {
        explode_thesaurus_browse_concept(concept_id, this_but);
        return false;
    };
    $('#full_thesaurus_browse_concept_' + concept_id + '_children').html('<img src="design/icons/loading10x10.gif"/>');
    $('#full_thesaurus_browse_concept_' + concept_id + '_toggle_image').attr('src','design/icons/toggle-small.png');
    $('#full_thesaurus_browse_concept_' + concept_id + '_children').hide();
}

