// GENERATE A RANDOM BANNER IMAGE

if (eval(unescape(window.location).match(/tsunami/i))) {
	// test if URL contains "tsunami"
	var n = 1; // default image
	var r = 41; // # of images in set
	n = (Math.round(Math.random()*(r - 1)) + 1); // generate random number
	i = "http://www.pnud.cl/banner/undp_" + n + ".jpg";
	credit = "";
} else {
	// no match, choose from one of the default sets
	var n = 1; // default image
	
	// pick a number between 1 and 10
	var chance = Math.round(Math.random()*9) + 1;

	// use each set 40/60% of the time
	if (chance > 6) {
		// UNCDF
		var r = 41; // # of images in set
		n = (Math.round(Math.random()*(r - 1)) + 1); // generate random number
		i = "http://www.pnud.cl/banner/undp_" + n + ".jpg";
		credit = "";
	} else {
		// Aerial Images
		var r = 41; // # of images in set
		n = (Math.round(Math.random()*(r - 1)) + 1); // generate random number
		i = "http://www.pnud.cl/banner/undp_" + n + ".jpg";
		credit = "";
	}

}

// write image CSS
document.write('<style type="text/css">.banner {background-image: url(' + i + ');}</style>');

