/* 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. */
var KeepAlive = {
  close:function() {
    if (/AppleWebKit|MSIE/.test(navigator.userAgent)) {
      new Ajax.Request("/ping/close", { asynchronous:false });
    }
  }
}