function pedir_numero_visitas()

{

	url = "pedir_numero_visitas.php";

	if (window.XMLHttpRequest)

	{

	    req = new XMLHttpRequest();

	    req.onreadystatechange = processReqVisitas;

	    req.open("GET", url, true);

	    req.send(null);

	}

	else if (window.ActiveXObject)

    {   isIE = true;

        req = new ActiveXObject("Microsoft.XMLHTTP");

        if (req)

        {   req.onreadystatechange = processReqVisitas;

            req.open("GET", url, true);

            req.send();

        }

    }

}



function processReqVisitas()

{

    if (req.readyState == 4)

    {

        if (req.status == 200)

        {

			response  = req.responseText;

			document.getElementById('numero_visitas').innerHTML=response;

        }

        else

        {

            pedir_numero_visitas();

        }

    }

}

function nuevoAjax(){ 
      var xmlhttp=false; 
	  var browser= navigator.appName;
      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(); 
      } 
	   if(browser == "Microsoft Internet Explorer"){  
      	 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");  //esto para explorer  
	   } else {  
		   xmlhttp = new XMLHttpRequest(); //esto para firefox  
	   }  
   return xmlhttp; 
   } 
	
function info_depa_area(nro_depa)
{	url = "pedir_info_area.php?nro_depa="+nro_depa;
    ajax = nuevoAjax(); 
     ajax.open('GET', url, true ); 
      ajax.onreadystatechange = function() { 
	  if ( ajax.readyState == 4 ) { 
			document.getElementById('area').innerHTML = ajax.responseText; 
			info_depa_condicion(nro_depa);
         } 
      } 
      ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
      ajax.send( null  ); 
}

function info_depa_condicion(nro_depa)
{	url = "pedir_info_condicion.php?nro_depa="+nro_depa;
    ajax = nuevoAjax(); 
     ajax.open('GET', url, true ); 
      ajax.onreadystatechange = function() { 
	  if ( ajax.readyState == 4 ) { 
			document.getElementById('condicion').innerHTML = ajax.responseText; 
         } 
      } 
      ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
      ajax.send( null  ); 
}
