function PadDigits(n, totalDigits) 
{ 
  n = n.toString(); 
  var pd = ''; 
  if (totalDigits > n.length) 
    { 
      for (i=0; i < (totalDigits-n.length); i++) 
	{ 
	  pd += '0'; 
	} 
    } 
  return pd + n.toString(); 
} 


// create the array of commentary text
var cs_commentary = new Array();
//for (var idx_commentary=1;idx_commentary<=csindex;idx_commentary++) {
//  cs_commentary[idx_commentary]="";
//}

cs_commentary[1] ='Farewell, Uncle Glenn.';
cs_commentary[2] ='Fun in Boston, Duck Tour Style! Jerry, Deb, Casey, and Jolene come to see Jodi and Steve in the birthplace of the Revolution.';
cs_commentary[3] ='Grease fires make everything taste better! It\'s a California-style house-warming as Jodi and Steve welcome a new life in the Bay Area.';
cs_commentary[4] ='Kate and Brad tie the not, and are suddenly drowned in a sea of bubbles.';
cs_commentary[5] ='Jodi and Steve welcome in Christmas in California. Pretend that\'s the glare from snow shining through the window . . . ';
cs_commentary[6] ='I\'ve never seen a (wo)man eat so many chicken wings!';
cs_commentary[7] ='What the house saw when it landed on the Wicked Witch. Jodi brings a certain flare to the couch with her socks and slippers.';
cs_commentary[8] ='Jerry ties the knot.';
cs_commentary[9] ='Jodi gets ready to run the Lakefront Marathon in Milwaukee.';
cs_commentary[10]='Memories they can live forever, care of iDVD.';
cs_commentary[11]='Jodi\'s Antractic Medal arrives, a recognition of her time at the South Pole.';
cs_commentary[12]='Brad and the Psi Stars take on the remaining academics in a no-holds-barred softball brouhaha.';
cs_commentary[13]='Farewell, Tom.';
cs_commentary[14]='Reflections on the Vietnam War Memorial. Jodi and Steve seek out a lost family friend in Washington in a cold October downpour.';
cs_commentary[15]='Kara, Steve, and Jodi enjoying a great wedding in Virginia.';
cs_commentary[16]='Tiger Woods may be buried here.';
cs_commentary[17]='Join Kate for a fund-raising recital!';
cs_commentary[18]='Physicists go to Washington. A joint lobbying trip by users at Fermilab and SLAC attempts to raise awareness about and secure support for the physical sciences and high-energy physics.';
cs_commentary[19]='Mr. Sekula is celebrated at a ceremony for outstanding educators in a  UCONN program that gives high school students a crack a college chemistry.';
cs_commentary[20]='Jolene proudly shows off her Park Falls Herald in France. Mon dieu! Product placement!';
cs_commentary[21]='Llama versus hedgehog in an epic struggle for the soul of Man.';
cs_commentary[22]='It was delicious, even before Pac-Man had a swing at it. Find recipes for this and other delights in <a href="http://cookbook.cooleysekula.net">Jodi\'s Cookbook</a>.';
cs_commentary[23]='A CIA-style view of the family homestead in Wisconsin.';
cs_commentary[24]='Jodi stands proudly on the shores of the San Francisco Bay, while NASA\'s Ames Research Center looms in the back.';
cs_commentary[25]='Goats, and other fire-protective measures. Yes, it\'s summer in the Bay Area.';
cs_commentary[26]='Steve turns 30.';
cs_commentary[27]='Jodi and her tomato plant. Today, cluttering the backyard - tomorrow, cluttering the world.';
cs_commentary[28]='The Church of the Assumption of Mogiltsy. <A href="http://steve.cooleysekula.net/photos/Moscow">Find this and other photos from Steve\'s trip to Moscow</a> in his photo album. Find <a href="http://steve.cooleysekula.net/blog/291">tales of the trip in his blog</a>.';
cs_commentary[29]='The Bamboozler, a pizza as big as your hopes and dreams. See <a href="http://steve.cooleysekula.net/photos/Soudan-Aug-2006">photos of this and other wonders of the Iron Range</a> in Steve\'s web photo album.';
cs_commentary[30]='Mom celebrates her birthday with family and friends in Milwaukee.';
cs_commentary[31]='The Domkyrkan dominates the landscape of Uppsala. <a href="http://steve.cooleysekula.net/photos/Uppsala">Find photos of this and other sights in Sweden</a> in Steve\'s photo album.';
cs_commentary[32]='Jodi and Steve celebrate their fourth anniversary.';
cs_commentary[33]='A four-pointer grazes on the last raspberries of the season in the backyard.';
cs_commentary[34]='Jackie and Jason enjoy the delights of San Francisco.';
cs_commentary[35]='Fried turkey and tur-duck-hen. It\'s why the Pilgrims sacrificed their lives to make a foothold in the New World.';
cs_commentary[36]='Jodi\'s deep in a mine, listening for whispers of dark matter. Join her, and all the members of CDMS, at the <a href="http://symmetrymagazine.org/cms/?pid=1000410"target="_blank">Symmetry Magazine website</a>.';
cs_commentary[37]='Jodi refinishes some old metal patio furniture.';
cs_commentary[38]='Jenny and Tom tie the knot. Contact Jodi and Steve if you\'re interested in the wedding ceremony DVD.';
cs_commentary[39]='Steve and Jodi get dressed up as a T-virus infested scientist and an iPod, respectively.';
cs_commentary[40]='Say hello to Andrew (left) and Connor (right) Wrasse!';
cs_commentary[41]='Meet the future physicists in Jodi\'s family: Connor (left), Akira (middle), and Andrew (right)!';
cs_commentary[42]='Leon\'s Pizza - a staple of life in the Sekula family whenever we are all home.';
cs_commentary[43]='Spot Mr. Sekula. Can you spot Mr. Sekula? Hint: it\'s the ears.';
cs_commentary[44]='Friends gather at Casa de Cooley-Sekula to watch the election returns.';
cs_commentary[45]='Jodi, Lisa, and Adam successfully complete the Big Sur Half Marathon in just about 2 hours each.';
cs_commentary[46]='Our neice, Akira, and nephews, Connor and Drew, all turn 1 years old.';
cs_commentary[47]='Our nephews, Andrew and Connor, and Jodi\'s mom., dad, and sister, visit us in California.';
cs_commentary[48]='Jodi and Steve begin their faculty positions at Southern Methodist University.';
cs_commentary[49]='Jodi unveils the last CDMS II result at SLAC National Accelerator Laboratory. <a href="http://www.slac.stanford.edu/~madejski/kipac.all_cropped.mov">Watch her presentation here.</a>';
cs_commentary[50]='It is a bad snow day in Dallas, SMU is closed, so we take the opportunity to put some of it to use.';
cs_commentary[51]='Akira turns two . . . and she\'s SO serious about it!';
cs_commentary[52]='The first day of spring, 2010, in Dallas, Texas.';

