// wfunction submit_email(title, link) {
//  var fromaddr = $F('sharesender');
//  var toaddr = $F('sharerecipiants');
//  var url = window.location;
//  if(String(url).match('/newscenter/')) {
//    var templates = 'gallery';
//  }else if(String(url).match('/gallery/')){
//    var templates = 'gallery';
//  }else{
//    var templates = 'hubblesite';
//  }
// 
//  new Ajax.Request('/shared/send_to_a_friend/send.php', {method:'POST', parameters:{email: toaddr, from:fromaddr, link: link, template:templates, title:title}});
//  $('sharebox').hide();
// }
// 
// function setup_callback_for(links) {
//  var myLinks = $A(links);
//  myLinks.each(function(link){
//    $(link).observe('click', call_shared(link.innerhtml, link.href));
//  });
// }
// 
// function call_shared(type, url) {
//  new Ajax.Request('/shared/shared.php?type=' + type + '&url=' + url);
// }
// 
// var is_setup = {};
// 
// function setup_share_boxes() {
//  Event.observe(document, 'dom:loaded', function() {
//    var handle_event = function(i) {
//      return function() {
//        if ($(i.box).visible()) {
//          $(i.box).hide();
//        } else {
//          var t = i.offset[1];
//          var l = i.offset[0];
// 
//          if (Prototype.Browser.IE) {
//            if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
//              if (RegExp.$1 == "6") {
//                t += document.viewport.getScrollOffsets().top;
//                l += document.viewport.getScrollOffsets().left;
//              }
//            }
//          }
// 
//          $(i.box).clonePosition($(i.id), {setWidth: false, setHeight: false, offsetLeft: l, offsetTop: t });
//          $(i.box).show();
//        }
//      }
//    };
// 
//    var to_hide_on_outside_click = [];
// 
//    var items = [
//      {'id': 'share_link', 'box': 'sharebox', 'closer': 'shareclosebox', 'offset': [ -273, 29 ]},
//      {'id': 'embed_link', 'box': 'embedbox', 'closer': 'embedclosebox', 'offset': [ -278, 29 ]}
//    ];
// 
//    var i;
//    for (i = 0; i < items.length; ++i) {
//      var info = items[i];
//      if ($(info.id) && $(info.closer)) {00
//        if (!is_setup[info.id]) {
//          var handler = handle_event(info);
//          $(info.id).observe('click', handler);
//          $(info.closer).observe('click', handler);
// 
//          to_hide_on_outside_click.push([$(info.box),$(info.id)]);
// 
//          is_setup[info.id] = true;
//        }
//      }
//    }
// 
//    var document_closer = function(e) {
//      var close_all = true;
//      to_hide_on_outside_click.each(function(i) {
//        if (e.findElement('#' + i[0].id + ', #' + i[1].id)) { close_all = false; }
//      });
//      if (close_all) { to_hide_on_outside_click.each(function(i) { i[0].hide(); }); }
//    };
// 
//    Event.stopObserving(document, 'click', document_closer);
//    Event.observe(document, 'click', document_closer);
//  });
// }
