// Random content selection code block
// -- Requires user to update the array of values (ie: text, filenames) as content is added/removed/renamed
// -- Some code samples found at:  http://www.webdevelopersnotes.com/tips/html/random_image_display_using_javascript.php3


// Purpose: Randomly chooses a filename from the array of filenames
function chooseImage()
{
	// User modifies entries to this variable, so that files listed in comma-delimited format -- Ex: ("File_1.jpg", "myfile.gif", "FileHeader23.jpg", ... , "LastFile.jpg")
	var arrImages = new Array ("header2.jpg", "header1.jpg", "header_a.jpg", "header_b.jpg", "header_c.jpg", "header_d.jpg", "header_e.jpg", "header_f.jpg", "header_g.jpg", "header_h.jpg", "header_i.jpg", "header_j.jpg");
	
	// Leave the rest of these variables and logic alone
	var index = arrImages.length;
	var iTarget = Math.floor(index * Math.random());
	var output = "";
	
	if (iTarget > index)
	{
		iTarget = 0;
	}
	
	return arrImages[iTarget];
}


// Purpose: Returns an image file and path
function randomImageWithPath()
{
	var imagePath = 'pics/ImageSwap';	// The folder path (currently is relative to the file calling the function)
	var fileName = chooseImage();
	var compiledPath = imagePath + '/' + fileName;
	
	return compiledPath;
}



// Purpose: Returns the HTML code for displaying a random image
function htmlRandomImage()
{
	var imageSource = randomImageWithPath();
	var cssClass = 'hwidth';				// The user may need to modify this if CSS class names changes
	var output = '<img src="' + imageSource + '" alt="Image Not Found" class="' + cssClass + '">';
	
	return output;
}