
function createXMLHttpRequest() {
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
  try { return new XMLHttpRequest(); } catch(e) {}
  alert("XMLHttpRequest not supported");
  return null;
}

var http = createXMLHttpRequest();

function sndReq(action) {
		 document.getElementById('loading').style.display = 'block';
     http.open('get', '/includes/product_search_inc.php?action='+action);
     http.onreadystatechange = handleResponse;
     http.send(null);	 

}

function sndReq_metal(action) {
		 document.getElementById('loading').style.display = 'block';
     http.open('get', '/includes/category_display.php?action='+action);
     http.onreadystatechange = handleResponse;
     http.send(null);	 

}

function handleResponse() {
     if(http.readyState == 4){
          var response = http.responseText;
          var update = new Array();

          if(response.indexOf('|' != -1)) {
               update = response.split('|');
							 document.getElementById('loading').style.display = 'none';
							
               document.getElementById(update[0]).innerHTML = update[1];
          }
     }
}


