function test()
{
	alert('hello');
}

/***************************************
*  Evalua la tecla digitada
*/
function evaluaTECLA()
{
    if (event.keyCode()==13) metaSEARCH();
}


/*************************************************
* limpia cadena
*/
function replace(data,buscar,cambiar)
{
    while (true) {
        if (data.indexOf(buscar)==-1) break;
        data = data.replace(buscar,cambiar);
    }
    return data;
} 

/*************************************************
* limpia cadena
*/
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
} 

/*************************************************
* captura nombre del mes actual
*/
function getNOMBRE_MES()
{
   arMES = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Setiembre","Octubre","Noviembre","Diciembre");
   mesACTUAL = new Date();
   document.write(arMES[mesACTUAL.getMonth()]);

   return;
}

/***********************************************
* adiciona usuario al DSI
*/
function user2DSI(bloque)
{
   titMSG = "DIPECHO::Servicio DSI\n------------------------------\n";

   ape = trim(document.dsi.apellidos.value);
	nom = trim(document.dsi.nombres.value);
	ema = trim(document.dsi.email.value);
	pai = trim(document.dsi.pais.value);

  if (ape=="" || nom=="" || ema=="" || pai=="") {

	alert(titMSG+"Es indispensable ingresar datos en todos los campos");
	return;

  }

   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'>Un momento...</div>";
   appPHP = "bvsSearch/app/addUSER_DSI.php";

   datos  = "ape=" + ape + "&nom=" + nom + "&ema=" + ema + "&pai=" + pai ;
   ajaxRUN(appPHP,bloque,datos)


}

function showMSG(bloque)
{
	alert(titMSG + document.dsi.apellidos.value + ", " + document.dsi.nombres.value+"\nRegistrado en forma satisfactoria.");
	document.getElementById(bloque).innerHTML = "";
	document.dsi.reset();
}

/***********************************************
* Lista las alertas del mes
*/
function getINFO(bloque,db,numRECORD)
{
   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='bvsSearch/loading.gif' /></div>";

   appPHP = "bvsSearch/app/getNEWS.php";
   datos  = "db=" + db + "&record=" + numRECORD;
   ajaxRUN(appPHP,bloque,datos)

}

/***********************************************
* Lee otros RSS
*/
function getOTHERS(bloque)
{
   document.getElementById(bloque).innerHTML = "<div align='center' valign='middle'><img src='bvsSearch/loading.gif' /></div>";

   appPHP = "bvsSearch/app/getOTHERS_RSS.php";
   datos  = "";
   ajaxRUN(appPHP,bloque,datos)

}


/***********************************************
* actualiza bloques div
*/
function showINFO(bloque,id)
{

	idSRC = "topNEWS" + id;
	document.getElementById(bloque).innerHTML = document.getElementById(idSRC).innerHTML;

}



/***********************************************
* AJAX aninados
*/
function otherAJAX(bloque,app)
{

  if (bloque=='topNEWS1')  getINFO('topNEWS2','multimedia',2);
  if (bloque=='topNEWS2')  getINFO('topNEWS3','lisa',2); 
  if (bloque=='topNEWS3') getINFO('showEVENTOS','eventos',2);
  
  if (bloque=='showEVENTOS') beginCHANGE();
     if (bloque=='dsiMSG') showMSG(bloque);
       
}



function beginCHANGE()
{
	showINFO("lastNEWS",panel);
	InitializeTimer();
}


/******************************************************
*  TIMER
*/

var panel = 1;
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    secs = 4
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
					 /* de acuerdo al # de paneles*/
		panel = (panel>=3 ? 1 : panel+1);

	showINFO("lastNEWS",panel);

	InitializeTimer(); 

    }	
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}





