// Tratamiento de Fechas

var laFecha = new Date ();
var LUNES = 1;
var MARTES = 2;
var MIERCOLES = 3;
var JUEVES = 4;
var VIERNES = 5;
var SABADO = 6;
var DOMINGO = 0;

// Global to store handle to popup window.
var oPopupWin;

function isDay (aDay)
{
     return (laFecha.getDate () == aDay);
}

function betweenDays (firstDay, lastDay)
{
    return ((laFecha.getDate () > firstDay) && (laFecha.getDate () < lastDay));
}


function isWeekday (aWeekDay)
{
     return (laFecha.getDay () == aWeekDay);
}


function betweenWeekdays (firstDay, lastDay)
{
    return ((laFecha.getDay () > firstDay) && (laFecha.getDay () < lastDay));
}


function isHour (anHour)
{
    return (laFecha.getHours () == anHour);
}


function betweenHours (horaIni, horaFin)
{
   return ((horaIni < laFecha.getHours ()) && (horaFin > laFecha.getHours ()));
}                 

function getYear() {
   date = new Date();
   var year = date.getYear()   
   if (year<200)
   year+=1900;
   return year;
}   

function display_title() {
  var hours = date.getHours();
  var message = '';

  if (hours >= 6) { time_of_day = 'Buenos Días'; message='Morning Message';}
  if ((hours >= 14) && (hours < 21)) { time_of_day = 'Buenas Tardes'; message='Afternoon Message'}
  if (hours >= 21) { time_of_day = 'Buenas Noches'; message='Evening Message';}
  if ((hours >= 0) && (hours < 6)){ time_of_day = 'Buenas Noches'; message='Night Message';}

  document.write('<font color="white"><left>' + time_of_day + ' </left></font>');
}

function display_date() {

   date = new Date();

   var day_of_week_number = date.getDay();
   var day_of_month = date.getDate();
   var month_number = date.getMonth();
   var year = getYear();
   var day_of_week = '';
   var month = '' 

   if(month_number == 0){month = 'Enero';}
   if(month_number == 1){month = 'Febrero';}
   if(month_number == 2){month = 'Marzo';}
   if(month_number == 3){month = 'Abril';}
   if(month_number == 4){month = 'Mayo';}
   if(month_number == 5){month = 'Junio';}
   if(month_number == 6){month = 'Julio';}
   if(month_number == 7){month = 'Agosto';}
   if(month_number == 8){month = 'Septiembre';}
   if(month_number == 9){month = 'Octubre';}
   if(month_number == 10){month = 'Noviembre';}
   if(month_number == 11){month ='Diciembre';}


   if(day_of_week_number == 0){day_of_week = 'Domingo';}
   if(day_of_week_number == 1){day_of_week = 'Lunes';}
   if(day_of_week_number == 2){day_of_week = 'Martes';}
   if(day_of_week_number == 3){day_of_week = 'Miercoles';}
   if(day_of_week_number == 4){day_of_week = 'Jueves';}
   if(day_of_week_number == 5){day_of_week = 'Viernes';}
   if(day_of_week_number == 6){day_of_week = 'Sábado';} 

   var date_to_show = day_of_week + ',  ' + day_of_month + '  ' + month +  '  ' + year + '. ';

   document.write('<left>' + date_to_show.fontcolor("white") + '</left>');

}



// Popup Window
    function popup(page, width, height) {
        var tmp;
        if (oPopupWin) {
            // Make sure oPopupWin is empty before
            // calling .close() or we could throw an
            // exception and never set it to null.
            oPopupWin.close();
            tmp = oPopupWin;
            oPopupWin = null;
        }
        //Open the popup window
        oPopupWin = window.open(page, "IntlPopup",
"alwaysRaised=1,dependent=1,height=" + height +
",location=0,menubar=0,personalbar=0,scrollbars=1,status=0,toolbar=0,width="
+ width + ",resizable=0"); 
        oPopupWin.focus();
        return !oPopupWin;
    }

function abrir(){ 
control=window.open('calendario.htm','control','alwaysRaised=yes,scrollbars=1,width=720,height=500,resizable=no'); 
return; }
