		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) {	
	//showtimer();
	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;
	//hidetimer();
	}
		else setTimeout('handleServerResponse37()', 500);
	}
}


function shows(entry, ids, lan) {
	

	
	document.getElementById('bgfot').src='/im/big-'+entry;
    
    document.getElementById('nobles').href='/im/'+entry;
	
	zapros="id="+ids+"&lan="+lan;
	
	if(xmlHttp) {	

	if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		xmlHttp.open("POST", "/showimg.php", true);
		xmlHttp.onreadystatechange=handleServerResponse3172;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(zapros);	
	}
	else setTimeout('shows('+entry+','+ids+','+lan+')', 1000);
			}
}








function handleServerResponse3172() {
if(xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			response = xmlHttp.responseText;
		document.getElementById('namm').innerHTML=response;

	}
		else setTimeout('handleServerResponse3172()', 500);
	}
}


function show_direction() {
    
    document.getElementById('sop1').style.display='';
    document.getElementById('sop3').style.display='none';
    document.getElementById('sop2').style.display='none';
}

function show_programs() {
    
    document.getElementById('sop1').style.display='none';
    document.getElementById('sop2').style.display='';
    document.getElementById('sop3').style.display='none';
}

function show_contacts() {
    
     document.getElementById('sop1').style.display='none';
    document.getElementById('sop2').style.display='none';
    document.getElementById('sop3').style.display='';
}


function sopli() {
    
    
    
    var forma=document.getElementById('osa');
		var zapros='';
        var zap='';
		var count=0;
for(var i=0; i<forma.length; i++)
{
	if(forma.elements[i].id=='zoro' && forma.elements[i].checked!='') {
	   
       if(i==0) zap+=forma.elements[i].value;
       else zap+=","+forma.elements[i].value;
       
       
       
       
       }
}
zapros+="count="+count+"&ids="+zap;
    
 
    
    if(xmlHttp) {	

	if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		xmlHttp.open("POST", "/showprograms.php", true);
		xmlHttp.onreadystatechange=handleServerResponse3173;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(zapros);	
	}
	else setTimeout('sopli()', 1000);
			}
    
    
}


function handleServerResponse3173() {
if(xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			response = xmlHttp.responseText;
		document.getElementById('sop2').innerHTML=response;

	}
		else setTimeout('handleServerResponse3173()', 500);
	}
}


function proverka(form) {
    
    if(form.name.value=='' || form.email.value=='') {alert("Заполните обязательные поля"); return false;}
    else return true;
    
}
