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 ProximaImagen(i) 
   { 
    a = 1;
    b = 5;
     
    i = (i) ? i : Math.round(Math.random()*(b-a)+a);

    //document.getElementById('img').style.background='url(../pasarela/images/' + i + '_ch.jpg)';
	divResultado = document.getElementById('texto');
       document.getElementById('slide').style.top=52+"px";
    cad = "image.php?n=" + i;
	ajax=objetoAjax();
	ajax.open("GET", cad, true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) 
		{ divResultado.innerHTML = ajax.responseText }
	                                   }
	ajax.send(null)
     mostrarCapa(0);
         }

	     var luis;
         var i=1;

        function mostrarCapa(X)
	     {
            if(X){b=X;} else {b=0;}
            var bloque=document.getElementById('slide');


            var x=(document.defaultView && document.defaultView.getComputedStyle) ?
                   document.defaultView.getComputedStyle(bloque,'').getPropertyValue("top") :
                   bloque.currentStyle ? bloque.currentStyle.top : "";		   

            x = parseInt(x);		
            x -= 4;
		    b += .05;
            bloque.style.top=x+"px";			
            bloque.style.opacity= b;                               //Firefox
            bloque.style.filter="alpha(opacity="+(b*100)+")";      //IE
			
            if(x>2)
	         {
                luis=setTimeout("mostrarCapa(b)",100);
              }
			
              else {
                    clearTimeout(luis);
                    jose=setTimeout("ProximaImagen()",10000);
                   }
           }

function validar(form) 
  {
	var emailRegEx = /^((\w|\.){2,}@)\w{3,}\.\w{2,4}((\.(\w{2}))?)?$/
	var numericoRegEx = /^\d*$/
 
	if(form.nombre.value == "") 
	{
		form.nombre.focus();
		form.correo.value = "";		
		mostrar("El campo <em>Nombre Completo</em> es obligatorio");
		return false;
	}
	
	if(form.correo.value == "") 
	{
		form.correo.focus();
		form.correo.value = "";
		mostrar("El campo <em>Correo electrónico</em> es obligatorio");
		return false;
	} 
	else {
		if(!form.correo.value.match(emailRegEx)) 
		   {
			form.correo.focus();
			form.correo.value = "";
			mostrar("Debe ingresar una dirección de correo válida");
			return false;
		   }
	     }
	return true;
}
 
function mostrar(error) 
  {
	document.getElementById('Errores').innerHTML = error;
	document.getElementById('Errores').style.background = "#fdeeee";
	document.getElementById('Errores').style.border = "1px dashed #f12a25";
  }