function createXMLHTTP() 
	{
		var ajax;
		try 
		{
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(e) 
		{
			try 
			{
				ajax = new ActiveXObject("Msxml2.XMLHTTP");
				alert(ajax);
			}
			catch(ex) 
			{
				try 
				{
					ajax = new XMLHttpRequest();
				}
				catch(exc) 
				{
					 alert("Esse browser não tem recursos para uso do Ajax");
					 ajax = null;
				}
			}
			return ajax;
		}
	
	
		   var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
							    "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
							    "Microsoft.XMLHTTP"];
		   for (var i=0; i < arrSignatures.length; i++) 
		   {
				try 
				{
					var oRequest = new ActiveXObject(arrSignatures[i]);
					return oRequest;
				} 
				catch (oError) 
				{
			    }
		   }
		
			   throw new Error("MSXML is not installed on your system.");
	}


//
var xmlhttp; 
// url_encode version 1.0  
function url_encode(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;  
}  

// url_decode version 1.0  
function url_decode(str) {  
    var n, strCode, strDecode = "";  

    for (n = 0; n < str.length; n++) {  
        if (str.charAt(n) == "%") {  
            strCode = str.charAt(n + 1) + str.charAt(n + 2);  
            strDecode += String.fromCharCode(parseInt(strCode, 16));  
            n += 2;  
        } else {  
            strDecode += str.charAt(n);  
        }  
    }  
    return strDecode;  
}  


function divimagem(autonum)
 {

var oHTTPRequest = createXMLHTTP(); 
oHTTPRequest.open("post", "pages/divimagem.asp", true);
oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
oHTTPRequest.setRequestHeader("Pragma", "no-cache");
oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");//"application/x-www-form-urlencoded");
//oHTTPRequest.setRequestHeader("Content-Type", "text/xml"); 
oHTTPRequest.setRequestHeader("encoding", "UTF-8"); 
oHTTPRequest.onreadystatechange=function busca(){ 
if (oHTTPRequest.readyState==4){
document.all.divimagem.innerHTML = oHTTPRequest.responseText;}}
oHTTPRequest.send("id=" + autonum);
} 

function divtexto(autonum)
 {

var oHTTPRequest = createXMLHTTP(); 
oHTTPRequest.open("post", "pages/divtexto.asp", true);
oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
oHTTPRequest.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
oHTTPRequest.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
oHTTPRequest.setRequestHeader("Pragma", "no-cache");
oHTTPRequest.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");//"application/x-www-form-urlencoded");
//oHTTPRequest.setRequestHeader("Content-Type", "text/xml"); 
oHTTPRequest.setRequestHeader("encoding", "UTF-8"); 
oHTTPRequest.onreadystatechange=function busca(){ 
if (oHTTPRequest.readyState==4){
document.all.divtexto.innerHTML = oHTTPRequest.responseText;}}
oHTTPRequest.send("id=" + autonum);
} 

