function all_metadata() {
   var hiddenData = document.getElementById("hiddenData");
   var reveal = document.getElementById("reveal");
   var hide = document.getElementById("hide");
   hiddenData.style.display = "block";
   hide.style.display = "block";
   reveal.style.display = "none";
}
function min_metadata() {
   var hiddenData = document.getElementById("hiddenData");
   var reveal = document.getElementById("reveal");
   var hide = document.getElementById("hide");
   hiddenData.style.display = "none";
   hide.style.display = "none";
   reveal.style.display = "block";
   
}
function selectTab(selected) {
   var tabbar = document.getElementById('resultstabs');
   var tabs = tabbar.getElementsByTagName('div');
   for (i=0; i<tabs.length; i++) {
      if (tabs[i].className != "tabempty") {
         tabs[i].className="tab";
      }
   }
   selected.className="tabselect";
}
function displayFullWebpage (url) {
   window.open(url);
   return false;
}
function ellipsis (x, maxlen) {
   /* given a string and a maximum length for the string, this routine
      returns the same string truncated to the maximum length. In addition,
      if the string was truncated, "..." is added to the end, again not to
      exceed the maximum length.
      E.g. ellipsis("abcdef", 4) = "a..."
      ellipsis("abcdef", 6) = "abcdef"
   */
   if (x.length <= maxlen)
      return x
   else if (maxlen < 4)
      return x.substring(0, maxlen) // no room for ellipsis
   else
      return x.substring(0, maxlen-3) + "...";
}

function setCurators(index) {
   // Index key:
   //      0   -   All collections / general
   //      1   -   Baroness Elsa von Freytag-Loringhoven Digital Library
   //      2   -   Films@UM
   //      3   -   In Transition: Selected Poems of the Baroness Elsa von Freytag-Loringhoven
   //      4   -   The Jim Henson Works
   //      5   -   National Trust Library Historic Postcard Collection
   //      6   -   Prange Digital Children's Book Collection
   //      7   -   Sterling Family Papers
   //      8   -   A Treasury of World's Fair Art and Architecture
   //      9   -   University AlbUM
   // The following e-mail addresses are presented as unicode character strings to
   // prevent spam harvesting - Sean D 10/4/07
   var atUM = String.fromCharCode(64) + String.fromCharCode(117,109,100,46,101,100,117);
   var primaryEmail = String.fromCharCode(108,105,98,100,99,114) + atUM;
   var henson = String.fromCharCode(118,110,111,118,97,114,97) + atUM;
   var worldsfairs = String.fromCharCode(112,99,111,115,115,97,114,100) + atUM;
   var album1 = String.fromCharCode(97,116,117,114,107,111,115) + atUM;
   var album2 = String.fromCharCode(101,109,99,97,108,108,105,115) + atUM;
   var sterling = String.fromCharCode(108,101,118,106,101,110) + atUM;
   var baroness = String.fromCharCode(97,108,118,97,114,101,122) + atUM;
   var films = String.fromCharCode(110,111,110,112,114,105,110,116) + atUM;
   var prange = String.fromCharCode(112,114,97,110,103,101,98,117,110,107,111) + atUM;
   var ntlpostcards = String.fromCharCode(106,97,114,99,104,101,114) + atUM;
   var transition = String.fromCharCode(116,99,108,101,109,101,110,116) + atUM;
   // Hidden input with the recipient e-mail
   var recipient = document.getElementById("recipient");
   if (index == 1) recipient.value = primaryEmail + "," + baroness;
   else if (index == 2) recipient.value = primaryEmail + "," + films;
   else if (index == 3) recipient.value = primaryEmail + "," + transition;
   else if (index == 4) recipient.value = primaryEmail + "," + henson;
   else if (index == 5) recipient.value = primaryEmail + "," + ntlpostcards;
   else if (index == 6) recipient.value = primaryEmail + "," + prange;
   else if (index == 7) recipient.value = primaryEmail + "," + sterling;
   else if (index == 8) recipient.value = primaryEmail + "," + worldsfairs;
   else if (index == 9) recipient.value = primaryEmail + "," + album1 + "," + album2;
   else recipient.value = primaryEmail;
}
function hideMetadata () {
   var hiddendata = document.getElementById("hiddenData");
   var hidelink = document.getElementById("hide");
   var showlink = document.getElementById("reveal");
   hiddendata.style.display = "none";
   hiddendata.style.marginBottom = "0";
   hidelink.style.display = "none";
   showlink.style.display = "block";
}
