function EnviarOpcion(j){
  document.f.Opcion.value=j;
  document.f.submit();
}

function CambiarOrigen()
{
 for(m=document.f.Destino.length;m>0;m--)
   document.f.Destino[m]=null; 
 var Earreglo = new Array(2);
 Earreglo[0]= new Array();
 Earreglo[1]= new Array();
 Earreglo=MiArreglo();
 for(i=0;i<Earreglo[0].length;i++) 
  if(document.f.Origen.value==Earreglo[0][i])
    GuardarDestino(Earreglo[1][i]); 
 ordenar();
} 

function CambiarDestino()
{
 if(document.f.Traductor.length>0)
   for(m=document.f.Traductor.length-1;m>0;m--)
     document.f.Traductor[m]=null; 
 var Earreglo = new Array(2);
 Earreglo[0]= new Array();
 Earreglo[1]= new Array();
 Earreglo=MiArreglo();
 for(i=0;i<Earreglo[0].length;i++) 
  if((document.f.Origen.value==Earreglo[0][i])&&(document.f.Destino.value==Earreglo[1][i]))
      GuardarTraductor(Earreglo[2][i]); 
}

function GuardarDestino(ldestino)
{
 v=0;
 for(h=0;h<document.f.Destino.length;h++)
   if(document.f.Destino[h].value==ldestino)
     v=1;

 if(v==0)
   document.f.Destino[document.f.Destino.length]=new Option(ldestino,ldestino);
}

function GuardarTraductor(ltraductor)
{
 v=0;
 for(h=0;h<document.f.Traductor.length;h++)
   if(document.f.Traductor[h].value==ltraductor)
     v=1;

 if(v==0)
   document.f.Traductor[document.f.Traductor.length]=new Option(ltraductor,ltraductor);
}

function ordenar() { 
    var v=new Array(); 
    for (var i=0; i<document.f.Destino.length; i++) { 
        v[v.length]=new Array(document.f.Destino[i].text,document.f.Destino[i].value); 
    } 
    v.sort(); 
    for (var i=0; i<v.length; i++) { 
        document.f.Destino[i]=new Option(v[i][0],v[i][1],false,false); 
    } 
} 
function compara(a, b) { 
    return (a[0]<b[0]?"-1":"1"); 
} 
