
var http_request = false;
   function makeRequest(sld, tld) {
      http_request = false;// make sure http request is set to false...
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
	  theurl = '../dcheck/get.php?tld=' + tld + '&sld=' + sld
	  //alert(theurl);
      http_request.open('GET',theurl, true);
      http_request.send(null);
   }

function alertContents() {
	if (http_request.readyState==4) {
		if (http_request.status == 200) {
			if (http_request.responseText==0){
				theresult = '<span style="color:red;">' +domtaken + '</span>'; 
			}
			if (http_request.responseText==1){
				theresult = '<span style="color:green;">'+ domavailable +'&nbsp;</span><input type="submit" value="'+ domregister +'" onClick="document.location.href=\'' + regurl +'?tld=' + tld + '&sld=' + sld + '\'"/>';
			}
			if (http_request.responseText==4){
				restheresultult = '<span style="color:red;">' +domerror + '</span>'; 
			}
			if (http_request.responseText==5){
				restheresultult = '<span style="color:red;">' +domerror + '</span>'; 
			}
		} else {
			theresult = '<span style="color:red;">' +domerror + '</span>'; 
		}
	}else{
		theresult = '<div style="padding-top:5px;"><img src="/img/pleaseWait.gif" alt="Checking" width="16" height="16" align="absmiddle"/>&nbsp;&nbsp;' + domchecking + '</div>';
	}
	document.getElementById('myspan').innerHTML = theresult;
}

   function get(obj) { // Function that gets the what was keyed in to the text fields...
      var getstr = "?";
      for (i=0; i<obj.childNodes.length; i++) {
         if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text") {
             sld = obj.childNodes[i].value;
            }
         }
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];
         	tld = sel.options[sel.selectedIndex].text;
         }

      }
	  if (sld!=""&&tld!=""){
     	 makeRequest(sld, tld); // goes to the fuction at the top of the page witch makes the http requests and tells it to get the page "get.php"
	  } else {
		  document.getElementById('myspan').innerHTML = '<span>' + domempty + '</span>'; 
	  }
   }