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 espec(tipo) {	
	http.open('get', 'http://www.vrcarros.com.br/tipo.php?tipo='+tipo);
   	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) { 
      		var response = http.responseText;
      		if(response) { 
				//document.getElementById("tipoe2").innerHTML = "";
				document.getElementById("tipoes").innerHTML = http.responseText; 
      		} 
   		} 
	} 
   	http.send(null); 
}

//função para tirar os acentos das variaveis
function tiraacento(str) { 
	var hex_chars = "0123456789ABCDEF"; 
	var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 
	var n, strCode, hex1, hex2, strEncode = ""; 
	
	for(n = 0; n < str.length; n++) { 
	    if (noEncode.test(str.charAt(n))) { 
	        strEncode += str.charAt(n); 
	    } else { 
	        strCode = str.charCodeAt(n); 
	        hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 
	        hex2 = hex_chars.charAt(strCode % 16); 
	        strEncode += "%" + (hex1 + hex2); 
	    } 
	} 
	return strEncode; 
}  

function AbrePagina(pagina, div) {	
	document.getElementById(div).innerHTML = "<img src='imagens/carregando2.gif'>";
	http.open('get', pagina);
   	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) { 
      		var response = http.responseText;
      		if(response) { 
				document.getElementById(div).innerHTML = http.responseText; 
      		} 
   		} 
	} 
   	http.send(null); 
}


