function gebi(id) { return document.getElementById(id) }

function visYear(Year) {
	if (((Year % 4)==0) && ((Year % 100) != 0) || ((Year % 400)==0)) return (true);
		else return (false);
}

function getDaysInMonth(month, year) {
	var days;
	if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) days=31;
		else if (month==4 || month==6 || month==9 || month==11) days=30;
			else if (month==2) {
				if (visYear(year)) days=29;
				else days=28;
			}
	return(days);
}

function setToday() {
	var now=new Date();
	day=now.getDate();
	month=now.getMonth();
	year=now.getYear();
	if (year < 2000) year=year+1900;
	displayCalendar(day, month, year);
	nowdate=anamemonth[month]+" "+year;
	gebi("strdate").innerHTML=nowdate;
}

function setPrevMonth() {
	if (!(year==2007 && month==7)) {
		if (month == 0) {
			month=11;
			year--;
		} else month--;
		displayCalendar(50, month, year);
		nowdate=anamemonth[month]+" "+year;
		gebi("strdate").innerHTML=nowdate;
	}
}

function setNextMonth() {
	var now=new Date();
	nowmonth=now.getMonth();
	nowyear=now.getYear();
	if (nowyear < 2000) nowyear=nowyear+1900;
	if (year < nowyear || (year==nowyear && month < nowmonth)) { 
		if (month == 11) {
			month=0;
			year++;
		} else month++;
		displayCalendar(50, month, year);
		nowdate=anamemonth[month]+" "+year;
		gebi("strdate").innerHTML=nowdate;
	}
}

function test_search(formname) {
	if (formname.search.value=="") {
		alert('Заполните поле для поиска');
		return false;
	};
		return true;
}

function visibleform(param)
{
  if (document.getElementById("tabl"+param).style.visibility == "visible") {
      document.getElementById("tabl"+param).style.visibility = "hidden";
      document.getElementById("tabl"+param).style.display = "none";
  } else {
      document.getElementById("tabl"+param).style.visibility = "visible";
      document.getElementById("tabl"+param).style.display = "block";
  }
}

function test(frm) {
	if (gebi("nik").value == "") alert('Укажите свое имя или свой ник');
		else if (gebi("txtcomm").value == "") alert('Введите текст комментария');
			else if (gebi("code").value == "") alert('Введите код с картинки');
				else submit();
}

function showEl(el) {
	whichEl = document.getElementById("div" + el);
    if (whichEl) {
        if (whichEl.style.display != "block") whichEl.style.display = "block";
			else whichEl.style.display = "none";
    }
}
