function myXMLHttpRequest (){
	var xmlhttplocal = false;
	if (typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttplocal = new XMLHttpRequest ();
		}
		catch (e) {
  			xmlhttplocal = false;
		}
	}
	if (!xmlhttplocal) {
		try {
			xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")
		}
		catch (e) {
			try {
				xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")
			}
			catch (E) {
				xmlhttplocal = false;
				alert ('Lamentablemente parece que su navegador no soporta aplicaciones Ajax y esta página lo utiliza.');
			}
  		}
	}
	return (xmlhttplocal);
}



function Navegacion(categoria, pag){
var respuesta = new String;
	var xmlhttp = new myXMLHttpRequest ();
	if (xmlhttp) {
		target = document.getElementById ('div_navegacion');
		if (target){
			target.innerHTML = "<center><img border='0' src='imagenes/busqueda.gif' width='32' height='32' style='margin:15px'></center>";
			url =  "galerias_navega.php?c=" + categoria + "&p=" + pag;
			xmlhttp.open ("GET", url, true);
			errormatch = new RegExp ("^ERROR:");

			xmlhttp.onreadystatechange = function () {
				if (xmlhttp.readyState == 1) {
					target.innerHTML = "<center><img border='0' src='imagenes/busqueda.gif' width='32' height='32' style='margin:15px'></center>";
				}//if	
					
				if (xmlhttp.readyState == 4) {
					respuesta = xmlhttp.responseText;
					if (respuesta.match (errormatch)) {	
						respuesta = respuesta.substring (6, respuesta.length);
						alert (respuesta);			
					}else{
						target.innerHTML = respuesta;
					}//if
				}//if
			}//  function() 
		}//if(target)
		xmlhttp.send (null);
		
	}//if (xmlhttp)	
}//fun

function MuestroFoto(dire){
	var respuesta = new String;
	var xmlhttp = new myXMLHttpRequest ();
	if (xmlhttp) {
		target2 = document.getElementById ('div_foto');	
		if (target2) {
			target2.innerHTML = "<center><img border='0' src='imagenes/busqueda.gif' width='32' height='32' style='margin:15px'></center>";
			url =  "galerias_foto.php?i=" + dire;
			xmlhttp.open ("GET", url, true);
			errormatch = new RegExp ("^ERROR:");

			xmlhttp.onreadystatechange = function () {
				if (xmlhttp.readyState == 1) {
					target2.innerHTML = "<center><img border='0' src='imagenes/busqueda.gif' width='32' height='32' style='margin:15px'></center>";
				}//if	
					
				if (xmlhttp.readyState == 4) {
					respuesta = xmlhttp.responseText;
					if (respuesta.match (errormatch)) {	
						respuesta = respuesta.substring (6, respuesta.length);
						alert (respuesta);			
					}else{
						target2.innerHTML = respuesta;
					}//if
				}//if
			}//  function() 
		}//if(target)
		xmlhttp.send (null);
		
	}//if (xmlhttp)
	//location.hash = "!foto";
}//fun

