// Obtener la cantidad de noticias
function timer_cantnot()
{
   w = 1;
   while (document.getElementById('notrot'+w))
      w = w + 1;
   return (w-1);
}

// Oculta todas las noticias y devuelve el id de la noticia activa
function timer_ocultar()
{
   cantnot = timer_cantnot();

   for (i=1; i<=cantnot; i++)
   {
      if (document.getElementById('notrot'+i).style.display=='')
         selectnot = i;

      document.getElementById('notrot'+i).style.display='none';
   }
   return selectnot;
}

function myfunction()
{
   cantnot = timer_cantnot();

   selectnot = timer_ocultar();

   if (selectnot==cantnot)
      document.getElementById('notrot1').style.display='';
   else
      document.getElementById('notrot'+(selectnot+1)).style.display='';
}

function timer_mover(accion)
{
   cantnot = timer_cantnot();


   document.getElementById('estadotimer').value='pausa';
   timer.pause();

   selectnot = timer_ocultar();

   proxnot = selectnot+accion;

   if ((selectnot==cantnot)&&(accion==1))
      actnot='notrot1';
   else
      if ((selectnot==1)&&(accion==-1))
         actnot='notrot'+cantnot;
      else
         actnot='notrot'+proxnot;

   document.getElementById(actnot).style.display='';

/*
   newcolor='#EFEFEF';
   document.getElementById('notrot2').style.display='';
   document.getElementById('notrot2').style.backgroundColor=newcolor;
*/
}

function timer_pausa()
{
   if (document.getElementById('estadotimer').value!='pausa')
   {
      document.getElementById('estadotimer').value='pausa';
      timer.pause();
   }
   else
   {
      document.getElementById('estadotimer').value='play';
      timer.resume();
   }
}

