
/*********************************************
* cambia el filtro
*/
function usarFILTRO(where,bloque,tipo,from,to)
{

   to = (to==0 ? 9999 : to);
   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='imagenes/loading.gif' /></div>";

   appPHP = "app/portal.php";
   datos  = "tipo=" + tipo+"&from="+from+"&to="+to+"&where=" + where;
   ajaxRUN(appPHP,bloque,datos)

}


/*********************************************
* cambia el orden de los registros
*/
function changeORDEN(sort,bloque,tipo,from,to)
{

   to = (to==0 ? 9999 : to);
   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='imagenes/loading.gif' /></div>";

   appPHP = "app/portal.php";
   datos  = "tipo=" + tipo+"&from="+from+"&to="+to+"&sort=" + sort;
   ajaxRUN(appPHP,bloque,datos)

}


/***********************************************
* Extrae etapas
*/
function getESPECIALES(bloque,tipo)
{
   appPHP = "/site/OnLine/app/get-especiales.php";
   datos  = "tipo=" + tipo;
   ajaxRUN(appPHP,bloque,datos)
}

/***********************************************
* Extrae etapas
*/
function getETAPAS(bloque,etapa)
{
   appPHP = "/site/OnLine/app/get-etapas.php";
   datos  = "etapa=" + etapa;
   ajaxRUN(appPHP,bloque,datos)
}


/***********************************************
* Extrae registros relacionados
*/
function getMAS_DATOS(bloque,tabla,item)
{
   appPHP = "/site/OnLine/app/get-relacionados.php";
   datos  = "tabla=" + tabla+"&it_key="+item;
   ajaxRUN(appPHP,bloque,datos)
}


/***********************************************
* Extrae informacion de la base de datos
*/
function getINFO(bloque,tipo,from,to)
{

   to = (to==0 ? 9999 : to);
   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='imagenes/loading.gif' /></div>";

   appPHP = "/site/OnLine/app/portal.php";
   datos  = "tipo=" + tipo+"&from="+from+"&to="+to;
   ajaxRUN(appPHP,bloque,datos)

}

function getREGION(bloque,tipo,from,to)
{

   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='imagenes/loading.gif' /></div>";

   idREGION = document.region.idREGION.value;
   appPHP = "app/portal.php";
   datos  = "tipo=" + tipo+"&from="+from+"&to="+to+"&region="+idREGION;
   ajaxRUN(appPHP,bloque,datos)

}


function getALERTA(bloque,tipo,from,to)
{

   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='imagenes/loading.gif' /></div>";

   idALERTA = document.getElementById("numeroALERTA").innerHTML;
   appPHP = "app/portal.php";
   datos  = "tipo=" + tipo+"&from="+from+"&to="+to+"&numeroALERTA="+idALERTA;
   ajaxRUN(appPHP,bloque,datos)

}



/***********************************************
* Lista las alertas del mes
*/
function getALERTA_MES(bloque,tipo,mes)
{

   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='imagenes/loading.gif' /></div>";

   appPHP = "app/portal.php";
   datos  = "tipo=" + tipo+"&mesACTUAL="+mes;
   ajaxRUN(appPHP,bloque,datos)

}


/***********************************************
* Recupera el ultimo contacto foro ingresado
*/
function getLAST_CONTACTO(bloque,tipo,from,to)
{
	getINFO(bloque,tipo,from,to);
}


/***********************************************
* Asigna el anio actual
*/
function getYEAR(bloque)
{
    today      = new Date();
    yearACTUAL = today.getFullYear();
    document.getElementById(bloque).innerHTML = "<b>" + yearACTUAL + "</b>";
}

/***********************************************
* AJAX aninados
*/
function otherAJAX(bloque,app)
{
    if (bloque=='listaPROGRAMA') getINFO('lastPROGRAMA','programa-radial1',0,1);


    if (bloque=='last') getINFO('Abloque','contacto-others',1,1);
	    if (bloque=='Abloque') getINFO('Bbloque','contacto-others',2,1);
	    if (bloque=='Bbloque') getINFO('Cbloque','contacto-others',3,1);
	    if (bloque=='Cbloque') getINFO('Dbloque','contacto-others',4,1);

    if (bloque=='lastREVISTA') getINFO('otherREVISTA','revistas1',1,0);

//    if (bloque=='lastNOTICIA') getINFO('AbloqueNOTICIA','noticias1',1,6);
//        if (bloque=='AbloqueNOTICIA') getINFO('BbloqueNOTICIA','noticias1',7,13);

    if (bloque=='lastPRONUNCIAMIENTO') getINFO('AbloquePRONUNCIAMIENTO','pronunciamientos1',1,6);
        if (bloque=='AbloquePRONUNCIAMIENTO') getINFO('BbloquePRONUNCIAMIENTO','pronunciamientos1',7,13);
        
    if (bloque=='nombreREGION') getREGION('regionEVENTOS','region-eventos',0,3);
        if (bloque=='regionEVENTOS') getREGION('regionPROGRAMAS','region-programas',0,4);
        if (bloque=='regionPROGRAMAS') getREGION('regionBOLETINES','region-boletines',0,4);
        if (bloque=='regionBOLETINES') getREGION('regionENLACES','region-enlaces',0,3);

    if (bloque=='topMAIN') getINFO('nextMAIN','next-main',0,0);

    if (bloque=='numeroALERTA') getALERTA('alertaDESTAQUE','alerta-destaque',0,1);
        if (bloque=='alertaDESTAQUE') getALERTA('alertaDESTAQUE1','alerta-destaque1',1,1);
        if (bloque=='alertaDESTAQUE1') getALERTA('alertaDESTAQUE2','alerta-destaque2',2,1);
        if (bloque=='alertaDESTAQUE2') getALERTA('alertaDESTAQUE3','alerta-destaque3',3,4);
        
    if (bloque=='alertaDESTAQUE3') getALERTA('alertaINSTITUCIONAL','alerta-institucional',0,1);
        if (bloque=='alertaINSTITUCIONAL') getALERTA('alertaINSTITUCIONAL1','alerta-institucional1',1,2);

    if (bloque=='alertaINSTITUCIONAL1') getALERTA('alertaENLACE','alerta-enlace',0,2);
    if (bloque=='alertaENLACE') getALERTA('alertaOPINION','alerta-opinion',0,5);
        
}


/***********************************************
* Obtiene dato  del alerta
*/
function alertaCONTENIDO()
{

    idALERTA = document.getElementById("numeroALERTA").innerHTML;
    contenido = document.getElementById("contenidoALERTA").innerHTML;
    
    document.archivo.numero.value = idALERTA;
    document.archivo.data.value = contenido;
    
    abrirWINMSG("");
    document.archivo.submit();
    top.close();
    
}
