A variational method for the calculation of rovibrational levels of any triatomic molecule