var festivos = [5,6];
var festivosColor = "#AAC4D5";
var familia_fuente = "Verdana";
var size_fuente = 1;
var ahora = new Date();
var calculo;
if (document.layers)
isNav = true;
else if (document.all)
isIE = true;
Calendario.Meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Deciembre"];
Calendario.DiasMes = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
Calendario.BisiestoDiasMes = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function Calendario(p_item, p_WinCal, mes, anyo, formato)
{
if ((mes == null) && (anyo == null))
return;
if (p_WinCal == null)
this.gWinCal = calculo;
else
this.gWinCal = p_WinCal;
if (mes == null)
{
this.dameMes = null;
this.dameNumeroMes = null;
this.dameAnyo = true;
}
else
{
this.dameMes = Calendario.get_month(mes);
this.dameNumeroMes = new Number(mes);
this.dameAnyo = false;
}
this.gYear = anyo;
this.gFormat = formato;
this.gBGColor = "#D1E2ED";
this.gFGColor = "black";
this.gTextColor = "black";
this.gHeaderColor = "black";
this.gReturnp_item = p_item;
}
Calendario.get_month = Calendario_get_month;
Calendario.get_diasdelmes = Calendario_get_diasdelmes;
Calendario.calcula_mes_anyo = Calendario_calcula_mes_anyo;
Calendario.print = Calendario_print;
function Calendario_get_month(monthNo)
{
return Calendario.Meses[monthNo];
}
function Calendario_get_diasdelmes(monthNo, anyo)
{
if ((anyo % 4) == 0)
{
if ((anyo % 100) == 0 && (anyo % 400) != 0)
return Calendario.DiasMes[monthNo];
return Calendario.BisiestoDiasMes[monthNo];
}
else
return Calendario.DiasMes[monthNo];
}
function Calendario_calcula_mes_anyo(mes, anyo, incremento)
{
var ret_arr = new Array();
if (incremento == -1)
{
/**
* hacia atras
*/
if (mes == 0)
{
ret_arr[0] = 11;
ret_arr[1] = parseInt(anyo) - 1;
}
else
{
ret_arr[0] = parseInt(mes) - 1;
ret_arr[1] = parseInt(anyo);
}
}
/**
* hacia adelante
*/
else if (incremento == 1)
{
if (mes == 11)
{
ret_arr[0] = 0;
ret_arr[1] = parseInt(anyo) + 1;
}
else
{
ret_arr[0] = parseInt(mes) + 1;
ret_arr[1] = parseInt(anyo);
}
}
return ret_arr;
}
function Calendario_print()
{
calculo.print();
}
Calendario.prototype.getMonthlyCalendarioCode = function()
{
var vCode = "";
var vHeader_Code = "";
var vData_Code = "";
vCode = vCode + "
";
vHeader_Code = this.cal_header();
vData_Code = this.cal_data();
vCode = vCode + vHeader_Code + vData_Code;
vCode = vCode + "
";
return vCode;
}
Calendario.prototype.show = function()
{
var vCode = "";
this.gWinCal.document.open();
this.wwrite("");
this.wwrite("Calendario Buzoneo.info");
this.wwrite("");
this.wwrite("");
this.wwriteA("");
this.wwriteA(this.dameMes + " " + this.gYear);
this.wwriteA("
");
var prevMMYYYY = Calendario.calcula_mes_anyo(this.dameNumeroMes, this.gYear, -1);
var prevMM = prevMMYYYY[0];
var prevYYYY = prevMMYYYY[1];
var nextMMYYYY = Calendario.calcula_mes_anyo(this.dameNumeroMes, this.gYear, 1);
var nextMM = nextMMYYYY[0];
var nextYYYY = nextMMYYYY[1];
this.wwrite("
");
vCode = this.getMonthlyCalendarioCode();
this.wwrite(vCode);
this.wwrite("");
this.gWinCal.document.close();
}
Calendario.prototype.showY = function()
{
var vCode = "";
var i;
var vr, vc, vx, vy;
var vxf = 285;
var vyf = 200;
var vxm = 10;
var vym;
if (isIE)
vym = 75;
else if (isNav)
vym = 25;
this.gWinCal.document.open();
this.wwrite("");
this.wwrite("Calendario Buzoneo.info");
this.wwrite("");
this.wwrite("");
this.wwrite(""); ;
this.wwrite("");
this.wwrite("Year : " + this.gYear);
this.wwrite("
");
var prevYYYY = parseInt(this.gYear) - 1;
var nextYYYY = parseInt(this.gYear) + 1;
this.wwrite("
");
var j;
for (i=11; i>=0; i--)
{
if (isIE)
this.wwrite("");
else if (isNav)
this.wwrite("");
this.dameNumeroMes = i;
this.dameMes = Calendario.get_month(this.dameNumeroMes);
vCode = this.getMonthlyCalendarioCode();
this.wwrite(this.dameMes + "/" + this.gYear + "
");
this.wwrite(vCode);
if (isIE)
this.wwrite("
");
else if (isNav)
this.wwrite("");
}
this.wwrite("
");
this.gWinCal.document.close();
}
Calendario.prototype.wwrite = function(wtext)
{
this.gWinCal.document.writeln(wtext);
}
Calendario.prototype.wwriteA = function(wtext)
{
this.gWinCal.document.write(wtext);
}
Calendario.prototype.cal_header = function()
{
var vCode = "";
vCode = vCode + "";
vCode = vCode + "| Lunes | ";
vCode = vCode + "Martes | ";
vCode = vCode + "Miercoles | ";
vCode = vCode + "Jueves | ";
vCode = vCode + "Viernes | ";
vCode = vCode + "Sábado | ";
vCode = vCode + "Domingo | ";
vCode = vCode + "
";
return vCode;
}
Calendario.prototype.cal_data = function()
{
var vDate = new Date();
vDate.setDate(1);
vDate.setMonth(this.dameNumeroMes);
vDate.setFullYear(this.gYear);
var vFirstDay=vDate.getDay()-1;
var vDay=1;
var vLastDay=Calendario.get_diasdelmes(this.dameNumeroMes, this.gYear);
var vOnLastDay=0;
var vCode = "";
vCode = vCode + "";
if(vFirstDay==-1)
{
for (i=0; i<6; i++)
{
vCode = vCode + "| | ";
}
for (j=6; j<7; j++)
{
vCode = vCode + "" +
"" + this.format_day(vDay) + "" +
" | ";
vDay=vDay+1;
}
}
else
{
for (i=0; i ";
}
for (j=vFirstDay; j<7; j++)
{
vCode = vCode + "" +
"" +
this.format_day(vDay) +
"" +
" | ";
vDay=vDay+1;
}
}
vCode = vCode + "
";
for (k=2; k<7; k++)
{
vCode = vCode + "";
for (j=0; j<7; j++)
{
vCode = vCode + "| " +
"" +
this.format_day(vDay) +
"" +
" | ";
vDay=vDay + 1;
if (vDay > vLastDay)
{
vOnLastDay = 1;
break;
}
}
if (j == 6)
vCode = vCode + "
";
if (vOnLastDay == 1)
break;
}
for (m=1; m<(7-j); m++)
{
if (this.dameAnyo)
vCode = vCode + " | ";
else
vCode = vCode + "" + m + " | ";
}
return vCode;
}
Calendario.prototype.format_day = function(vday)
{
var vNowDay = ahora.getDate();
var vNowMonth = ahora.getMonth();
var vNowYear = ahora.getFullYear();
if (vday == this.gYear == vNowYear && this.dameNumeroMes == vNowMonth && vNowDay)
return ("" + vday + "");
else
return (vday);
}
Calendario.prototype.write_festivos_string = function(vday)
{
var i;
for (i=0; i