Loading Random Background Image

I’m trying to use jQuery to load a random background image in a header in Wordpress. I can’t get it to work at all. Is there something wrong with my code?

$(document).ready(function() {
	  var randomImages = ['home-bg-1','home-bg-2','home-bg-3'];
	  var rndNum = Math.floor(Math.random() * randomImages.length + 1);
	  $("#wrapper-home").css({ background: "url(images/home-bg-" + rndNum + ".jpg) left 48px no-repeat" });

In Firebug I can see it loading the random image “background-image:url(images/home-bg-1.jpg);” as an element style to #wrapper-home div.

This is in a header-home.php file in the main wp-content directory. The images are in the images/ folder in the same directory.

I figured it out…

I needed to add <?php bloginfo(‘template_directory’) ?>/ to the path in front of the images url. Im a noob to WP.