Non so in che modo tu intenda "formattare"... ma vedi l'esempio:
codice:
function Attiva(id,s1,s2){
var el=document.getElementById(id);
el.style.display="none";
var c=document.createElement("div");
var link=document.createElement("a");
link.href="#";
link.style.color = 'red'; 
link.appendChild(document.createTextNode(s1));
link.onclick=function(){
link.firstChild.nodeValue = (link.firstChild.nodeValue==s1) ? s2 : s1;
link.style.color = (link.firstChild.nodeValue==s1) ? 'red' : 'blue'; 
el.style.display=(el.style.display=="none") ? "block" : "none";
return(false);
}
c.appendChild(link);
el.parentNode.insertBefore(c,el);
}
ciao