var csindex=cs_commentary.length - 1;
var csimage=PadDigits(csindex,3);


function writeCSImage() {

  HTMLOut = '';

  HTMLOut += '<div id="cs_image"><a href="images/cs-'+csimage+'.png"><img style="border: 0px solid ; width: 350px;" alt="Cross-section image" src="images/cs-'+csimage+'_thumbnail.png" name="csimage_thumbnail"></a></div><br>';

  HTMLOut += '<small><span style="font-style: italic; font-weight: bold;">Cross-Section: a snapshot of life in our families</span><br>';

  HTMLOut += '<div id="cs_commentary"><span class="value"  style="font-style: italic;">'+cs_commentary[csindex]+'</span></div></small>';

  HTMLOut += '<br>To see an old cross-section photo, click on a number below:<br><br>';

  HTMLOut += '<span><small>(';

  for (var idx_image = 1; idx_image <= csindex; idx_image++) {
    if (idx_image != 1) {
      HTMLOut += '- ';
    }

    HTMLOut += '<a href="javascript:set_csimage('+idx_image+');">'+PadDigits(idx_image,3)+'</a>';

  }
  
  HTMLOut += ')</small></span>';

  document.write(HTMLOut);
  
}


function set_csimage(number) {
  csimage = PadDigits(number,3);

  document.getElementById("cs_image").innerHTML = '<a href="images/cs-'+csimage+'.png"><img style="border: 0px solid ; width: 350px;" alt="Cross-section image" src="images/cs-'+csimage+'_thumbnail.png" name="csimage_thumbnail"></a>';

  document.getElementById("cs_commentary").innerHTML = '<span class="value" style="font-style: italic;">'+cs_commentary[number]+'</span>';
}

