// array for langues d'interface
array_li = new Array(false, false, false);
var langInterLat    = 0;
var langInterAssoc  = 1;
var langInterAutres = 2;

function formScript_li(categorie) {

    switch (categorie) {
        case "langInterLat" :
            isChecked_li(langInterLat);
            addOption_li();
            break;
        case "langInterAssoc" :
            isChecked_li(langInterAssoc);
            addOption_li();
            break;
        case "langInterAutres" :
            isChecked_li(langInterAutres);
            addOption_li();
            break;
    }

    // expand langInterface
    if (
        array_li[langInterLat]       ||
        array_li[langInterAssoc]     ||
        array_li[langInterAutres]
            ) {
        expandForm("langInterface");
    }

    // collapse langInterface
    if (
        !array_li[langInterLat]      &&
        !array_li[langInterAssoc]    &&
        !array_li[langInterAutres]
        ) {
        collapseForm("langInterface");
        document.searchForm.langInterLat.checked = 0;
        document.searchForm.langInterAssoc.checked = 0;
        document.searchForm.langInterAutres.checked = 0;
    }
}

//-----------------------------------------------------------------------------------------

function addOption_li()
{

    //------------------------------//
    // first, we delete all options //
    //------------------------------//
    var langInterfaceLength = document.searchForm.langInterface.length;

    for (i = langInterfaceLength - 1; i >=0; i--) {
        document.searchForm.langInterface.options[i] = null;
    }

    // -------------------- all element deleted --------------------//

    //--------------------------------------//
    // we loop our array and we display the //
    // related content when required        //
    //--------------------------------------//
    for(i = 0; i < array_li.length; i++) {

        // if current value is true we call the related function inside the switch block
        if (array_li[i]) {
            switch (i) {
                case 0 :
                    buildLangInterLat();
                    break;
                case 1 :
                    buildLangInterAssoc();
                    break;
                case 2 :
                    buildLangInterAutres();
                    break;
            }
        }

    }
}

//-----------------------------------------------------------------------------------------

// check if the check box was realy checked or not
function isChecked_li(variable)
{
    var myBool = false;

    switch (variable) {
        case 0 :
            if (document.searchForm.langInterLat.checked) {
                array_li[0] = changeValue(array_li[0]);
                array_li[1] = false;
                array_li[2] = false;
            }
            break;
        case 1 :
            if (document.searchForm.langInterAssoc.checked) {
                 array_li[0] = false;
                 array_li[1] = changeValue(array_li[1]);
                 array_li[2] = false;
            }
            break;
        case 2 :
            if (document.searchForm.langInterAutres.checked) {
                array_li[0] = false;
                array_li[1] = false;
                array_li[2] = changeValue(array_li[2]);
            }
            break;
    }
}

