JavaLikeCalc.JavaScript
if(f_start) {
	selDay = selMonth = selYear = selWDay = isDst = 0;	//Selected data parts
	maxDayInMonth = 30;			//Maximum days into selected month
	selTime = SYS.time();		//Selected time, ordered to days
	prevTime = 0;					//Previous time for detect time selection change
	cntr = 0;						//Global counter for update period limit for some parts
}

//Years list update
if(f_start || (cntr%(f_frq*3600*24)) == 0)	{	//By day
	curYear = 0;
	SYS.localtime(SYS.time(), 0, 0, 0, 0, 0, curYear);
	year_items = "";
	for(i_y = 0; i_y < 10; i_y++)	year_items += (i_y?"\n":"")+(curYear-i_y);
}

//Events process
for(ev_rez = "", off = 0; (ev_cur=event.parse(0,"\n",off)).length; ) {
	//SYS.messInfo("MnCntr","Event: "+ev_cur);
	if(ev_cur == "ws_BtPress:/curDay")	selTime = SYS.time();
	else if(ev_cur == "ws_CombChange:/year")
		selTime = SYS.mktime(0, 0, 0, selDay, selMonth, year_value, 0, 0, isDst);
	else if(ev_cur == "ws_CombChange:/month")
		selTime = SYS.mktime(0, 0, 0, selDay, (month_value.match("\\((\\d+)\\)","")[1].toInt()-1), selYear, 0, 0, isDst);
	else if(ev_cur.indexOf("key_mousePresLeft:/w") == 0) {
		weekWdg = this.wdgAt(ev_cur.slice(19));
		if(weekWdg.attr("text").length)
			selTime = SYS.mktime(0, 0, 0, weekWdg.attr("text"), selMonth, selYear, 0, 0, isDst);
	}
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

if(selTime != prevTime) {
	selTime = min(selTime, SYS.time());
	SYS.localtime(selTime, 0, 0, 0, selDay, selMonth, selYear, 0, 0, isDst);
	selTime = SYS.mktime(0, 0, 0, selDay, selMonth, selYear, 0, 0, isDst);
	selWDay = 0;
	selTimeMonth = SYS.mktime(0, 0, 0, 1, selMonth, selYear, selWDay, 0, isDst);
	title_arg0val = SYS.strftime(selTime, "%d.%m.%Y");

	year_value = selYear;
	month_value = month_items.match("([^\n]*\\("+(selMonth+1)+"\\))","m")[0];

	//Days number into selected month
	tMonth = selMonth, tYear = selYear, tisDst = isDst;
	for(maxDayInMonth = 29; true; maxDayInMonth++) {
		tDayInMonth = maxDayInMonth;
		SYS.mktime(0, 0, 0, tDayInMonth, tMonth, tYear, 0, 0, tisDst);
		if(tDayInMonth != maxDayInMonth)	{ maxDayInMonth--; break; }
		if(maxDayInMonth >= 31)	break;
	}

	//Week box update
	for(i_w = 0, i_d = 1; i_w < 6; i_w++)
		for(i_wd = 0; i_wd < 7; i_wd++)
			if((i_w == 0 && i_wd < (((tVl=selWDay-1)<0)?7+tVl:tVl)) || i_d > maxDayInMonth)	//Clear cell
				this.wdgAt("w"+i_w+"_"+i_wd).attrSet("text","").attrSet("bordWidth","0").attrSet("backColor","");
			else {
				this.wdgAt("w"+i_w+"_"+i_wd).attrSet("text",i_d).attrSet("bordWidth","0").attrSet("backColor","lightgray-1");
				if(i_d == selDay)						//Selected day
					this.wdgAt("w"+i_w+"_"+i_wd).attrSet("text",i_d).attrSet("bordWidth","1").attrSet("backColor","lightgreen");
				i_d++;
			}
	prevTime = selTime;
}

cntr++;