/* auteur: Bernard Martin-Rabaud */
/* Date de création: 06/01/2003 */

// PHOTOS TOURNANTES EN PAGE D'ACCUEIL SITE A.Pa.R.S

// variables globales
var t_photos = new Array();
var dir_photos = "squelettes/photos/";

// classe des photos
function clPhoto(fimage, legende) {
  this.image = fimage;
  this.legende = legende;
}

// affiche l'image et la légende
clPhoto.prototype.affiche = function() {
  var texte = "<img src='" + dir_photos + this.image + "' border='0'><br>";
  texte += this.legende;
  contenu_div("photo", texte);
}

// ajout d'une image dans t_photos
function photo(fimage, legende) {
  t_photos[t_photos.length] = new clPhoto(fimage, legende);
}

// affiche une photo au hasard
// si un numéro de photo est indiqué en argument, seule cette photo sera affichée
// sinon, une photo est choisie au hasard parmi la liste en bas du script
function photo_hasard() {
  if (arguments.length) t_photos[arguments[0]].affiche();
  else {
     var i = Math.floor(Math.random() * t_photos.length);
     t_photos[i].affiche();
  }
}

function contenu_div(id_div, texte) {
  if (!texte) texte = "<b>A</b>ssociation <b>Pa</b>risienne de <b>R</b>echerche <b>S</b>péléologique";
  if (document.layers) {
    document.layers[id_div].document.open();
	document.layers[id_div].document.write(texte);
	document.layers[id_div].document.close();
  }
  else if (document.all) document.all[id_div].innerHTML = texte;
  else if (document.getElementById) document.getElementById(id_div).innerHTML = texte;
}

function info_menu(texte) {
  contenu_div("menuinfo", texte);
}

function survol(img, fimage) {
  document.images[img].src = "images/" + fimage;
}

photo("concression1.jpg", "");
photo("concression2.jpg", "");
photo("concression3.jpg", "");
photo("concression4.jpg", "");
photo("concression5.jpg", "");

