var coeff=6;//Coefficient de reduction
var larg=560;//largeur maxi de l'image
var haut=400;//hauteur maxi de l'image
var coeffinit=coeff;
var larg_min=125;
var haut_min=94;
var taille = new Array();
var image = new Array();
var id = new Array();
var maxi=99;
var taille_max="FALSE";
var test="FALSE";


for(ind=1;ind<=maxi;ind++)
{
image[ind]="image"+ind;
taille[ind]="min";
id[ind]="id"+ind;
}


 
function changer(sel) {

if(test!="TRUE")
{
for(ind_test=1;ind_test<=maxi;ind_test++)
{
if(document.getElementById(id[ind_test])){}
else{
maxi=ind_test-1;
test="TRUE";
break;
}}}
 


taille_max="FALSE";
for(ind_A=1;ind_A<=maxi;ind_A++)
{
if(taille[ind_A]=="max") { if(ind_A!=sel) { taille_max="TRUE"; } }
}

if(taille_max=="TRUE")
{

for(ind_B=1;ind_B<=maxi;ind_B++)
{
 if(ind_B!=sel)initial(ind_B);
}

   setTimeout("changer("+sel+");",100)
   return;
}

if(taille[sel]=="max"){initial(sel);}
else
{
if (document.getElementById(image[sel]).width < larg) {
document.getElementById(id[sel]).style.zIndex = 50;
coeff = coeff-0.5;
document.getElementById(image[sel]).width = Math.round(larg/coeff);
document.getElementById(image[sel]).height = Math.round(haut/coeff);
chang=window.setTimeout('changer('+sel+');',10);//vitesse de l'effet
}
else
{
taille[sel]="max";
document.getElementById(id[sel]).style.padding = "20px";
document.getElementById(id[sel]).style.cursor = "url(./IMG/zoomout.cur), pointer";
document.getElementById(id[sel]).style.zIndex = 50;
document.getElementById(id[sel]).style.width=larg+"px";
document.getElementById(image[sel]).title="Cliquez pour réduire";
}
}
return;
}

 

function initial(sel) {
if (document.getElementById(image[sel]).width > larg_min+5) {
window.clearTimeout(chang);
document.getElementById(id[sel]).style.width="100px";
coeff = coeff+0.5;
document.getElementById(image[sel]).width = Math.round(larg/coeff);
document.getElementById(image[sel]).height = Math.round(haut/coeff);
initi=window.setTimeout('initial('+sel+');',10);//vitesse de l'effet
}
else
{
document.getElementById(id[sel]).style.padding = "0px";
document.getElementById(id[sel]).style.cursor = "url(./IMG/zoomin.cur), pointer";
document.getElementById(id[sel]).style.zIndex = 1;
document.getElementById(id[sel]).style.width="100px";
document.getElementById(image[sel]).width = larg_min;
document.getElementById(image[sel]).height = haut_min;
document.getElementById(image[sel]).title="Cliquez pour agrandir";
taille[sel]="min";
}
return;
}