function HTMLEncode(str)
{
	var s = "";
	if(str.length == 0)
		return "";
	s = str.replace(/&/g, "&amp;");
	s = s.replace(/</g, "&lt;");
	s = s.replace(/>/g, "&gt;");
	s = s.replace(/ /g, "&nbsp;");
	s = s.replace(/\'/g, "&#39;");
	s = s.replace(/\"/g, "&quot;");
	s = s.replace(/\r/g, "");
	s = s.replace(/\n/g, "<br>");
	return s;
}

function URLEncode(strInput)
{
	strTmp = encodeURI(strInput);
	strTmp = strTmp.replace(/\ /g, '+');
	strTmp = strTmp.replace(/\@/g, '%40');
	strTmp = strTmp.replace(/\#/g, '%23');
	strTmp = strTmp.replace(/\$/g, '%24');
	strTmp = strTmp.replace(/\&/g, '%26');
	strTmp = strTmp.replace(/\+/g, '%2B');
	strTmp = strTmp.replace(/\=/g, '%3D');
	strTmp = strTmp.replace(/\;/g, '%3B');
	strTmp = strTmp.replace(/\:/g, '%3A');
	strTmp = strTmp.replace(/\//g, '%2F');
	strTmp = strTmp.replace(/\?/g, '%3F');
	strTmp = strTmp.replace(/\,/g, '%2C');
	return strTmp;
}
