//// random number function ////
function randomNumber(limit) {
	
	// returns random number based on limit
	return Math.floor(Math.random()*limit);
}

//// function to write random image ////
function randImage(path, name, w, h, limit) {
	
  	// instantiate variables
	var imgSrc, r;
  	
	// create a random number within limits
	r = randomNumber(limit);
  
  	// create image source with appropriate path
  	imgSrc = path+"/"+name+"-"+r+".jpg";
	
	// writes the image tag into the html
  	document.write("<img src=\""+imgSrc+"\" alt=\""+name+"\" width=\""+w+"\" height=\""+h+"\" border=\"0\" />");
}
