alecpl
2011-11-15 3fec6952ddbff1b5b487ea2927928338f39e4fef
program/js/common.js
@@ -542,10 +542,17 @@
  return out;
};
// make a string URL safe
// make a string URL safe (and compatible with PHP's rawurlencode())
function urlencode(str)
{
  return window.encodeURIComponent ? encodeURIComponent(str) : escape(str);
  if (window.encodeURIComponent)
    return encodeURIComponent(str).replace('*', '%2A');
  return escape(str)
    .replace('+', '%2B')
    .replace('*', '%2A')
    .replace('/', '%2F')
    .replace('@', '%40');
};
@@ -671,6 +678,23 @@
  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};
// Extend Date prototype to detect Standard timezone without DST
// from http://www.michaelapproved.com/articles/timezone-detect-and-ignore-daylight-saving-time-dst/
Date.prototype.getStdTimezoneOffset = function()
{
  var m = 12,
    d = new Date(null, m, 1),
    tzo = d.getTimezoneOffset();
    while (--m) {
      d.setUTCMonth(m);
      if (tzo != d.getTimezoneOffset()) {
        return Math.max(tzo, d.getTimezoneOffset());
    }
  }
  return tzo;
}
// Make getElementById() case-sensitive on IE
if (bw.ie)