﻿function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function aviasearch(query) {
    var req = getXmlHttp();
	    var statusElem = document.getElementById('statussearch');
		var allTextElem = document.getElementById('aviasearch');
		req.onreadystatechange = function() {
		  if (req.readyState == 4) {
		      statusElem.innerHTML = req.statusText;
			  if(req.status == 200) {
			   statusElem.innerHTML = 'Загружено'
			     allTextElem.innerHTML = ""+req.responseText+""; 
				 document.getElementById('aviainfo').style.display = 'none';
				 return true;	
				 if(req.responseText==""){
				     allTextElem.innerHTML="<big>Нет результата</big>";
					 return false;
				   }
			 }
			}
		}

	  var _adress = "/index.php?mode=avia2&null=1"+query;

     req.open('GET', _adress, true);
	 req.send(null);
	 statusElem.innerHTML = '<big>Загрузка расписания</big>';
}

function divonoff(lay) {
var Layer = document.getElementById(lay);
if (Layer.style.display == 'none') {
Layer.style.display = 'block';
   }
else {
Layer.style.display = 'none';
       }
}

function onoff(status) {
alert(text); 
}
