	var CatEscolhidas = new Array(0);
	
	function Categoria(Desc, Codigo, Superior){
		this.Desc = Desc;
		this.Codigo = Codigo;
		this.Superior = Superior;
	}
     
	function swapOptions(the_pather_id, the_child)
	{
 	 	var numbers_select = eval(the_child);
  		var the_pather = the_pather_id;
  		setOptionText(numbers_select, "Secundarias", the_pather);
	}

	function setOptionText(the_select, the_array, the_pather)
	{
		limpaLista(the_select);
		var arrayEscolhido = eval(the_array);
 		the_select.length = arrayEscolhido.length;
		ct = 1;
	 	for (loop=0; loop < arrayEscolhido.length; loop++)
  		{  			
			superiorAtual = arrayEscolhido[loop].Superior;
  			if(superiorAtual == the_pather){
		   		the_select.options[ct].text = arrayEscolhido[loop].Desc;
		   		the_select.options[ct].value = arrayEscolhido[loop].Codigo;		   		
		   		ct ++;
		   	}
  		}
  		the_select.length = ct;
	}

        function preencheEscolhas()
        {
        		limpaLista(document.categoria.the_choices);
                for (loop=0; loop < CatEscolhidas.length; loop++)
                {
                        document.categoria.the_choices.options[loop].text = CatEscolhidas[loop].Descricao;
                }
                limpaLista(document.categoria.the_examples);
                limpaLista(document.categoria.the_options);                
        }

        function limpaLista(lista){
                for(loop=0; loop <lista.length; loop++)
                {
                        lista.options[loop].text = "";
                }
        }
        
        
