/**
* 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 el pdf del diario seleccionado
*
* @params string  Diario      
*
**/
function mostrarDiario(diario)
{	
   if (diario == 'Seleccione')
   {
   		return false;
   }
	
   if (diario == 'anteriores')
     {
         var ajax = newAjax();
	   
	     var contenido = document.getElementById('contenido');
   	   	   	
         ajax.open("GET","periodicos_anteriores/periodicos_anteriores.php",true);
	     ajax.onreadystatechange = function mostrarEdicionesAnteriores()
		     					 {
							 	     if (ajax.readyState == 4)
								     {
									    if (ajax.status == 200)
									    { 	
										    if (ajax.responseText != '')
										    {    
 												 //HAY RESULTADOS
											     contenido.innerHTML = ajax.responseText;
										    }										 
                                        }//end status									   
							         }//end state
							     }//end function
	    ajax.send(null);
	 }
	 else
	 {  
	   if (diario != '')
	     {
   	       window.open ('templates/pdf/diario/periodico_'+diario+'.pdf', 'Diario','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=900,height=1000,left=50,top=50');   
         }
		 else
		 {
		   return false;
		 }
     }	  
}


