Or if you really want to get fancy you can set your browser to use proxy autoconfiguration to some local file that you can generate/edit from a script. Proxy autoconfiguration allows you
to define a policy for whether to use a proxy or not
for specific requests, so for instance you can have a
browser use a proxy for everything except http://www.perlmonks.org.
in reply to Scripting Proxy Settings in IE and Firefox
More info on proxy autoconfiguration
Probably overkill and not really helpful for you, but couldn't resist the urge of mentioning this...