// JavaScript Document
function switchImage(idImage,srcImage){
	document.getElementById(idImage).src = srcImage;
}

// portfolio
var cacherBackground = true;
function AfficherRealisation(valeur, nom)
   { 
	 tableauRealisation = valeur.split("|");
	 if (tableauRealisation.length == 2){
	      cacherBackground = false;
	      document.getElementById('realisation_image').innerHTML             = "<img src='/FichiersUpload/Realisations/" + tableauRealisation[1] + " ' alt=''>";
		  document.getElementById('realisation_image').style.backgroundColor = '#fff';
		  document.getElementById('realisation_image').style.background      = '#fff';		   
	      document.getElementById('realisation_client').innerHTML            = tableauRealisation[0];
	 }		
   }

function CacherRealisation(){
  cacherBackground = true;
  window.setTimeout('CacherRealisation2();',1000);
}
function CacherRealisation2(){
  if (cacherBackground){
	      document.getElementById('realisation_image').innerHTML             = "";
		  document.getElementById('realisation_image').style.backgroundColor = "";
		  document.getElementById('realisation_image').style.background      = "";		   
	      document.getElementById('realisation_client').innerHTML            = "";
  }
} 

// Équipe
function AfficherEquipe(valeur, nom)
   { 
	 tableauEquipe = valeur.split("|");
	 if (tableauEquipe.length == 4){
	      if (tableauEquipe[2].length > 0) {
			 document.getElementById('containerPhoto').innerHTML = "<img src='../FichiersUpload/Equipes/" + tableauEquipe[2] + " ' width='125' alt='' />";
		  } else { 
	      	 document.getElementById('containerPhoto').innerHTML = "<img src='../images/equipe_nd.gif' width='125' alt='' />";		  
		  }
		  document.getElementById('ficheNom').innerHTML = tableauEquipe[1];
	      document.getElementById('ficheStatut').innerHTML = tableauEquipe[3];
	      document.getElementById('fiche').style.display = "block";		  
	 }
	 else{
	      document.getElementById('ficheNom').innerHTML = "";
	      document.getElementById('ficheStatut').innerHTML = "";	 
	      document.getElementById('containerPhoto').innerHTML = "";		
	      document.getElementById('fiche').style.display = "none";		    
	 }				
   }
   
//Antispam
 function Antispam(tableau1, tableau2, subject){
   var courriel = ""; 
   var texte    = "";
   for (i=0;i<tableau1.length;i++)
     courriel+=String.fromCharCode(tableau1[i])
   if (typeof(tableau2) != 'undefined'){
       if (tableau2.length > 0){
           for (i=0;i<tableau2.length;i++)
             texte+=String.fromCharCode(tableau2[i])
	   }
	   else
	      texte = courriel;
   }			  
   else
   	  texte = courriel;
   if (typeof(tableau2) == 'undefined')
       subject = "";
	   
   tableauTexte = texte.split("@");
   if (tableauTexte.length == 2){
   	  texte = tableauTexte[0] + '<span style="display:none;">REMOVE-THIS-FOR-SPAM</span>&#64;' + tableauTexte[1];
   }   
   document.write('<a href="mailto:a" onclick="this.href = AntiSpamClic(Array(' + tableau1 + '),\'' + subject + '\');">' + texte + '</a>');   
 }
 function AntiSpamClic(tableau1, subject){ 
   var courriel = ""; 
   for (i=0;i<tableau1.length;i++)
     courriel+=String.fromCharCode(tableau1[i]);	 
   if (subject.length > 0)
   	  courriel+= '?subject=' + subject;
   return 'mai' + 'lto:' + courriel; 
 }
