function xmlhttpPost() {
   
   var strURL = 'modules/vulind_search_engine/lookup.php';
	var xmlHttpReq = false;
    var self = this;
    
	// Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
        // alert(self.xmlHttpReq.responseText);
			updatepageXML(self.xmlHttpReq.responseXML);
        }
    }
	
    self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
    var form = document.forms['f1'];
    var word = form.cntnt01searchinput.value;
    qstr = 'q=' + escape(word); 
	//alert(qstr);
    return qstr;
}

//function updatepage(str){
//    document.getElementById("result").innerHTML = str;
//}

function updatepage(xml){
    document.getElementById("result").innerHTML = str;
}

function updatepageXML(obj){
  
  var dataArray = obj.getElementsByTagName('result');
  var dataArrayLen = dataArray.length;
  var rowCount = 0;
  
  //alert(dataArrayLen);
  
  var returnString = ''; 
  
  for (var i=0; i<dataArrayLen; i++){
		
	if(dataArray[i].firstChild != null){
		
		//get the keyword
		sKeyword = dataArray[i].firstChild.data
		
		//assemble the link
		sLink = 'index.php?mact=Search%2Ccntnt01%2Cdosearch%2C0&cntnt01returnid=55&cntnt01searchinput=' + sKeyword.replace(" ", "+");		
		
		if(rowCount == 0){
			returnString += "<li class='first'><a href='" + sLink + "'>" + sKeyword  +  "</a></li>";
		}else if(rowCount == (dataArrayLen - 1) ){
			returnString += "<li class='last'><a href='" + sLink + "'>" + sKeyword + "</a></li>";
		}else{
			returnString += "<li><a href='" + sLink + "'>" + sKeyword + "</a></li>";
		}
	
	}
	
	rowCount++;
	
  }  
  
  	//close out if there is only one result
  	if(dataArrayLen ==1 ){
		returnString += "<li class='last'></li>";  
	}
  
	//show the list
	document.getElementById("result").style.display = 'block';
	document.getElementById("result").style.visibility = 'visible';
  
  
	//populate the list  
	document.getElementById("result").innerHTML = returnString;
  
}


/*

<ul>
                <li class="first">     </li>
                <li></li>
               
            </ul>

*/



