// FUNCTION:  Write the menu that will appear on each page of the Photography site.
function writeMenu (contentsTop) {

  // Top value defaults to 150.
  if (contentsTop == '') {
    contentsTop = '150';
  }

  document.open();
  document.writeln('<div id="contents" style="top: ' + contentsTop + 'px">');
  document.writeln('  <h2>Galleries</h2>');
  document.writeln('  <p style="margin-left: 0.2in">');
  document.writeln('    &ndash; <a href="gallery_Animals.html">Animals</a><br/>');
  document.writeln('    &ndash; <a href="gallery_Conceptual.html">Conceptual</a><br/>');
  document.writeln('    &ndash; <a href="gallery_Landscapes.html">Landscapes</a><br/>');
  document.writeln('    &ndash; <a href="gallery_People.html">People</a><br/>');
  document.writeln('    &ndash; <a href="gallery_PJ.html">Photojournalism</a><br/>');
  document.writeln('    &ndash; <a href="gallery_Sports.html">Sports</a></p>');
  document.writeln('  <p><a href="biography.html">About the Photographer</a><br/>');
  document.writeln('  <a href="CC_License.html">Creative Commons Info</a><br/></p>');
  document.writeln('  <img src="/Images/CC/cc_Attrib.gif" width="30" height="30" alt="Attribution" />');
  document.writeln('  <img src="/Images/CC/cc_NonCom.gif" width="30" height="30" alt="No Commercial Use" />');
  document.writeln('  <img src="/Images/CC/cc_Share.gif" width="30" height="30" alt="Share Alike" />');
  document.writeln('</div>');
  document.close();
  return true;

}  // end of writeMenu function

// FUNCTION:  Obfuscate an e-mail address
function writeAddress (username, domain, alias) {
  document.open();
  document.write('<a href="mailto:' + username + '@' + domain + '">');

  if (alias == '') {
    document.write(username + '@' + domain);
  } else {
    document.write(alias);
  } // end if

  document.write('</a>');
  document.close();
  return true;
}

// FUNCTION: Write a table to contain image thumbnails
function writeImages (pathName, imgSrc, imgAlt) {

  document.open();
  
  document.writeln('<table border="0" width="600" align="center">');
    
  for (count = 0; count < imgSrc.length; count++) {

    // We will open no new row before its time.
    if (count % 3 == 0) {
      document.writeln('<tr>');
    } // end if
    
    document.writeln('  <td class="image" title="' + imgAlt[count] + '">');
    document.writeln('    <a href="/Images/Photos/' + pathName + '/' + imgSrc[count] + '">');
    document.writeln('    <img src="/Images/Photos/Thumbs/' + pathName + '/' + imgSrc[count] + '" width="180" height="135">');
    document.writeln('  </td>');
    
    // Everything that has a beginning has an end, Neo.
    if (count == imgSrc.length - 1 || count % 3 == 2) {
      document.writeln('</tr>');
      if (count < imgSrc.length - 1) {
        document.writeln('<tr>');
      } // end if
    } // end if
  
  } // end for
  
  document.writeln('</table><br/>');
  document.close();

} // End of writeImages function