/*
	randomElementFromArray(theArray)
	return a random item from an array
	parameters:
	theArray	array
 */
function randomElementFromArray(theArray) {
	var item=theArray[Math.round(Math.random() * theArray.length - 1)];
	if (item) {
		return (item);
	} else {
		return(randomElementFromArray(theArray));
	}
}

/*
	randomSourceForImageWithId(id, images)
	replace the src attribute of an <img> element with a random
	image
	Parameters:
	id	string	the id attribute of the image to be replaced
	images	array	the set of random images
 */	
function randomSourceForImageWithId(id, images) {
		var img=document.getElementById(id);
		img.src=randomElementFromArray(images);
}
