// AJAX =============================================================================================

function ajaxInit() {
var req;

try {
 req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
 try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
 } catch(ex) {
  try {
   req = new XMLHttpRequest();
  } catch(exc) {
   alert("Esse browser não tem recursos para uso do Ajax");
   req = null;
  }
 }
}

return req;
}

function mudaFoto(x, gal) {
 foto = x.name;
 galeria = gal
 ajax = ajaxInit();
 if(ajax) {
   var exibeResultado = document.getElementById("divMostraFoto")
   ajax.open("GET", "/galeria/fotos.asp?foto=" + foto + "&galeria=" + gal, true);
   ajax.onreadystatechange = function() {
     if(ajax.readyState == 4) {
       if(ajax.status == 200) {
		 var resultado = ajax.responseText;
		   resultado = resultado.replace(/\+/g," ");
		   resultado = unescape(resultado); // Resolve o problema dos acentos 
		   exibeResultado.innerHTML = resultado;
       } else {
         alert(ajax.statusText);
       }
     }
   }
   ajax.send(null);
 }
}
