function objetoAjax(){
        var xmlhttp=false;
        try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                try {
                   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                        xmlhttp = false;
                }
        }

        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}

function comprobar(id,idioma) {
	
	
	ajax=objetoAjax();
	ajax.open("POST", "consultafoto.php", true);
	ajax.onreadystatechange = procesaRespuesta;
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("id="+id+"&idioma="+idioma);
	
	
}

function procesaRespuesta() {
	var divResultado = document.getElementById('descripcion');
	var imagen = document.getElementById('fotogrande');
	var enlace = document.getElementById('fotochica');
	if(ajax.readyState == 4) {
		if(ajax.status == 200) {
			//divResultado.innerHTML = ajax.responseText;
			var info=ajax.responseXML;
			
			var fotog= info.getElementsByTagName('fotoxml').item(0).firstChild.data;
			
			var descripciontxt= info.getElementsByTagName('descripcionxml').item(0).firstChild.data;
			
			divResultado.innerHTML = descripciontxt;
			imagen.className='bordefoto';
			imagen.src = 'img/fotos/grandes/'+fotog;
			enlace.href = 'img/fotos/grandes2/'+fotog;
			//enlace.title = foto;
			//imagen.style.border = '3px solid white';
			
		}else{
			divResultado.innerHTML ="Error al recibir los datos";
		}
		
	}else {     // si readyState ha cambiado
                 // pero readyState <> 4
		imagen.className='bordefotosin';
        imagen.src = 'img/loader3.gif';
		   
    }
}
