if (!String.prototype.format) // '11{aa}11111{bb}11111'.format({aa:'22',bb:'33'});
	String.prototype.format = function(args) {
		return this.replace(/\{(\w+)\}/gm, function(m, i) {
			return args[i];
		});
	}

if (!String.format) // String.format('11{0}11111{2}11111','22','33');
	String.format = function() {
		if (arguments.length == 0)
			return null;
		var str = arguments[0];
		var args = $(arguments).slice(1);
		for (var i = 1; i < arguments.length; i++) {
			var re = new RegExp('\\{(\\w+)\\}', 'gm');
			str = str.replace(re, function(m, k) {
				return args[k];
			});
		}
		return str;
	}
if (!String.prototype.escapeXml)
	String.prototype.escapeXml = function(/* boolean */noSingleQuotes) {
		// summary:
		// Adds escape sequences for special characters in XML: &<>"'
		// Optionally skips escapes for single quotes
		var str = this;
		str = str.replace(/&/gm, "&amp;").replace(/</gm, "&lt;").replace(/>/gm,
				"&gt;").replace(/"/gm, "&quot;");
		if (!noSingleQuotes) {
			str = str.replace(/'/gm, "&#39;");
		}
		return str; // string
	}

if (!String.prototype.unescapeXml)
	String.prototype.unescapeXml = function(/* boolean */noSingleQuotes) {
		var str = this;
		str = str.replace(/&amp;/gm, "&").replace(/&lt;/gm, "<").replace(
				/&gt;/gm, ">").replace(/&quot;/gm, '"');
		if (!noSingleQuotes) {
			str = str.replace(/&#39;/gm, "'");
		}
		return str; // string
	}
if (!String.prototype.endsWith){
  String.prototype.endsWith = function(pattern) {
    var d = this.length - pattern.length;
    return d >= 0 && this.lastIndexOf(pattern) == d;
  }
}
//http://www.cnblogs.com/index-html/archive/2013/04/23/js_multiline_const_string.html
//Multiple lines string in javascript.
//var lines = multiline( function(){/*
//line1,
//line2,
//*/});
function multiline(wrap) {
    return wrap.toString().match(/\/\*\s([\s\S]*)\s\*\//)[1];
}
  