[jQuery] css sheet change protocol of background images on the fly?

[jQuery] css sheet change protocol of background images on the fly?


On a secure (HTTPS) page, if I call a css that contain absolute paths
to images,
i.e.
background-image: url("http://www.xxxxx.com/images/d.gif")
browsers will throw a secure/nonsecure error.
We currently use JavaScript to print the style to the document at
runtime so we
can control the protocol reference.
document.write(' background-image: url('+writeSWNprotocol+'://
www.xxxxx.com/images/d.gif);');
This seems messy (and unnecessary).
2) Does $(document).ready(function() {} fire soon enough to flip the
protocol
on all [background] image calls to "https" so the browser won't balk
at the nonsecure images?