Will this do it:
Code:
function change_font(what){
var start_of_id = what.substr(0, 2); /*find out which group of ids it belongs to, for example, "mk" */
var allSpans = document.getElementsByTagName("span"); // get all span elements
for(i=0; i < allSpans.length; i++) // loop through all the span elements
{
// identify the ones with starting with an id the same as the one that triggered the event
if (allSpans[i].id.substr(0, 2) == start_of_id)
{
// reset any span elements starting with id="mk" to normal text
allSpans[i].style.fontWeight = "normal";
allSpans[i].style.color= "#000";
allSpans[i].style.fontSize = "12";
}
}
/* Now all have normal text
Next customise the span element with id that was passed to function */
document.getElementById(what).style.fontSize = "12";
document.getElementById(what).style.fontWeight = "bold";
document.getElementById(what).style.color = "#990000";
}
I don't know if that's the most efficient way of doing it, as you're looping through all the span elements on the page....but I think it works!!