
function getHTTPObject(){try{xmlhttp=new XMLHttpRequest();}catch(eee){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(ee){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){xmlhttp=false;}}}
return xmlhttp;}
fila=[];ifila=0;function ajaxHTML(id,url,carregando,modoRetorno,sobre){mostrarCarregando(id,carregando,sobre);fila[fila.length]=[id,url,modoRetorno];if((ifila+1)==fila.length){ajaxRun();}}
function ajaxRun(){try{xmlhttp.open("GET",fila[ifila][1],true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){retorno=unescape(xmlhttp.responseText.replace(/\+/g," "));document.getElementById(fila[ifila][0]).innerHTML=retorno;modoRetorno=fila[ifila][2];if(modoRetorno&&modoRetorno=='sort'){alterarSort(fila[ifila][0]);}
proximo();}}
xmlhttp.setRequestHeader("Cache-Control","no-store, no-cache, must-revalidate");xmlhttp.setRequestHeader("Cache-Control","post-check=0, pre-check=0");xmlhttp.setRequestHeader("Pragma","no-cache");xmlhttp.send(null);}catch(erro){alert("Erro na aplicação, contacte um responsável: "+erro);proximo();}}
function alterarSort(id){var links=document.getElementById(id).getElementsByTagName("A");for(var x=0;x<links.length;x++){var href=links[x].href;if(href.indexOf("sort.")!=-1){links[x].href="javascript:sort('"+href.substring(href.lastIndexOf("/")+1,href.length)+"', '"+id+"');";}}}
function listaAjax(id,url,carregando){ajaxHTML(id,url,carregando,'sort',true);}
function mostrarCarregando(id,mostrar,sobre){if(mostrar){var div1=document.createElement('div');var div=document.createElement('div');var img=document.createElement('img');img.src='paginas/imagens/load.gif'
div.appendChild(img);div.tittle='Carregando...';div.align='center';div.verticalAlign='middle';if(sobre){div.style.position='absolute';}
div.style.padding='5px';div.style.zIndex='1';div.style.color='#AAA';div.style.fontSize='11px';div.style.opacity='.80';div.style.filter='alpha(opacity:80)';div1.appendChild(div);document.getElementById(id).innerHTML=div1.innerHTML+document.getElementById(id).innerHTML;}}
function proximo(){ifila++;if(ifila<fila.length)
setTimeout("ajaxRun()",300);}
function sort(url,id){listaAjax(id,url,true);}
var xmlhttp=getHTTPObject();