var currentDiapo = -1;
var picturesObj = document.getElementById('pictures').childNodes;
var pictureArray = new Array();
for (var i = 0; i < picturesObj.length; i++) {
  if (picturesObj[i].className == 'picture') { pictureArray.push(picturesObj[i]); }
}
        
function diapo() {
  if (currentDiapo == -1) {
    currentDiapo = 0;
    showPicture(currentDiapo);
  } else {
    hidePicture(currentDiapo);
    currentDiapo++;
    if (currentDiapo >= pictureArray.length) currentDiapo = 0;
    setTimeout('showPicture('+ currentDiapo +')', 1000);
  }
  setTimeout('diapo()', 5000);
}

function showPicture(eleIt) {
  Effect.Appear(pictureArray[eleIt]);
}
function hidePicture(eleIt) {
  Effect.Fade(pictureArray[eleIt]);
}
