Criteria for the reality of the spectrum of PT-symmetric Schroedinger operators and for the existence of PT-symmetric phase transitions