/**
* Crea el objeto Ajax
*
**/
function newAjax()
{
    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;
} 



/**
* Muestra los datos de la delegacion
*
* @params int      Id de la delegacion
*
**/
function mostrarDatosDelegacion(delegacion)
{	
       var ajax_foto = newAjax();
	   var ajax_datos = newAjax();
	   
	   var fachada = document.getElementById('fachada');
	   var datos = document.getElementById('datos');
	   
	   	   	
       ajax_foto.open("GET","delegaciones/foto_delegacion.php?d="+delegacion,true);
	   ajax_foto.onreadystatechange = function mostrarFoto()
		     					 {
							 	     if (ajax_foto.readyState == 4)
								     {
									    if (ajax_foto.status == 200)
									    { 	
										    if (ajax_foto.responseText != '')
										    {    
 												 //HAY RESULTADOS
											     fachada.innerHTML = ajax_foto.responseText;
										    }										 
                                        }//end status									   
							         }//end state
							     }//end function
	   ajax_foto.send(null);
	   
	   ajax_datos.open("GET","delegaciones/datos_responsable.php?d="+delegacion,true);
	   ajax_datos.onreadystatechange = function mostrarFotoResponsable()
		     					 {
							 	     if (ajax_datos.readyState == 4)
								     {
									    if (ajax_datos.status == 200)
									    { 	
										    if (ajax_datos.responseText != '')
										    {    
 												 //HAY RESULTADOS
											     datos.innerHTML = ajax_datos.responseText;
										    }										 
                                        }//end status									   
							         }//end state
							     }//end function
	   ajax_datos.send(null);
	   
}





/**
* Muestra los datos del centro de documentacion rapida
*
*
**/
function mostrarDatosCentroDocumentacion()
{	
       var ajax_foto = newAjax();
	   var ajax_datos = newAjax();
	   
	   var fachada = document.getElementById('fachada');
	   var datos = document.getElementById('datos');
	   
	   	   	
       ajax_foto.open("GET","delegaciones/foto_centro_documentacion.php",true);
	   ajax_foto.onreadystatechange = function mostrarFoto()
		     					 {
							 	     if (ajax_foto.readyState == 4)
								     {
									    if (ajax_foto.status == 200)
									    { 	
										    if (ajax_foto.responseText != '')
										    {    
 												 //HAY RESULTADOS
											     fachada.innerHTML = ajax_foto.responseText;
										    }										 
                                        }//end status									   
							         }//end state
							     }//end function
	   ajax_foto.send(null);
	   
	   ajax_datos.open("GET","delegaciones/datos_responsable_centro_documentacion.php",true);
	   ajax_datos.onreadystatechange = function mostrarFotoResponsable()
		     					 {
							 	     if (ajax_datos.readyState == 4)
								     {
									    if (ajax_datos.status == 200)
									    { 	
										    if (ajax_datos.responseText != '')
										    {    
 												 //HAY RESULTADOS
											     datos.innerHTML = ajax_datos.responseText;
										    }										 
                                        }//end status									   
							         }//end state
							     }//end function
	   ajax_datos.send(null);
	   
}




/**
* Posiciona la pagina de delegaciones, y luego muestra la delegacion pasada por parametro
*
* @params int      Id de la delegacion
*
**/
function mostrarPaginaDelegaciones(delegacion)
{
    location.href='?delegaciones&d='+delegacion;
    
}


