I agree that trying to dynamically switch this without a carefully designed bespoke solution would be extremely dangerous, as a 240V input could easily be detected as 120V for a brief period during plug-in. In my opinion you need to sample the voltage for at least 1 second before making a decision which circuit to enable. I wouldn't dream of doing anything but buying a new charger with a wide voltage input though.