
function getImgSrc(imgArray) {

// Returns random image from array.
// imgArray [,imgFldr] [,imgParams]

var imgFldr='', imgParams='';
if (getImgSrc.arguments.length>1) imgFldr=getImgSrc.arguments[1];
if (getImgSrc.arguments.length>2) imgParams=getImgSrc.arguments[2];

var strTemp=imgFldr+imgArray[getRandom(imgArray.length-1)];

document.write ('<img src="'+strTemp+'" '+imgParams+'>');

return true;

}


function getImg(imgObj,imgArray) {

// Changes imgObj src to image randomly selected from an array.

var imgFldr='';
if (getImg.arguments.length>2) imgFldr=getImg.arguments[2];

var x=getRandom(imgArray.length-1);

imgObj.src=imgFldr+imgArray[x]; imgObj.alt='Image '+x;

return true;

}

function getRandom(upperbound) {

var lowerbound=0;

if (getRandom.arguments.length>1) {
	if (!isNaN(getRandom.arguments[1])) lowerbound=0; 
}

if (lowerbound>upperbound) {
	var hold=lowerbound;
	lowerbound=upperbound;
	upperbound=hold;
}

var x=Math.floor((upperbound-lowerbound+1)*Math.random()+lowerbound)

return x;

}