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

function setBackgroundImage(idPhotoCell)
{
	var headImages = new Array();
	headImages[0]="images/home_LaptopCheer.jpg"
	headImages[1]="images/home_FriendsLaptop.jpg"
	headImages[2]="images/home_GroupCheer.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 + ')';
}
