function swapindex(idx)
{
	old=curridx;
	curridx=imgidx[idx];
	imgidx[idx]=old;
}
function showimage0(idx)
{
	changeico("ico",idx);
	changelegende("detaillegende",objleg[imgidx[idx]])
	imageobj.src=objimg[imgidx[idx]];
}
function showimage(idx)
{
	showBimage0(idx)
	showimage0(idx)
	swapindex(idx)
}
function showBimage0(idx)
{
	changeico("Bico",idx);
	changelegende("Blegende",objleg[imgidx[idx]])
	BimageObj.src=objbimg[imgidx[idx]];
}
function showbimage(idx)
{
	showBimage0(idx)
	showimage0(idx)
	swapindex(idx)
	
}
function changelegende(id,toThis) 
  {
  if (document.getElementById)
    {
    document.getElementById(id).innerHTML = toThis;
    }
  else if (document.all) 
    {
    document.all[id].innerHTML = toThis;
    }
  }
function changeico(id,idx) 
{
 
  if (document.getElementById)
    {
    document.getElementById(id+idx).src = objico[curridx];
    }
  else if (document.all) 
    {
    document.all[id+idx].src = objico[curridx];
    }

}

function changeleft(numeroCouche,left)
{
 if (document.getElementById)
 {
    
    document.getElementById(numeroCouche).style.left=left;
 }
 else if (document.all) 
 {
    document.all[numeroCouche].style.left=left;
 }
	
}

function cacheCouche(numeroCouche)
{
 if (document.getElementById)
 {
    document.getElementById(numeroCouche).style.visibility="hidden";
 }
 else if (document.all) 
 {
    document.all[numeroCouche].style.visibility="hidden";
 }
	
}

function montreCouche(numeroCouche)
{
 if (document.getElementById)
 {
    document.getElementById(numeroCouche).style.visibility="visible";
 }
 else if (document.all) 
 {
    document.all[numeroCouche].style.visibility="visible";
 }
}

function largeur_fenetre()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function hauteur_fenetre()
{
 if (window.innerHeight) return window.innerHeight  ;
 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 else return 0;
}


function reconstruction()
{
	largeur=largeur_fenetre();
 	if (972<largeur)
	{
		s=(largeur-972);
		s=s-s%2;
		s=s/2
		changeleft("detailobjet",420+s)
		
	}
	else
	{
		changeleft("detailobjet",420)
	}

}
function getparams()
{    
	var thispage=window.location.href;
	if (thispage.lastIndexOf('?') != -1)
	{	
		params= thispage.substring(thispage.lastIndexOf('?')+1,thispage.length);
		params=URLDecode(params);
	}
	return params;
}
function URLDecode(str)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = str;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
}
function Timer()
{   
	//Boucle de 30 seçondes (30000 milisecondes)
	timeoutID = window.setTimeout("changeimage()",8000);
}
var bd_home=1;
function changeimage()
{
	setnext();
	timeoutID = window.setTimeout("changeimage()",8000);
}

function setnext()
{
	if (bd_home==3) {bd_home=1;} else {bd_home=bd_home+1;}
	banniere.src="charte/images/bandeau_home_" + bd_home + ".jpg";
}
function Timereng()
{   
	//Boucle de 30 seçondes (30000 milisecondes)
	timeoutID = window.setTimeout("changeimageeng()",8000);
}
function changeimageeng()
{
	setnexteng();
	timeoutID = window.setTimeout("changeimageeng()",8000);
}
function setnexteng()
{
	if (bd_home==3) {bd_home=1;} else {bd_home=bd_home+1;}
	banniere.src="../charte/images/bandeau_home_" + bd_home + ".jpg";
}
