// returns filename without extension from full path
// (removes trailing "_pas" and "_ico" commented)
function getImageName(path) {
	// extracts filename without extension
	poslastslash = path.lastIndexOf("/");
	poslastspoint = path.lastIndexOf(".");
	path2 = path.slice(poslastslash+1,poslastspoint);
	// removes trailing "_pas" if any
/*	pospas = path2.lastIndexOf("_pas");
	if(pospas>=0) path2 = path2.slice(0,pospas);
	// removes last "_ico" if any
	posico = path2.lastIndexOf("_pas");
	if(posico>=0) path2 = path2.slice(0,posico);
*/
	return path2;
}

// changes the thumbnail when mouse passes over
function exchange(slideshowname,imageobj, event) {
  // gets name of currently active image
  bigimage = eval("document." + slideshowname);
  // if this thumb corresponds to displayed image, do nothing
  if((getImageName(bigimage.src) + "_ico") == getImageName(imageobj.src)) return;

  switch(event) {
    case "onmouseout": // activates the thumb
      // table in which we'll find the right thumb image
//      tabthumbimages = eval("images_" + slideshowname + "_actth");
      // puts the shadows around the image
      for(i=1;i<=4;i++) {
        imgsh = eval("document." + imageobj.name + "_sh" + i);
        imgsh.src = "./resources/thumbshadow_sh" + i + ".jpg";
      }
      break;
    case "onmouseover":
      // puts the shadows around the image
      for(i=1;i<=4;i++) {
        imgsh = eval("document." + imageobj.name + "_sh" + i);
        imgsh.src = "./resources/1trans.gif";
      }
      break;
   }
}

// changes big photo (when clicking on thumbnail)
function changePhoto(slideshowname,imageobj) {
  bigimage = eval("document." + slideshowname);
  oldimagename = getImageName(bigimage.src);

  // changes src, title and alt of image
  tabbigimages = eval("images_" + slideshowname);
  bigimage.src = tabbigimages[imageobj.name].src;
  bigimage.alt = imageobj.name;
  bigimage.title = imageobj.name;

  // activates formerly displayed thumbnail
  oldth = eval("document." + oldimagename);
  exchange(slideshowname,oldth,"onmouseout");
}
