2010-12-02 23:34:41 +00:00
/ * *
* _ _ _ _ _ _ _ _ _
2011-05-10 18:58:57 -04:00
* Dynarch Calendar -- JSCal2 , version 1.9 \ / _ / /
* Built at 2011 / 03 / 13 10 : 28 GMT \ / / /
2010-12-02 23:34:41 +00:00
* \ / /_ /
* ( c ) Dynarch . com 2009 \ / /
* All rights reserved . / /
* Visit www . dynarch . com / projects / calendar for details \ /
*
* /
2013-04-29 17:55:48 -04:00
function getElementsByClassName ( node , classname ) {
var a = [ ] ;
var re = new RegExp ( '(^| )' + classname + '( |$)' ) ;
var els = node . getElementsByTagName ( "*" ) ;
for ( var i = 0 , j = els . length ; i < j ; i ++ )
if ( re . test ( els [ i ] . className ) ) a . push ( els [ i ] ) ;
return a ;
}
2012-12-21 14:45:30 -04:00
var _ _lastMasks _ _ = { } ;
2013-05-08 11:07:37 -04:00
Calendar = function ( ) { function bm ( a ) { typeof a == "string" && ( a = document . getElementById ( a ) ) ; return a } function bk ( a , b , c ) { for ( c = 0 ; c < a . length ; ++ c ) b ( a [ c ] ) } function bj ( ) { var a = document . documentElement , b = document . body ; return { x : a . scrollLeft || b . scrollLeft , y : a . scrollTop || b . scrollTop , w : a . clientWidth || window . innerWidth || b . clientWidth , h : a . clientHeight || window . innerHeight || b . clientHeight } } function bi ( a ) { var b = 0 , c = 0 , d = /^div$/i . test ( a . tagName ) , e , f ; d && a . scrollLeft && ( b = a . scrollLeft ) , d && a . scrollTop && ( c = a . scrollTop ) , e = { x : a . offsetLeft - b , y : a . offsetTop - c } , a . offsetParent && ( f = bi ( a . offsetParent ) , e . x += f . x , e . y += f . y ) ; return e } function bh ( a , b ) { var c = e ? a . clientX + document . body . scrollLeft : a . pageX , d = e ? a . clientY + document . body . scrollTop : a . pageY ; b && ( c -= b . x , d -= b . y ) ; return { x : c , y : d } } function bg ( a , b ) { var c = a . style ; b != null && ( c . display = b ? "" : "none" ) ; return c . display != "none" } function bf ( a , b ) { b === "" ? e ? a . style . filter = "" : a . style . opacity = "" : b != null ? e ? a . style . filter = "alpha(opacity=" + b * 100 + ")" : a . style . opacity = b : e ? /alpha\(opacity=([0-9.])+\)/ . test ( a . style . opacity ) && ( b = parseFloat ( RegExp . $1 ) / 100 ) : b = parseFloat ( a . style . opacity ) ; return b } function bd ( a , b , c ) { function h ( ) { var b = a . len ; a . onUpdate ( c / b , d ) , c == b && g ( ) , ++ c } function g ( ) { b && ( clearInterval ( b ) , b = null ) , a . onStop ( c / a . len , d ) } function f ( ) { b && g ( ) , c = 0 , b = setInterval ( h , 1e3 / a . fps ) } function d ( a , b , c , d ) { return d ? c + a * ( b - c ) : b + a * ( c - b ) } a = U ( a , { fps : 50 , len : 15 , onUpdate : bl , onStop : bl } ) , e && ( a . len = Math . round ( a . len / 2 ) ) , f ( ) ; return { start : f , stop : g , update : h , args : a , map : d } } function bc ( a , b ) { if ( ! b ( a ) ) for ( var c = a . firstChild ; c ; c = c . nextSibling ) c . nodeType == 1 && bc ( c , b ) } function bb ( a , b ) { var c = ba ( arguments , 2 ) ; return b == undefined ? function ( ) { return a . apply ( this , c . concat ( ba ( arguments ) ) ) } : function ( ) { return a . apply ( b , c . concat ( ba ( arguments ) ) ) } } function ba ( a , b ) { b == null && ( b = 0 ) ; var c , d , e ; try { c = Array . prototype . slice . call ( a , b ) } catch ( f ) { c = Array ( a . length - b ) ; for ( d = b , e = 0 ; d < a . length ; ++ d , ++ e ) c [ e ] = a [ d ] } return c } function _ ( a , b , c ) { var d = null ; document . createElementNS ? d = document . createElementNS ( "http://www.w3.org/1999/xhtml" , a ) : d = document . createElement ( a ) , b && ( d . className = b ) , c && c . appendChild ( d ) ; return d } function $ ( a , b , c ) { if ( b instanceof Array ) for ( var d = b . length ; -- d >= 0 ; ) $ ( a , b [ d ] , c ) ; else Y ( b , c , a ? c : null ) ; return a } function Z ( a , b ) { return Y ( a , b , b ) } function Y ( a , b , c ) { if ( a ) { var d = a . className . replace ( /^\s+|\s+$/ , "" ) . split ( /\x20/ ) , e = [ ] , f ; for ( f = d . length ; f > 0 ; ) d [ -- f ] != b && e . push ( d [ f ] ) ; c && e . push ( c ) , a . className = e . join ( " " ) } return c } function X ( a ) { a = a || window . event , e ? ( a . cancelBubble = ! 0 , a . returnValue = ! 1 ) : ( a . preventDefault ( ) , a . stopPropagation ( ) ) ; return ! 1 } function W ( a , b , c , d ) { if ( a instanceof Array ) for ( var f = a . length ; -- f >= 0 ; ) W ( a [ f ] , b , c ) ; else if ( typeof b == "object" ) for ( var f in b ) b . hasOwnProperty ( f ) && W ( a , f , b [ f ] , c ) ; else a . removeEventListener ? a . removeEventListener ( b , c , e ? ! 0 : ! ! d ) : a . detachEvent ? a . detachEvent ( "on" + b , c ) : a [ "on" + b ] = null } function V ( a , b , c , d ) { if ( a instanceof Array ) for ( var f = a . length ; -- f >= 0 ; ) V ( a [ f ] , b , c , d ) ; else if ( typeof b == "object" ) for ( var f in b ) b . hasOwnProperty ( f ) && V ( a , f , b [ f ] , c ) ; else a . addEventListener ? a . addEventListener ( b , c , e ? ! 0 : ! ! d ) : a . attachEvent ? a . attachEvent ( "on" + b , c ) : a [ "on" + b ] = c } function U ( a , b , c , d ) { d = { } ; for ( c in b ) b . hasOwnProperty ( c ) && ( d [ c ] = b [ c ] ) ; for ( c in a ) a . hasOwnProperty ( c ) && ( d [ c ] = a [ c ] ) ; return d } function T ( a ) { if ( /\S/ . test ( a ) ) { a = a . toLowerCase ( ) ; function b ( b ) { for ( var c = b . length ; -- c >= 0 ; ) if ( b [ c ] . toLowerCase ( ) . indexOf ( a ) == 0 ) return c + 1 } return b ( L ( "smn" ) ) || b ( L ( "mn" ) ) } } function S ( a ) { if ( a ) { if ( typeof a == "number" ) return P ( a ) ; if ( ! ( a instanceof Date ) ) { var b = a . split ( /-/ ) ; return new Date ( parseInt ( b [ 0 ] , 10 ) , parseInt ( b [ 1 ] , 10 ) - 1 , parseInt ( b [ 2 ] , 10 ) , 12 , 0 , 0 , 0 ) } } return a } function R ( a , b ) { var c = a . getMonth ( ) , d = a . getDate ( ) , e = a . getFullYear ( ) , f = M ( a ) , g = a . getDay ( ) , h = a . getHours ( ) , i = h >= 12 , j = i ? h - 12 : h , k = N ( a ) , l = a . getMinutes ( ) , m = a . getSeconds ( ) , n = /%./g , o ; j === 0 && ( j = 12 ) , o = { "%a" : L ( "sdn" ) [ g ] , "%A" : L ( "dn" ) [ g ] , "%b" : L ( "smn" ) [ c ] , "%B" : L ( "mn" ) [ c ] , "%C" : 1 + Math . floor ( e / 100 ) , "%d" : d < 10 ? "0" + d : d , "%e" : d , "%H" : h < 10 ? "0" + h : h , "%I" : j < 10 ? "0" + j : j , "%j" : k < 10 ? "00" + k : k < 100 ? "0" + k : k , "%k" : h , "%l" : j , "%m" : c < 9 ? "0" + ( 1 + c ) : 1 + c , "%o" : 1 + c , "%M" : l < 10 ? "0" + l : l , "%n" : "\n" , "%p" : i ? "PM" : "AM" , "%P" : i ? "pm" : "am" , "%s" : Math . floor ( a . getTime ( ) / 1e3 ) , "%S" : m < 10 ? "0" + m : m , "%t" : "\t" , "%U" : f < 10 ? "0" + f : f , "%W" : f < 1
var NAV = navigator . appName ;
var gridwidth = 0 ;
if ( document . forms . length <= 5 && NAV != "Microsoft Internet Explorer" && getElementsByClassName ( document . body , 'borderForm' ) [ 0 ] . clientWidth < getElementsByClassName ( document . body , 'tableGrid' ) [ 0 ] . clientWidth && getElementsByClassName ( document . body , 'borderForm' ) [ 0 ] . clientWidth ) {
gridwidth = getElementsByClassName ( document . body , 'borderForm' ) [ 0 ] . clientWidth + 190 ;
} ;
i = h ( b [ 0 ] ) , i . y < g . y && ( i . y = c . y , i = h ( b [ 1 ] ) ) , i . x + f . x > g . x + g . w && ( i . x = c . x , i = h ( b [ 2 ] ) ) , i . y + f . y > g . y + g . h && ( i . y = c . y , i = h ( b [ 3 ] ) ) , i . x < g . x && ( i . x = c . x , i = h ( b [ 4 ] ) ) , this . showAt ( i . x - gridwidth , i . y , ! 0 ) , e . visibility = "" , this . focus ( ) } , h . manageFields = function ( b , c , d ) { var e = this ; c = bm ( c ) , b = bm ( b ) , /^button$/i . test ( b . tagName ) && b . setAttribute ( "type" , "button" ) , V ( b , "click" , function ( ) { e . inputField = c , e . dateFormat = d ; if ( e . selection . type == a . SEL _SINGLE ) { var f , g , h , i ; f = /input|textarea/i . test ( c . tagName ) ? c . value : c . innerText || c . textContent , f && ( g = /(^|[^%])%[bBmo]/ . exec ( d ) , h = /(^|[^%])%[de]/ . exec ( d ) , g && h && ( i = g . index < h . index ) , f = Calendar . parseDate ( f , i ) , f && ( e . selection . set ( f , ! 1 , ! 0 ) , e . args . showTime && ( e . setHours ( f . getHours ( ) ) , e . setMinutes ( f . getMinutes ( ) ) ) , e . moveTo ( f ) ) ) } e . popup ( b ) } ) } , h . callHooks = function ( a ) { var b = ba ( arguments , 1 ) , c = this . handlers [ a ] , d = 0 ; for ( ; d < c . length ; ++ d ) c [ d ] . apply ( this , b ) } , h . addEventListener = function ( a , b ) { this . handlers [ a ] . push ( b ) } , h . removeEventListener = function ( a , b ) { var c = this . handlers [ a ] , d = c . length ; while ( -- d >= 0 ) c [ d ] === b && c . splice ( d , 1 ) } , h . getTime = function ( ) { return this . time } , h . setTime = function ( a , b ) { if ( this . args . showTime ) { a = a != null ? a : this . time , this . time = a ; var c = this . getHours ( ) , d = this . getMinutes ( ) , e = c < 12 ; this . args . showTime == 12 && ( c == 0 && ( c = 12 ) , c > 12 && ( c -= 12 ) , this . els . timeAM . innerHTML = L ( e ? "AM" : "PM" ) ) , c < 10 && ( c = "0" + c ) , d < 10 && ( d = "0" + d ) , this . els . timeHour . innerHTML = c , this . els . timeMinute . innerHTML = d , b || this . callHooks ( "onTimeChange" , this , a ) } } , h . getHours = function ( ) { return Math . floor ( this . time / 100 ) } , h . getMinutes = function ( ) { return this . time % 100 } , h . setHours = function ( a ) { a < 0 && ( a += 24 ) , this . setTime ( 100 * ( a % 24 ) + this . time % 100 ) } , h . setMinutes = function ( a ) { a < 0 && ( a += 60 ) , a = Math . floor ( a / this . args . minuteStep ) * this . args . minuteStep , this . setTime ( 100 * this . getHours ( ) + a % 60 ) } , h . _getInputYear = function ( ) { var a = parseInt ( this . els . yearInput . value , 10 ) ; isNaN ( a ) && ( a = this . date . getFullYear ( ) ) ; return a } , h . _showTooltip = function ( a ) { var b = "" , c , d = this . els . tooltip ; a && ( a = P ( a ) , c = this . args . dateInfo ( a ) , c && c . tooltip && ( b = "<div class='DynarchCalendar-tooltipCont'>" + R ( a , c . tooltip ) + "</div>" ) ) , d . innerHTML = b } ; var j = " align='center' cellspacing='0' cellpadding='0'" , r = { "DynarchCalendar-topCont" : "topCont" , "DynarchCalendar-focusLink" : "focusLink" , DynarchCalendar : "main" , "DynarchCalendar-topBar" : "topBar" , "DynarchCalendar-title" : "title" , "DynarchCalendar-dayNames" : "dayNames" , "DynarchCalendar-body" : "body" , "DynarchCalendar-menu" : "menu" , "DynarchCalendar-menu-year" : "yearInput" , "DynarchCalendar-bottomBar" : "bottomBar" , "DynarchCalendar-tooltip" : "tooltip" , "DynarchCalendar-time-hour" : "timeHour" , "DynarchCalendar-time-minute" : "timeMinute" , "DynarchCalendar-time-am" : "timeAM" , "DynarchCalendar-navBtn DynarchCalendar-prevYear" : "navPrevYear" , "DynarchCalendar-navBtn DynarchCalendar-nextYear" : "navNextYear" , "DynarchCalendar-navBtn DynarchCalendar-prevMonth" : "navPrevMonth" , "DynarchCalendar-navBtn DynarchCalendar-nextMonth" : "navNextMonth" } , x = { "-3" : "backYear" , "-2" : "back" , 0 : "now" , 2 : "fwd" , 3 : "fwdYear" } , H = { 37 : - 1 , 38 : - 2 , 39 : 1 , 40 : 2 } , I = { 33 : - 1 , 34 : 1 } ; h . _getDateDiv = function ( a ) { var b = null ; if ( a ) try { bc ( this . els . body , function ( c ) { if ( c . getAttribute ( "dyc-date" ) == a ) throw b = c } ) } catch ( c ) { } return b } , ( a . Selection = function ( a , b , c , d ) { this . type = b , this . sel = a instanceof Array ? a : [ a ] , this . onChange = bb ( c , d ) , this . cal = d } ) . prototype = { get : function ( ) { return this . type == a . SEL _SINGLE ? this . sel [ 0 ] : this . sel } , isEmpty : function ( ) { return this . sel . length == 0 } , set : function ( b , c , d ) { var e = this . type == a . SEL _SINGLE ; b instanceof Array ? ( this . sel = b , this . normalize ( ) , d || this . onChange ( this ) ) : ( b = O ( b ) , e || ! this . isSelected ( b ) ? ( e ? this . sel = [ b ] : this . sel . splice ( this . findInsertPos ( b ) , 0 , b ) , this . normalize ( ) , d || this . onChange ( this ) ) : c && this . unselect ( b , d ) ) } , reset : function ( ) { this . sel = [ ] , this . set . apply ( this , arguments ) } , countDays : function ( ) { var a = 0 , b = this . sel , c = b . length , d , e , f ; while ( -- c >= 0 ) d = b [ c ] , d instanceof Array && ( e = P ( d [ 0 ] ) , f = P ( d [ 1 ] ) , a += Math . round ( Math . abs ( f . getTime ( ) - e . getTime ( ) ) / 864e5 ) ) , ++ a ; return a } , unselect : function ( a , b ) { a = O ( a ) ; var c = ! 1 ; for ( var d = this . sel , e = d . length , f ; -- e >= 0 ; ) { f = d [ e ] ; if ( f instanceof Array ) { if ( a >= f [ 0 ] && a <= f [ 1 ] ) { var g = P ( a ) , h = g . getDate ( ) ; if ( a == f [ 0 ] ) g . setDate ( h + 1 ) , f [ 0 ] = O ( g ) , c = ! 0 ; else if ( a == f [ 1 ] ) g . setDate ( h - 1 ) , f [ 1 ] = O ( g