/* A pretty little hack to make uploads not hang in Safari. Just call this
 * immediately before the upload is submitted. This does an Ajax call to
 * the server, which returns an empty document with the "Connection: close"
 * header, telling Safari to close the active connection. A hack, but
 * effective. */
function closeKeepAlive() {
  if (/AppleWebKit|MSIE/.test(navigator.userAgent)) {
    new Ajax.Request('/ping/close', { asynchronous:false });
  }
}

Event.onReady(function() {
	$$('.show_on_load').invoke('show');
  $$('.print_link').invoke('observe', 'click', function(e) { window.print(); e.stop(); });
	$$('textarea.embed_code').invoke('observe', 'click', function(e) { this.select(); });
});
