Хм,может это сработает?
(O.style.display == "block"){
T.style.display = "none";
TH.style.display = "none";
}else if if(T.style.display == "block"){
O.style.display = "none";
TH.style.display = "none";
}else if if(TH.style.display == "block"){
O.style.display = "none";
T.style.display = "none";
}