var subPortfolio = false;
var subAPropos = false;
var subCv = false;
var subContact = false;

window.onload=miseEnPlace;

function miseEnPlace(){

	/*Declaration des images sur lesquelles il va avoir hover*/
	var imgPortfolio = document.getElementById('imgPortfolio');
	var imgAPropos = document.getElementById('imgAPropos');
	var imgCv = document.getElementById('imgCv');
	var imgContact = document.getElementById('imgContact');
	
	var textPortfolio = document.getElementById('textPortfolio');
	var textAPropos = document.getElementById('textAPropos');
	var textCv = document.getElementById('textCv');
	var textContact = document.getElementById('textContact');
	
	/*Declaration des images a afficher*/
	var subImgPortfolio = document.getElementById('subImgPortfolio');
	var subImgAPropos = document.getElementById('subImgAPropos');
	var subImgCv = document.getElementById('subImgCv');
	var subImgContact = document.getElementById('subImgContact');
	
	/*Declaration des images du menu portfolio*/
	var menuPortfolioPhotographie = document.getElementById('menu-portfolio-photographie');
	var menuPortfolioCreations = document.getElementById('menu-portfolio-creations');
	var menuPortfolioProjets = document.getElementById('menu-portfolio-projets');
	
	/*Declaration des div a detecter*/
	var presenceDivCreations = document.getElementById("creations");
	var presenceDivToutesLesCreations = document.getElementById("toutesLesCreations");
	var presenceDivPhoto = document.getElementById("photo");
	var presenceDivAPropos = document.getElementById("qui-suis-je");
	var presenceDivContact = document.getElementById("coordonnees");
	var presenceDivCv = document.getElementById("formation");
	var presenceDivProjets = document.getElementById("projets");
	
	/*Si telle div est detecte alors afficher telle image*/
	if (presenceDivProjets||presenceDivToutesLesCreations||presenceDivPhoto){
		subImgPortfolio.style.visibility="visible";
		subPortfolio = true;
	}
	else {subPortfolio = false;}
	
	if (presenceDivAPropos){
		subImgAPropos.style.visibility="visible";	
		subAPropos = true;
	}
	else {subAPropos = false;}

	if (presenceDivCv){
		subImgCv.style.visibility="visible";	
		subCv = true;
	}
	else {subCv = false;}
	
	if (presenceDivContact){
		subImgContact.style.visibility="visible";	
		subContact = true;
	}
	else {subContact = false;}
	
	if (presenceDivPhoto){
		menuPortfolioPhotographie.style.background="url(../images/sprite-menu-portfolio-photo.png) top no-repeat";
	}
	
	if (presenceDivToutesLesCreations){
		menuPortfolioCreations.style.background="url(../images/sprite-menu-portfolio-creat.png) top no-repeat";
	}
	
	if (presenceDivProjets){
		menuPortfolioProjets.style.background="url(../images/sprite-menu-portfolio-proje.png) top no-repeat";
	}
	
	/*Hover sur l'image portfolio*/
	imgPortfolio.onmouseover=function(){
		subImgPortfolio.style.visibility="visible";
	}	
	imgPortfolio.onmouseout = function(){
		if(subPortfolio==false)
		subImgPortfolio.style.visibility="hidden";
	}
	textPortfolio.onmouseover=function(){
		subImgPortfolio.style.visibility="visible";
	}	
	textPortfolio.onmouseout = function(){
		if(subPortfolio==false)
		subImgPortfolio.style.visibility="hidden";
	}
	
	/*Hover sur l'image APropos*/
	imgAPropos.onmouseover=function(){
		subImgAPropos.style.visibility="visible";
	}	
	imgAPropos.onmouseout = function(){
		if(subAPropos==false)
		subImgAPropos.style.visibility="hidden";
	}
	textAPropos.onmouseover=function(){
		subImgAPropos.style.visibility="visible";
	}	
	textAPropos.onmouseout = function(){
		if(subAPropos==false)
		subImgAPropos.style.visibility="hidden";
	}
	
	/*Hover sur l'image CV*/
	imgCv.onmouseover=function(){
		subImgCv.style.visibility="visible";
	}
	imgCv.onmouseout = function(){
		if(subCv==false)
		subImgCv.style.visibility="hidden";
	}
	textCv.onmouseover=function(){
		subImgCv.style.visibility="visible";
	}
	textCv.onmouseout = function(){
		if(subCv==false)
		subImgCv.style.visibility="hidden";
	}
	
	/*Hover sur l'image CV*/
	imgContact.onmouseover=function(){
		subImgContact.style.visibility="visible";
	}	
	imgContact.onmouseout = function(){
		if(subContact==false)
		subImgContact.style.visibility="hidden";
	}
	textContact.onmouseover=function(){
		subImgContact.style.visibility="visible";
	}	
	textContact.onmouseout = function(){
		if(subContact==false)
		subImgContact.style.visibility="hidden";
	}
	
}