// creausa JavaScript Document

// set the following in each html file based on directory showing for this html file 
// var imagePath = ".\/images\/";		// where photos and thumbnails reside for this page
// var setpics = new Array("hp-photo2.jpg","hp-photo3.jpg","hp-photo4.jpg","hp-photo1.jpg", ....);
// var pictimer = 10;   // or whatever time

var numpics = 0;;
var idx = 0;;

window.onload = function() { init(); }

function init() {
	// load thumb nail images into frames
	if (document.images) {	
		if (!pictimer) alert("Must define picTimer in html");
		numpics = setpics.length;
		idx=0; 	// init indexes
		setTimeout("changePic()",pictimer);
	} else {
		alert("No document.images supported");
	}
}
function changePic() {
	var a;
	a = 1 + Math.round(Math.random() * 3);  // result is num between 1 to 4
	switch(a) {
		case 1:
			document.p1.src = imagePath + setpics[idx];
			break;
		case 2:
			document.p2.src = imagePath + setpics[idx];
			break;
		case 3:
			document.p3.src = imagePath + setpics[idx];
			break;
		case 4:
			document.p4.src = imagePath + setpics[idx];
			break;
	}
	if (++idx >= numpics) idx= 0;
	setTimeout("changePic()",pictimer);	
}

