JavaLikeCalc.JavaScript
function testLev( v1, v2 ) {
	isSub = abs(v1) > 7 && abs(v2) > 7;
	v1_ = abs((!isSub && abs(v1) > 7) ? v1/10 : v1);
	v2_ = abs((!isSub && abs(v2) > 7) ? v2/10 : v2);
	return (v1_ >= v2_);
}

function getSrc( categ, sourceCache ) {
	srcO = categ.match("^al(.+):([^\\.]+)|^(.*):al");
	tVl = "";

	//From remote station
	if(srcO.length == 4)
		for(off2 = 0, isFirst = true; (tVl2=srcO[3].parse(0,":",off2)).length; tVl += (tVl.length?".":"")+tVl2, isFirst = false) {
			if(!isFirst)	continue;
			if(!sourceCache[tVl2].isEVal())	tVl2 = sourceCache[tVl2];
			else {
				req = SYS.XMLNode("get").setAttr("path","/Transport/%2fsub%2fehost").setAttr("upRiseSYS",1);
				SYS.cntrReq(req);
				for(iTr = 0; req.childSize() && iTr < req.childGet(0).childSize(); iTr++)
					if(req.childGet(0).childGet(iTr).text() == tVl2) {
						tVl2 = sourceCache[tVl2] = req.childGet(1).childGet(iTr).text();
						break;
					}
			}
		}

	return tVl;
}

if(f_start) {
	cnt = 0;
	toUpdate = makeReport = toMassQuitt = false;
	wTm = 0;							//From current time
	realPrTm = prTm = SYS.time() - 86400*size_value, prTmU = 0;		//From default set depth
	messItSep = ": ";
	als = new Array();			//Hierarchical alarms with the statuses
	cAls = new Object();		//Last alarms by the criteria
	alUnSel = 0;
	highLght_ = new Array();
	for(off = 0; (iH=highLght.parse(0,"\n",off)).length || off < highLght.length; ) {
		if(!iH.length || iH[0] == "#")	continue;
		iHo = new Object();
		if(iH.parse(0,":").length > 3)
			iHo.lev = iH.slice(0,2).toInt(), iHo.quiet = iH.slice(2,3).toInt()?1:0, iHo.act = iH.slice(3,4).toInt()?1:0;
		else iHo.lev = iH.slice(0,1).toInt(), iHo.quiet = iH.slice(1,2).toInt()?1:0, iHo.act = iH.slice(2,3).toInt()?1:0;
		iHo.color = iH.parse(1,":"); iHo.font = iH.parse(2,":"); iHo.fontColor = iH.parse(3,":");
		highLght_.push(iHo);
	}
	colVars = new Array();
	//Filters curent state proceed
	fMax = 5;
	fTopOrig = fTop = this["fltr0"].attr("geomY") + this["fltr0"].attr("geomH");
	for(iF = fMax-1; iF > 0 && !this["fltr"+iF].attr("en"); iF--) ;
	fTop = this["fltr"+iF].attr("geomY") + this["fltr"+iF].attr("geomH");

	sourceCache = new Object();

	user = user_ = "";
}

//Permitions load
user = this.ownerSess().user();
if(f_start || user != user_) {
	user_ = user;
	permLoc = EVAL, permLev = 0;
	if(user != "root") {
		permLoc = new Array();
		permLev = 10;
		gList = SYS.Security["usr_"+user].groups();
		for(iG = 0; iG < gList.length; iG++) {
			if(gList[iG] == "root") { permLoc = EVAL; break; }
			gDescr = SYS.Security["grp_"+gList[iG]].cfg("LONGDESCR");
			for(iLc = 0; iLc < 10; iLc++) {
				if(permLoc[iLc].isEVal())	permLoc[iLc] = new Object();
				if((itLc=gDescr.match("^loc"+iLc+"=(.+?)$","m")).length)
					for(off = 0; (tVl=itLc[1].parse(0,";",off)).length; )
						permLoc[iLc][tVl] = true;
			}
			if((itLev=gDescr.match("^lev=(.+?)$","m")).length)	permLev = min(permLev, itLev[1].toInt());
		}
		if(permLev == 10)	permLev = 0;
	}

	//To reload
	realPrTm = prTm = (wTm?wTm:SYS.time()) - 86400*size_value, prTmU = 0;
	als = new Array(); cAls = new Object();
	toUpdate = true;
}

