function getXMLHTTPRequest() {

try {
req = new XMLHttpRequest(); /* p.e. Firefox */
} catch(e) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  /* algunas versiones IE */
  } catch (e) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    /* algunas versiones IE */
    } catch (e) {
      req = false;
    }
  }
}
return req;

}
var http = getXMLHTTPRequest();


function carga_pagina(pagina_nueva) {
	
	if (pagina_nueva=="bienvenida")
		var boton="bienve";
		
	if (pagina_nueva=="filosofia")
		var boton="filo";
		
	if (pagina_nueva=="servicios")
		var boton="serv";
		
	if (pagina_nueva=="metodologia")
		var boton="metod";
		
	if (pagina_nueva=="presupuesto_p1")
		var boton="presup";
		
	if (pagina_nueva=="cartera")
		var boton="cart";
	
   document.getElementById("bienve").src="imagenes/bienve.jpg";
   document.getElementById("filo").src="imagenes/filo.jpg";
   document.getElementById("serv").src="imagenes/serv.jpg";
   document.getElementById("metod").src="imagenes/metod.jpg";
   document.getElementById("presup").src="imagenes/presup.jpg";
   document.getElementById("cart").src="imagenes/cart.jpg";
   
   document.getElementById(boton).src="imagenes/"+boton+"_over.jpg";
	
   //pagina = pagina_nueva;

	var myurl = '../' + pagina_nueva + '.php';
  
    myRand = parseInt(Math.random()*999999999999999);
    // saltarse la cache
   
   var modurl = myurl+"?rand="+myRand;

   http.open("GET", modurl, true);
   http.onreadystatechange = useHttpResponsenewpage;
   http.send(null);
}

function useHttpResponsenewpage() {
   if (http.readyState == 4) {
	   if(http.status == 200) {
	  
	  /*if(var recibe=document.getElementById('menubottom'))
	  {
		  while (document.getElementById('menubottom') .hasChildNodes())
		  {
			document.getElementById('menubottom').removeChild(document .getElementById('menubottom').firstChild);
		  }
	  }*/
		
		//Mete en el div contenido, el contenido de la pagina consultada
	    document.getElementById("contenido").innerHTML = http.responseText;
		//refreshMenu(pagina);
	   }
	   else
  	   {
	    document.getElementById("contenido").innerHTML = '<img src="../imagenes/cargando.gif" style="position:absolute;left:32%;top:40%;" />';
  	   }
	}
}

function menubottom(pagina_bottom) {
	
   document.getElementById("bienve").src="imagenes/bienve.jpg";
   document.getElementById("filo").src="imagenes/filo.jpg";
   document.getElementById("serv").src="imagenes/serv.jpg";
   document.getElementById("metod").src="imagenes/metod.jpg";
   document.getElementById("presup").src="imagenes/presup.jpg";
   document.getElementById("cart").src="imagenes/cart.jpg";
   
   var myurl = '../' + pagina_bottom + '.php';
  
    myRand = parseInt(Math.random()*999999999999999);
    // saltarse la cache
   
   var modurl = myurl+"?rand="+myRand;

   http.open("GET", modurl, true);
   http.onreadystatechange = useHttpResponseBottom;
   http.send(null);
}

function useHttpResponseBottom() {
   //Selecciona el div donde ira todo el contenido que se obtenga
   //var area = document.getElementById("contenido");
   
   if (http.readyState == 4) {
	   if(http.status == 200) {
		
		//Mete en el div contenido, el contenido de la pagina consultada
	    /*if (document.getElementById("contenido").innerHTML = http.responseText) {
			refreshMenu('nada');
			}*/
		document.getElementById("contenido").innerHTML = http.responseText
	   }
	}
  else
  {
	  document.getElementById("contenido").innerHTML = '<img src="../imagenes/cargando.gif" style="position:absolute;left:32%;top:40%;" />';
  }
}

/*function refreshMenu(pagina) {

	var myurl = '../refreshmenu.php';
  
    myRand = parseInt(Math.random()*999999999999999);
    // saltarse la cache
   
   var modurl = myurl+"?rand="+myRand+"&pagina="+pagina;

   http.open("GET", modurl, true);
   http.onreadystatechange = useHttpResponseRefresh;
   http.send(null);
}

function useHttpResponseRefresh() {
   if (http.readyState == 4) {
	   if(http.status == 200) {
		
		//Mete en el div contenido, el contenido de la pagina consultada
	    document.getElementById("botonera").innerHTML = http.responseText;
	   }
	}
  else
  {
	  document.getElementById("botonera").innerHTML = '<img src="../imagenes/cargando.gif" style="position:absolute;left:32%;top:40%;" />';
  }
}*/
