var requisicao_http = false;

function pagina(url, lugar) {
  requisicao_httpt = false;

  if (window.XMLHttpRequest) { // Mozilla, Safari,...
    requisicao_http = new XMLHttpRequest();
    if (requisicao_http.overrideMimeType) {
      requisicao_http.overrideMimeType('text/xml');
    }
  } else if (window.ActiveXObject) { // IE
    try {
      requisicao_http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        requisicao_http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }
  
  if (!requisicao_http) {
    alert('Não foi possível criar uma instância XMLHTTP');
    return false;
  }
  
  exibirConteudo.abrir=lugar;
  requisicao_http.onreadystatechange = exibirConteudo;
  requisicao_http.open('GET', url, true);
  requisicao_http.send(null);
}

function exibirConteudo() {
 if(exibirConteudo.abrir==undefined){
  exibirConteudo.abrir="centro";
 }

  if (requisicao_http.readyState == 4) {
    if (requisicao_http.status == 200) {
		
      var doc = requisicao_http.responseText;
      html_div = parent.document.getElementById(exibirConteudo.abrir);
      html_div.innerHTML = doc;
	$(document).ready(function() {
		
		$("a#fancy").fancybox({
		 'frameWidth': 300,
		 'frameHeight': 450
		});
		
		$("a.single").fancybox(); 
		
		$("a.frame").fancybox({
		 'frameWidth': 400,
		 'frameHeight': 550,
		 'hideOnContentClick': false,
		 'overlayShow': true
		});
		
	
		$("a.group").fancybox({
			'hideOnContentClick': false,
			'overlayShow': true
		});

	});	
	 } else {
      alert('Problema de compatibilidade!');
    }
  }else if (requisicao_http.readyState == 2 || requisicao_http.readyState == 3)  {	
      html_div = document.getElementById(exibirConteudo.abrir);
      html_div.innerHTML = "<div align='center'><img src='js/loading.gif'></div>";  
  }
}

//-------------------------------------------------------------------------------------


function loadMatrix(strURL,lugar){
var xmlHttp;

if (window.XMLHttpRequest) { // Mozilla, Safari,...
    xmlHttp = new XMLHttpRequest();
    if (xmlHttp.overrideMimeType) {
      xmlHttp.overrideMimeType('text/xml');
    }
  } else if (window.ActiveXObject) { // IE
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {}
    }
  }

xmlHttp.open('POST', strURL, true);
xmlHttp.onreadystatechange = function(){ 
 if (xmlHttp.readyState == 4){
   var doc = xmlHttp.responseText;
   html_div = parent.document.getElementById(lugar);
   html_div.innerHTML = doc;
 }
}
xmlHttp.send(strURL);
}
