//Apici.com.br

function carrega(n,div){
try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}
    var conteudo=document.getElementById(div);
	conteudo.innerHTML='carregando...';
    var today = new Date();
	var d = today.getDay();
	var h = today.getHours();
	var m = today.getMinutes();
	var s = today.getSeconds();
	pg = n+"&wzsd=1"+d+h+m+s;
	//alert(pg);
	pg = pg.replace("php&","php?");
    xmlhttp.open("GET",pg,true);
	
    xmlhttp.onreadystatechange=function() {

		if (xmlhttp.readyState==4){

			var texto=xmlhttp.responseText;
			texto=texto.replace(/\+/g," ");
			texto=unescape(texto);
			document.getElementById(div).innerHTML=texto;

        }
    }

	xmlhttp.send(null)
}


function carrega_basico(n,div){
try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

    var conteudo=document.getElementById(div);
	conteudo.innerHTML='carregando...';
	var today = new Date();
	var d = today.getDay();
	var h = today.getHours();
	var m = today.getMinutes();
	var s = today.getSeconds();
	pg = n+"&wzsd=1"+d+h+m+s;
	pg = pg.replace("php&","php?");
    xmlhttp.open("GET",pg,true);

    xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			var texto=xmlhttp.responseText;
			texto=texto.replace(/\+/g," ");
			texto=unescape(texto);
			document.getElementById(div).innerHTML=texto;
        }
    }
	xmlhttp.send(null)
}

function ajax_retorna(n){
try{xmlhttp = new XMLHttpRequest();}
catch(ee){try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
	catch(e){
		try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
		catch(E){xmlhttp = false;}
   	}
}
	var today = new Date();
	var d = today.getDay();
	var h = today.getHours();
	var m = today.getMinutes();
	var s = today.getSeconds();
	pg = n+"&wzsd=1"+d+h+m+s;
	pg = pg.replace("php&","php?");
    xmlhttp.open("GET",pg,true);
    xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			var texto=xmlhttp.responseText;
			texto=texto.replace(/\+/g," ");
			texto=unescape(texto);
			document.getElementById("err_email_bd").value = texto;
        }
    }
	xmlhttp.send(null)
}

function retorna_cep(n,cps){
try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}
	xmlhttp.open("GET",n,true);
    xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			var texto=xmlhttp.responseText;
			texto=texto.replace(/\+/g," ");
			texto=unescape(texto);	
			varArray1 = cps.split('$');
			varArray2 = texto.split('@');
			
			for (i=0;i<varArray1.length;i++){
				document.getElementById(varArray1[i]).value = varArray2[i];
			}
        }
    }
	xmlhttp.send(null)
}
