/********************************************************
-- JJBM, 26/11/2004, Calendario.eld
-- JJBM, 16/12/2004, cCalendarioComboIcono
-- Víctor, 19/09/2005, Cambiar colores
-- Víctor, 05/06/2006, Comprobar día en cCalendarioCombos_IrA
-- JJBM, 24/11/2006, posicionar correctamente la ventana respecto el cursor.
-- JJBM, 24/11/2006, normalizar colores.
--/
"#FF0000" //
********************************************************/
var calendario_COLOR_cal_borde = "gray" // Color del borde total de un calendario.
var calendario_COLOR_mes_borde = "gray" // Color del borde de todo mes interior.
var calendario_COLOR_int_borde = "gray" // Color del borde del interior de un mes.
var calendario_COLOR_diN_fondo = "#F0F0F0" // Celdas de días sin no disponibles.
var calendario_COLOR_diN_color = "#A0A0A0"
var calendario_COLOR_diS_fondo = "white" // Celdas de días sí disponibles.
var calendario_COLOR_diS_color = "black"
var calendario_COLOR_sem_fondo = "#022FD4" // Celdas de la cabecera con los días de la semana.
var calendario_COLOR_sem_color = "white"
var calendario_COLOR_fin_fondo = "#C0C43E" // Celdas de días disponibles en fin de semana.
var calendario_COLOR_fin_color = "#CC3300"
var calendario_COLOR_sel_fondo = "#2E1C86" // Celdas de días seleccionados.
var calendario_COLOR_sel_color = "white"
var calendario_COLOR_pes_fondo = "#A0A0A0" // Pestaña del calendario.
var calendario_COLOR_pes_color = "white"
var calendario_COLOR_anu_fondo = "#EBDB85" // Tabla del calendario anual.
var calendario_COLOR_anu_color = "#7A7E03"
/********************************************************
cIntervaloFechas
********************************************************/
function cIntervaloFechas( Fecha1, Fecha2 ) {
this.Fecha1 = Fecha1
this.Fecha2 = Fecha2
this.Siguiente = null
}
/********************************************************
cListaFechas
********************************************************/
function cListaFechas() {
this.Fechas = null
this.Fecha1 = new Date( 1900, 1, 1 )
this.Fecha2 = new Date( 2099, 1, 1 )
this.Acotar = function( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) {
this.Fecha1 = new Date( Anio1, Mes1, Dia1 )
this.Fecha2 = new Date( Anio2, Mes2, Dia2 )
}
this.Vaciar = function() {
this.Fechas = null
}
this.InsertarNodo = function( Nodo ) {
Nodo.Siguiente = this.Fechas
this.Fechas = Nodo
}
this.InsertarIntervalo = function( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) {
this.InsertarNodo( new cIntervaloFechas( new Date( Anio1, Mes1, Dia1 ),
new Date( Anio2, Mes2, Dia2 ) ) )
}
this.InsertarFecha = function ( Anio, Mes, Dia ) {
this.InsertarIntervalo( Anio, Mes, Dia, Anio, Mes, Dia )
}
this.Dentro = function ( Anio, Mes, Dia ) {
if( Dia == 0 ) return false
var d = new Date( Anio, Mes, Dia ), l = this.Fechas
if( d < this.Fecha1 || d > this.Fecha2 ) return false // Fuera de cotas.
for(; l!= null; l=l.Siguiente ) if( l.Fecha1<=d && d<=l.Fecha2 ) return true
return false
}
this.Sacar = function ( Anio, Mes, Dia ) {
if( this.Fechas != null ) {
var d = new Date( Anio, Mes, Dia )
if( this.Fechas.Fecha1 <= d && d <= this.Fechas.Fecha2 )
this.Fechas = this.Fechas.Siguiente
else {
var l = this.Fechas
for(; l.Siguiente != null; l = l.Siguiente )
if( l.Siguiente.Fecha1 <= d && d <= l.Siguiente.Fecha2 ) {
l.Siguiente = l.Siguiente.Siguiente
break
}
}
}
}
}
/********************************************************
cCalendario
********************************************************/
function cCalendario_xtra_Texto( Texto ) {
this.innerHTML = Texto
}
function cCalendario_Formatear(x,y) {
var o = this.TD(x,y)
with( o.style ) {
var bgc, col
if( x == 6 || ( this.Lunes && x == 5 ) || ( !this.Lunes && x == 0 ) )
{ bgc = this.FinFondo; col = this.FinColor }
else { bgc = this.DiaFondo; col = this.DiaColor }
if( !y ) { bgc = this.TitFondo; col = this.TitColor }
else
if( !this.Lista.Dentro( this.Anio, this.Mes, o.d ) )
{ bgc = this.DiaFFondo; col = this.DiaFColor }
else
if( this.Seleccion.Dentro( this.Anio, this.Mes, o.d ) )
{ bgc = this.SelFondo; col = this.SelColor }
backgroundColor = bgc
color = col
borderRight =
borderBottom = "solid 1px " + this.TabRejillaColor
textAlign = "center"
fontSize = "12px"
if( this.Lista.Dentro( this.Anio, this.Mes, o.d ) ) {
try { o.style.cursor = "pointer" }
catch(e) { o.style.cursor = "hand" } // IE5 falla con pointer
fontWeight = "bold"
} else {
o.style.cursor = "default"
fontWeight = "normal"
}
}
}
function cCalendario_Construir() {
var C = "", i, j
C += "
"
C += ""
for( j = 0; j < 7; j++, C += "" )
for( i = 0, C += ""; i < 7; i++ )
C += "| | "
C += " |
"
this.Capa.innerHTML = C
for( i = 0; i < 7; i++ )
for( j = 0; j < 7; j++ ) {
var o = this.TD(i,j)
o.d = 0; o.x = i; o.y = j; o.Calendario = this
o.onclick = this.TDOnClick
o.Texto = cCalendario_xtra_Texto
this.Formatear(i,j)
}
this.RellenarMes()
}
function cCalendario_TD(x,y) {
return eval("document.getElementById('" + this.Clase + "TD" + x + "x" + y + "')")
}
function cCalendario_TDOnClick() {
var c = this.Calendario
var s = c.Seleccion, l = c.Lista
var a = c.Anio, m = c.Mes, d = this.d
if( c.MultiSeleccion ) {
if( l.Dentro( a, m, d ) ) {
if( s.Dentro( a, m, d ) ) s.Sacar( a, m, d )
else s.InsertarFecha( a, m, d )
c.Formatear( this.x, this.y )
}
} else {
// Sólo una selección.
}
// Propagamos el evento:
this.Calendario.OnClick( this )
}
function cCalendario_RellenarDia( x, y, NDia ) {
with( this.TD(x,y) ) {
d = NDia
title = NDia ? NDia : ""
Texto( !NDia ? " " : this.Contenido[NDia] != "" ? this.Contenido[NDia] : NDia )
}
this.Formatear(x,y)
}
function cCalendario_DiaSemana( ds ) {
if( this.Lunes ) return ( ds + 1 ) % 7
return ds
}
function cCalendario_TextoDiaSemana( ds ) {
return aDiaSemana[ ds ]
}
function cCalendario_NumDiasMes( a, m ) {
return m==2?(28+(!(a%400)||(a%100&&!(a%4)))):(30+(m&1)^(m>7))
}
function cCalendario_SumarDias( n ) {
if( n > 0 ) this.AvanzarDias( n )
if( n < 0 ) this.RetrocederDias( -n )
}
function cCalendario_AvanzarDias( n ) {
var a = this.Anio, m = this.Mes, d = this.Dia
while(n--)if(d1)d--;else{if(m>1)m--;else{m=12;a--}d=this.NumDiasMes(a,m)}
this.Anio = a; this.Mes = m; this.Dia = d
}
function cCalendario_toDDMMAAAA( separador ) {
var s = ""
if( this.Dia < 10 ) s += "0"
s += this.Dia.toString() + separador
if( this.Mes < 10 ) s += "0"
return s + this.Mes.toString() + separador + this.Anio.toString()
}
function cCalendario_toDDMMAAAAsecuencia( ndias, separadorDMA, separadorFechas ) {
var s = "", c = new cCalendario( "null", "null", 1 ), q = ""
c.Dia = this.Dia; c.Mes = this.Mes; c.Anio = this.Anio
while( ndias-- ) {
s += q + c.toDDMMAAAA( separadorDMA )
q = separadorFechas
c.SumarDias( 1 )
}
return s
}
function cCalendario_RellenarMes() {
var D = new Date( this.Anio, this.Mes-1, 1 ), ic = 0, i, pds
var ND = this.NumDiasMes( this.Anio, this.Mes )
for( i = 0; i < 7; i++ ) this.TD(i,0).Texto(" "+this.TextoDiaSemana(this.DiaSemana(i))+" ")
while( this.DiaSemana( ic ) != ( pds = D.getDay() ) ) this.RellenarDia( ic++, 1, 0 )
for( i = 1; i <= ND; ic++, i++ ) this.RellenarDia( ic % 7, 1 + Math.floor( ic / 7 ), i )
for(; ic < 42; ic++ ) this.RellenarDia( ic % 7, 1 + Math.floor( ic / 7 ), 0 )
}
function cCalendario_NumDias() {
return this.NumDiasMes( this.Anio, this.Mes )
}
function cCalendario_InvertirSeleccion() {
var i, j, R = this.OnClick
this.OnClick = function(){}
for( i = 0; i < 7; i++ )
for( j = 1; j < 7; j++ )
with( this.TD(i,j) )
if( d )
onclick()
this.OnClick = R
}
function cCalendario_PoblarSeleccion( strTexto ) {
var i, j
for( i = 0; i < 7; i++ )
for( j = 1; j < 7; j++ )
with( this.TD(i,j) )
if( d )
if( this.Seleccion.Dentro( this.Anio, this.Mes, d ) ) {
this.Contenido[d] = strTexto
this.RellenarDia(x,y,d)
}
}
function cCalendario_Reformatear() {
var i, j
for( i = 0; i < 7; i++ )
for( j = 0; j < 7; j++ )
this.Formatear(i,j)
}
function cCalendario_SeleccionarContenido( strTexto ) {
var i, j
for( i = 0; i < 7; i++ )
for( j = 1; j < 7; j++ )
with( this.TD(i,j) )
if( d )
if( this.Contenido[d] == strTexto )
if( !this.Seleccion.Dentro( this.Anio, this.Mes, d ) ) {
this.Seleccion.InsertarFecha( this.Anio, this.Mes, d )
this.Formatear(x,y)
}
}
function cCalendario( Nombre, Soporte, EnLunes ) {
this.Clase = Nombre
this.Capa = Soporte
this.TabBordeColor = calendario_COLOR_mes_borde
this.TabRejillaColor = calendario_COLOR_int_borde
this.TitFondo = calendario_COLOR_sem_fondo
this.TitColor = calendario_COLOR_sem_color
this.DiaFondo = calendario_COLOR_diS_fondo
this.DiaColor = calendario_COLOR_diS_color
this.DiaFFondo = calendario_COLOR_diN_fondo
this.DiaFColor = calendario_COLOR_diN_color
this.FinFondo = calendario_COLOR_fin_fondo
this.FinColor = calendario_COLOR_fin_color
this.SelFondo = calendario_COLOR_sel_fondo
this.SelColor = calendario_COLOR_sel_color
this.Lunes = EnLunes
this.Anio = 2004
this.Mes = 1
this.Contenido = new Array()
{ var i = 1; while(i<32) this.Contenido[i++] = "" }
this.ArrastreMes = 0
this.ArrastreDia = 0
this.MultiSeleccion = false
this.Lista = new cListaFechas()
this.Seleccion = new cListaFechas()
this.Construir = cCalendario_Construir
this.TD = cCalendario_TD
this.TDOnClick = cCalendario_TDOnClick
this.RellenarMes = cCalendario_RellenarMes
this.RellenarDia = cCalendario_RellenarDia
this.DiaSemana = cCalendario_DiaSemana
this.TextoDiaSemana = cCalendario_TextoDiaSemana
this.NumDiasMes = cCalendario_NumDiasMes
this.Formatear = cCalendario_Formatear
this.NumDias = cCalendario_NumDias
this.InvertirSeleccion = cCalendario_InvertirSeleccion
this.PoblarSeleccion = cCalendario_PoblarSeleccion
this.Reformatear = cCalendario_Reformatear
this.SeleccionarContenido = cCalendario_SeleccionarContenido
this.OnClick = function( TD ) {} // Virtual.
this.SumarDias = cCalendario_SumarDias
this.AvanzarDias = cCalendario_AvanzarDias
this.RetrocederDias = cCalendario_RetrocederDias
this.toDDMMAAAA = cCalendario_toDDMMAAAA
this.toDDMMAAAAsecuencia = cCalendario_toDDMMAAAAsecuencia
}
/*******************************************************/
/********************************************************
cCalendarioSelector
********************************************************/
function cCalendarioSelector_Construir() {
var C = ""
C += ""
C += ""
C += "| << | "
C += "2004 | "
C += ">> |
"
C += "| |
"
C += "
"
this.Capa.innerHTML = C
this.Calendario = new cCalendario( this.Clase + ".Calendario", document.getElementById( this.Clase + ".Calendario" ), this.Lunes )
this.FormatearTitulo()
}
function cCalendarioSelector_FormatearTitulo() {
if( this.Mes == 0 ) { this.Mes = 12; this.Anio-- }
if( this.Mes == 13 ) { this.Mes = 1; this.Anio++ }
if( this.Calendario.Lista.Fecha1 > new Date( this.Anio, this.Mes, this.Calendario.NumDiasMes( this.Anio, this.Mes ) ) )
this.OnDerecha()
if( this.Calendario.Lista.Fecha2 < new Date( this.Anio, this.Mes, 1 ) )
this.OnIzquierda()
document.getElementById(this.Clase + ".Titulo").innerHTML = aMesAnio[ this.Mes-1 ] + " " + this.Anio
this.Calendario.Anio = this.Anio
this.Calendario.Mes = this.Mes
this.Calendario.Construir()
}
function cCalendarioSelector_OnIzquierda() {
this.Mes--; this.FormatearTitulo()
}
function cCalendarioSelector_OnDerecha() {
this.Mes++; this.FormatearTitulo()
}
function cCalendarioSelector_IrA( mes, anio ) {
this.Anio = anio
this.Mes = mes
this.FormatearTitulo()
}
function cCalendarioSelector( Nombre, Soporte, EnLunes ) {
this.Clase = Nombre
this.Capa = Soporte
this.Calendario = null
this.BordeColor = calendario_COLOR_cal_borde
this.Fondo = calendario_COLOR_pes_fondo
this.Anio = 2004
this.Mes = 11
this.Lunes = EnLunes
this.Construir = cCalendarioSelector_Construir
this.OnIzquierda = cCalendarioSelector_OnIzquierda
this.OnDerecha = cCalendarioSelector_OnDerecha
this.FormatearTitulo = cCalendarioSelector_FormatearTitulo
this.IrA = cCalendarioSelector_IrA
}
/*******************************************************/
/********************************************************
cCalendarioAnual
********************************************************/
function cCalendarioAnual_Construir( Filas, Columnas ) {
var C = "", i, j, k
if( Filas * Columnas != 12 ) alert("¡Filas*Columnas deberían ser 12!")
C += ""
for( k = 0, i = 0; i < Filas; i++ ) {
C += ""
for( j = 0; j < Columnas; j++ ) C += "| " + aMesAnioLargo[k+j] + " | "
C += "
"
C += ""
for( j = 0; j < Columnas; j++ ) C += "| | "
C += "
"
}
this.Capa.innerHTML = C
for( k = 0; k < 12; k++ ) {
this.Calendario[k] = new cCalendario( this.Clase + ".Calendario." + k, document.getElementById( this.Clase + ".Calendario." + k ), this.Lunes )
this.Calendario[k].Anio = this.Anio
this.Calendario[k].Mes = k+1
this.Calendario[k].MultiSeleccion = this.MultiSeleccion
}
}
function cCalendarioAnual( Nombre, Soporte, EnLunes ) {
this.Clase = Nombre
this.Capa = Soporte
this.BordeColor = "black"
this.Fondo = calendario_COLOR_anu_fondo
this.Color = calendario_COLOR_anu_color
this.Anio = 2004
this.Lunes = EnLunes
this.MultiSeleccion = false
this.Calendario = new Array()
this.Construir = cCalendarioAnual_Construir
// Utiliza los miembros de cListaFechas para propagarlas a todos los calendarios:
this.ListaAcotar = function( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Lista.Acotar( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) }
this.ListaVaciar = function() { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Lista.Vaciar() }
this.ListaInsertarIntervalo = function( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Lista.InsertarIntervalo( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) }
this.ListaInsertarFecha = function ( Anio, Mes, Dia ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Lista.InsertarFecha( Anio, Mes, Dia ) }
this.ListaDentro = function ( Anio, Mes, Dia ) { var i; for( i = 0; i < 12; i++ ) if( this.Calendario[i].Lista.Dentro( Anio, Mes, Dia ) ) return true; return false }
this.ListaSacar = function ( Anio, Mes, Dia ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Lista.Sacar( Anio, Mes, Dia ) }
this.SeleccionAcotar = function( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Seleccion.Acotar( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) }
this.SeleccionVaciar = function() { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Seleccion.Vaciar() }
this.SeleccionInsertarIntervalo = function( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Seleccion.InsertarIntervalo( Anio1, Mes1, Dia1, Anio2, Mes2, Dia2 ) }
this.SeleccionInsertarFecha = function ( Anio, Mes, Dia ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Seleccion.InsertarFecha( Anio, Mes, Dia ) }
this.SeleccionDentro = function ( Anio, Mes, Dia ) { var i; for( i = 0; i < 12; i++ ) if( this.Calendario[i].Seleccion.Dentro( Anio, Mes, Dia ) ) return true; return false }
this.SeleccionSacar = function ( Anio, Mes, Dia ) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Seleccion.Sacar( Anio, Mes, Dia ) }
this.InvertirSeleccion = function() { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].InvertirSeleccion() }
this.PoblarSeleccion = function(Texto) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].PoblarSeleccion(Texto) }
this.Reformatear = function() { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Reformatear() }
this.SeleccionarContenido = function(Texto) { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].SeleccionarContenido(Texto) }
// Métodos para realizar llamadas a todos los calendarios a la vez:
this.AniosConstruir = function() { var i; for( i = 0; i < 12; i++ ) this.Calendario[i].Construir() }
}
/********************************************************
********************************************************/
/********************************************************
cCalendarioCombos
********************************************************/
function cCalendarioCombos_Construir(nombre_combo, mes_largo) {
var C = "",i,ob
if(mes_largo)
ob = aMesAnioLargo
else
ob = aMesAnio
//Ponemos el combo de días
C += ""
//Ponemos el combo de meses
C += ""
//Ponemos el combo de años
var j
i = this.AnioIni
j = this.AnioFin
C += ""
this.Capa.innerHTML = C
this.CDia = document.getElementById(this.Clase + "_dia")
this.CMes = document.getElementById(this.Clase + "_mes")
this.CAnio = document.getElementById(this.Clase + "_anio")
}
function cCalendarioCombos_Ajustar() {
var i = cCalendario_NumDiasMes( this.Anio, this.Mes )
// Comprobamos si hay más días de los necesarios, quitamos
if( this.CDia.length > i )
while( this.CDia.length > i )
this.CDia.options[this.CDia.length-1] = null
//Comprobamos si hay menos días de los necesarios, metemos
if( this.CDia.length < i )
while( this.CDia.length < i )
this.CDia.options[ this.CDia.length ] = new Option(this.CDia.length+1,this.CDia.length+1)
// Establecemos el día, mes y año que corresponde:
if( this.Dia - 1 >= i )
this.CDia.selectedIndex = this.CDia.length - 1
else
this.CDia.selectedIndex = this.Dia - 1
this.CMes.selectedIndex = this.Mes - 1
for( i = 0; i < this.CAnio.length; i++ )
if( this.CAnio[ i ].value == this.Anio )
this.CAnio.selectedIndex = i
this.OnCambio()
}
function cCalendarioCombos_CambiaDia() {
this.Dia = this.CDia.selectedIndex + 1
this.Ajustar()
}
function cCalendarioCombos_CambiaMes() {
this.Mes = this.CMes.selectedIndex + 1
this.Ajustar()
}
function cCalendarioCombos_CambiaAnio() {
this.Anio = this.CAnio[ this.CAnio.selectedIndex ].value
this.Ajustar()
}
function cCalendarioCombos_IrA( dia, mes, anio ) {
if (dia > cCalendario_NumDiasMes( anio, mes ) ) dia = cCalendario_NumDiasMes( anio, mes )
if( this.Anio != anio || this.Mes != mes || this.Dia != dia ) {
this.Anio = anio
this.Mes = mes
this.Dia = dia
this.Ajustar()
}
}
function cCalendarioCombos( Nombre, Soporte /* anio_inicial, anio_final */ ) {
this.Clase = Nombre
this.Capa = Soporte
this.Anio = 2004
this.Mes = 1
this.Dia = 1
this.AnioIni = cCalendarioCombos.arguments.length >= 3 ? cCalendarioCombos.arguments[2]*1 : (new Date).getFullYear()
this.AnioFin = cCalendarioCombos.arguments.length >= 4 ? cCalendarioCombos.arguments[3]*1 : ( this.AnioIni + 3 )
this.Construir = cCalendarioCombos_Construir
this.CambiaDia = cCalendarioCombos_CambiaDia
this.CambiaMes = cCalendarioCombos_CambiaMes
this.CambiaAnio = cCalendarioCombos_CambiaAnio
this.Ajustar = cCalendarioCombos_Ajustar
this.IrA = cCalendarioCombos_IrA
this.OnCambio = function(){}
}
/********************************************************
********************************************************/
/********************************************************
cCalendarioIcono
********************************************************/
function cCalendarioIcono_Construir(nombre_combo, mes_largo) {
var C = ""
this.NFrame = this.Clase.replace( /\./g, '_' ) + "_Capa_ifr"
C += "
"
C += ""
if( !window.Event )
C += ""
C += "
"
this.Capa.innerHTML = C
this.Destino = document.getElementById( this.Clase+"_Capa" )
if( window.Event ) {
eval("document.getElementById('" + this.NFrame + "c').onclick = function (e) {"+this.Clase+".Muestra_Calendario(e)}")
this.Calendario = new cCalendarioSelector( this.Clase + ".Calendario", this.Destino, this.Lunes )
}
}
function cCalendarioIcono_IrA( dia, mes, anio ) {
if( this.Anio != anio || this.Mes != mes || this.Dia != dia ) {
this.Anio = anio
this.Mes = mes
this.Dia = dia
}
}
function cCalendarioIcono_Acotar(ai,mi,di,af,mf,df) {
this.Dia_i = di; this.Mes_i = mi; this.Anio_i = ai
this.Dia_f = df; this.Mes_f = mf; this.Anio_f = af
}
function cCalendarioIcono_Ocultar() {
this.Destino.style.visibility = 'hidden'
}
function cCalendarioIcono_Muestra_calendario(e) {
if( this.Destino.style.visibility == 'visible' ) {
this.Ocultar()
if( this.AlOcultar != null )
this.AlOcultar()
} else {
if( !window.Event )
this.Calendario = eval( this.NFrame + ".Calendario" )
this.Calendario.Anio = this.Anio
this.Calendario.Mes = this.Mes
this.Calendario.Construir()
this.Calendario.Calendario.CalendarioIcono = this
this.Calendario.Calendario.Lista.Acotar (this.Anio_i,this.Mes_i,this.Dia_i,this.Anio_f,this.Mes_f,this.Dia_f)
this.Calendario.Calendario.Lista.InsertarIntervalo(this.Anio_i,this.Mes_i,this.Dia_i,this.Anio_f,this.Mes_f,this.Dia_f)
this.Calendario.Calendario.OnClick = function (td) {
if( td.Calendario.Lista.Dentro( td.Calendario.Anio, td.Calendario.Mes, td.d ) ) {
td.Calendario.CalendarioIcono.Dia = td.d
td.Calendario.CalendarioIcono.Mes = td.Calendario.Mes
td.Calendario.CalendarioIcono.Anio = td.Calendario.Anio
td.Calendario.CalendarioIcono.Destino.style.visibility = 'hidden'
td.Calendario.CalendarioIcono.OnCambio()
}
}
this.Calendario.Calendario.Construir()
//Posición y visibilidad de la capa con el calendario
this.Destino.style.visibility = 'visible'
var x, y
if( window.Event ) {
x = e.clientX
y = e.clientY
} else {
x = event.clientX
y = event.clientY
}
this.Posicionar( ( x + document.body.scrollLeft ) - 155 + "px", ( y + document.body.scrollTop ) + 15 + "px" )
if( this.AlMostrar != null )
this.AlMostrar()
}
}
function cCalendarioIcono_Posicionar( x, y ) {
this.Destino.style.top = y
this.Destino.style.left = x
}
function cCalendarioIcono( Nombre, Soporte, EnLunes ) {
this.Clase = Nombre
this.Capa = Soporte
//this.Destino = aún no asignada
//this.NFrame = nombre del frame, aún no asignado
this.Anio = 2004
this.Mes = 1
this.Dia = 1
this.Lunes = EnLunes
this.Imagen = "./calendario.gif"
this.Construir = cCalendarioIcono_Construir
this.Muestra_Calendario = cCalendarioIcono_Muestra_calendario
//this.Calendario = aún no asignado
this.Acotar = cCalendarioIcono_Acotar
this.IrA = cCalendarioIcono_IrA
this.OnCambio = function(){}
this.Posicionar = cCalendarioIcono_Posicionar
this.AlMostrar = null
this.AlOcultar = null
this.Ocultar = cCalendarioIcono_Ocultar
this.Acotar( 2004, 1, 15, 2005, 1, 1 )
}
/********************************************************
********************************************************/
function cCalendarioComboIcono_IrA( dia, mes, anio ) {
this.Anio = anio
this.Mes = mes
this.Dia = dia
this.Combo.IrA( dia, mes, anio )
this.Icono.IrA( dia, mes, anio )
this.OnCambio()
}
function cCalendarioComboIcono_Construir() {
this.Icono.Construir()
this.Combo.Construir()
this.IrA( 1, 1, 2004 )
}
function cCalendarioComboIcono( Nombre, SoporteIcono, SoporteCombo, EnLunes ) {
this.Clase = Nombre
this.Icono = new cCalendarioIcono ( this.Clase + ".Icono", SoporteIcono, EnLunes )
this.Combo = new cCalendarioCombos ( this.Clase + ".Combo", SoporteCombo )
this.Icono.Padre =
this.Combo.Padre = this
this.Icono.OnCambio =
this.Combo.OnCambio = function() { this.Padre.IrA( this.Dia, this.Mes, this.Anio ) }
this.Construir = cCalendarioComboIcono_Construir
this.IrA = cCalendarioComboIcono_IrA
this.OnCambio = function() {}
}
/********************************************************
********************************************************/