// JavaScript Document

var lastFocus = "";
function getFocusBorder(elt) {
	if(lastFocus != ""){
		lastFocus.style.border='1px solid #ccc';
	}
	elt.style.border='1px solid #327337';
	lastFocus = elt;
}

// fonction qui defini la fonction javascript em qui permet d'interpreter un mail crypté
// h :        chaine cryptee correspondant a une adresse email a interpreter
// subject :  sujet du mail 
// id :       id de la balise <a> ciblee dont le href doit recevoir le mailto
function em(h,subject,id)
{
  var result = "";
  var string = "";
  var key = "MIAM";
  for (var i= (h.substr(0, 2)=="0x")?2:0; i<h.length; i+=2) {string += String.fromCharCode (parseInt (h.substr (i, 2), 16));}
  for(i=1; i<=string.length; i++)
  {
     c = string.substr(i-1,1);
     keychar = key.substr((i % key.length)-1,1);
     c = String.fromCharCode(c.charCodeAt(0)-keychar.charCodeAt(0));
     result=result+c;
   }
   if ( subject=="" ) {document.getElementById(id).href="mailto:"+result;}
   else {document.getElementById(id).href="mailto:"+result+"?subject="+subject;}
   return result;
}

// function qui permet de demander a l'user s'il veut ajouter son site aux favoris

function favoris(idStage) {

        if ( navigator.appName != 'Microsoft Internet Explorer' ){ 

               window.sidebar.addPanel("Formatic","http://www.formatic.net/formation_description.php?idStage="+idStage+"",""); 

        }else{ 

               window.external.AddFavorite("http://www.formatic.net/formation_description.php?idStage="+idStage+"","Formatic"); 

        } 

}