/////////////////////////////////////////////////////
/////// DEFINITION DES OBJETS ///////////////////////
/////////////////////////////////////////////////////

//ELEMENT
function element(adresse, page_html)
{
	this.indice;
	this.adresse = adresse; //repertoire correspondant au nom = le nom sans espaces
	this.nom = adresse.replace(/'_'/g,' '); // le nom avec des espaces	
	this.page_html = page_html; //nom de la page html à charger
} 

//PROJET
function projet(adresse,page_html)
{
	return(new element(adresse,page_html));
}

/////////////////////////////////////////////////////
///////NAVIGATION////////////////////////////////////
/////////////////////////////////////////////////////

///FONCTIONS NAVIGATION

//retrouve l'indice du projet en fonction de l'url de la page courante
function get_infos_from_url()
{ 
	var arborescence = String(window.document.location).split('/');
	
	projet_courant.adresse = arborescence[arborescence.length-2];
	projet_courant.nom = projet_courant.adresse.replace(/_/g,' '); ;
	
	for(i=0 ; i<liste_projets.length ; i++)
	{ 
		if(liste_projets[i].adresse == projet_courant.adresse)
		{ 
					 projet_courant.indice = i;
					 return;
		}
	}  
}

function goto_projet(base_url,i)
{
	//base_url = chemin relative au répertoire appelé
	//i = indice du projet
	var projet_adresse = liste_projets[i].adresse;
	var projet_page_html = liste_projets[i].page_html;
	window.open(base_url+projet_adresse+"/"+projet_page_html+".html","_self");
}

function goto_categorie(i)
{
	goto_projet(RELATIVE_URL,i,0,0);
}

function index_goto_categorie(i)
{
	goto_projet("",i,0,0);
}

function goto_next_projet()
{
	var i = projet_courant.indice;
	if(++i==liste_projets.length){i = 0;}
	goto_projet(RELATIVE_URL,i);
}

function goto_previous_projet()
{
	var i = projet_courant.indice;
	if(--i==-1)	{i = liste_projets.length-1;}
	goto_projet(RELATIVE_URL,i);
}





