// Функция замены элементов в строке
	function replaceString(strSource, strFind, strReplace, caseInsensitive){
		 if (caseInsensitive) re = "/" + strFind + "/g";
		 else re = "/" + strFind + "/gi";
		 return strSource.replace(eval(re), strReplace);
	}
// Расширение объекта Date() - добавление функции format
(function(p){
    with( p ){
        p.Y = getFullYear;
        p.M = function(){ return this.getMonth() + 1 };
        p.D = getDate;
        p.h = getHours;
        p.m = getMinutes;
        p.s = getSeconds;
        p.y = Y;
        p.format = function(f){
            var self = this
            return f.replace(/\%([YyMDhms])/g,
                function(a,k){
                    var str = '0' + self[k]()
                    return str.substring(str.length - (k == 'Y' ? 4 : 2))
                }
            )
        }
    }
})(Date.prototype)

	// Универсальная функция доступа к элементу DOM по di=name
	function getObjectBW(name) 
	{
		if(!name || name == null) return null;
		else if(document.getElementById) return document.getElementById(name);
		else if(document.all) return document.all[name];
		else return null;
	}
	function selectall(tbl_id, chk)	// Отметить/сбросить все поля таблицы tbl_id в значение chk
	{
		if (tbl_id==0)
			var fld = getObjectBW('index_tree').getElementsByTagName('input');
		else
		{
			var class_nm = 'fld_index'+tbl_id;
			var fld = getElementsByClassName(class_nm,'input');
		}
		var l=fld.length;
		for(var i=0; i<l; i++)
			fld[i].checked=chk;
		return;
	}