/** * Random Background Image Generator * * This script contains a function with several global switches  * which will randomly assign an image from a given array of images * and set it as a document's background image. *  * Advanced functionality is only available in DOM compliant browsers: * IE 4.x up and NN6.x up *///----------------------------------------------------------------------------// CONSTANTS//constants for background positioningvar TOPLEFT = "top left"; var TOPCENTER = "top center"; var TOPRIGHT = "top right"; var CENTERLEFT = "center left";var CENTERCENTER = "center center"; var CENTERRIGHT = "center right"; var BOTTOMLEFT = "bottom left";var BOTTOMCENTER = "bottom center"; var BOTTOMRIGHT = "bottom right";//----------------------------------------------------------------------------// GLOBAL FUNCTION SWITCHES// sets whether or not the background image will tile, must be pulled from one of these options// ( repeat | no-repeat | repeat-x | repeat-y )var IMG_REPEAT = "repeat";    // sets the position of the image if it isn't tiled, value must be pulled from one of these options// ( TOPLEFT | TOPCENTER | TOPRIGHT | CENTERLEFT | CENTERCENTER | CENTERRIGHT | BOTTOMLEFT | BOTTOMCENTER | BOTTOMRIGHT )var IMG_POSITION = CENTERCENTER;// super easy browser detection for nn4.xvar NN4 = (document.layers)? true : false;//GLOBAL IMAGE LISTvar IMG_LIST = new Array();/** * to add or remove images from the list, simply add to this array structure * just make sure if you remove an image that you don't skip numbers or things * can look bad. */

/**IMG_LIST[0] = "images/boomie_bg.jpg";IMG_LIST[1] = "images/bottle_bg.jpg";IMG_LIST[2] = "images/catghost_bg.jpg";IMG_LIST[3] = "images/coastcar_bg.jpg";IMG_LIST[4] = "images/eye_big_detail.jpg";IMG_LIST[5] = "images/gulls_bg.jpg";IMG_LIST[6] = "images/gulltail_bg.jpg";IMG_LIST[7] = "images/hohenzollern_bg.jpg";IMG_LIST[8] = "images/hon_ghost_big.jpg";IMG_LIST[9] = "images/meberlin_bg.jpg";IMG_LIST[10] = "images/sap_wall_bg.jpg";IMG_LIST[11] = "images/spider_bg.jpg";*/

for(i = 1; i<=48; i++)
{

	if(i < 10) 
	{
		var num_string = "0" + i.toString();
	} else {
		var num_string = i.toString();
	}

	IMG_LIST[i-1] = "images/bg_images - " + num_string + ".jpg";
}
/** * This function uses a global array of images and randomly selects an item from * that array to set as the document's background image. * * @declare public * @param variable type description * @return boolean returns true if successful, false if not. */var iRnd = Math.floor(Math.random() * (IMG_LIST.length));
document.writeln("<font size=-2 color=#AAAAAA>B: " + iRnd.toString() + "</font> <br>");
        
function rndBkgndImg( ){    // create our random number here    // switch on the browser case    if (!NN4){        document.body.style.backgroundImage = "url('" + IMG_LIST[iRnd] + "')";        document.body.style.backgroundRepeat = IMG_REPEAT;        document.body.style.backgroundPosition = IMG_POSITION.toString();
    }}
