function ImagesToUl(xml){
    var pathimages = xml.children('config').children('pathimages').text();
    //alert(pathimages);
    var imagenes = xml.children('imagenes').children('imagen');
    //alert(imagenes.length);
    if (imagenes.length > 0)
    {
      var ul = $('<ul/>');
      imagenes.each(function(){
        var $this = $(this);
        //alert(pathimages+$this.children('fichero').text());
        var li = $('<li/>');
        var a = $('<a/>',{
            text: '',
            href: pathimages+$this.children('fichero').text()
        });
        a.prepend('<img width="120" src="'+pathimages+$this.children('fichero').text()+'" alt="'+$this.children('titulo').text()+'" title="'+$this.children('titulo').text()+'" />');
        li.append(a);
        var a = $('<a/>',{
            text: '',
            href: $this.children('enlace').text()
        });
        li.append(a);
        
        var div = $('<div/>',{
            style: 'left:5px; top:5px; width:350px; height:0;color:#000; background-color:transparent;'
        });
        div.prepend('<h1>'+$this.children('titulo').text()+'</h1><br/>'+$this.children('descripcion').text()+'<br/><a href="'+$this.children('enlace').text()+'"><img src="images/buttons/btseemore.gif"/></a>');
        
        li.append(div);
        
        ul.append(li);
      });
      return ul;
    }
    return null;
}
/*
                  <a href="images/images-banner/soluciones-de-peso.gif"><img width="120" src="images/images-banner/soluciones-de-peso.gif" alt="Soluciones de peso" title="Soluciones de peso" /></a>
                  <a href="http://www.grupoepelsa.com/PdIndustrial.html"></a>                        
                  <div style="left:5px; top:5px; width:300px; height:0;color:#000; background-color:#FFFFFF;"> 
                  	<h1>Soluciones de peso</h1>
                  	  <br/>
                      Equipos de pesaje para:<br/>
                      Alimentaci&oacute;n - transporte<br/>
                      Qu&iacute;micas - dosificaci&oacute;n<br/>
                      <br/>
                      <a href="http://www.grupoepelsa.com/PdIndustrial.html"><img src="images/buttons/btseemore.gif"/></a>
                  </div>
                </li>
*/


$(document).ready(function() {
  
  $nocachingxml = new Date().getTime();
  $.ajax({
      url:'config/images-banner.xml?t='+$nocachingxml,
      dataType: 'xml',
      success: function(data){
          var xml = $(data);
          $('#banner_image_container').append( ImagesToUl(xml.children()) );
          runBanner();
      }
  });
  
});  
