/**
 * Escapes all regex chars in a string.
 */
String.prototype.pregQuote = function() {
    return (this+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
}

/**
 * Case insensitive search and replace.
 */
String.prototype.iReplace = function(search, replace) {
    return this.replace(new RegExp(search.pregQuote(), "gi"), replace);
}
  
function parseJsonDate(jsonDate)
{
  return new Date(parseInt(jsonDate.substr(6))); 
}
