﻿//ARF 26/02/2010 · Creación
function rellenaComboPuertos(info, urlBase, sesion, textoSeleccionePuerto){
    
   var urlPuertos = urlBase + "?sesionPassport=" + sesion;
   var buscadorPuertosSalida_xmlPuertosSalida = Sarissa.getDomDocument();           
   buscadorPuertosSalida_xmlPuertosSalida.async = false;                
   buscadorPuertosSalida_xmlPuertosSalida.load(urlPuertos + "&info=" + info);   
   var l_nodeC = buscadorPuertosSalida_xmlPuertosSalida.selectNodes("xml/PuertosSalida/Puerto");             
   /*if (l_nodeC.length == 0 && rellamada == false) {
        rellamada = true;
        rellenaComboPuertos(info, urlBase, sesion, textoSeleccionePuerto);        
   }*/
   if (l_nodeC.length > 0){
       var opciones = document.getElementById("puerto").length;
       while(document.getElementById("puerto").hasChildNodes()){
            document.getElementById("puerto").removeChild(document.getElementById("puerto").lastChild);
       }              
       var opcion = document.createElement('option');
       opcion.text = "-- " + textoSeleccionePuerto + " --";
       opcion.value = "SINSELECCION";       
       document.getElementById("puerto").options[0] = opcion;       
       for (var indL=0;indL<l_nodeC.length;indL++) {
            var puertoDes = l_nodeC[indL].getAttribute("des");
            var puertoCod = l_nodeC[indL].getAttribute("cod").toUpperCase();                  
            opcion = document.createElement('option');
            opcion.text = puertoDes;
            opcion.value = puertoCod;
            document.getElementById("puerto").options[indL + 1] = opcion;                          
       }              
   }
}
