
// funções do Ajax 

function newajax(url, id_content){
  var page_request = false;
  if (window.XMLHttpRequest){
    // Se Mozilla, Safari etc
    page_request = new XMLHttpRequest ();
    } 
  else if (window.ActiveXObject){
    // se IE
    try{
      page_request = new ActiveXObject ("Msxml2.XMLHTTP");
      }
    catch (e){
      // versão antiga
      try{
        page_request = new ActiveXObject ("Microsoft.XMLHTTP");
        }
      catch (e){
        }
      }
    } 
  else
    return false;
	
  page_request.onreadystatechange = function (){
    // função de resposta
    loadpage (page_request, id_content);
    }
  page_request.open ('GET', url, true); // métodos open e send
  page_request.send (null);
  }

// função que carrega o conteúdo na página xhtml

function loadpage(page_request, id_content){
    if (page_request.readyState == 4 && (page_request.status == 200 || window.location.href.indexOf ("http") == - 1))
    var texto=page_request.responseText;
	texto=texto.replace(/\+/g," ");
    texto=unescape(texto);
	document.getElementById (id_content).innerHTML = texto;
  }


function openWindow(url) {
  popupWin = window.open(url, 'new_page', 'width=600,height=400,scrollbars=0,left=50,top=20');
  } 
  
function openPrint(url) {
  popupWin = window.open(url, 'new_page', 'width=685px,height=540px,scrollbars=1,left=50px,top=20px');
  }   
