numcat='';

function getRazdel(punct) {
	if(document.getElementById("cat"+punct).innerHTML==''){
		document.getElementById("cat"+punct).style.display='block';

		numcat=punct;
		document.getElementById("cat"+numcat).innerHTML ="<font color=red>Загрузка...</font>";
		req=false;
		try { // определить метод поддержки
			req=new ActiveXObject('Msxml2.XMLHTTP');
		} catch (e) {
			try {
				req=new ActiveXObject('Microsoft.XMLHTTP'); // сработает в Internet Explorer
			} catch (e) {
				if(window.XMLHttpRequest){ // сработает в Mozilla и Safari
					req=new XMLHttpRequest();
				}
			}
		}

		if (req){// если какой-то из вариантов поддерживается
			req.onreadystatechange = readystate; // назначим обработчик событию объекта
			req.open("GET", "/shop/pod.php?cat="+punct+"&rand="+Math.random()+"#"+punct, true); // задать параметры методу open
			req.send(null); // отправить запрос
			return false;
		}// иначе грузить новую страницу
	}else{
		document.getElementById("cat"+punct).innerHTML='';
		document.getElementById("cat"+punct).style.display='none';
		return false;
	}
}

function readystate() {
	arstatus = new Array();
	arstatus[0]='Объект не удалось инициализировать';
	arstatus[1]='Идет загрузка';
	arstatus[2]='Объект уже загружен';
	arstatus[3]='Загружен частично';
//	alert(req.readyState+'\n'+req.status+'\n'+req.responseText);
	if (req.readyState == 4){// если запрос завершен
		if (req.status == 200) { // если он завершен без ошибок
			//text=req.responseText.replace(/\|/ig, "\r\n<li><a href='?cat=");
			//alert(req.responseText);
			document.getElementById("cat"+numcat).innerHTML = req.responseText;
		} else {
			if (req.statusText==''){
				Textstatus=arstatus[req.status];
			}else{
				Textstatus=req.statusText;
			}
			alert("Произошла ошибка "+ req.status+":\n" + Textstatus);
		}
	}else{
		document.getElementById("cat"+numcat).innerHTML ="<font color=red>"+arstatus[req.readyState]+"</font>";
	}
	return false;
}

function hideconf(block){
	document.getElementById(block).style.visibility = 'hidden'
}
function showconf(block){
	document.getElementById(block).style.visibility = 'visible'
	return false;
}

