function ongletOn(yep){
	if(yep == 1){
		window.document.getElementById('perso').className='on';
		window.document.getElementById('perso').blur();
		window.document.getElementById('formation').className='off';
		window.document.getElementById('exp').className='off';
		perso();
	}
	if(yep == 2){
		window.document.getElementById('perso').className='off';
		window.document.getElementById('formation').className='on';
		window.document.getElementById('formation').blur();
		window.document.getElementById('exp').className='off';
		formation();
	}
	if(yep == 3){
		window.document.getElementById('perso').className='off';
		window.document.getElementById('formation').className='off';
		window.document.getElementById('exp').className='on';
		window.document.getElementById('exp').blur();
		exp();
	}
	
}

function perso(){
	
	var xhr_object = null;

	if(window.XMLHttpRequest)
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject)
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else{
		alert("Votre navigateur ne supporte pas l'Ajax !");
		return;
	}

	xhr_object.open("GET", "include/perso.php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4 ){
			var remplir = document.getElementById("ajax");
			remplir.innerHTML =  xhr_object.responseText;
		}
	}
	
	xhr_object.send(null);

}

function formation(){
	
	var xhr_object = null;

	if(window.XMLHttpRequest)
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject)
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else{
		alert("Votre navigateur ne supporte pas l'Ajax !");
		return;
	}

	xhr_object.open("GET", "include/formation.php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4 ){
			var remplir = document.getElementById("ajax");
			remplir.innerHTML =  xhr_object.responseText;
		}
	}
	
	xhr_object.send(null);

}

function exp(){
	
	var xhr_object = null;

	if(window.XMLHttpRequest)
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject)
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else{
		alert("Votre navigateur ne supporte pas l'Ajax !");
		return;
	}

	xhr_object.open("GET", "include/exp.php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4 ){
			var remplir = document.getElementById("ajax");
			remplir.innerHTML =  xhr_object.responseText;
		}
	}
	
	xhr_object.send(null);

}
function references(cat){
	if(document.getElementById("ajaxRef")){
		document.getElementById("ajaxRef").id = "ajax";
	}
	
	var xhr_object = null;

	if(window.XMLHttpRequest)
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject)
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else{
		alert("Votre navigateur ne supporte pas l'Ajax !");
		return;
	}

	xhr_object.open("GET", "include/"+cat+".php", true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4 ){
			var remplir = document.getElementById("ajax");
			remplir.innerHTML =  xhr_object.responseText;
		}
	}
	
	xhr_object.send(null);

}

function ongletOnRef(yep){
	if(yep == 1){
		window.document.getElementById('web').className='onRef';
		window.document.getElementById('web').blur();
		window.document.getElementById('dev').className='offRef';
		window.document.getElementById('graphisme').className='offRef';
		window.document.getElementById('photos').className='offRef';
		window.document.getElementById('divers').className='offRef';
		references('web');
	}
	if(yep == 2){
		window.document.getElementById('web').className='offRef';
		window.document.getElementById('dev').blur();
		window.document.getElementById('dev').className='onRef';
		window.document.getElementById('graphisme').className='offRef';
		window.document.getElementById('photos').className='offRef';
		window.document.getElementById('divers').className='offRef';
		references('dev');
	}
	if(yep == 3){
		window.document.getElementById('web').className='offRef';
		window.document.getElementById('graphisme').blur();
		window.document.getElementById('dev').className='offRef';
		window.document.getElementById('graphisme').className='onRef';
		window.document.getElementById('photos').className='offRef';
		window.document.getElementById('divers').className='offRef';
		references('graphisme');
	}
	if(yep == 5){
		window.document.getElementById('web').className='offRef';
		window.document.getElementById('divers').blur();
		window.document.getElementById('dev').className='offRef';
		window.document.getElementById('graphisme').className='offRef';
		window.document.getElementById('photos').className='offRef';
		window.document.getElementById('divers').className='onRef';
		references('divers');
		
	}
	if(yep == 4){
		window.document.getElementById('web').className='offRef';
		window.document.getElementById('photos').blur();
		window.document.getElementById('dev').className='offRef';
		window.document.getElementById('graphisme').className='offRef';
		window.document.getElementById('photos').className='onRef';
		window.document.getElementById('divers').className='offRef';
		references('photos');
	}
	
}

function afficherMini(url){
	//alert('lol');
	var tableau = url.split('/');
	document.getElementById("ajax").innerHTML = '<div id="photo" ><img src="images/references/'+url+'" /></div><p style="text-align: center;"><a href="#" onclick="references(\''+tableau[0]+'\')" class="lienPhoto">Retour</a></p>';
}

function afficherWeb(urlImage, titre, desc, lien){
	var tableau = urlImage.split('/');
	
	document.getElementById("ajax").id = "ajaxRef";
	if(lien == "NULL"){
		document.getElementById("ajaxRef").innerHTML = '<div id="infoRef"><p style="text-align: center;margin-bottom:30px;"><strong>'+titre+'</strong></p><p>'+desc+'</p><a style="color:grey;">Visiter le site</a><p><a href="#" onclick="references(\''+tableau[0]+'\')" class="lienPhoto">Retour</a></p></div><div id="imageRef" ><img src="images/references/'+urlImage+'" /></div>';
	}
	else{
		document.getElementById("ajaxRef").innerHTML = '<div id="infoRef"><p style="text-align: center;margin-bottom:30px;"><strong>'+titre+'</strong></p><p>'+desc+'</p><a href="'+lien+'">Visiter le site</a><p><a href="#" onclick="references(\''+tableau[0]+'\')" class="lienPhoto">Retour</a></p></div><div id="imageRef" ><img src="images/references/'+urlImage+'" /></div>';
	}
	
}

function rien(){
	document.getElementById("ajax").innerHTML ='<p style="align=center;"> Partie en travaux...</p>';
}

function afficherTitre(titre){
	document.getElementById("titre").innerHTML='<p><strong>Voir : </strong>'+titre+'</p>';
}
