/* JavaScript Document

Developed by: 
	Web Solutions
	April 2009
For:
	Rotating the images on the CMHI homepage.
Rights:
	May be used, modified, re-distributed freely dependant that alterations of the manner in which the code behaves
	is well documented to maintain ease of use.
*/


/* Enter width and height, respectively, for images being rotated. ALL IMAGES NEED TO BE THIS SIZE! */	
	var picWidth = 231;
	var picHeight = 160;
	

function picToUse(picNum){			

/* !! The following code is where you enter the file names of the images. All images need to be saved in the "images/home" folder and need to have a .jpg extension. File names must be surrounded in quotes and commas must separate items.*/
		
	var randomPics = new Array("dementia", "elderly-couple", "family", "generations", "granddaughter", "senior-doctor", "sisters", "visiting-doctor", "young-family");
	picDisplayed = randomPics[picNum];
	return picDisplayed;
	}
	
	
// !!IMPORTANT!! enter the total number of images here. 
numItems = 9;







/*  Make No Other Changes   */	
function getPicNum(){	
	var picNum1 = Math.floor(Math.random()*numItems) + 0;
	
	do { 
		picNum2 = Math.floor(Math.random()*numItems) + 0;
		if(picNum2 >= numItems){
			picNum2 = 0;
		}
	} 
	while (picNum1 == picNum2);
	
	
	do { 
		picNum3 = Math.floor(Math.random()*numItems) + 0;
		if(picNum3 >= numItems){
			picNum3 = 2;
		}
	} 
	while ((picNum2 == picNum3)||(picNum1 == picNum3));

return [picNum1, picNum2, picNum3];
}
	



