Salve a tutti!

Premetto che non sono molto capace con il js, però guardando un po' in giro, ho scritto questa semplice funzione, che però non funziona...pecché?

codice:
function showhide(name)
{
 if (document.getElementById(name).style.display=="")
 {
  document.getElementById(name).style.display="none";
 }
 else
 {
  document.getElementById(name).style.display="";
 }
}
GRAZIE