Instead of specifying http://example.com/foo.png or https://example.com/foo.png, you can just use //example.com/foo.png. AFAIK the only downside to that is older versions of IE (6 & 7 I think) will download the image twice for some reason.
http://blog.httpwatch.com/2010/02/10/using-protocol-relative...
...and the unfortunately double-loading bug for CSS files in IE7/8 here:
http://www.stevesouders.com/blog/2010/02/10/5a-missing-schem...