// charge les informations de la page en AJAX
function ajaxLoadVideos()
{
  //alert('ajaxLoadVideos');
  //alert(url2006UsaLoadVideos);
  var xhr = getXHR();
  xhr.onreadystatechange = function() { ajaxDisplayVideos(xhr); };
  xhr.open('GET', url2006UsaLoadVideos, true);
  xhr.send(null);
}

function ajaxDisplayVideos(xhr)
{
  //alert('ajaxDisplayVideos');
  if(xhr.readyState == 4 && xhr.status == 200) // le serveur est disponible && la lecture du fichier XML a bien été effectuée
  {
    var docXML = xhr.responseXML.documentElement;
    var items = docXML.childNodes;

    var td_videos = document.getElementById('videos');

    var table = null;
    var border = null;
    var cellpadding = null;
    var cellspacing = null;
    //var class = null;
    var width = null;
    var height = null;
    var tr = null;
    var td = null;
    var textNode = null;
    var b = null;
    var br = null;
    var a = null;
    var href = null;
    var target = null;

    table = document.createElement('table');

    border = document.createAttribute('border');
    border.nodeValue = 0;
    table.setAttributeNode(border);
    cellpadding = document.createAttribute('cellpadding');
    cellpadding.nodeValue = 0;
    table.setAttributeNode(cellpadding);
    cellspacing = document.createAttribute('cellspacing');
    cellspacing.nodeValue = 0;
    table.setAttributeNode(cellspacing);
    //class = document.createAttribute('class');
    //class.nodeValue = 'videos';
    //table.setAttributeNode(class);

    //alert(items.length);
    for (var i = 0; i < items.length; i++)
    {
      if (i % 2 == 0)
        tr = document.createElement('tr');

      td = document.createElement('td');
      //class = document.createAttribute('class');
      //class.nodeValue = 'videos_etape';
      //td.setAttributeNode(class);

      b = document.createElement('b');
      textNode = document.createTextNode(items.item(i).childNodes.item(1).firstChild.nodeValue);
      b.appendChild(textNode);
      td.appendChild(b);

      br = document.createElement('br');
      td.appendChild(br);

      b = document.createElement('b');
      textNode = document.createTextNode(items.item(i).childNodes.item(2).firstChild.nodeValue);
      b.appendChild(textNode);
      td.appendChild(b);

      br = document.createElement('br');
      td.appendChild(br);

      object = document.createElement('object');
      
      width = document.createAttribute('width');
      width.nodeValue = 425;
      object.setAttributeNode(width);
      
      height = document.createAttribute('height');
      height.nodeValue = 350;
      object.setAttributeNode(height);
      
      param = document.createElement('param');
      
      name = document.createAttribute('name');
      name.nodeValue = 'movie';
      param.setAttributeNode(name);
      
      value = document.createAttribute('value');
      value.nodeValue = items.item(i).childNodes.item(3).firstChild.nodeValue;
      param.setAttributeNode(value);
      
      object.appendChild(param);
      
      param = document.createElement('param');
      
      name = document.createAttribute('name');
      name.nodeValue = 'wmode';
      param.setAttributeNode(name);

      value = document.createAttribute('value');
      value.nodeValue = 'transparent';
      param.setAttributeNode(value);

      object.appendChild(param);

      embed = document.createElement('embed');
      
      src = document.createAttribute('src');
      src.nodeValue = items.item(i).childNodes.item(3).firstChild.nodeValue;
      embed.setAttributeNode(src);
      
      type = document.createAttribute('type');
      type.nodeValue = 'application/x-shockwave-flash';
      embed.setAttributeNode(type);
      
      wmode = document.createAttribute('wmode');
      wmode.nodeValue = 'transparent';
      embed.setAttributeNode(wmode);
      
      width = document.createAttribute('width');
      width.nodeValue = 425;
      embed.setAttributeNode(width);
      
      height = document.createAttribute('height');
      height.nodeValue = 350;
      embed.setAttributeNode(height);
      
      object.appendChild(embed);

      td.appendChild(object);

      br = document.createElement('br');
      td.appendChild(br);

      a = document.createElement('a');
      href = document.createAttribute('href');
      href.nodeValue = 'etape.php?etape=' + items.item(i).childNodes.item(0).firstChild.nodeValue + '&affichcarte=no&affichvideo=no';
      a.setAttributeNode(href);
      textNode = document.createTextNode('Accédez au carnet de route de cette étape');
      a.appendChild(textNode);
      td.appendChild(a);

      tr.appendChild(td);
					
      if (i % 2 == 0)
        table.appendChild(tr);
    }

    td_videos.appendChild(table);
  }
  else
  {
  }
}

