	
		var xmlHttp;

	try {
		xmlHttp=new XMLHttpRequest();


	}
	catch(e) {
		var XmlHttpVersions=new Array('MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
		
		for(var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) {
			try {
				xmlHttp = new ActiveXObject(XmlHttpVersions[i]);

			
			}
			catch(e) {}
		}
	}

	if(!xmlHttp) alert("Ошибка создания объекта XMLHttpRequest.");
	
	
	//Проверяем правильность введенного кода
function ochko() {
	
//	alert(entry.value);
	
	var gaga=document.getElementById('intext').value;
	
	zapros="fuck="+gaga;
	
	if(xmlHttp) {	

		if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		xmlHttp.open("POST", "ok_code.php", true);
		xmlHttp.onreadystatechange=handleServerResponse37;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(zapros);	
	}
	else setTimeout('ochko()', 1000);
			}
}
function handleServerResponse37() {
if(xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			response = xmlHttp.responseText;
			
		document.getElementById('outcode').value=response;

	}
		else setTimeout('handleServerResponse37()', 500);
	}
}


//Выводим описание
function descrip(entry) {
	
	
	zapros="id="+entry;
	
	if(xmlHttp) {	

		if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		xmlHttp.open("POST", "submenu.php", true);
		xmlHttp.onreadystatechange=handleServerResponse317;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(zapros);	
	}
	else setTimeout('descript('+entry+')', 1000);
			}
}
function handleServerResponse317() {
if(xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			response = xmlHttp.responseText;
			
		document.getElementById('vivod').innerHTML=response;

	}
		else setTimeout('handleServerResponse317()', 500);
	}
}


	//Пролистывание каталога
function gotip(entry, page) {
	
//	alert(entry.value);
	
	var gaga=document.getElementById('cid').value;
	
	zapros="cid="+gaga+"&dia="+entry+"&page="+page;
	
	if(xmlHttp) {	

		if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		xmlHttp.open("POST", "gotip.php", true);
		xmlHttp.onreadystatechange=handleServerResponse371;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(zapros);	
	}
	else setTimeout('gotip('+entry+', '+page+')', 1000);
			}
}
function handleServerResponse371() {
if(xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			response = xmlHttp.responseText;
			
		

	
	
	//alert(response);
			
		
if(response!='not') {
	
	var arr = response.split("^^");
			
		if(arr[0]=='') {document.getElementById('img1').src='files/empty.gif'; 
		
	
		
		}
	else {document.getElementById('img1').src='im/'+arr[0];
	
	

	}
	
	
	if(arr[1]=='') {document.getElementById('img2').src='files/empty.gif';
	

	}
	else {document.getElementById('img2').src='im/'+arr[1]; 
	

	}
	
	
	if(arr[2]=='') {document.getElementById('img3').src='files/empty.gif'; document.getElementById('kom1').href='#';
	
	document.getElementById('kom1').title='';
	}
	else {document.getElementById('img3').src='im/'+arr[2]; document.getElementById('kom1').href='im/'+arr[2];
	
	document.getElementById('kom1').title='';	
	}
	
	
	if(arr[3]=='') {document.getElementById('img4').src='files/empty.gif';
	

	}
	else {document.getElementById('img4').src='im/'+arr[3];  
	

	}
	
	if(arr[4]=='') {document.getElementById('img5').src='files/empty.gif'; 

	}
	else {document.getElementById('img5').src='im/'+arr[4]; 
	

	}	
		
	document.getElementById('cid').value=arr[5];
	
	descrip(arr[5]);
	
}		
	
	}
		else setTimeout('handleServerResponse371()', 500);
	}
}
