

function html(text) 
{
    var enc = "";
    for(var pos=0; pos<text.length; pos++)
    {
        var c=text.charCodeAt(pos);
/*		if (c==60){
			enc += "&lt;";
		}
		else if (c==62) {
			enc += "&gt;";
		}
		else if (c==38) {
			enc += "&amp;";
		} */
		if(c == 13 || c==10) {
		    enc += "<br>"
		} else if ((c>=32 && c<128) || c == 12 || c == 17) {
			enc += text.charAt(pos);
		} else {
			enc += "&#"+c+";";
		}
    }
    return enc;
}

function invHtml(text) {
    return text.gsub("<br>",String.fromCharCode(10));
}
function textReduce2Number(text) {
	  var enc = "";
    for(var pos=0; pos<text.length; pos++)
    {
       		var c=text.charCodeAt(pos);
		if ((c>=48 && c<58)) {
			enc += text.charAt(pos);
		} 
    }
    return Number(enc);
}
