/*
   Funciones javascript para uso genérico 
   Javascript generic functions 

   Nova Comunicación. http://www.internorma.com 

   Puedes usar y modificar estas funciones libremente,
   pero notificanos tus mejoras a info@internorma.com

   You may freely use and alter these functions
   but, please, notify your changes to info@internorma.com
*/

/*--------------------------------------------------------------------*/
/* Variables de uso común. */
/* Common use variables. */

var IE = /*@cc_on!@*/false;	


/*--------------------------------------------------------------------*/
/* Borra los elementos de una matriz (vector). */
/* Erases the elements of a matrix (vector). */

function BorrarArray(matriz)
{
  for(i=0;i<matriz.length;i++) matriz[i]=null;
}


/*--------------------------------------------------------------------*/
/* Genera un número aleatorio entre x e y. */
/* Returns a random numbre between x and y */

function randNum(x, y)
{
  var range = y - x + 1;
  return Math.floor(Math.random() * range) + x;
}


/*--------------------------------------------------------------------*/
/* SCROLLDIV */

var scrollid=1;  //id del div.
var timerUp,timerDown;
defaultStep=1
step=defaultStep

/*- - - - - - - - - - - - - - -*/
/* Desplaza contínuamente un div hacia abajo con incremento de "salto" */
/* Continuously moves a div upward with a step of "salto" */

function scrollDivDown(salto)
{
  step = salto ? salto : step; 
  var T=document.getElementById(scrollid).scrollTop;
  T+=step;
  document.getElementById(scrollid).scrollTop=T;
  if((T+document.getElementById(scrollid).clientHeight)<document.getElementById(scrollid).scrollHeight) timerDown=setTimeout("scrollDivDown(step)",20)
}


/*- - - - - - - - - - - - - - -*/
/* Desplaza contínuamente un div hacia arriba con incremento de "salto" */
/* Continuously moves a div downward with a step of "salto" */

function scrollDivUp(salto)
{
  step = salto ? salto : step; 
  var T=document.getElementById(scrollid).scrollTop;
  T-=step;
  document.getElementById(scrollid).scrollTop=T;
  if(T>0) timerUp=setTimeout("scrollDivUp(step)",20)
}


/*- - - - - - - - - - - - - - -*/
/* Detiene el scroll */
/* Scroll stopping */

function noScroll()
{
  step=defaultStep;
  clearTimeout(timerUp);
  clearTimeout(timerDown);
}


/*--------------------------------------------------------------------*/
/* FECHA / DATE */
 
/* Escribe la fecha en formato: www, dd de mmmm de yyyy */
/* Writes the date in the format: www, dd de mmmm de yyyy */
/* MostrarFecha --> Español / Spanish */
/* ShowDate --> Inglés / English */

function MostrarFecha()  
{  
  var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado")  
  var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")  
  var fecha_actual = new Date()  
  dia_mes = fecha_actual.getDate()     //dia del mes / Day of month 
  dia_semana = fecha_actual.getDay()       //dia de la semana / Day of week 
  mes = fecha_actual.getMonth() + 1  
  anio = fecha_actual.getFullYear()  
  document.write(nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio)  
}  

/*- - - - - - - - - - - - - - -*/
function ShowDate()  
{  
  var day_names = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")  
  var month_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")  
  var today = new Date()  
  month_day = today.getDate()     //dia del mes /Day of month 
  week_day = today.getDay()       //dia de la semana / Day of week 
  month = today.getMonth() + 1  
  year = today.getFullYear()  
  document.write(day_names[week_day] + ", " + month_names[month - 1] + " " + month_day + " " + year)  
}  

/*--------------------------------------------------------------------*/
/* Muestra un elemento oculto. */
/* Shows a hidden element. */

function showid(id)
{
  document.getElementById(id).style.display="block";
}

/*--------------------------------------------------------------------*/
/* Oculta un elemento visible. */
/* Hides a visible element. */

function hideid(id)
{
  document.getElementById(id).style.display="none";
}

