setMarginMenu = function() {
	var mm = $('mainMenu');
	var lis = mm.getElementsByTagName('li');
	var wid = 0;
	for(i=0; i<lis.length; i++) wid += lis[i].offsetWidth;
	if(970 > wid) mm.style.marginLeft = ((970-wid)/2) + 'px';
}
showMonth = function(yy,y,m) {
	if(y > yy || y < 2000) return false;
	new Ajax.Updater('calendar', '/calendar.php', {
		method: 'post',
	  parameters: { year: y, month: m }
	});
}
checkField = function(th, idErr, min, err, reg, trm, thrw) {
	if(trm) th.value = th.value.strip();

	if(th.value.length < min || (reg != null && !th.value.match(reg))) {
		upd($(idErr), err);
		th.className = 'err';
		if(thrw === true) throw 'ERR';
	}
	else {
		rmChld($(idErr));
		th.className = '';
	}
}

rmChld = function(th)		{	while(th.firstChild != null) th.removeChild(th.firstChild);	}
upd = function(th, msg) {	if(th.firstChild == null) th.appendChild(document.createTextNode(msg));	}