  function createQCObject() { 
   var req;     
   if(window.XMLHttpRequest){ 
      // Firefox, Safari, Opera... 
      req = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { 
      // Internet Explorer 5+ 
      req = new ActiveXObject("Microsoft.XMLHTTP"); 
   } else { 
      alert('Problem creating the XMLHttpRequest object'); 
   } 
   return req; 
} 

// Make the XMLHttpRequest object 
var http = createQCObject(); 
function searchScottyAJAX(searchquery) {

    var CENTAURAjaxTimeout=setTimeout("ajaxTimeout();",4000); 
    http.open('get', 'http://library.ucr.edu/redirect/?scotty='+searchquery);
       http.onreadystatechange = function() {
        if(http.readyState == 4 && http.status == 200) { 
            clearTimeout(CENTAURAjaxTimeout); 
              var response = http.responseText;
              if(response) { 
                document.getElementById("scottySearchMatch").innerHTML = http.responseText; 
              } 
           } 
    }  
       http.send(null); 
}


function ajaxTimeout(){
    http.abort();
   document.getElementById("scottySearchMatch").innerHTML = 'Scotty Results not available.';
}