(function() {
    function LispUtil() {

	this.sexp_escape = function(input_word) {
	    var escape_char = [{target: "\\+", after: "__plass__"}, {target: "-", after: "__minus__"},
			       {target: "=", after: "__equal__"}, {target: "#", after: "__sharp__"}];
	    for(var i=0,len=escape_char.length;i<len;i++) {
		after = escape_char[i].after;
		target = escape_char[i].target;
		rexp = new RegExp(target, "g");
		input_word = input_word.replace(rexp, after);
	    }
	    return input_word;
	};

	this.sexp_say_escape = function(input_word) {
	    input_word = input_word.escapeHTML();
	    escape_char = [{target: "\n", after: "</br>"}, {target: "<table>".escapeHTML(), after: "</table>"},
			   {target: "</table>".escapeHTML(), after: "</table>"}, {target: "<tr>".escapeHTML(), after: "<tr>"},
			   {target: "</tr>".escapeHTML(), after: "</tr>"}, {target: "</td>".escapeHTML(), after: "</td>"},
			   {target: "<td>".escapeHTML(), after: "<td>"}, {target: "<b>".escapeHTML(), after: "<b>"},
			   {target: "</b>".escapeHTML(), after: "</b>"}
			   ];
	    for(var i=0,len=escape_char.length;i<len;i++) {
		after = escape_char[i].after;
		target = escape_char[i].target;
		rexp = new RegExp(target, "g");
		input_word = input_word.replace(rexp, after);
	    }
	    return input_word;
	};

	this.isNullOrEmpty = function(input_word) {
	    if(input_word == null){
		return true;
	    }
	    if(typeof(input_word) == "string"){
		if(this.trim(input_word) == ""){
		    return true;
		}
	    }
	    return false;
	};

	this.trim = function(target) {
	    return target.replace(/^\s+|\s+$/g, '');
	};
    };
    var L = new LispUtil()
//    L.init();
    lsh["util"] = L;
})();

