  // set this to the total number of baby pics
  pad=11;
  babyPicTotal = 30;

  // calculate a random num between 1 and babyPicTotal and add pad
  randomNum = Math.floor(Math.random() * babyPicTotal) + pad;

  // set this to the total number of baby pics
  pad=1;
  agePicTotal = 5;

  // calculate a random num between 1 and babyPicTotal and add pad
  randomNumAge = Math.floor(Math.random() * agePicTotal) + pad;

  // get passed baby id if there is one
 
function getArgs() {
    var args = new Object();
    var query = location.search.substring(1);  // Get query string.
    var pairs = query.split(",");              // Break at comma.
    for(var i = 0; i < pairs.length; i++) {
	var pos = pairs[i].indexOf('=');       // Look for "name=value".
	if (pos == -1) continue;               // If not found, skip.
	var argname = pairs[i].substring(0,pos);  // Extract the name.
	var value = pairs[i].substring(pos+1); // Extract the value.
	args[argname] = unescape(value);          // Store as a property.
    }
    return args;                               // Return the object.
}

var args = getArgs();                 // Get arguments.

// reset num if there is a passed baby id
if ((args.id) && (args.id >=11) && (args.id <= babyPicTotal+pad)) {
  randomNum = args.id;
}

// add leading zeros
	paddedRandomNum = '0'+ randomNum;

