var xmlHttp; 


function createXMLHttpRequest() 
{ 
var xmlHttp=null; 
try 
{ 
// FF, Opera 8.0+, Safari 
xmlHttp=new XMLHttpRequest(); 
} 
catch (e) 
{ 
//Internet Explorer 
try 
  { 
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
  } 
catch (e) 
  { 
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
  } 
} 
return xmlHttp; 
} 





function startRequest(text) 
{ 
   if(text != "") 
   { 
       xmlHttp = createXMLHttpRequest();
      xmlHttp.onreadystatechange = handleStateChange; 
	 var myRand=parseInt(Math.random()*999999999);
      xmlHttp.open("GET", "http://www.rorprodukter.se/field_match.php?text="+escape(text)+"&rand="+myRand+"&sortby="+'sortering'+"&sortorder="+'ASC', true); 
      xmlHttp.send(null);
	  
	 
	 
	 
	 
	  
   } 
   else 
   { 
      document.getElementById('result').innerHTML = ""; 
   } 
} 
 



function handleStateChange() 
{ 
  

  
  if(xmlHttp.readyState == 4) 
   { 
   
  
   
   
   if(xmlHttp.status == 200) 
   { 
   
 
      var response = xmlHttp.responseText; 
      var update = new Array(); 
      if(response.indexOf('||' != -1)) 
      { 
         update = response.split('||'); 
       
         document.getElementById('result').innerHTML = update[1]; 
		 //alert ('vanlig');
        // document.getElementById('submit').disabled  = true; 
        
      } 
   } 
}
  if(xmlHttp.readyState < 4) 
   { 
  
  document.getElementById('result').innerHTML = '<div align="center"><br><br><img src="http://www.rorprodukter.se/loading-spiral.gif" width="235" height="235" /><br><br></div>'; 
   
   }
}





function createXMLHttpRequest() 
{ 
var xmlHttp=null; 
try 
{ 
// FF, Opera 8.0+, Safari 
xmlHttp=new XMLHttpRequest(); 
} 
catch (e) 
{ 
//Internet Explorer 
try 
  { 
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
  } 
catch (e) 
  { 
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
  } 
} 
return xmlHttp; 
} 




<!--
	
	//Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;
	
	//Check if we are using IE.
	try {
		//If the Javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		//alert ("You are using Microsoft Internet Explorer.");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using Internet Explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//alert ("You are using Microsoft Internet Explorder");
		} catch (E) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
		//alert ("You are not using Microsoft Internet Explorer");
	}
	
	
	function makerequest(serverPage, objID) {
		
		var obj = document.getElementById(objID);
		xmlhttp.open("GET", serverPage);
		
		// setStatus ("Loading...", obj);
		
		xmlhttp.onreadystatechange = function() {
			
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			} else {
			
			
			
				
			  obj.innerHTML ="<div class=\"bold\">" + '<br><br><br><br>Produkterna laddas... <br><br><br><br>'  + "</div";
				
			}
			
		}
		xmlhttp.send(null);
	}
	
	//-->
	
	
	
	
	
	function makerequest3(serverPage, objID) {
		
		var obj = document.getElementById(objID);
		xmlhttp.open("GET", serverPage);
		
	
		
		// setStatus ("Loading...", obj);
		
		xmlhttp.onreadystatechange = function() {
			
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			} else {
			
			
			
				
			//  obj.innerHTML =" ";
				
			}
			
		}
		xmlhttp.send(null);  
	  
	  }
	
	
	
	
	
	
	function makerequest2(serverPage, objID) {
		
		var obj = document.getElementById(objID);
		xmlhttp.open("GET", serverPage);
		
	
		
		// setStatus ("Loading...", obj);
		
		xmlhttp.onreadystatechange = function() {
			
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			} else {
			
			
			
				
			  obj.innerHTML =" ";
				
			}
			
		}
		xmlhttp.send(null);  
	  
	  }
	
	
	

	
	
	function setStatus (theStatus, theObj)
			{
				
			obj= document.getElementById(theObj);
			
			if (obj){
				
			  obj.innerHTML ="<div class=\"bold\">" + theStatus + "</div";
					}
			
			}
						


