 function Theme(id_theme, lib_theme){
   this.id = id_theme;
   this.libelle = lib_theme;
 }

 function SousTheme(id_soustheme, lib_soustheme, id_theme){
   this.id = id_soustheme;
   this.libelle = lib_soustheme;
   this.idParent = id_theme;
 }
 
 function updateListOfSousTheme(id_theme){
   var ddl = document.getElementById('id_soustheme');
   clearddl(ddl);
   var st;
   var indice = 0;

   for (i=0;i<=sousthemes.length;i++){
     st = sousthemes[i];
     if (st){
       if (st.idParent == id_theme || st.idParent == 0){
        ddl.options[indice] = new Option(st.libelle, st.id);
        indice++;
       }
     }
   }
 }
   
 function SelectDdl(ddl, itemvalue)
 {
   if (ddl)
   {
     for (i=0;i<ddl.options.length;i++)
     {
       if (ddl.options[i].value == itemvalue)
       {
         ddl.options[i].selected = true;
         ddl.selectedIndex = i;
         break;
       }
     }
   }
 }
 
 function clearddl(ddl){
   if (ddl){
     for (i=ddl.options.length-1;i>-1;i--){
       ddl.options[i]=null;
     }
   }
 }

 function loadDDL(){
   var ddl = document.getElementById('id_theme');
   clearddl(ddl);
   var t;
   var indice = 0;

   for (i=0;i<=themes.length;i++){
     t = themes[i];
     if (t){
        ddl.options[indice] = new Option(t.libelle, t.id);
        indice++;
     }
   }
   var st = sousthemes[0];
   ddl = document.getElementById('id_soustheme');
   ddl.options[0] = new Option(st.libelle, st.id, 0);
 }

 var themes = new Array();
 var sousthemes = new Array();

