var http = false;

function createRequestObject() {
    var tmpXmlHttpObject;

    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
    if (window.XMLHttpRequest) {
        // Mozilla, Safari would use this method ...
        tmpXmlHttpObject = new XMLHttpRequest();

    } else if (window.ActiveXObject) {
        // IE would use this method ...
        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    }

    return tmpXmlHttpObject;
}

//call the above function to create the XMLHttpRequest object
var http = createRequestObject();


function loading(){
	document.getElementById("foo").innerHTML='<div style="background:url(http://globalwebserve.com/images/spin.gif) no-repeat top left; padding-top:2px; padding-left:20px; margin-left:20px;">loading...</div>';
}

function makeGetRequest() {

    //if (window.event.keyCode == 13){ /* key=13 */

	document.getElementById("foo").innerHTML='<div style="background:url(http://globalwebserve.com/images/spin.gif) no-repeat top left; padding-top:2px; padding-left:20px; margin-left:20px;">loading...</div>';

	var vform = document.getElementById('theform');
	var vsld = document.theform.domain_sld.value;
	var s = document.getElementById("select_tld");
		
	if(navigator.appName == "Microsoft Internet Explorer") {
		var vtld = s.options[s.selectedIndex].text;
	} else {
		var vtld = s.options[s.selectedIndex].value;
	}

    //make a connection to the server ... specifying that you intend to make a GET request
    //to the server. Specifiy the page name and the URL parameters to send
    http.open('GET', 'whois_result.php?domain_sld=' +vsld+ '&domain_tld=' +vtld);

    //assign a handler for the response
    http.onreadystatechange = processResponse;

    //actually send the request to the server
    http.send(null);
    
    //} /* key=13 */
}

function processResponse() {
    //check if the response has been received from the server
    if(http.readyState == 4){

        //read and assign the response from the server
        var response = http.responseText;

        //do additional parsing of the response, if needed

        //in this case simply assign the response to the contents of the <div> on the page.
        document.getElementById('foo').innerHTML = response;

        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!.
        //So it may be worth doing some basic error before setting the contents of the <div>
    }
}

//fsdocument.getElementById('domain_sld').clearModule();
