
function UrlEncode(str) {//标准UrlEncode
	window.execScript("function reHex(str)\
	reHex=hex(asc(str))\
	end function \r\n\
	function jsChr(str)\
	jsChr=Chr(str)\
	end function", "vbscript")

	String.prototype.UrlEncode = function() {
		glbEncode = {};
		return escape(this).replace(/%u(.{4})/g,
		function(a, b, c, d) {
		return reHex(String.fromCharCode(eval("0x" + b))).replace(/(.{2})(.{2})/, "%$1%$2")
		}).replace(/\+/g, "%2B").replace(/%20/g, "+");
	}
	return str.UrlEncode();
}

function urlEncode(str) {//JS版的Server.UrlEncode编码函数，所有字符全替换
String.prototype.urlEncode = function() {
	var str = this;
	str = str.replace(/./g,
	function(sHex) {
	window.EnCodeStr = "";
	window.sHex = sHex;
	window.execScript('window.EnCodeStr=Hex(Asc(window.sHex))', "vbscript");
	return window.EnCodeStr.replace(/../g, "%$&");
	});
	return str;
}
return str.urlEncode();
}
