A study of swelling and collapse in polyelectrolyte gels