Critical temperature of layered highT c superconductors