
counter = 1;
theID = 'm' + counter;

while (document.getElementById(theID)) {
  theID2 = theID + 'c';
  eval ('f'+counter+'On = function () { document.getElementById("'+theID2+'").style.display = "block"; }');
  eval ('f'+counter+'Off = function () { document.getElementById("'+theID2+'").style.display = "none";}');
  document.getElementById(theID).onmouseover = eval('f'+counter+'On');
  document.getElementById(theID).onmouseout = eval('f'+counter+'Off');
  counter++;
  theID = 'm' + counter;
}