//************ Album Photo ****************//
var alb_pho_currPos = 1;
function alb_pho_moveback(albumID) {
  var obj = albumID.parentNode;
  while (obj.tagName.toUpperCase() != "TABLE") {
    obj = obj.parentNode;
  }
  if (arrAlbum[obj.id]) {
	if (arrAlbum[obj.id][alb_pho_currPos - 1]) {
	  --alb_pho_currPos;
	} else {
	  var cpt = 0;
	  for (var key in arrAlbum[obj.id]) {
		cpt = cpt + 1;
	  }
	  alb_pho_currPos = cpt;
	}
	alb_pho_displayImg(obj.id, alb_pho_currPos, 1);
  }
  return false;
}

function alb_pho_movenext(albumID) {
  var obj = albumID.parentNode;
  while (obj.tagName.toUpperCase() != "TABLE") {
    obj = obj.parentNode;
  }
  if (arrAlbum[obj.id]) {
	if (arrAlbum[obj.id][alb_pho_currPos + 1]) {
	  ++alb_pho_currPos;
	} else {
	  alb_pho_currPos = 1;
	}
	alb_pho_displayImg(obj.id, alb_pho_currPos, 1);
  }
  return false;
}

function alb_pho_displayImg(albumID, position, albDisp) {
  if (parseInt(albDisp) == 0) {
    albumID = "album_" + albumID;
  }
  if (arrAlbum[albumID][position]) {
	var newArr = arrAlbum[albumID][position].split("¥");
	alb_pho_currPos = position;
	document.getElementById("imgCour" + albumID.replace(/album_/,'')).src = newArr[0]; //show new image
	document.getElementById("alb_linkedimg_" + albumID.replace(/album_/,'')).href = newArr[0]; //new image link
	document.getElementById("alb_titre" + albumID.replace(/album_/,'')).innerHTML = newArr[1] + "&nbsp;"; //change title
	document.getElementById("alb_descrip_" + albumID.replace(/album_/,'')).innerHTML = newArr[2]; //change description
	document.getElementById("imgCour" + albumID.replace(/album_/,'')).setAttribute("alt", newArr[3].replace("&#39;","'"));
	document.getElementById("imgCour" + albumID.replace(/album_/,'')).setAttribute("title", newArr[3].replace("&#39;","'"));
  }
  return false;
}

function ModalInfoBulle(albumID, position) { 
	albumID = "album_" + albumID;
	var newArr = arrAlbum[albumID][position].split("¥");
	alb_pho_currPos = position;
	if ((newArr[1] != "") || (newArr[2] != "") || (newArr[3] != "")) {
		var textfield = "<span id=spanbulle" + position + " class=infobullemodal>";
		
		if (newArr[1] != "") {
			textfield += "<span class='infobullemodal_titre'>" + newArr[1].replace(/&#39;/g,"'") + "</span>";
		}
		if ((newArr[3] != "") && (newArr[1] != "")) {
			textfield += " <span class='infobullemodal_alt'>(" + newArr[3].replace(/&#39;/g,"'") + ")</span>";
		} else if (newArr[3] != "") {
			textfield += "<span class='infobullemodal_alt'>" + newArr[3].replace(/&#39;/g,"'") + "</span>";
		}
		if ((newArr[2] != "") && (newArr[3] == "") && (newArr[1] == "")) {
			textfield += "<span class='infobullemodal_description'>" + newArr[2].replace(/&#39;/g,"'") + "</span>";
		} else if (newArr[2]) {
			textfield += "<br><span class='infobullemodal_description'>" + newArr[2].replace(/&#39;/g,"'") + "</span>";
		}
		textfield += "</span>";
		Montrer(textfield,"#eeeeee", "#666666","#000000");
	}
}
