var request;

var queryString;   //will hold the POSTed data


function sendData(  ){
	var input = document.getElementById ('theInput');
	queryString = input.name+"="+input.value;
    var url="http://goohackle.com/scripts/ws/google_hits_ws.php";
	document.getElementById ('statusLabel').innerHTML="Working...";
    httpRequest("POST",url,true, handleResponse, queryString);

}


//event handler for XMLHttpRequest
function handleResponse(  ){

    if(request.readyState == 4){

        if(request.status == 200){

			var data = request.responseText;
			addEvent(data,encodeURIComponent(document.forms[0].elements[0].value));

        } else {

            alert("A problem occurred with communicating between "+

                  "the XMLHttpRequest object and the server program.");
			var data = request.responseText;
			var div = document.getElementById("msgDisplay");
			div.className="header";
			div.innerHTML=data;

        }

    }//end outer if

}


function parseResponse(  ){

    if(request.readyState == 4){

        if(request.status == 200){

			var data = request.responseText;
			var div = document.getElementById("msgDisplay");
			div.className="header";
			div.innerHTML=data;

        } else {

            alert("A problem occurred with communicating between "+

                  "the XMLHttpRequest object and the server program.");

        }

    }//end outer if

}

