//   Fonction de gestion des galeries (menu_galerie.js)
//   25/06/2002		Version 1.0
//	 Laurent Toussaint


/*
   Gere les differentes sections et leur nombre de galerie. 
   Cree un menu permettant de naviguer entre les galeries.
   Dans la page html, appeler la fonction menu_galerie avec comme
   parametres le numero de la galerie et la section.
   Nbr de galeries max = 8
														*/

function section(name, nbr_gal)
{
	this.name = name;
	this.nbr_gal = nbr_gal;
}


photos_marches_nouakchott = new section('photos_marches_nouakchott', 37);
port_peche_nouakchott = new section('port_peche_nouakchott', 9);
nouakchott_photos_actualite = new section('nouakchott_photos_actualite', 16);
nouakchott_alentours = new section('nouakchott_alentours', 3);
nouakchott_photos_ville = new section('nouakchott_photos_ville', 24);
// Initialisation des variables et des images
num_gal_cnt = 0;


numpage = new Array;
numpage[0] = '_01';
numpage[1] = '_07';
numpage[2] = '_13';
numpage[3] = '_19';
numpage[4] = '_25';
numpage[5] = '_31';
numpage[6] = '_37';
numpage[7] = '_43';



	g1on = new Image; g1on.src ="../xsmimages/g1_on.jpg";  
	g1off = new Image; g1off.src ="../xsmimages/g1_off.jpg";      
	g2on = new Image; g2on.src ="../xsmimages/g2_on.jpg" ; 
	g2off = new Image; g2off.src ="../xsmimages/g2_off.jpg";      
	g3on = new Image; g3on.src ="../xsmimages/g3_on.jpg";  
	g3off = new Image; g3off.src ="../xsmimages/g3_off.jpg";      
	g4on = new Image; g4on.src ="../xsmimages/g4_on.jpg" ; 
	g4off = new Image; g4off.src ="../xsmimages/g4_off.jpg" ;     
	g5on = new Image; g5on.src ="../xsmimages/g5_on.jpg" ; 
	g5off = new Image; g5off.src ="../xsmimages/g5_off.jpg" ;     
	g6on = new Image; g6on.src ="../xsmimages/g6_on.jpg";  
	g6off = new Image; g6off.src ="../xsmimages/g6_off.jpg";      
	g7on = new Image; g7on.src ="../xsmimages/g7_on.jpg" ; 
	g7off = new Image; g7off.src ="../xsmimages/g7_off.jpg"  ;    
	g8on = new Image; g8on.src ="../xsmimages/g8_on.jpg"  ;
	g8off = new Image; g8off.src ="../xsmimages/g8_off.jpg" ; 
		
function create_menu(num_gal, nom_gal, nbr_gal)
{
	if (i == num_gal)
		   {
		      content += '<td><a href="./' + nom_gal + numpage[i-1] + '.html" target="_parent"><img src="../xsmimages/g' + i + '_on.jpg" width="15" height="15" alt="Galerie ' + i + '"></a></td>'
		   }
		   else if (i <= nbr_gal)
		   {
			   content += '<td><a  onmouseover="img_act(\'g' + i + '\');return true;" onmouseout="img_inact(\'g' + i + '\');return true;" href="./' + nom_gal + numpage[i-1] + '.html" target="_parent"><img name="g' + i + '" id="g' + i + '" src="../xsmimages/g' + i + '_off.jpg" width="15" height="15" alt="Galerie '+ i + '"></a></td>'
		   }
		   else 
		   {
			   content += '<td><img src="../xsmimages/g' + i + '_no.jpg" width="15" height="15" alt=""></td>'
		   }
}

function menu_galerie ( num_gal, nom_gal)
{
    nbr_gal = eval(nom_gal + '.nbr_gal');
	content = '<div align="center"><table cellspacing="0" cellpadding="0" border="0"><tr>';
    content += '<td rowspan="2"><img src="../xsmimages/gal_01.jpg" alt="" width="100" height="30" border="0"></td>';
	for (i=1;i<=8;i+=2)
	{   
		create_menu(num_gal, nom_gal, nbr_gal);
	}
	content += '<td rowspan="2"><a href="./' + nom_gal + '.html" target="_parent"><img src="../xsmimages/gal_02.jpg" alt="" width="100" height="30" border="0"></a></td>';
	content += '</tr><tr>';
	for (i=2;i<=8;i+=2)
	{
 		create_menu(num_gal, nom_gal, nbr_gal);
	}
	content += '</tr></table></div>';
	document.write(content);
}

