/*
	Instructions for adding to the random photo.
	
	Step 1: List all the photos to be selected from in the parentheses of photo_array = new Array(...). 
			List the filename of the photos without path but make sure to include the extension.
			Enclose the filename in double-quotation mark and separate the filename with commas.
			
	Step 2:	Make sure the number of (0)zeros in the string assigned to display_list is equal to
			the number of photos listed in photo_array.
			
	Step 3:	Make sure the graphic files listed in photo_array is in the "h_images" folder from
			the root.
	
	Step 4:	That's it.  The rest of the code will handle everything else.
	
*/
var img_path = "h_images/";
var photo_array = new Array( "01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg");
//var display_list = "000000";
var display_order = new Array(1);
var photos = new Array(1);

// Random image display
function randPhoto1() {
	
	var count = 0;
	var i = 0;
	var display_list = "";
	
	for( a=0; a < photo_array.length; a++ )
		display_list += "0";
	
	//find the index to 5 photos
	while( count < display_list.length ) {
		i = Math.round( Math.random() * (photo_array.length - 1));
		if( display_list.charAt(i) == '0' ) {
			if( i == 0 )
				display_list = "1" + display_list.substring(1);
			else if( i == (photo_array.length-1) )
				display_list = display_list.substring(0,photo_array.length-1) + "1";
			else
				display_list = display_list.substring(0,i) + "1" + display_list.substring(i+1);
			display_order[count++] = i;
		}//if
	}//while
	
	//load images into array	
	for( b=0; b < 1; b++ ) {
		photos[b] = new Image();
		photos[b].src = eval( "\"" + img_path + photo_array[display_order[b]] + "\"");
	}
	
	//display images
	for( c=1; c <= 1; c++ ) {
		eval( "document.img" + c + ".src = photos[c-1].src;" );
	}

}//randPhoto

function randPhoto() {
	
	var count = 0;
	var i = 0;
	var end_index = photo_array.length - 1;
	var dl_array = new Array( photo_array.length );
	
	for( a=0; a < photo_array.length; a++ )
		dl_array[a] = a;
	
	//find the index to 5 photos
	while( count < 7 ) {
		i = Math.round( Math.random() * end_index);
		display_order[count++] = dl_array[i];
		if( i != end_index )
			dl_array[i] = dl_array[end_index];
		end_index--;
			
	}//while
	
	//load images into array	
	for( b=0; b < 1; b++ ) {
		photos[b] = new Image();
		photos[b].src = eval( "\"" + img_path + photo_array[display_order[b]] + "\"");
	}
	
	//display images
	for( c=1; c <= 1; c++ ) {
		eval( "document.img" + c + ".src = photos[c-1].src;" );
	}

}//randPhoto