
      function getData(dataSource) 
      { 
        var XMLHttpRequestObject = false; 
        
	 //Checking the browser version-type
            if(window.XMLHttpRequest){
                XMLHttpRequestObject = new XMLHttpRequest();  // Firefox Mozilla
            }else if(window.ActiveXObject){
                try{
                XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP");  // IE7
                } catch (exception1){
                    try{
                        XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); // IE6
                    } catch (exception2){
                        XMLHttpRequestObject = false;
                    }
                }
                if (!XMLHttpRequestObject && window.XMLHttpRequest) {
                    XMLHttpRequestObject = new XMLHttpRequest();
                }             
            }
            
			// In case of creating an XMLHttpRequest
            if(XMLHttpRequestObject){
					
				
            XMLHttpRequestObject.open("GET", dataSource);
            
            XMLHttpRequestObject.onreadystatechange = function()
            {
            if(XMLHttpRequestObject.readyState == 4 &&
               XMLHttpRequestObject.status == 200){
                    // Getting the php document from the Server            
				eval(XMLHttpRequestObject.responseText);

                }    
            }
            XMLHttpRequestObject.send(null);
            }      
		}
             window.google = new Object();
             window.google.ac = new Object();       
             window.google.ac.h = sendRPCDone;


      function getSuggest(keyEvent) 
      {
		
        keyEvent = (keyEvent) ? keyEvent: window.event;
        input = (keyEvent.target) ? keyEvent.target : 
          keyEvent.srcElement;

        if (keyEvent.type == "keyup") {
          if (input.value) {
            getData("google.php?qu=" + input.value);
          } 
          else {
            var targetDiv = document.getElementById("targetTable");
            targetDiv.innerHTML = '<div class="topHeader" '+
		'style="background: url(images/menu.gif) repeat-x;border:none">'+
		'GOOGLE RESULTS</div><div style="margin:20px">Your search did not match any document.</div>';
		return;
          }
        }
		  
      }
      


      function sendRPCDone(arrayResults) 
      {
        var data = '<div class="topHeader" '+
		'style="background: url(images/menu.gif) repeat-x;border:none">'+
		'GOOGLE RESULTS</div><table style="margin:20px">';
        var loopIndex;

		if (arrayResults[1].length != 0) {
          for (var loopIndex = 0; loopIndex < arrayResults[1].length; 
            loopIndex++) {
            data += "<tr><td style='width:60%'>" +
            "<a class='links' id='links2'" +
			"style='font-size:11px' href='http://www.google.com/search?q=" + 
            arrayResults[1][loopIndex][0] + "' target='_blank'>" + arrayResults[1][loopIndex][0] + 
            '</a></td><td>' + arrayResults[1][loopIndex][1] + "</td></tr>";
          }
        }

        data += "</table></div>";
        var targetDiv = document.getElementById("targetTable");
        targetDiv.innerHTML = data;
      }
