// photos.js - javascript code for photo gallery

// function to show a big version of a photo, and put a link to its Flickr 
// page (their TOS requires us to do that)
function bigphoto(img, link) {
 // show big version of clicked image
 var bigimg = document.getElementById('bigimg');
 var bigdiv = document.getElementById('bigdiv');
 if (bigdiv.style.display == 'none')
  bigdiv.style.display = 'block';
 // get "medium" size instead of thumbnail
 bigimg.src = img.src.replace(/_s\.j/, '.j');
 // set titles appropriately (if no title say "none")
 var title = img.alt == '' ? 'none' : img.alt;
 bigimg.alt = title;
 bigimg.title = title;
 document.getElementById('imgtitle').firstChild.nodeValue = title;
 // set the flickr link
 document.getElementById('imglink').href = 'http://www.flickr.com/photos/'
  + link;

 // while the image loads, hide the info and display the loading text
 document.getElementById('imgmeta').style.display = 'none';
 document.getElementById('loading').style.display = 'block';
 // once the image loads, hide the loading text and show the info
 bigimg.onload = function() {
  document.getElementById('loading').style.display = 'none';
  document.getElementById('imgmeta').style.display = 'block';
 }

}
