// JavaScript Document

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

var popupDisplayed = 0;

function showPopup(id){
	hidePopup ();
	document.getElementById(id).style.display="block";
	popupDisplayed=id;
}
		
function hidePopup (){
	for(i=0;i<tabPopup.length;i++)
	{	//on masque toutes les popups
		document.getElementById(tabPopup[i]).style.display="none";
	}
}

function showNext (){
	var pTab = arrayIndexOf(popupDisplayed);
	pTab++;
	if (pTab>(tabPopup.length-1)) {pTab=0;}	
	showPopup(tabPopup[pTab]);
}

function showPrevious (){
	var pTab = arrayIndexOf(popupDisplayed);
	pTab--;
	if (pTab<0) {pTab=tabPopup.length-1;}
	showPopup(tabPopup[pTab]);
}

function arrayIndexOf(searching){

	var i=0;
	while((tabPopup[i]!=searching)&&(i<tabPopup.length))
	{
		i++;	
	}
	if (tabPopup[i]!=searching) {i=null;}
	return i;
}

function showInfosMap(id){
	document.getElementById(id).style.display="block";
}

function hideInfosMap(id){
	document.getElementById(id).style.display="none";
}