function ajax() {
   try {
      xmlhttp = new XMLHttpRequest();
   }
   catch(ee) {
      try {
         xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch(e) {
         try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch(E) {
            xmlhttp = false;
         }
      }
   }
   return xmlhttp;
}

document.write('<div id="exectAjax"></div>');
document.write('<div id="fundoAjax"></div>');
document.write('<img src="imagens/layout/loading.gif" id="loadImg" />');


execut = new ajax();
function mLExectAjax(pagina){

	document.getElementById('loadImg').style.display = "block";
	
	execut.open("post",pagina,true);
	execut.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	execut.onreadystatechange=function() {
		if(execut.readyState==4) {
			document.getElementById('loadImg').style.display = "none";

			
			document.getElementById('exectAjax').innerHTML = execut.responseText; 
		}
	}
	
	execut.send(null);
}

/////////////////////////////////////////////////
function actionScroll(divId, pagina){
	var scrollX = document.getElementById(divId).scrollTop || document.getElementById(divId).pageYOffset;
	var totalX = document.getElementById(divId).scrollHeight - (document.getElementById(divId).offsetHeight+80);
	
	if(scrollX > totalX){
		mlScrolLo(pagina, divId);
	} else {
		setTimeout("actionScroll('"+divId+"', '"+pagina+"')", 100);
	}
}

scrolllo = new ajax();
function mlScrolLo(pagina, divId){
	document.getElementById('loadImg').style.display = "block";
	document.getElementById('fundoAjax').style.display = "block";
	
	scrolllo.open("post",pagina+"&myfil="+myfil,true);
	scrolllo.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	scrolllo.onreadystatechange=function() {
		if(scrolllo.readyState==4) {
			document.getElementById('exectAjax').innerHTML = scrolllo.responseText; 
			document.getElementById('loadImg').style.display = "none";
			document.getElementById('fundoAjax').style.display = "none";
		}
	}
	
	scrolllo.send(null);
}


