// JavaScript Document

HTTPRequest = function () {
   var xmlhttp=null;
   try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (_e) {
      try {
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (_E) {    }
   }
   if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
     try {
        xmlhttp = new XMLHttpRequest();
     } catch (e) {
        xmlhttp = false;
   }  }
   return xmlhttp;
}

function ask(url, resultelm) {
	  var http = new HTTPRequest();
   	  http.open("GET", url, true);
	  http.onreadystatechange = function (){ handleHttpResponse(http, resultelm)};
	  http.send(null);
}

function handleHttpResponse(http, resultelm) {
  if (http.readyState == 4) {
    result = http.responseText;
	
   	if ( -1 != result.search("null") ) {
		resultelm.style.borderColor = "red";
		resultelm.innerHTML = "Request could not be processed due to some technical error. Please try again.";
	} else {
		resultelm.style.borderColor = "blue";
		resultelm.innerHTML = result;
		} 
	} 
}