function chcalendar(part,ch)
 {
 var year  = document.getElementById("n_year").innerHTML;
 var month = document.getElementById("n_month").innerHTML;
 var req = new JsHttpRequest();
 req.onreadystatechange = function()
  {
  if (req.readyState == 4)
   {
   if (req.responseJS)
    {
    rez = req.responseJS.rez;
    document.getElementById("cry_calendar").innerHTML = rez;
    }
   }
  }
 req.caching = false; //true
 req.open('POST', '/inc/sub_ajax.php', true);
 req.send({ year: year, month: month, part: part, ch: ch});
 }
 
function getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
		if (yScroll > windowHeight)	windowWidth -= 16;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight) pageHeight = windowHeight;
	else pageHeight = yScroll;
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth) pageWidth = windowWidth;
	else pageWidth = xScroll;
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

var scrt;

function show_about_box() {
	var width = 472;
	var height = 373;
	var pagesize = getPageSize();
	var about_box = document.getElementById("about_box");
	if (typeof about_box != "undefined") {
		if (about_box.innerHTML == "") {
			var req = new JsHttpRequest();
			req.onreadystatechange = function() {
		 		if (req.readyState == 4) {
		 			if (req.responseJS) {
		 				document.getElementById("about_box").innerHTML = req.responseJS.rez;
			 	    }
			    }
			}
			req.caching = false; //true
			req.open('POST', '/inc/about_ajax.php', true);
			req.send({width: width});
		}	
		var overlay = document.getElementById("overlay");
		if (typeof overlay != "undefined") {
			overlay.style.display = "block";
			//overlay.style.zIndex = 9000;
			overlay.style.height = pagesize[1];
			overlay.onclick = function() {hide_about_box();}
		}
		about_box.style.zIndex = 10000;
		about_box.style.backgroundColor = "#FFFFFF";
		if (document.all) {
			about_box.style.position = "absolute";
			var body = document.getElementsByTagName("body");
			body[0].style.width = "100%";
			body[0].style.height = "100%";
			var html = document.getElementsByTagName("html");
			html[0].style.height = "100%";
			html[0].style.width = "100%";
			html[0].style.overflow = "hidden";
			//scrt = document.documentElement.scrollTop;
			//document.documentElement.scrollTop = 0;
		}
		else about_box.style.position = "fixed";
		about_box.style.width = width+"px";
		about_box.style.height = height+"px";
		about_box.style.left = ((pagesize[2] / 2) - (width / 2))+"px";
		if (document.all) about_box.style.top = document.documentElement.scrollTop + ((pagesize[3] / 2) - (height / 2))+"px";
		else about_box.style.top = ((pagesize[3] / 2) - (height / 2))+"px";
		about_box.style.display = "block";
	}
}

function hide_about_box() {
	var about_box = document.getElementById("about_box");
	if (typeof about_box != "undefined") {
		about_box.style.display = "none";
	}
	var overlay = document.getElementById("overlay");
	if (typeof overlay != "undefined") {
		overlay.style.display = "none";
		overlay.onclick = "";
	}
	if (document.all) {
		var body = document.getElementsByTagName("body");
		body[0].style.width = "auto";
		body[0].style.height = "auto";
		var html = document.getElementsByTagName("html");
		html[0].style.height = "auto";
		html[0].style.width = "auto";
		html[0].style.overflow = "";
		//document.documentElement.scrollTop = scrt;
	}
}