	var timer=new Array();
	var lequel=new Array();
	var lequel2=new Array();
	var gCategorie='web';
	var clique=0;
	var photosGr=new Array();
	var firstRun=true;
	
	function afficheContenu() {
		document.getElementById('descPrt').innerHTML='Chargement de la page...';
		if (document.implementation && document.implementation.createDocument) {
			xmlDoc = document.implementation.createDocument("", "", null);
			xmlDoc.onload = creerContenu;
		}
		else if (window.ActiveXObject)
		{
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.onreadystatechange = function () {
				if (xmlDoc.readyState == 4) creerContenu();
			};
		}
		else
		{
			alert('Vous ne pouvez pas supporter le projet');
			return;
		}
		xmlDoc.load("inc/portfolio.xml");
	}
	
	function listeItems(lequel) {
		var getObj = obj.getElementsByTagName(lequel);
		var texte = '<br />';
		for(var y=0; y<getObj.length; y++) {
			texte+='- '+getObj.item(y).firstChild.nodeValue+' <br />';
		}
		return texte;
	}
	
	function voirContenu(pId) {
		if(clique!=0) { var pOuvre=document.getElementById('tb_'+clique); }
		var pOuvre2=document.getElementById('tb_'+pId);
		if(pOuvre2.filters) {
			if(clique!=0) { pOuvre.filters.alpha.opacity=0; }
			pOuvre2.filters.alpha.opacity=100;
		}
		else {
			if(clique!=0) { pOuvre.style.MozOpacity=0; }
			pOuvre2.style.MozOpacity=1;
		}
		clique=pId;
				
				
		var getToute = xmlDoc.getElementsByTagName('projet');
		var codeHTML='';
		for(var x=0; x<getToute.length; x++) {
			obj = getToute[x];
			var id = obj.getElementsByTagName('id').item(0).firstChild.nodeValue;
			if(id==pId) {
				var nom = obj.getElementsByTagName('nom').item(0).firstChild.nodeValue;
				var grosse = obj.getElementsByTagName('image').item(0).firstChild.nodeValue;
				var description = obj.getElementsByTagName('description').item(0).firstChild.nodeValue;
				var date = obj.getElementsByTagName('date').item(0).firstChild.nodeValue;
				var taches = listeItems('tache');
				var logiciels = listeItems('logiciel');
				var langages = listeItems('langage');
				var adresse = obj.getElementsByTagName('adresse').item(0).firstChild.nodeValue;
				codeHTML = description + '<br /><strong>Date:</strong> ' + date + '<br /><strong>Tâches:</strong> ' + taches +'<strong>Logiciels utilisés:</strong> ' + logiciels;
				if(langages!='<br />') {
					codeHTML+='<strong>Langages utilisés:</strong> ' + langages;
				}
				if(adresse!='#') {
					codeHTML+='<a href="'+adresse+'" target="_blank"><img src="im/prt_voir.gif" alt="Voir le projet" /></a>';
				}
				break;
			}
		}
		document.getElementById('grossePRT').src=photosGr[id].src;
		document.getElementById('descPrt').innerHTML=codeHTML;
		document.getElementById('hTitre').innerHTML='Portfolio - '+nom;
	}
		
	function changeImage(nom, tb, etat) {
		document.images["tb_"+nom].src='im/tb/'+tb+etat+'.jpg';
	}
	
	function fadeIn(pElement, pNom) {
		if(clique!=pNom) {
			lequel[pNom]=pElement;
			lequel2[pNom]=pNom;
			if(!timer[pNom]) {
				timer[pNom]=setInterval("faitFadeIn(lequel["+pNom+"],lequel2["+pNom+"])", 10);
			}
			else {
				clearInterval(timer[pNom]);
				timer[pNom]=null;
				timer[pNom]=setInterval("faitFadeIn(lequel["+pNom+"],lequel2["+pNom+"])", 10);
			}
		}
	}
	
	function fadeOut(pElement, pNom) {
		if(clique!=pNom) {
			lequel[pNom]=pElement;
			lequel2[pNom]=pNom;
			if(timer[pNom]) {
				clearInterval(timer[pNom]);
				timer[pNom]=null;
			}
			timer[pNom]=setInterval("faitFadeOut(lequel["+pNom+"],lequel2["+pNom+"])", 10);
		}
	}
	
	function faitFadeIn(pBouge, pQTimer) {
		if(pBouge.filters) {
			var valeur=parseInt(pBouge.filters.alpha.opacity);
			valeur+=20;
			if(valeur>=100) {
				pBouge.filters.alpha.opacity=100;
				clearInterval(timer[pQTimer]);
				timer[pQTimer]=null;
			}
			else {
				pBouge.filters.alpha.opacity=valeur;
			}
		}
		else {
			var valeur=parseFloat(pBouge.style.MozOpacity);
			valeur+=0.1;
			if(valeur>=1) {
				pBouge.style.MozOpacity=1;
				clearInterval(timer[pQTimer]);
				timer[pQTimer]=null;
			}
			else {
				pBouge.style.MozOpacity=valeur;
			}
		}
	}
	
	function faitFadeOut(pFerme, pQTimer) {
		if(pFerme.filters) {
			var valeur=parseInt(pFerme.filters.alpha.opacity);
			valeur-=20;
			if(valeur<=0) {
				pFerme.filters.alpha.opacity=0;
				clearInterval(timer[pQTimer]);
				timer[pQTimer]=null;
			}
			else {
				pFerme.filters.alpha.opacity=valeur;
			}
		}
		else {
			var valeur=parseFloat(pFerme.style.MozOpacity);
			valeur-=0.1;
			if(valeur<=0) {
				pFerme.style.MozOpacity=0;
				clearInterval(timer[pQTimer]);
				timer[pQTimer]=null;
			}
			else {
				pFerme.style.MozOpacity=valeur;
			}
		}
	}
	
	function changeCat(pCat) {
		gCategorie=pCat;
		clique=0;
		creerContenu();
	}
	
	function retourneLID(pCat) {
		var getToute = xmlDoc.getElementsByTagName('projet');
		for(var x=0; x<getToute.length; x++) {
			obj = getToute[x];
			var categorie = obj.getElementsByTagName('categorie').item(0).firstChild.nodeValue;
			if(categorie==pCat) {
				var id = obj.getElementsByTagName('id').item(0).firstChild.nodeValue;
				var nom = obj.getElementsByTagName('nom').item(0).firstChild.nodeValue;
				return(id);
			}
		}
	}
	
	function creerContenu() {		
		var getToute = xmlDoc.getElementsByTagName('projet');
		var htmlLiens='<ul id="liTB">';
		for(var x=0; x<getToute.length; x++) {
			obj = getToute[x];
			var nom = obj.getElementsByTagName('nom').item(0).firstChild.nodeValue;
			var id = obj.getElementsByTagName('id').item(0).firstChild.nodeValue;
			var thumbnail = obj.getElementsByTagName('thumbnail').item(0).firstChild.nodeValue;
			var categorie = obj.getElementsByTagName('categorie').item(0).firstChild.nodeValue;
			if(categorie==gCategorie) {
				htmlLiens+='<li style="background:url(im/tb/'+thumbnail+'.jpg) no-repeat;"><a href="#" style="background:url(im/tb/'+thumbnail+'2.jpg) no-repeat; -moz-opacity:0; filter:alpha(opacity=0);" id="tb_'+id+'" onclick="voirContenu(\''+id+'\'); return false;" onmouseover="fadeIn(this, \''+id+'\')" onmouseout="fadeOut(this, \''+id+'\')"><span>'+nom+'</span></a></li>';
			}
		}
		htmlLiens+='</ul>';
		document.getElementById('prtTb').innerHTML=htmlLiens;
		if(firstRun) {
			for(var x=0; x<getToute.length; x++) {
				obj = getToute[x];
				var id = obj.getElementsByTagName('id').item(0).firstChild.nodeValue;
				var grosse = obj.getElementsByTagName('image').item(0).firstChild.nodeValue;
				photosGr[id]=new Image();
				photosGr[id].src="im/prt/"+grosse+".jpg";
			}
			firstRun=false;
		}
		
		voirContenu(retourneLID(gCategorie));
	}