function avance_miniature (section, debut)
{

fin =  nbr_gal = eval(section + '.nbr_gal');

if (debut <= -1)  debut = (fin - 6 > 0?fin - 6: 0);
 content = "<!-- Gestion des photos -->";
 content += "<table cellspacing=\"2\" cellpadding=\"2\" width=\"95%\">";
 content += "<tr align=\"center\">";
 content += "<td><img src=\"./images/left_white.jpg\" alt=\"Suite galerie\" border=\"0\" onclick=\"debut = avance_miniature(\'" + section + "\', debut - 6);return true;\">";
 content += "</td>";
 content += "<td valign=\"middle\">";
 content += "<a id=\"ad_min_1\" href=\"./" + section + "_" + (debut)%fin  + ".html\"><img name=\"min_1\" id=\"min_1\" height=\"50\" alt=\"" + miniature[(debut)%fin ][1] + "\"";
 content += " src=\"" + miniature[(debut)%fin ][0] + "\" width=\"73\" /></a> ";
 content += "</td>";
content += "<td valign=\"middle\">";
 content += "<a id=\"ad_min_2\" href=\"./" + section + "_" + eval ((debut + 1)%fin) + ".html\"><img name=\"min_2\" id=\"min_2\" height=\"50\" alt=\"" + miniature[(debut  + 1)%fin][1] + "\"";
 content += " src=\"" + miniature[(debut + 1)%fin ][0] + "\" width=\"73\" /></a> ";
 content += "</td>";
content += "<td valign=\"middle\">";
 content += "<a id=\"ad_min_3\" href=\"./" + section + "_" + eval ((debut + 2)%fin) + ".html\"><img name=\"min_3\" id=\"min_3\" height=\"50\" alt=\"" + miniature[(debut  + 2)%fin][1] + "\"";
 content += " src=\"" + miniature[(debut  + 2)%fin][0] + "\" width=\"73\" /></a> ";
 content += "</td>";
content += "<td valign=\"middle\">";
 content += "<a id=\"ad_min_4\" href=\"./" + section + "_" + eval ((debut + 3)%fin) + ".html\"><img name=\"min_4\" id=\"min_4\" height=\"50\" alt=\"" + miniature[(debut  + 3)%fin][1] + "\"";
 content += " src=\"" + miniature[(debut  + 3)%fin][0] + "\" width=\"73\" /></a> ";
 content += "</td>"
content += "<td valign=\"middle\">";
 content += "<a id=\"ad_min_5\" href=\"./" + section + "_" + eval ((debut + 4)%fin) + ".html\"><img name=\"min_5\" id=\"min_5\" height=\"50\" alt=\"" + miniature[(debut  + 4)%fin][1] + "\"";
 content += " src=\"" + miniature[(debut + 4)%fin][0] + "\" width=\"73\" /></a> ";
 content += "</td>";
content += "<td valign=\"middle\">";
 content += "<a id=\"ad_min_6\" href=\"./" + section + "_" + eval ((debut + 5)%fin) + ".html\"><img name=\"min_6\" id=\"min_6\" height=\"50\" alt=\"" + miniature[(debut  + 5)%fin][1] + "\"";
 content += " src=\"" + miniature[(debut  + 5)%fin][0] + "\" width=\"73\" /></a> ";
 content += "</td>";
content += "<td> <img src=\"./images/right_white.jpg\" alt=\"Suite galerie\" border=\"0\" onclick=\"debut = avance_miniature(\'" + section + "\', debut + 6);return true;\">";
 content += "</td>";
 content += "</tr>";
 content += "</table>";
 content += "<br /><span style=\"font-size: xx-small;\" onclick=\"toutes_miniatures (\'" + section + "\');return true;\">Voir toutes les miniatures</span>";
 
 
 
 change_contenu_div('menu_galerie', content)
 return debut++;
}




function toutes_miniatures (section)
{

fin =  eval(section + '.nbr_gal');

 content = "<!-- Gestion des photos -->";

for (i=0;i<fin;i+=1)
{
 path_img = miniature[i][0];
 desc_img = miniature[i][1];
 
 content += "<a id=\"ad_min_" + eval(i+1) + "\" href=\"./" + section + "_" + i  + ".html\"><img name=\"min_" + eval(i+1) + "\" id=\"min_" + eval(i+1) + "\" height=\"50\" alt=\"" + desc_img + "\"";
 content += " src=\"" + path_img + "\" width=\"73\" /></a> ";

}
 
 
 change_contenu_div('menu_galerie', content)
 return true;
}