if(this.alarms.attr("focus"))	alUnSel = 10;	//Wait for 10 seconds
else if(alUnSel > 0 && (alUnSel=max(0,alUnSel-1/f_frq)) <= 0) {
	alarms_value = "";
	if(this.wdgAt("/s/pg_control/pg_ElCadr",true).attr("prmShifr") == alarms_NAME)
		this.wdgAt("/s/pg_control/pg_terminator",true).attrSet("pgOpen", true);
}
if(alarms_com) { event += "usr_qtc:/alarms\n"; alarms_st_open = true; }

//Call per 1 seconds, start or force update
if((((cnt++)%(f_frq*1) == 0 && !wTm) || f_start || toUpdate) && !f_stop) {
	alMess = SYS.Archive.messGet(realPrTm, (wTm?wTm:SYS.time()), messCat, 1, alArch);

	for(iM = 0, iRecv = 0, iAppend = 0; iM < alMess.length && iAppend < messLim; iM++) {
		iMo = alMess[iM];
		if(iMo.tm < prTm || (iMo.tm == prTm && iMo.utm <= prTmU) || abs(iMo.level) < permLev) continue;
		// Check for permited location
		if(!permLoc.isEVal() && (sVl=iMo.mess.parse(1,messItSep).match("\\[\\[(.+)\\]\\]")).length) {
			for(off = 0, iLc = 0; (sVl2=sVl[1].parse(0,"=>",off)).length; iLc++)
				if(!(permLoc[iLc]["*"] == true || permLoc[iLc][sVl2] == true))	break;
			if(sVl2.length)	continue;
		}

		if(iMo.level < 0) {	//Alarm message
			iMoA = cAls[iMo.categ];
			// !!!! To prevent the duplicate entries for new alarms in that category.
			if(!iMoA.isEVal() && iMoA.categ == iMo.categ && iMoA.tm == iMo.tm && iMoA.utm == iMo.utm) continue;
			if(!iMoA.isEVal() && !iMoA.mess.parse(4,messItSep).length) {	//Renewal state set for not marked as NORMAL
				iMoA.mess = iMoA.mess.parse(0,messItSep)+messItSep+iMoA.mess.parse(1,messItSep)+messItSep+iMoA.mess.parse(2,messItSep)+messItSep+iMoA.mess.parse(3,messItSep)+messItSep+
						tr("Renewal")+messItSep+iMoA.mess.parse(5,messItSep);
				/*if(iMoA.mess.parse(3,messItSep).length && !iMo.mess.parse(3,messItSep).length)	//Inherit the quietance fact from the previous
					iMo.mess = iMo.mess.parse(0,messItSep)+messItSep+iMo.mess.parse(1,messItSep)+messItSep+iMo.mess.parse(2,messItSep)+messItSep+iMoA.mess.parse(3,messItSep)+messItSep+
						iMo.mess.parse(4,messItSep)+messItSep+iMo.mess.parse(5,messItSep);
				if(iMoA.mess.parse(5,messItSep).length && !iMo.mess.parse(5,messItSep).length)	//Inherit the comment from the previous
					iMo.mess = iMo.mess.parse(0,messItSep)+messItSep+iMo.mess.parse(1,messItSep)+messItSep+iMo.mess.parse(2,messItSep)+messItSep+iMo.mess.parse(3,messItSep)+messItSep+
						iMo.mess.parse(4,messItSep)+messItSep+iMoA.mess.parse(5,messItSep);*/
			}
			cAls[iMo.categ] = iMo;
			iMo.lsPos = als.length;
			als.push(iMo);
			iAppend++;
		}
		else if(!(iMoA=cAls[iMo.categ]).isEVal()) {	//Norma or quietance
			/*if(iMo.mess.parse(2,messItSep).match("\\s*(.+?)\\s*$")[1] == tr("QUITANCE")) {
				if(!iMoA.mess.parse(3,messItSep).length)	//Fill for missed
					iMoA.mess = iMoA.mess.parse(0,messItSep)+messItSep+iMoA.mess.parse(1,messItSep)+messItSep+iMoA.mess.parse(2,messItSep)+messItSep+
						SYS.strftime(iMo.tm,formDtTm.replace("%MS",(iMo.utm/1000).toString(10,3)).replace("%US",iMo.utm.toString(10,6)))+messItSep+
						iMoA.mess.parse(4,messItSep)+messItSep+iMoA.mess.parse(5,messItSep);
			}
			else*/
			if(!(tVl=iMoA.mess.parse(4,messItSep)).length || tVl == tr("Norm on down"))	//Fill for missed
				iMoA.mess = iMoA.mess.parse(0,messItSep)+messItSep+iMoA.mess.parse(1,messItSep)+messItSep+iMoA.mess.parse(2,messItSep)+messItSep+iMoA.mess.parse(3,messItSep)+messItSep+
						SYS.strftime(iMo.tm,formDtTm.replace("%MS",(iMo.utm/1000).toString(10,3)).replace("%US",iMo.utm.toString(10,6)))+messItSep+
						iMoA.mess.parse(5,messItSep);
		}
		iRecv++;
		prTm = iMo.tm; prTmU = iMo.utm;
	}
	if(iM < alMess.length && iAppend >= messLim)	{ sizeLim_text = ((alMess.tm-alMess[iM-1].tm)/86400).toFixed(3); go_prev_sizeLim_en = true; }
	else if(wTm || (SYS.time()-realPrTm) > 3600) { sizeLim_text = ""; go_prev_sizeLim_en = false; }
	realPrTm = alMess.tm;
	//Active alarms get for the gone on down ones detect
	if(!wTm) {
		actAlMess = SYS.Archive.messGet(0, SYS.time(), messCat, -1);
		actAls = new Object();
		for(iM = 0; iM < actAlMess.length; iM++) {
			iMo = actAlMess[iM];
			if(abs(iMo.level) < permLev) continue;
			// Check for permited location
			if(!permLoc.isEVal() && (sVl=iMo.mess.parse(1,messItSep).match("\\[\\[(.+)\\]\\]")).length) {
				for(off = 0, iLc = 0; (sVl2=sVl[1].parse(0,"=>",off)).length; iLc++)
					if(!(permLoc[iLc]["*"] == true || permLoc[iLc][sVl2] == true))	break;
				if(sVl2.length)	continue;
			}

			actAls[iMo.categ] = iMo;
		}
		//Detect and mark "Norm on down"
		for(var iA in cAls)
			if(!(iMo=cAls[iA]).mess.parse(4,messItSep).length && !actAls[iMo.categ])
				iMo.mess = iMo.mess.parse(0,messItSep)+messItSep+iMo.mess.parse(1,messItSep)+messItSep+iMo.mess.parse(2,messItSep)+messItSep+iMo.mess.parse(3,messItSep)+messItSep+
						tr("Norm on down")+messItSep+iMo.mess.parse(5,messItSep);
		//Force placing the active alarms to the list
		for(var iA in actAls) {
			iMo = cAls[iA]; iMo1 = actAls[iA];
			if(iMo.isEVal() /*|| iMo1.tm > iMo.tm || (iMo1.tm == iMo.tm && iMo1.utm > iMo.utm)*/)
			{ als.push(iMo1); cAls[iA] = iMo1; iRecv = true; }
		}
	}

	if(iRecv || toUpdate) {
		//Sort the messages
		sortAr = new Array();
		sR = sort_value.match("\\((.+)\\)")[1];
		//this.messInfo("TEST 00: sR="+sR);		
		for(iM = 0; iM < als.length; iM++) {
			iMo = als[iM];
			tvl = iM.toString(10,6);
			if((sR_=sR.parse(0,":")) == "atm")	tvl = SYS.strftime(iMo.tm,formDtTm.replace("%MS",(iMo.utm/1000).toString(10,3)).replace("%US",iMo.utm.toString(10,6)));
			else if(sR_ == "qttm")	tvl = iMo.mess.parse(3, messItSep);
			else if(sR_ == "nrmtm")tvl = iMo.mess.parse(4, messItSep);
			else if(sR_ == "lev")	tvl = iMo.level;
			else if(sR_ == "type")	tvl = types.parse(abs(iMo.level), ";");
			else if(sR_ == "cat")	tvl = iMo.categ;
			else if(sR_ == "mess")	tvl = iMo.mess;
			else if(sR_ == "prm")	{
				tvl = iMo.mess.parse(0, messItSep);
				if((tvl2=getSrc(iMo.categ,sourceCache)).length)	tvl = tvl2 + " > " + tvl;
			}
			else if(sR_ == "dscr")	tvl = iMo.mess.parse(1, messItSep).replace(new RegExp("\\[\\[.+\\]\\]"),"");
			else if(sR_ == "alrm")	tvl = iMo.mess.parse(2, messItSep);
			else if(sR_ == "cmnt")	tvl = iMo.mess.parse(5, messItSep);
			//else if(sR_ == "src")	tvl = getSrc(iMo.categ, sourceCache);
			else if(sR_.slice(0,8) == "dscrCust")
				tvl = (tvl=iMo.mess.parse(1,messItSep).match("\\[\\[(.+)\\]\\]")).length ? tvl[1].parse(sR_.slice(8).toInt(),"=>") : "";
			sortAr.push(">"+tvl+"\n"+iM);
		}
		sortAr = sortAr.sort();
		if(sR.isEVal() || sR.parse(1,":") == "!")	sortAr = sortAr.reverse();
		sort_items = tr("Disable");

		for(iF = 0; iF < fMax; iF++) this["fltrCol"+iF].attrSet("items", tr("Disable"));

		//The table content update
		alarms_items = "<tbl sel='row' sortEn='1' colsWdthFit='1' hHdrVis='"+(hHdrVis?1:0)+"' vHdrVis='"+(vHdrVis?1:0)+"'>\n";
		alarms_items += "<h><s width='0px'>ID</s>";
		if(makeReport) rep = "<body>\n"
			"<h1>"+tr("Alarms report for")+" "+SYS.strftime(wTm?wTm:SYS.time())+"</h1>\n"
			"<table class='data' width='100%' export='1'><tr>\n";
		for(vC = "", off = 0; (vC=colms.parse(0,",",off)).length; ) {
			tvl = ""; toEdit = false;
			if(vC == "atm")			tvl = tr("Alarm time");
			else if(vC == "qttm")	tvl = tr("Quietance time");
			else if(vC == "nrmtm")	{ tvl = tr("Norm"); colVars[vC] = new Object(); }
			else if(vC == "lev")	tvl = tr("Lev.");
			else if(vC == "type")	tvl = tr("Type");
			else if(vC == "cat")	tvl = tr("Category");
			else if(vC == "mess")	tvl = tr("Message");
			else if(vC == "prm")	tvl = tr("Source");
			else if(vC == "dscr")	tvl = tr("Description");
			else if(vC == "alrm")	tvl = tr("Alarm");
			else if(vC == "cmnt")	tvl = tr("Comment"), toEdit = true;
			//else if(vC == "src")	tvl = tr("Source");
			else if(vC.slice(0,8) == "dscrCust") {
				nCust = vC.slice(8).toInt();
				tvl = (tVl=colDscrCustNames.parse(nCust,";")).length ? tVl : tr("Custom")+" "+nCust;
				colVars[vC] = new Object();
			}
			if(tvl.length) {
				alarms_items += "<s"+(toEdit?" edit='1'":"")+((vC=="atm")?" sort='1'":"")+">"+tvl+"</s>";
				if(makeReport) rep += "<th>"+tvl+"</th>";
				sort_items += "\n"+tvl+" ("+vC+")\n"+tvl+", "+tr("reversed")+" ("+vC+":!)";
				for(iF = 0; iF < fMax; iF++)
					this["fltrCol"+iF].attrSet("items", this["fltrCol"+iF].attr("items")+"\n"+tvl+" ("+vC+")");
			}
		}
		alarms_items += "</h>\n";
		if(makeReport) rep += "</tr>\n";
		for(iSM = 0; iSM < sortAr.length; iSM++) {
			iM = als[iMid=sortAr[iSM].parse(1,"\n").toInt()];
			//Check for higlight properties match
			for(iHgl = false, iH = 0; iH < highLght_.length && !iHgl; iH++) {
				iHo = highLght_[iH];
				if(testLev(iM.level,iHo.lev) && (iM.mess.parse(3,messItSep).length?1:0) == iHo.quiet &&
																 ((wTm||iM.mess.parse(4,messItSep).length)?0:1) == iHo.act)
					iHgl = iHo;
			}
			aRow = "<r"+(iHgl?" color='"+iHgl.color+"' font='"+iHgl.font+"' colorText='"+iHgl.fontColor+"'":"")+"><i>"+iMid+"</i>";
			if(makeReport) repRow = "<tr>\n";
			for(vC = "", off = 0, isMatch = true; isMatch && (vC=colms.parse(0,",",off)).length; ) {
				if(vC == "atm")			{ sVl = SYS.strftime(iM.tm,formDtTm.replace("%MS",(iM.utm/1000).toString(10,3)).replace("%US",iM.utm.toString(10,6))); aRow += "<s>"+sVl+"</s>"; }
				else if(vC == "qttm")	{ sVl = iM.mess.parse(3, messItSep); aRow += (sVl.length ? "<s>"+sVl+"</s>" : "<b edit='1'>0</b>"); }
				else if(vC == "nrmtm")	{
					if(!(sVl=iM.mess.parse(4,messItSep)).length && !wTm) sVl = tr("Active");
					aRow += "<s align='center'>"+sVl+"</s>";
					if(!sVl.toInt()) colVars[vC][sVl] = true;
				}
				else if(vC == "lev")	{ sVl = abs(iM.level).toString(); aRow += "<s align='center'>"+sVl+"</s>"; }
				else if(vC == "type")	{ sVl = types.parse(abs(iM.level), ";"); aRow += "<s align='center'>"+sVl+"</s>"; }
				else if(vC == "cat")	{ sVl = iM.categ; aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>"; }
				else if(vC == "mess")	{ sVl = iM.mess; aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>"; }
				else if(vC == "prm")	{
					sVl = iM.mess.parse(0, messItSep);
					if((tvl2=getSrc(iM.categ, sourceCache)).length)	sVl = tvl2 + " > " + sVl;
					aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>";
				}
				else if(vC == "dscr")	{ sVl = iM.mess.parse(1, messItSep).replace(new RegExp("\\[\\[.+\\]\\]"),""); aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>"; }
				else if(vC == "alrm")	{ sVl = iM.mess.parse(2, messItSep); aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>"; }
				else if(vC == "cmnt")	{ sVl = iM.mess.parse(5, messItSep); aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>"; }
				//else if(vC == "src")	{ sVl = getSrc(iM.categ, sourceCache); aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>"; }
				else if(vC.slice(0,8) == "dscrCust") {
					nCust = vC.slice(8).toInt();
					sVl = (sVl=iM.mess.parse(1,messItSep).match("\\[\\[(.+)\\]\\]")).length ? sVl[1].parse(nCust,"=>") : "";
					aRow += "<s>"+SYS.strEncode(sVl,"HTML")+"</s>";
					colVars[vC][sVl] = true;
				}
				for(iF = 0; iF < fMax; iF++)
					if(vC == this["fltrCol"+iF].attr("value").match("\\((.+)\\)")[1] && (tVl=this["fltr"+iF].attr("value")).length) {
							if(vC == "lev")	isMatch = (sVl.toInt() >= tVl.toInt());
							else if(vC == "nrmtm" || vC.slice(0,8) == "dscrCust")	isMatch = (sVl.match(tVl).length > 0);
							else isMatch = (sVl.indexOf(tVl) >= 0);
					}
				if(makeReport) repRow += "<td>"+SYS.strEncode(sVl,"HTML")+"</td>";
			}
			if(isMatch) {
				alarms_items += aRow + "</r>\n";
				if(makeReport) rep += repRow + "</tr>\n";
				if(toMassQuitt && !iM.mess.parse(3,messItSep).length) {
					SYS.messNote("OP:"+this.ownerSess().user()+":"+iM.mess.parse(0,messItSep),
						"'"+iM.mess.parse(0,messItSep)+"'. "+tr("Command")+" : "+iM.mess.parse(1, messItSep) + " -> " + iM.mess.parse(2, messItSep)+" : : "+alarms_digComs.parse(0,";").parse(0,"-"));
					tmU = 0;
					tMess = iM.mess.parse(0,messItSep)+messItSep+iM.mess.parse(1,messItSep)+messItSep+iM.mess.parse(2,messItSep)+messItSep+
						SYS.strftime(SYS.time(tmU),formDtTm.replace("%MS",(tmU/1000).toString(10,3)).replace("%US",tmU.toString(10,6)));
					if((tVl1=iM.mess.parse(4,messItSep)).length || (tVl2=iM.mess.parse(5,messItSep)).length) {
						tMess += messItSep+tVl1;
						if((tVl2=iM.mess.parse(5,messItSep)).length) tMess += messItSep+tVl2;
					}
					iM.mess = tMess;
					isCurAct = ((iAo=actAls[iM.categ]) && iAo.tm == iM.tm && iAo.utm == iM.utm);
					SYS.Archive.messPut(iM.tm, iM.utm, iM.categ, iM.level, iM.mess, isCurAct?"":alArch);
				}
			}
		}
		alarms_items += "</tbl>";
		if(makeReport) { rep += "</table>\n</body>\n"; go_report_report = rep; }

		//Filter's selection list update
		for(iF = 0; iF < fMax; iF++) {
			iFCo = this["fltrCol"+iF]; iFo = this["fltr"+iF];
			fCol = iFCo.attr("value").match("\\((.+)\\)")[1];
			fCfg = "";
			if(colVars[fCol]) {
				fCfgPref = iFo.attr("value");
				for(sumVl = "", tVl1 = "", off = 0; (tVl=fCfgPref.parse(0,"|",off)).length; tVl1 = tVl)
					if(tVl1.length) { sumVl += (sumVl.length?"|":"")+tVl1; fCfg += sumVl + "\n"; }
				custColO = colVars[fCol];
				for(var iFv in custColO)
					if(iFv.length && fCfgPref.indexOf(iFv) < 0) fCfg += (fCfgPref.length?fCfgPref+"|":"") + iFv + "\n";
			}
			iFo.attrSet("cfg", fCfg);
		}
	}
	toUpdate = makeReport = false;
}

if(toMassQuitt) { toMassQuitt = false; toUpdate = true; }

//Events process
for(off = 0; (sval=event.parse(0,"\n",off)).length; ) {
	//this.messInfo("TEST 01: Event="+sval+" : "+alarms_value);
	isFirst = isSec = false;
	if(sval == "ws_FocusIn:/alarms") {
		alarms_geomY = fTopOrig; alarms_geomH += fTop-fTopOrig;
		if(alarms_value.length) event += "usr_goquiet:/alarms\n";
	}
	else if(sval == "ws_FocusOut:/alarms")	{ alarms_geomY = fTop; alarms_geomH -= fTop-fTopOrig; }
	else if(( (sval == "usr_qtc:/alarms" && (iM=als[alarms_value])) ||
					(sval.slice(0,12) == "ws_TableEdit" && colms.parse(sval.parse(2,"_").toInt()-1,",") == "qttm" && (iM=als[sortAr[sval.parse(3,"_").toInt()].parse(1,"\n").toInt()])) )
			&& !iM.mess.parse(3,messItSep).length)
	{
		//this.messInfo("TEST 02: value="+alarms_value+"; set="+alarms_set);
		if(!alarms_com) SYS.messNote("OP:"+this.ownerSess().user()+":"+alarms_NAME, "'"+alarms_NAME+"'. "+tr("Command")+" : "+alarms_DESCR+" : : "+alarms_digComs.parse(0,";").parse(0,"-"));
		tmU = 0;
		tMess = iM.mess.parse(0,messItSep)+messItSep+iM.mess.parse(1,messItSep)+messItSep+iM.mess.parse(2,messItSep)+messItSep+
					SYS.strftime(SYS.time(tmU),formDtTm.replace("%MS",(tmU/1000).toString(10,3)).replace("%US",tmU.toString(10,6)));
		if((tVl1=iM.mess.parse(4,messItSep)).length || (tVl2=iM.mess.parse(5,messItSep)).length) {
			tMess += messItSep+tVl1;
			if((tVl2=iM.mess.parse(5,messItSep)).length) tMess += messItSep+tVl2;
		}
		iM.mess = tMess;
		isCurAct = ((iAo=actAls[iM.categ]) && iAo.tm == iM.tm && iAo.utm == iM.utm);
		SYS.Archive.messPut(iM.tm, iM.utm, iM.categ, iM.level, iM.mess, isCurAct?"":alArch);
		toUpdate = true;
		alarms_com = false;
	}
	else if(sval == "ws_BtPress:/quietMass")	toMassQuitt = toUpdate = true;
	else if(sval == "ws_TableChangeSel:/alarms") {
		iM = als[alarms_value];
		alarms_NAME = iM.mess.parse(0, messItSep);
		alarms_DESCR = iM.mess.parse(1, messItSep) + " -> " + iM.mess.parse(2, messItSep);
		alarms_st_open = iM.mess.parse(3, messItSep).length;
		if(alarms_value.length) event += "usr_goquiet:/alarms\n";
	}
	else if(sval.slice(0,12) == "ws_TableEdit" && colms.parse(sval.parse(2,"_").toInt()-1,",") == "cmnt") {
		iM = als[sortAr[sval.parse(3,"_").toInt()].parse(1,"\n").toInt()];
		//this.messInfo("TEST 03: value="+alarms_value+"; set="+alarms_set);
		iM.mess = iM.mess.parse(0,messItSep)+messItSep+iM.mess.parse(1,messItSep)+messItSep+iM.mess.parse(2,messItSep)+messItSep+
						iM.mess.parse(3,messItSep)+messItSep+iM.mess.parse(4,messItSep)+messItSep+alarms_set;
		isCurAct = ((iAo=actAls[iM.categ]) && iAo.tm == iM.tm && iAo.utm == iM.utm);
		SYS.Archive.messPut(iM.tm, iM.utm, iM.categ, iM.level, iM.mess, isCurAct?"":alArch);
	}
	else if(sval == "ws_CombChange:/sort")	toUpdate = true;
	else if(sval.slice(0,22) == "ws_CombChange:/fltrCol") {
		fN = sval.slice(22).toInt();
		fAct = !this["fltrCol"+fN].attr("value").match("\\((.+)\\)")[1].isEVal();
		this["fltr"+fN].attrSet("active", fAct).attrSet("value", "");
		if(fAct && (fN+1) < fMax && !this["fltrCol"+(fN+1)].attr("en")) {
			this["fltrCol"+(fN+1)].attrSet("en", true);
			this["fltr"+(fN+1)].attrSet("en", true).attrSet("active", false).attrSet("value", "");
		}
		else for(iF = fMax-1; !fAct && iF >= fN; iF--)
			if(iF < (fMax-1)) {
				this["fltrCol"+(iF+1)].attrSet("en", false).attrSet("value", tr("Disable"));
				this["fltr"+(iF+1)].attrSet("en", false).attrSet("active", false).attrSet("value", "");
			}
		//Apply filter vertical offset and size
		for(iF = fMax-1; iF > 0 && !this["fltr"+iF].attr("en"); iF--) ;
		fTop_ = this["fltr"+iF].attr("geomY") + this["fltr"+iF].attr("geomH");
		alarms_geomH += fTop-fTop_; fTop = fTop_; alarms_geomY = fTop;

		toUpdate = true;
	}
	else if(sval.slice(0,17) == "ws_LnAccept:/fltr")	toUpdate = true;
	else if((isFirst=(sval=="ws_LnAccept:/size")) || (isSec=(sval=="ws_LnAccept:/time")) || sval == "ws_BtPress:/go_cur") {
		if(!isFirst)	{
			wTm = isSec ? time_value : 0;
			if(wTm >= SYS.time()) wTm = 0;
		}
		realPrTm = prTm = (wTm?wTm:SYS.time()) - 86400*size_value, prTmU = 0;
		als = new Array(); cAls = new Object();
		toUpdate = true;
	}
	else if((isFirst=(sval=="ws_BtPress:/go_prev")) || (isSec=(sval=="ws_BtPress:/go_prev_sizeLim")) || sval == "ws_BtPress:/go_prev1") {
		wTm = max(0, (wTm?wTm:SYS.time())-86400*(isSec?sizeLim_text.toReal():size_value)*((isFirst||isSec)?1:5));
		realPrTm = prTm = wTm - 86400*size_value, prTmU = 0;
		als = new Array(); cAls = new Object();
		toUpdate = true;
	}
	else if((isFirst=(sval=="ws_BtPress:/go_next")) || sval == "ws_BtPress:/go_next1") {
		if((wTm=(wTm?wTm:SYS.time()) + 86400*size_value*(isFirst?1:5)) >= SYS.time()) wTm = 0;
		realPrTm = prTm = (wTm?wTm:SYS.time()) - 86400*size_value, prTmU = 0;
		als = new Array(); cAls = new Object();
		toUpdate = true;
	}
	else if(sval == "ws_BtPress:/go_report")				toUpdate = makeReport = true;
}

time_value = wTm ? wTm : SYS.time();
//go_cur_active = wTm;