/* This script was adapted from export.js
written by Mike Kaply */
//�200-The MITRE Corporation.  All rights reserved.
//This code is available under the Creative Commons Attribution License


var geoLoc = [];
var geoIndex = 0;
if (Components.utils.import) {
  try {
    Components.utils.import("rel:Microformats.js");
  } catch (ex) {}
}

var exhibit_contacts = {
  descriptionAll: "Exhibit Contacts",
  scope: {
    semantic: {
      "hCard" : "fn"
    }
  },
  /* doActionAll gets ALL of the semantic Object arrays */
  doActionAll: function(semanticArrays, semanticObjectType) {
    var url;
     try {
          // Needed for Mozilla if local file tries to access an http URL
           netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
          } catch (e) {  /* ignore */ }
    if (semanticArrays["hCard"].length > 0) {
      // Microformat conversion to JSON data 
      var file = Components.classes["@mozilla.org/file/directory_service;1"].
                            getService(Components.interfaces.nsIProperties).
                            get("TmpD", Components.interfaces.nsIFile);

      file.append("hCard_js.js");
      file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0664);
      var fileName = file.leafName;
      var ios = Components.classes["@mozilla.org/network/io-service;1"]
                    .getService(Components.interfaces.nsIIOService);
      var fileHandler = ios.getProtocolHandler("file")
                     .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
      var urlfileData = fileHandler.getURLSpecFromFile(file);
      var fos = Components.classes["@mozilla.org/network/file-output-stream;1"].
                           createInstance(Components.interfaces.nsIFileOutputStream);
      fos.init(file, -1, -1, false);
      var header = "{  \r\n "  +
                    "types: {" +
                              '"contact" : {' +
                        ' pluralLabel: "contacts"' +
                    '}' +
                 '},' +  " items: [" + "\r\n" ;
      var footer = "]"  + "\r\n" + "}";
      fos.write(header, header.length);
      for (var j =0; j < semanticArrays["hCard"].length; j++) {
        var vcf = this.vCard_json(semanticArrays["hCard"][j]);
        if (vcf) {
          if (j < semanticArrays["hCard"].length -1) 
             vcf += ",";
          fos.write(vcf, vcf.length);
        }
      }
   
  
      fos.write(footer,footer.length);
      fos.close();               
      // initialize html to call the exhibit
       var file = Components.classes["@mozilla.org/file/directory_service;1"].
                            getService(Components.interfaces.nsIProperties).
                            get("TmpD", Components.interfaces.nsIFile);
      file.append("exhibit.html");
      file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0664);
          // do whatever you need to the created file
      var htmlRender = file.leafName;
      var urlfilehtmlRender = fileHandler.getURLSpecFromFile(file);
    
      var fhtm = Components.classes["@mozilla.org/network/file-output-stream;1"].
                               createInstance(Components.interfaces.nsIFileOutputStream);
    
       fhtm.init(file, 0x04 | 0x08 | 0x20, 420, 0);
       var htmlFile = htmlPage(urlfileData)
       fhtm.write(htmlFile,htmlFile.length);
       fhtm.close();
       window.open(urlfilehtmlRender) ;
  }  
    
    return ;
  }, 
  doActionOld: function(semanticObject, semanticObjectType) {
    var url;
    var file = Components.classes["@mozilla.org/file/directory_service;1"].
                            getService(Components.interfaces.nsIProperties).
                            get("TmpD", Components.interfaces.nsIFile);

      file.append("hCard_js.js");
      file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0664);
      var fileName = file.leafName;
      var ios = Components.classes["@mozilla.org/network/io-service;1"]
                    .getService(Components.interfaces.nsIIOService);
      var fileHandler = ios.getProtocolHandler("file")
                     .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
      var urlfileData = fileHandler.getURLSpecFromFile(file);
      var fos = Components.classes["@mozilla.org/network/file-output-stream;1"].
                           createInstance(Components.interfaces.nsIFileOutputStream);
      fos.init(file, -1, -1, false);
      var header = "{  \r\n " + " items: [" + "\r\n";
      var footer = "]"  + "\r\n" + "}";
      fos.write(header, header.length);
      var vcf = this.vCard_json(semanticObject);
        fos.write(vcf, vcf.length);
      fos.write(footer,footer.length);
      fos.close();               
      // initialize html to call the exhibit
       var file = Components.classes["@mozilla.org/file/directory_service;1"].
                            getService(Components.interfaces.nsIProperties).
                            get("TmpD", Components.interfaces.nsIFile);
      file.append("exhibit.html");
      file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0664);
          // do whatever you need to the created file
      var htmlRender = file.leafName;
      var urlfilehtmlRender = fileHandler.getURLSpecFromFile(file);
    
      var fhtm = Components.classes["@mozilla.org/network/file-output-stream;1"].
                               createInstance(Components.interfaces.nsIFileOutputStream);
    
       fhtm.init(file, 0x04 | 0x08 | 0x20, 420, 0);
       var htmlFile = htmlPage(urlfileData)
       fhtm.write(htmlFile,htmlFile.length);
       fhtm.close();
       window.open(urlfilehtmlRender) ;
      
  return url;
  },
  
 vCard_json: function(hcard) {
    var crlf = "\r\n";
    var vcf;
    var i;
    var j;
    var escape='"';
    vcf  = "{" + crlf;
    vcf  += "type:" + escape + "hCard" + escape + "," + crlf;
    vcf  += "label:" + escape + hcard.fn + escape;
    if (hcard.n && (hcard.n["family-name"] || hcard.n["given-name"] ||
        hcard.n["additional-name"] || hcard.n["honorific-prefix"] ||
        hcard.n["honorific-suffix"])) {
     
      if (hcard.n["family-name"]) {
        vcf += "," + crlf;
        vcf += escape +  "family-name" + escape + ":" + escape +  hcard.n["family-name"] + escape;
         
      }
    
      if (hcard.n["given-name"]) {
        vcf += "," + crlf;
        vcf += escape + "given-name" + escape + ":" + escape +  hcard.n["given-name"] + escape;
       
      }
     
      if (hcard.n["additional-name"]) {
        vcf += "," + crlf;
        vcf += escape + "additional-name" +   escape +  ":" + escape + hcard.n["additional-name"].join(",") + escape;
       
      }

      if (hcard.n["honorific-prefix"]) {
        vcf += "," + crlf;
        vcf += escape + "honorific-prefix" + escape + ":" + escape + hcard.n["honorific-prefix"].join(",") + escape;
        
      }
   
      if (hcard.n["honorific-suffix"]) {
       vcf += "," + crlf;
        vcf += escape + "honorific-suffix" + escape + ":" +  escape + hcard.n["honorific-suffix"].join(",") + escape;
        
      }
   
    } 
    if (hcard.org) {
     
      if (hcard.org[0]["organization-name"]) {
        vcf += "," + crlf;
        vcf += escape + "organization-name" + escape + ":" +  escape + hcard.org[0]["organization-name"] + escape;
        
      }
      if (hcard.org[0]["organization-unit"]) {
        vcf += "," + crlf;
        vcf += escape + "organization-unit" +  escape + ":" + escape + hcard.org[0]["organization-unit"].join(",") + escape;
        
      }
     
    }
    if (hcard.fn) {
      vcf += "," + crlf;
      vcf += escape + "formatted-name" + escape + ":" + escape + hcard.fn + escape ;
      
    }
    if (hcard.title) {
      vcf += "," + crlf;
      vcf += "title:" + escape + hcard.title[0] + escape;
       
    }
    if (hcard.role) {
      vcf += "," + crlf;
      vcf += "role:" + escape + hcard.role[0] + escape;
       
    }
    if (hcard["sort-string"]) {
      vcf += "," + crlf;
      vcf += escape + "sort-string" + escape + ":"  + escape + hcard["sort-string"][0] + escape;
      
    }
    if (hcard["class"]) {
      vcf += "," + crlf;
      vcf += "class:" + escape + hcard["class"] + escape;
     
    }
    if (hcard.tz) {
      vcf += "," + crlf;
      vcf += "tz:" + escape + hcard.tz + escape;
       
    }
    if (hcard.category) {
      vcf += "," + crlf;
      vcf += "categories:" + escape + hcard.category.join(",") + escape;
       
    }
    if (hcard.rev) {
      vcf += "," + crlf;
      vcf += "rev:" + escape + hcard.rev + escape;
      
    }
    if (hcard.bday) {
      vcf += "," + crlf;
      vcf += "bday:" + escape + hcard.bday + escape;
     
    }
    if (hcard.uid) {
      vcf += "," + crlf;
      vcf += "uid:" + escape + hcard.uid + escape;
    } 
   
    if (hcard.url) {
      vcf += "," + crlf;
      for (i=0;i<hcard.url.length;i++) {
        if (i > 0) vcf += "," + crlf;
        vcf += " url:" + escape + hcard.url[i] + escape;
       
         
      }
    }
    if (hcard.email) {
    
       
      for (i=0;i<hcard.email.length;i++) {
          vcf += "," + crlf;
        vcf += escape + "email";
        if (hcard.email[i].type) {
          vcf += "-type";
          vcf += hcard.email[i].type.join(",");
        }
        vcf +=  escape + ":";
        vcf += escape + hcard.email[i].value + escape;
        
      }
    }
    if (hcard.adr) {
      vcf += "," + crlf;
      for (i=0;i<hcard.adr.length;i++) {
        if (i > 0) vcf += "," + crlf;
        vcf += escape + "address";
        if (hcard.adr[i].type) {
          vcf += "-type-";
          vcf += hcard.adr[i].type.join(",");
        }
        vcf += escape + ":" + escape;
        if (hcard.adr[i]["post-office-box"]) {
          vcf += escape + hcard.adr[i]["post-office-box"];
        }
        vcf += " ";
        if (hcard.adr[i]["extended-address"]) {
          vcf += hcard.adr[i]["extended-address"];
        }
        vcf += " ";
        if (hcard.adr[i]["street-address"]) {
          vcf += hcard.adr[i]["street-address"].join(",");
        }
        vcf += " ";
        if (hcard.adr[i].locality) {
          vcf += hcard.adr[i].locality;
        }
        vcf += " ";
        if (hcard.adr[i].region) {
          vcf += hcard.adr[i].region;
        }
        vcf += " ";
        if (hcard.adr[i]["postal-code"]) {
          vcf += hcard.adr[i]["postal-code"];
        }
        vcf += " ";
        if (hcard.adr[i]["country-name"]) {
          vcf += hcard.adr[i]["country-name"];
        }
       vcf += escape;
      }
    }
    if (hcard.tel) {
      vcf += "," + crlf;
      for (i=0;i<hcard.tel.length;i++) {
         if (i > 0) vcf += "," + crlf;
        vcf += escape + "tel";
        if (hcard.tel[i].type) {
          vcf += "-type";
          vcf += hcard.tel[i].type.join(",");
        }
        vcf +=  escape + ":";
        vcf += escape + hcard.tel[i].value + escape;
       
      }
    }
    if (hcard.geo) {
      var geo = hcard.geo.latitude + "," + hcard.geo.longitude;
        geoLoc[geoIndex++] = geo;
    }
     if (hcard.note) {
      vcf += "," + crlf;
      vcf += "  note:";
      for (i=0; i< hcard.note.length;i++) {
        var s = hcard.note[i];
        s = s.replace(/\<.*?\>/gi, ' ');
        s = s.replace(/[\n\r\t]/gi, ' ');
        s = s.replace(/\s{2,}/gi, ' ');
        s = s.replace(/\s{2,}/gi, '');
        s = s.replace(/^\s+/, '');
        if (i != 0) {
          vcf += " ";
        }
        vcf += escape + s + escape;
      }
     
    }
    if (hcard.nickname) {
      vcf += "," + crlf;
      vcf += "nickname:" + escape + hcard.nickname + escape  +  crlf;
    }
    /* Add code to handle data URLs */
    if (hcard.photo) {
      vcf += "," + crlf;
      vcf += "  photo:" + escape + hcard.photo + escape +  crlf;
    }
    if (hcard.logo) {
      vcf += "," + crlf;
      vcf += "  logo:" + escape + hcard.logo + escape  + crlf;
    }
    if (hcard.label) {
      vcf += "," + crlf;
      vcf += "label:" + escape + hcard.label + escape  + crlf;
    }
   
    vcf += "}";
    return vcf;
  }
  };
  
  
