	
	var pics = new Array();		/* database of images */
	var alts = new Array();		/* database of alt texts */
		/* base url where images are all stored */
	base_url = 'http://nonfiction.org/boximages/';


function new_alt (alt) {
	alts[alts.length] = alt;
}

	new_alt('this is a box');
	new_alt('I like boxes');
	new_alt('do you like boxes?');
	new_alt('the serenity of a box');
	new_alt('lines are everything');
	new_alt('I do like boxes');
	new_alt('boxes are a delight');
	new_alt('the thrill of the box');
	new_alt('kiss the box');


/* new_pic function enters image entries */
/* into the database */	
function new_pic (url, width, height) {
	pics[pics.length] = '<IMG SRC="' + base_url + url + '" WIDTH=' + width + ' HEIGHT=' + height;
}

	new_pic('abox1.gif', 228, 211);
	new_pic('abox2.gif', 220, 176);
	new_pic('abox3.gif', 176, 192);
	new_pic('abox4.gif', 161, 164);
	new_pic('abox5.gif', 185, 139);

/* nrand function generates random numbers */
/* between 0 and the size of the database */
function nrand(modvalue) {
        R_day = new Date();		/* time seed */
        R_seed = R_day.getTime();
	x = parseInt(((R_seed - (parseInt(R_seed/1000, 10) * 1000))/1000) * modvalue + 1, 10);
	return x - 1;
}

/* get the correct database entry */
function get_pic(aligned) {

	img = pics[nrand(pics.length)] + ' ALT=' + '"' + alts[nrand(alts.length)] + '"';
	if (aligned == "")
	{
		return img + '>';
	}
	else
	{
		return img + ' ALIGN=' + aligned + '>';
	}
}

