  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 ObtenerDatos(datos,divID) { 

     var obj = document.getElementById(divID); 
     peticion=objetoAjax();
     peticion.open("GET", datos + "?rand=" + Math.random()); 
	obj.innerHTML = '<span class="cargando"><img src=images/tiny_red.gif>&nbsp;Cargando espere un momento...</span>';	 
     peticion.onreadystatechange = function()  { 
          if (peticion.readyState == 4) { 
               obj.innerHTML = peticion.responseText; 
          } 
     } 
     peticion.send(null); 

}

function CambiarEstilo(id) {
	var elementosMenu = getElementsByClassName(document, "li", "activo");
	for (k = 0; k< elementosMenu.length; k++) {
	elementosMenu[k].className = "inactivo";
	}
	var identity=document.getElementById(id);
	identity.className="activo";
}

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

       function ProximaImagen(i) 
          { 
    a = 1;
    b = 5;
     
    i = (i) ? i : Math.round(Math.random()*(b-a)+a);

    document.getElementById('contenedor').style.background='url(../pasarela/images/' + i + '.jpg)';
	divResultado = document.getElementById('texto');
       document.getElementById('slide').style.top=252+"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 -= 7;
		   b += .1;
            bloque.style.top=x+"px";			
            bloque.style.opacity= b;                               //Firefox
            bloque.style.filter="alpha(opacity="+(b*100)+")";      //IE
			
            if(x>205)
	         {
                luis=setTimeout("mostrarCapa(b)",100);
              }
			
              else {
                    clearTimeout(luis);
                    jose=setTimeout("ProximaImagen()",10000);
                   }
           }

 function CambiaBorde(iD,action)
  {
    if(action==1)
    document.getElementById(iD).style.borderLeft = "dashed  2px #111111";
    if(action==2)
    document.getElementById(iD).style.borderLeft = "solid   1px #616161";
    return false;
  }

 function veRow(renglon)
	 {
		 if(document.getElementById(renglon).style.display == 'none')
		    {document.getElementById(renglon).style.display = '';}
			  else {document.getElementById(renglon).style.display = 'none';}
	 }
