Switching Stylesheets

OK, I have an **inline **stylesheet and one styles the background image of a table cell. It looks like this:

	.maincell2 {
		background-image: url('<?php echo $randomimage ?>');
		height: 319px;
		width: 263px;
		border: solid 1px #000000;
		border-width: 0px 1px 1px 0px;
		padding-left: 8px;
		padding-bottom: 8px;

By the way, at the top, I have the following:

$randomimage = "bgimages/bgimage_" . rand(1,10) . ".jpg";

So basically, the background image of the “maincell2” cell is random.

Now, what would a function look like that, when called, would change this stylesheet so it would run the randomizing code again and change the stylesheet to the new background-image?

Any help would be much appreciated,