﻿if (String.prototype.urlToLink == null) {
	String.prototype.urlToLink = function() {
		var t = this;
		t = t.replace(/((www\.|(http|https|ftp|news|file)+\:\/\/)[&#95;.a-zA-Z0-9-]+\.[_a-zA-Z0-9\/&#95;:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])/g, '<a href=\"$1\" title=\"\" target=\"&#95;blank\">$1</a>');
		t = t.replace('href="www', 'href="http://www');
		//t = t.replace('">http://', '">');
		var txt = t;
		var poz = 0;
		var maxl = 25;
		var count = 0;
		while (txt.indexOf('>', poz) >= 0) {
			count++;
			if (count > 100) break;
			poz = txt.indexOf('>', poz) + 1;
			var i = txt.indexOf('</', poz);
			if (i <= poz || txt.indexOf('</a>', poz) != i) break;
			var ll = i - poz;
			if (ll <= maxl) {
				poz = i + 4;
				continue;
			}
			txt = txt.substring(0, poz + maxl) + '...' + txt.substring(i);
			poz = i + 4;
		}
		return txt;
	}
}
function ex_remove_index(array, from, to) {
	var rest = array.slice((to || from) + 1 || array.length);
	array.length = from < 0 ? array.length + from : from;
	return array.push.apply(array, rest);
};