Prova ad aggiungere le graffe cosi
codice:
var _targetdiv = null;
function showdiv(id) {
if(_targetdiv){//graffa aperta aggiunta
  _targetdiv.style.display = "none";
  _targetdiv = document.getElementById(id);
  _targetdiv.style.display = "block";
}//graffa chiusa aggiunta il commento puoi toglierlo
}