var show_div = 0;

function LoadSearchAjax(force) {
	var query = '' + document.getElementById('substring_id').value;
	var req = new Subsys_JsHttpRequest_Js();
	var txt = '';
	
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if (req.responseJS[0]) {
				txt = '<TABLE border=0 cellpadding=0 cellspacing=0 class="ajaxSearch_tbl">';
				for (i=0; i<req.responseJS.length; i++) {
					txt += "<TR><TD onClick='javascript:self.location=\"" + req.responseJS[i]['link'] +"\"' class='ajaxSearch' onMouseOver='this.className=\"ajaxSearchSelected\";' onMouseOut='this.className=\"ajaxSearch\";' nowrap>" + req.responseJS[i]['product'] + "</TD></TR>";
				}
				txt += '</TABLE>';
				document.getElementById('result_str').innerHTML = txt;
				document.getElementById('result_str').style.visibility = '';
			}
			else {
				document.getElementById('result_str').innerHTML = '';
				document.getElementById('result_str').style.visibility = 'hidden';
			}
		}
	}

	req.caching = false;
	req.open('GET', 'ajax_search.php', true);
	req.send({quest: query});
}

var timeout = null;
function doLoadSearch() {
	if (document.getElementById('substring_id').value != '') {
		if (timeout) clearTimeout(timeout);
			timeout = setTimeout(LoadSearchAjax, 200);
	}
}

/* xCartmod.com - AJAX Search Results */

