﻿Function.prototype.inherits = function inherits(new_class, parent_class){
    var p = new parent_class();
    for (var i in p) {
        var bypass = false, j_obj;
        for (var j in new new_class()) {
            if (j.toString() == i.toString()) {bypass = true; j_obj = j; break;}
        }

        if (!bypass) {
            new_class.prototype[i.toString()] = eval("p." + i.toString());
        }//else new_class.prototype[j_obj.toString()] = eval("new new_class()." + j_obj.toString());
    }
};

String.prototype.trim = function trim(){
    var str = this.substring(0, this.length);
    var code = str.substring(0).charCodeAt();
	while(code==32 || code==10 || code==13){
		str = str.substring(1, str.length);
		code = str.substring(0).charCodeAt();
	}

	code = str.substring(str.length-1).charCodeAt();
	while(code==32 || code==10 || code==13){
		str = str.substring(0, str.length-1);
		code = str.substring(str.length-1).charCodeAt();
	}return str;
};