Mean field model for the helix-coil transition in polypeptides