function nuevoAjax(){
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 aleatorio(inferior,superior){ 
	numPosibilidades = superior - inferior 
	aleat = Math.random() * numPosibilidades 
	aleat = Math.round(aleat) 
	return parseInt(inferior) + aleat 
}

function time(){
		ajax=nuevoAjax();
		//alert('hola');
		for (var i=0;i < document.uno.elements.length;i++) {
			var elemento = document.uno.elements[i];
				dir=elemento.value;
		}
		//alert(dir);
		//alert (dir+"includes/imagenale.php?aleatorio="+aleatorio(1,4)+"&dir="+dir);
		//ajax.open("GET", datos+'?horaConsultaIni='+valor_Ini+'&horaConsultaFin='+valor_Fin+'&id='+idCampoConsulta, true);
		ajax.open("POST", dir+"includes/imagenale.php?",true);
		variable="aleatorio="+aleatorio(1,5)+'&dir='+dir;
		ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			document.getElementById('echos').innerHTML = ajax.responseText
		}else{
			document.getElementById('echos').innerHTML = '<b>Cargando..</b>';
		}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(variable)
		//setTimeout('time();',5000);
}

