function rand(num)
{
	return (Math.floor(Math.random() *num));
}

function setBackgroundImage(idPhotoCell)
{
	var headImages = new Array();
	headImages[0]="images/home_weRnumberone.jpg"
	headImages[1]="images/home_laughingcoffee.jpg"
	headImages[2]="images/home_studytime_group.jpg"
	headImages[3]="images/home_wheelchairfriends.jpg"
	headImages[4]="images/home_pizzaandTV.jpg"
	headImages[5]="images/home_manlaptop.jpg"
	headImages[6]="images/home_buildings.jpg"
	
	
	var NumberOfImages = headImages.length - 1;
	var iIndex = rand(NumberOfImages);

	var this_cookie = new String(document.cookie);
	if ( this_cookie.match(/iIndex\=(\d+)/) )
	{
		iIndex = RegExp.$1;
		iIndex = ((iIndex * 1) + 1) % headImages.length;
	}
	else
	{
	  iIndex = rand(NumberOfImages);
	}

	document.cookie = "iIndex=" + iIndex;

	var imageURL = headImages[iIndex];

	if (document.layers)
		document[idPhotoCell].background.src = imageURL == 'none' ? null : imageURL;
	else if (document.all)
		document.all[idPhotoCell].style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
	else if (document.getElementById)
		document.getElementById(idPhotoCell).style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
}
