//+ Carlos R. L. Rodrigues
//@ http://jsfromhell.com/string/highlight [rev. #1]

String.prototype.highlight = function(f, c, i){
	var r = this, t = /([(){}|*+?.,^$\[\]\\])/g, i = !i ? "i" : "", rf = function(t, i){
		return r.lastIndexOf("<", i) > r.lastIndexOf(">", i) ? t : c(t, p);
	};
	for(var p = -1, l = (f = f instanceof Array ? f : [f]).length; ++p < l;)
		r = r.replace(new RegExp(f[p].replace(t, "\\\$1"), "gm" + i), rf);
	return r;
}