If there is no compulsory reason to try and align the image and text with javascript I would definitely do it with CSS ... plus it "just works".
If you need to update the image with javascirpt, give the <img id="dynamic" ... /> image tag an ID and just update it in place that way.
Here's my suggested solution without making it fancy or anything.
<head>
<style type="text/css">
body {
text-align: center; /* IE page centering */
}
#wrapper {
max-width: 200px;
margin: 0 auto; /* Mozilla page centering */
}
#wrapper img {
width: 200px; /* will auto-scale height */
}
#message {
border: 3px solid black;
text-align: left; /* selective un-centering */
}
#message b {
display: block;
text-align: center; /* selective re-centering */
}
</style>
</head>
<body>
<div id="wrapper">
<div id="message">
<b>Light of God</b>
The light of God surrounds me.
The love of God enfolds me.
The power of God protects me.
The presence of God
watches over me.
Wherever I am, God is.
</div>
<img src="http://www.lovingmemoriesofmemphis.com/backgrounds/prayerhands.jpg" />
</div>
</body>
If you must use javascript for aligning these elements or just want to learn -- post back and I'll try to hack something together for that too.