function htmlPage(datafile)   {
  
  var html="";
  
  
    html += "<html>";
    html += " <head>";
    html += '      <title>Microformats</title>';
    html += '       <link href="' + datafile + '" type="application/json" rel="exhibit/data" />';
    html += "       <script src='http://static.simile.mit.edu/exhibit/api/exhibit-api.js'";
    html += '           type="text/javascript"></script>';
    //thickbox
    html += '       <script type="text/javascript">';
    html += '                 function showThickbox(a){';
    html +=                    'var t = a.title || a.name || null;';
    html += '                    var g = a.rel || false;';
    html += '                    TB_show(t,a.href,g);';
    html += '                    a.blur();';
    html += '                    return false;'
    html += '};';
    html += '</script>';
    html += "      <style> ";
    html += "          body {";
    html += '            font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;';
    html += "                 color: #4f6b72;";
    html += "                    background: #E6EAE9;";
    html += "         }";
    html += "       #header {";
    html += "	               margin:60px 100px 0px 100px;";
    html += "	               padding:0px;";
    html += "	               }";
    html += "       .first {margin-top:0.8em;";
    html += "                    margin-bottom: 0.8em;"
    html += "                    padding  0.5em;}";
   
    html += "           #contacts {";
    html += "                padding:        0.5em 0.5in;";
    html += "            }";
                
    html += "            #contacts cite {";
    html += "                    font-weight: normal;";
    html += "                    font-style: italic;";
    html += "                    margin-bottom: 0.75em;";
    html += "            }";
                
                
                
    html += "       #top-panels {";
    html += "       padding:        0.5em 0.5in;";
    html += "       border-top:     1px solid #BCB79E;";
    html += "       border-bottom:  1px solid #BCB79E;";
    html += "       background:     #E6EAE9;";
    html += "   }";
    html += "exhibit-control-panel {";
    html += "   clear:  both;";
    html += "}";
    html += "exhibit-browse-panel {";
    html += "}";
    html += "exhibit-view-panel {";
    html += "padding:   1 em o.5in;";
    html += "}";
    html += "div.exhibit-browsePanel-logoContainer {";
    html +="        display: none;";
    html += "    }";
    html += "    div.exhibit-facet-frame {";
    html += "       width: 16em;";
    html += "       float: left;";
    html += "    }";
    html += "    div.exhibit-facet-body {";
    html += "        border: 1px solid #BCB79E;";
    html += "    }";
    html += "    td.exhibit-tileView-itemIndex {";
    html += "        display: none;";
    html += "   }";
    html += "    span.exhibit-collectionView-group-count {";
    html += "        color:       #ccc;";
    html += "        font-weight: normal;";
    html += "    }";
    html += "    div.exhibit-facet-value-selected {";
    html += "       background:  none;";
    html += "        font-weight: bold;";
    html += "    }";
    
    
     html += ".micro-thumbnail{";
     html += "       float:      left;";
     html += "       width:      20em;";
     html += "       height:     15em;";
     html += "       border:     1px solid #BCB79E;";
     html += "       background: #F0FFF0;";
     html += "       padding:    1em;";
     html += "       margin:     0.5em;";
     html += "       text-align: left;";
     html += "       word-wrap:  break-word";
     html += "   }";
        
        
    html += "            .formatText{";
    html += "                    background-color: rgb(95%,95%,90%);";
    html += "                    color: #000;";
    html += "                    border: none;";
    html += "                    margin-bottom: 0.75em;";
    html += "            }";
                
    html += "            .contactName {";
    html += "                    background-color: transparent;";
    html += "	                 border-top: none;";
    html += "                    font-size: medium;";
    html += "                    letter-spacing: normal;";
    html += "                    margin: 0 0 0.5em 0;";
    html += "                    padding: 0;";
    html += "                    text-transform: none; ";           
    html += "            }";
    //table format
    // adapted from http://www.duoh.com/csstutorials/csstables/styles.css
                        
                        
                        
     html += "                   #mytable {";
     html += "                       padding: 0;";
     html += "                       margin: 0;";
     html += "               }";
                    
     html += "               caption {";
     html += "                       padding: 0 0 5px 0;";
     html += "                       width: 700px;	"; 
     html += '                       font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;';
     html += "                       text-align: right;";
     html += "               }";
                    
     html += "               th {";
     html += '                       font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;';
     html += "                       color: #4f6b72;";
     html += "                       border-right: 1px solid #C1DAD7;";
     html += "                       border-bottom: 1px solid #C1DAD7;";
     html += "                       border-top: 1px solid #C1DAD7;";
     html += "                       letter-spacing: 2px;";
     html += "                       text-transform: uppercase;";
     html += "                       text-align: left;";
     html += "                       padding: 6px 6px 6px 12px;";
     html += "                       background: #CAE8EA url(images/bg_header.jpg) no-repeat;";
     html += "               }";
                    
     html += "               th.nobg {";
     html += "                       border-top: 0;";
     html += "                       border-left: 0;";
     html += "                       border-right: 1px solid #C1DAD7;";
     html += "                       background: none;";
     html += "               }";
                    
     html += "               td {";
     html += "                       border-right: 1px solid #C1DAD7;";
     html += "                       border-bottom: 1px solid #C1DAD7;";
     html += "                       background: #fff;";
     html += "                       padding: 6px 6px 6px 12px;";
     html += "                       color: #4f6b72;";
     html += "               }";
                    
                    
     html += "               td.alt {";
     html += "                       background: #F5FAFA;";
     html += "                       color: #797268;";
     html += "               }";
                    
     html += "               th.spec {";
     html += "                       border-left: 1px solid #C1DAD7;";
     html += "                       border-top: 0;";
     html += "                       background: #fff  no-repeat;";
     html += '                       font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;';
     html += "               }";
                    
     html += "               th.specalt {";
     html += "                       border-left: 1px solid #C1DAD7;";
     html += "                       border-top: 0;";
     html += "                       background: #f5fafa  no-repeat;";
     html += '                       font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;';
     html += "                       color: #797268;";
     html += "               }";
                        
    html += "     </style>";
    html += "  </head>"; 
    html += '  <body id="body">';
    html += '  <h1 id="header">hCard Microformats</h1>';
    html += '  <table width="100%" id="mytable">';
    html += "       <caption>List</caption> ";
    html += '      <tr valign="top">';
    html += '      <td class="spec">';
    html += '      <div id="contact">';
    html += '         <table width="100%">';
    html += '           <tr valign="top">';
     html += '           <td>';
    html += '               <div id="top-panels">';
    html += '                 <div id="exhibit-browse-panel" ex:facets=".label, .address" ></div>';
    html += '                 <div id="exhibit-control-panel"></div>'
    html += '               </div><p></p>';
    html += '            </td>';
    html += '           </tr>';
    html += '         </table>';
    html += '             <div id="exhibit-view-panel" >';
  
    html += '               <div ex:role="exhibit-view"';
    
    html += '                    ex:viewClass="Exhibit.ThumbnailView"';
    html += '                    ex:showAll="true"';
    html += '                    ex:orders=".label"';
    html += '                    ex:possibleOrders=".address, .tel">';
    html += '              <div ex:role="exhibit-lens" class="micro-thumbnail" >';
    html += '                          <div ex:if-exists=".photo">';
    html += '                              <img ex:src-content=".photo" />';
    html += '                          </div>';
    html += '                          <p><span ex:content=".label" ></span></p>';
    html += '                          <p><span ex:content=".address" ></span></p>'; 
    html += '                          <p><span ex:content=".tel" ></span></p>';
    html += '                   </div>';
     html += '                   </div>';
    html += '               <div ex:role="exhibit-view"';
    html += '                    ex:label="Additional-Information"';
    html += '                    ex:showAll="false"';
    html += '                    ex:orders=".label"';
    html += '                    ex:viewClass="Exhibit.TileView">';
 //   html += '                       <span ex:role="exhibit-lens">';                             
    html += '                       <span ex:content=".label" class="first"></span>';
    html += "                        <br></br>";
    html += '                       <cite><span ex:content=".title" class="formatText"></span></cite>';
    html += '                       <div ex:if-exists=".family-name" class="formatText">Family Name:'; 
    html += '                                <span ex:content=".family-name"></span>';
    html += '                       </div>';
    
    html += '                       <div ex:if-exists=".given-name" class="formatText">Given Name:'; 
    html += '                                 <span ex:content=".given-name"></span>';
    html += '                       </div>';
    
    html += '                       <div ex:if-exists=".additional-name" class="formatText">Additional Name:'; 
    html += '                                 <span ex:content=".additional-name"></span>';
    html += '                       </div>';
    
    html += '                      <div ex:if-exists=".honorific-prefix" class="formatText">Honorific Prefix:'; 
    html += '                                <span ex:content=".honorific-prefix"></span>';
     html += '                     </div>';
     
    html += '                      <div ex:if-exists=".honorific-suffix" class="formatText">Honorific Suffix:'; 
    html += '                                <span ex:content=".honorific-suffix"></span>';
    html += '                      </div>';
    
    html += '                      <div ex:if-exists=".organization-name" class="formatText">Organization Name:'; 
    html += '                                <span ex:content=".organization-name"></span>';
    html += '                      </div>';
    
    html += '                      <div ex:if-exists=".organization-unit" class="formatText">Organization Unit:'; 
    html += '                               <span ex:content=".organization-unit"></span>';
    html += '                      </div>';
   
    html += '                      <div ex:if-exists=".role" class="formatText">Role:'; 
    html += '                              <span ex:content=".role"></span>';
    html += '                      </div>';
    
    html += '                      <div ex:if-exists=".categories" class="formatText">Categories:'; 
    html += '                              <span ex:content=".categories"></span>';
    html += '                      </div>';
    
    html += '                      <div ex:if-exists=".bday" class="formatText">Birthday:'; 
    html += '                              <span ex:content=".bday"></span>';
    html +=                        '</div>';
    
    html += '                        <div ex:if-exists=".uid" class="formatText">UID:'; 
    html += '                                 <span ex:content=".uid"></span>';
    html += '                         </div>';
    
    html += '                        <div ex:if-exists=".url" class="formatText">URL:'; 
    html += '                                 <span ex:content=".url"></span>';
    html += '                        </div>';
    
    html += '                        <div ex:if-exists=".email" class="formatText">Email:'; 
    html += '                                 <span ex:content=".email"></span>';
    html += '                        </div>';
   
    html += '                        <div ex:if-exists=".email-type" class="formatText">Email:'; 
    html += '                                  <span ex:content=".email-type"></span>';
    html += '                        </div>';
    
    html += '                       <div ex:if-exists=".address" class="formatText">Address:'; 
    html += '                                  <span ex:content=".address"></span>';
    html += '                       </div>';
    
    html += '                      <div ex:if-exists=".tel" class="formatText">Telephone:'; 
    html += '                                 <span ex:content=".tel"></span>';
    html += '                      </div>';
    
    html += '                      <div ex:if-exists=".note" class="formatText">Notes:'; 
    html += '                                <span ex:content=".note"></span>';
    html += '                      </div>';
    
    html += '                      <div ex:if-exists=".nickname" class="formatText">Nickname:'; 
    html += '                               <span ex:content=".nickname"></span>';
    html += '                      </div>';
    
   html += '                       <div ex:if-exists=".photo">Photo:'; 
   html += '                                <img ex:src-content=".photo" />';  
   html += '                       </div>';
   html += '                </div>';  //exhibit-view
    html += '               <div ex:role="exhibit-view"';
    html += '                    ex:viewClass="Exhibit.TabularView"';
    html += '                    ex:columns=".label, .title, .address, .tel"';
    html += '                    >';
 
   
    html += '                   </div>';
  //  html += '               </div>';  //exhibit-lens
  
   html += '              </div>'; //exhibit-view-panel
  
   html += '</div>'; //div contact
   html += '                 <HR WIDTH="100%" COLOR="#6699FF"  SIZE="1">';
   html +=                   "</span></div>";
     if (geoIndex > 0) {
       html += '<div id="exhibit-view-panel">';
       html += '  <div ex:role="exhibit-lens">';  
  
       var link="";
   
          link = 'http://maps.google.com/maps?';
          for (var j =0; j < geoLoc.length; j++) {
            var geo="";
              link += "ll=" + geoLoc[j] + "&q=" + geoLoc[j];
           }
       
    
          html += '<a href="' +  link + '&KeepThis=true&TB_iframe=true&height=400&width=600"';
          html += ' title="See a map of the location" class="thickbox" '
          html += ' ex:href=content=".imageURL" onclick="return showThickBox(this);"'; 
          html += '>Open Google Map</a>';  
          html += "          </div></div>";
     };
    html += "          </div>";
    html += "          </div>";
    html += "           </td>";
    html += "           </div>";
    html += '         <td width="25%">';
    html += '            <div id="exhibit-browse-panel"></div>';
    html += "        </td>";
    html += "     </tr>";
    html += "   </table>";
    html += "   </body>";
    html += "   </html>";
    return(html);
    };
  
 
  
  SemanticActions.add("exhibit_contacts", exhibit_contacts);