		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 addnewcode() {
	
	
	if(xmlHttp) {	
	//showtimer();
	if(xmlHttp.readyState==4 || xmlHttp.readyState==0) {
		xmlHttp.open("POST", "/ok_code11.php", true);
		xmlHttp.onreadystatechange=handleServerResponse938;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(null);	
	}
	else setTimeout('addnewcode()', 1000);
			}
}

function handleServerResponse938() {
if(xmlHttp.readyState==4) {
		if(xmlHttp.status==200) {
			response = xmlHttp.responseText;
		document.getElementById('newcode').innerHTML=response;
	//hidetimer();
	}
		else setTimeout('handleServerResponse938()', 500);
	}
}




  function kirhides() {
    
    var allkir=document.getElementById('allkirs').value;
    
    for(i=1;i<=allkir;i++) {
        
        document.getElementById('cers'+i).style.display='none';
    }
    
  }
  
  function kirhide() {
    
    var allkir=document.getElementById('allkir').value;
    
    for(i=1;i<=allkir;i++) {
        
        document.getElementById('cer'+i).style.display='none';
    }
    
  }

 
  function kirs(entry) {
    kirhide();
    var allkir=document.getElementById('allkirs').value;
    
    for(i=1;i<=allkir;i++) {
        
        document.getElementById('cers'+i).style.display='none';
    }
    
    document.getElementById('cers'+entry).style.display='';
    
  }
  


  
  function kir(entry) {
    kirhides();
    var allkir=document.getElementById('allkir').value;
    
    for(i=1;i<=allkir;i++) {
        
        document.getElementById('cer'+i).style.display='none';
    }
    
    document.getElementById('cer'+entry).style.display='';
    
  }
  
  
  
  var width = 0, height = 0; 
function findDimensions(){ 
//   var width = 0, height = 0; 
  if(window.innerWidth){ 
    width = window.innerWidth; 
    height = window.innerHeight; 
  } 
  else if(document.documentElement && document.documentElement.clientWidth){ 
    width = document.documentElement.clientWidth; 
    height = document.documentElement.clientHeight; 
  } 
  else if(document.body && document.body.clientWidth){ 
    width = document.body.clientWidth; 
    height = document.body.clientHeight; 
  }
  
  var xx=width-120;
  document.getElementById('scrollme').style.width=xx+'px';
  document.getElementById('dispw').value=width;
} 
