2011-04-07 16:41:06 +00:00
/ *
2011-08-03 14:09:14 +00:00
This software is allowed to use under GPL or you need to obtain Commercial or Enterise License
2011-04-07 16:41:06 +00:00
to use it in not GPL project . Please contact sales @ dhtmlx . com for details
2011-06-20 10:05:57 +00:00
* /
2011-08-03 14:09:14 +00:00
dhtmlx = function ( a ) { for ( var b in a ) dhtmlx [ b ] = a [ b ] ; return dhtmlx } ;
dhtmlx . extend _api = function ( a , b , c ) { var d = window [ a ] ; if ( d ) window [ a ] = function ( a ) { if ( a && typeof a == "object" && ! a . tagName && ! ( a instanceof Array ) ) { var c = d . apply ( this , b . _init ? b . _init ( a ) : arguments ) , g ; for ( g in dhtmlx ) if ( b [ g ] ) this [ b [ g ] ] ( dhtmlx [ g ] ) ; for ( g in a ) if ( b [ g ] ) this [ b [ g ] ] ( a [ g ] ) ; else g . indexOf ( "on" ) == 0 && this . attachEvent ( g , a [ g ] ) } else c = d . apply ( this , arguments ) ; b . _patch && b . _patch ( this ) ; return c || this } , window [ a ] . prototype = d . prototype , c && dhtmlXHeir ( window [ a ] . prototype , c ) } ;
dhtmlxAjax = { get : function ( a , b ) { var c = new dtmlXMLLoaderObject ( ! 0 ) ; c . async = arguments . length < 3 ; c . waitCall = b ; c . loadXML ( a ) ; return c } , post : function ( a , b , c ) { var d = new dtmlXMLLoaderObject ( ! 0 ) ; d . async = arguments . length < 4 ; d . waitCall = c ; d . loadXML ( a , ! 0 , b ) ; return d } , getSync : function ( a ) { return this . get ( a , null , ! 0 ) } , postSync : function ( a , b ) { return this . post ( a , b , null , ! 0 ) } } ;
function dtmlXMLLoaderObject ( a , b , c , d ) { this . xmlDoc = "" ; this . async = typeof c != "undefined" ? c : ! 0 ; this . onloadAction = a || null ; this . mainObject = b || null ; this . waitCall = null ; this . rSeed = d || ! 1 ; return this }
dtmlXMLLoaderObject . prototype . waitLoadFunction = function ( a ) { var b = ! 0 ; return this . check = function ( ) { if ( a && a . onloadAction != null && ( ! a . xmlDoc . readyState || a . xmlDoc . readyState == 4 ) && b ) { b = ! 1 ; if ( typeof a . onloadAction == "function" ) a . onloadAction ( a . mainObject , null , null , null , a ) ; if ( a . waitCall ) a . waitCall . call ( this , a ) , a . waitCall = null } } } ;
dtmlXMLLoaderObject . prototype . getXMLTopNode = function ( a , b ) { if ( this . xmlDoc . responseXML ) { var c = this . xmlDoc . responseXML . getElementsByTagName ( a ) ; c . length == 0 && a . indexOf ( ":" ) != - 1 && ( c = this . xmlDoc . responseXML . getElementsByTagName ( a . split ( ":" ) [ 1 ] ) ) ; var d = c [ 0 ] } else d = this . xmlDoc . documentElement ; if ( d ) return this . _retry = ! 1 , d ; if ( _isIE && ! this . _retry ) { var e = this . xmlDoc . responseText , b = this . xmlDoc ; this . _retry = ! 0 ; this . xmlDoc = new ActiveXObject ( "Microsoft.XMLDOM" ) ; this . xmlDoc . async = ! 1 ; this . xmlDoc . loadXML ( e ) ; return this . getXMLTopNode ( a ,
b ) } dhtmlxError . throwError ( "LoadXML" , "Incorrect XML" , [ b || this . xmlDoc , this . mainObject ] ) ; return document . createElement ( "DIV" ) } ; dtmlXMLLoaderObject . prototype . loadXMLString = function ( a ) { try { var b = new DOMParser ; this . xmlDoc = b . parseFromString ( a , "text/xml" ) } catch ( c ) { this . xmlDoc = new ActiveXObject ( "Microsoft.XMLDOM" ) , this . xmlDoc . async = this . async , this . xmlDoc . loadXML ( a ) } this . onloadAction ( this . mainObject , null , null , null , this ) ; if ( this . waitCall ) this . waitCall ( ) , this . waitCall = null } ;
dtmlXMLLoaderObject . prototype . loadXML = function ( a , b , c , d ) { this . rSeed && ( a += ( a . indexOf ( "?" ) != - 1 ? "&" : "?" ) + "a_dhx_rSeed=" + ( new Date ) . valueOf ( ) ) ; this . filePath = a ; this . xmlDoc = ! _isIE && window . XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject ( "Microsoft.XMLHTTP" ) ; if ( this . async ) this . xmlDoc . onreadystatechange = new this . waitLoadFunction ( this ) ; this . xmlDoc . open ( b ? "POST" : "GET" , a , this . async ) ; d ? ( this . xmlDoc . setRequestHeader ( "User-Agent" , "dhtmlxRPC v0.1 (" + navigator . userAgent + ")" ) , this . xmlDoc . setRequestHeader ( "Content-type" ,
"text/xml" ) ) : b && this . xmlDoc . setRequestHeader ( "Content-type" , "application/x-www-form-urlencoded" ) ; this . xmlDoc . setRequestHeader ( "X-Requested-With" , "XMLHttpRequest" ) ; this . xmlDoc . send ( c ) ; this . async || ( new this . waitLoadFunction ( this ) ) ( ) } ; dtmlXMLLoaderObject . prototype . destructor = function ( ) { return this . xmlDoc = this . mainObject = this . onloadAction = null } ;
dtmlXMLLoaderObject . prototype . xmlNodeToJSON = function ( a ) { for ( var b = { } , c = 0 ; c < a . attributes . length ; c ++ ) b [ a . attributes [ c ] . name ] = a . attributes [ c ] . value ; b . _tagvalue = a . firstChild ? a . firstChild . nodeValue : "" ; for ( c = 0 ; c < a . childNodes . length ; c ++ ) { var d = a . childNodes [ c ] . tagName ; d && ( b [ d ] || ( b [ d ] = [ ] ) , b [ d ] . push ( this . xmlNodeToJSON ( a . childNodes [ c ] ) ) ) } return b } ; function callerFunction ( a , b ) { return this . handler = function ( c ) { if ( ! c ) c = window . event ; a ( c , b ) ; return ! 0 } } function getAbsoluteLeft ( a ) { return getOffset ( a ) . left }
function getAbsoluteTop ( a ) { return getOffset ( a ) . top } function getOffsetSum ( a ) { for ( var b = 0 , c = 0 ; a ; ) b += parseInt ( a . offsetTop ) , c += parseInt ( a . offsetLeft ) , a = a . offsetParent ; return { top : b , left : c } }
function getOffsetRect ( a ) { var b = a . getBoundingClientRect ( ) , c = document . body , d = document . documentElement , e = window . pageYOffset || d . scrollTop || c . scrollTop , f = window . pageXOffset || d . scrollLeft || c . scrollLeft , g = d . clientTop || c . clientTop || 0 , h = d . clientLeft || c . clientLeft || 0 , i = b . top + e - g , k = b . left + f - h ; return { top : Math . round ( i ) , left : Math . round ( k ) } } function getOffset ( a ) { return a . getBoundingClientRect && ! _isChrome ? getOffsetRect ( a ) : getOffsetSum ( a ) }
function convertStringToBoolean ( a ) { typeof a == "string" && ( a = a . toLowerCase ( ) ) ; switch ( a ) { case "1" : case "true" : case "yes" : case "y" : case 1 : case ! 0 : return ! 0 ; default : return ! 1 } } function getUrlSymbol ( a ) { return a . indexOf ( "?" ) != - 1 ? "&" : "?" } function dhtmlDragAndDropObject ( ) { if ( window . dhtmlDragAndDrop ) return window . dhtmlDragAndDrop ; this . dragStartObject = this . dragStartNode = this . dragNode = this . lastLanding = 0 ; this . tempDOMM = this . tempDOMU = null ; this . waitDrag = 0 ; window . dhtmlDragAndDrop = this ; return this }
dhtmlDragAndDropObject . prototype . removeDraggableItem = function ( a ) { a . onmousedown = null ; a . dragStarter = null ; a . dragLanding = null } ; dhtmlDragAndDropObject . prototype . addDraggableItem = function ( a , b ) { a . onmousedown = this . preCreateDragCopy ; a . dragStarter = b ; this . addDragLanding ( a , b ) } ; dhtmlDragAndDropObject . prototype . addDragLanding = function ( a , b ) { a . dragLanding = b } ;
dhtmlDragAndDropObject . prototype . preCreateDragCopy = function ( a ) { if ( ! ( ( a || event ) && ( a || event ) . button == 2 ) ) { if ( window . dhtmlDragAndDrop . waitDrag ) return window . dhtmlDragAndDrop . waitDrag = 0 , document . body . onmouseup = window . dhtmlDragAndDrop . tempDOMU , document . body . onmousemove = window . dhtmlDragAndDrop . tempDOMM , ! 1 ; window . dhtmlDragAndDrop . waitDrag = 1 ; window . dhtmlDragAndDrop . tempDOMU = document . body . onmouseup ; window . dhtmlDragAndDrop . tempDOMM = document . body . onmousemove ; window . dhtmlDragAndDrop . dragStartNode = this ; window . dhtmlDragAndDrop . dragStartObject =
this . dragStarter ; document . body . onmouseup = window . dhtmlDragAndDrop . preCreateDragCopy ; document . body . onmousemove = window . dhtmlDragAndDrop . callDrag ; window . dhtmlDragAndDrop . downtime = ( new Date ) . valueOf ( ) ; a && a . preventDefault && a . preventDefault ( ) ; return ! 1 } } ;
dhtmlDragAndDropObject . prototype . callDrag = function ( a ) { if ( ! a ) a = window . event ; dragger = window . dhtmlDragAndDrop ; if ( ! ( ( new Date ) . valueOf ( ) - dragger . downtime < 100 ) ) { if ( a . button == 0 && _isIE ) return dragger . stopDrag ( ) ; if ( ! dragger . dragNode && dragger . waitDrag ) { dragger . dragNode = dragger . dragStartObject . _createDragNode ( dragger . dragStartNode , a ) ; if ( ! dragger . dragNode ) return dragger . stopDrag ( ) ; dragger . dragNode . onselectstart = function ( ) { return ! 1 } ; dragger . gldragNode = dragger . dragNode ; document . body . appendChild ( dragger . dragNode ) ;
document . body . onmouseup = dragger . stopDrag ; dragger . waitDrag = 0 ; dragger . dragNode . pWindow = window ; dragger . initFrameRoute ( ) } if ( dragger . dragNode . parentNode != window . document . body ) { var b = dragger . gldragNode ; if ( dragger . gldragNode . old ) b = dragger . gldragNode . old ; b . parentNode . removeChild ( b ) ; var c = dragger . dragNode . pWindow ; if ( _isIE ) { var d = document . createElement ( "Div" ) ; d . innerHTML = dragger . dragNode . outerHTML ; dragger . dragNode = d . childNodes [ 0 ] } else dragger . dragNode = dragger . dragNode . cloneNode ( ! 0 ) ; dragger . dragNode . pWindow =
window ; dragger . gldragNode . old = dragger . dragNode ; document . body . appendChild ( dragger . dragNode ) ; c . dhtmlDragAndDrop . dragNode = dragger . dragNode } dragger . dragNode . style . left = a . clientX + 15 + ( dragger . fx ? dragger . fx * - 1 : 0 ) + ( document . body . scrollLeft || document . documentElement . scrollLeft ) + "px" ; dragger . dragNode . style . top = a . clientY + 3 + ( dragger . fy ? dragger . fy * - 1 : 0 ) + ( document . body . scrollTop || document . documentElement . scrollTop ) + "px" ; var e = a . srcElement ? a . srcElement : a . target ; dragger . checkLanding ( e , a ) } } ;
dhtmlDragAndDropObject . prototype . calculateFramePosition = function ( a ) { if ( window . name ) { for ( var b = parent . frames [ window . name ] . frameElement . offsetParent , c = 0 , d = 0 ; b ; ) c += b . offsetLeft , d += b . offsetTop , b = b . offsetParent ; if ( parent . dhtmlDragAndDrop ) { var e = parent . dhtmlDragAndDrop . calculateFramePosition ( 1 ) ; c += e . split ( "_" ) [ 0 ] * 1 ; d += e . split ( "_" ) [ 1 ] * 1 } if ( a ) return c + "_" + d ; else this . fx = c ; this . fy = d } return "0_0" } ;
dhtmlDragAndDropObject . prototype . checkLanding = function ( a , b ) { a && a . dragLanding ? ( this . lastLanding && this . lastLanding . dragLanding . _dragOut ( this . lastLanding ) , this . lastLanding = a , this . lastLanding = this . lastLanding . dragLanding . _dragIn ( this . lastLanding , this . dragStartNode , b . clientX , b . clientY , b ) , this . lastLanding _scr = _isIE ? b . srcElement : b . target ) : a && a . tagName != "BODY" ? this . checkLanding ( a . parentNode , b ) : ( this . lastLanding && this . lastLanding . dragLanding . _dragOut ( this . lastLanding , b . clientX , b . clientY , b ) , this . lastLanding =
0 , this . _onNotFound && this . _onNotFound ( ) ) } ;
dhtmlDragAndDropObject . prototype . stopDrag = function ( a , b ) { dragger = window . dhtmlDragAndDrop ; if ( ! b ) { dragger . stopFrameRoute ( ) ; var c = dragger . lastLanding ; dragger . lastLanding = null ; c && c . dragLanding . _drag ( dragger . dragStartNode , dragger . dragStartObject , c , _isIE ? event . srcElement : a . target ) } dragger . lastLanding = null ; dragger . dragNode && dragger . dragNode . parentNode == document . body && dragger . dragNode . parentNode . removeChild ( dragger . dragNode ) ; dragger . dragNode = 0 ; dragger . gldragNode = 0 ; dragger . fx = 0 ; dragger . fy = 0 ; dragger . dragStartNode =
0 ; dragger . dragStartObject = 0 ; document . body . onmouseup = dragger . tempDOMU ; document . body . onmousemove = dragger . tempDOMM ; dragger . tempDOMU = null ; dragger . tempDOMM = null ; dragger . waitDrag = 0 } ; dhtmlDragAndDropObject . prototype . stopFrameRoute = function ( a ) { a && window . dhtmlDragAndDrop . stopDrag ( 1 , 1 ) ; for ( var b = 0 ; b < window . frames . length ; b ++ ) try { window . frames [ b ] != a && window . frames [ b ] . dhtmlDragAndDrop && window . frames [ b ] . dhtmlDragAndDrop . stopFrameRoute ( window ) } catch ( c ) { } try { parent . dhtmlDragAndDrop && parent != window && parent != a && parent . dhtmlDragAndDrop . stopFrameRoute ( window ) } catch ( d ) { } } ;
dhtmlDragAndDropObject . prototype . initFrameRoute = function ( a , b ) { if ( a ) window . dhtmlDragAndDrop . preCreateDragCopy ( { } ) , window . dhtmlDragAndDrop . dragStartNode = a . dhtmlDragAndDrop . dragStartNode , window . dhtmlDragAndDrop . dragStartObject = a . dhtmlDragAndDrop . dragStartObject , window . dhtmlDragAndDrop . dragNode = a . dhtmlDragAndDrop . dragNode , window . dhtmlDragAndDrop . gldragNode = a . dhtmlDragAndDrop . dragNode , window . document . body . onmouseup = window . dhtmlDragAndDrop . stopDrag , window . waitDrag = 0 , ! _isIE && b && ( ! _isFF || w < 1.8 ) && window . dhtmlDragAndDrop . calculateFramePosition ( ) ;
try { parent . dhtmlDragAndDrop && parent != window && parent != a && parent . dhtmlDragAndDrop . initFrameRoute ( window ) } catch ( c ) { } for ( var d = 0 ; d < window . frames . length ; d ++ ) try { window . frames [ d ] != a && window . frames [ d ] . dhtmlDragAndDrop && window . frames [ d ] . dhtmlDragAndDrop . initFrameRoute ( window , ! a || b ? 1 : 0 ) } catch ( e ) { } } ; w = _OperaRv = x = _isChrome = _isMacOS = _isKHTML = _isOpera = _isIE = _isFF = ! 1 ; navigator . userAgent . indexOf ( "Macintosh" ) != - 1 && ( _isMacOS = ! 0 ) ; navigator . userAgent . toLowerCase ( ) . indexOf ( "chrome" ) > - 1 && ( _isChrome = ! 0 ) ;
if ( navigator . userAgent . indexOf ( "Safari" ) != - 1 || navigator . userAgent . indexOf ( "Konqueror" ) != - 1 ) { var x = parseFloat ( navigator . userAgent . substr ( navigator . userAgent . indexOf ( "Safari" ) + 7 , 5 ) ) ; if ( x > 525 ) { _isFF = ! 0 ; var w = 1.9 } else _isKHTML = ! 0 } else navigator . userAgent . indexOf ( "Opera" ) != - 1 ? ( _isOpera = ! 0 , _OperaRv = parseFloat ( navigator . userAgent . substr ( navigator . userAgent . indexOf ( "Opera" ) + 6 , 3 ) ) ) : navigator . appName . indexOf ( "Microsoft" ) != - 1 ? ( _isIE = ! 0 , navigator . appVersion . indexOf ( "MSIE 8.0" ) != - 1 && document . compatMode != "BackCompat" &&
( _isIE = 8 ) ) : ( _isFF = ! 0 , w = parseFloat ( navigator . userAgent . split ( "rv:" ) [ 1 ] ) ) ;
dtmlXMLLoaderObject . prototype . doXPath = function ( a , b , c , d ) { if ( _isKHTML || ! _isIE && ! window . XPathResult ) return this . doXPathOpera ( a , b ) ; if ( _isIE ) return b || ( b = this . xmlDoc . nodeName ? this . xmlDoc : this . xmlDoc . responseXML ) , b || dhtmlxError . throwError ( "LoadXML" , "Incorrect XML" , [ b || this . xmlDoc , this . mainObject ] ) , c != null && b . setProperty ( "SelectionNamespaces" , "xmlns:xsl='" + c + "'" ) , d == "single" ? b . selectSingleNode ( a ) : b . selectNodes ( a ) || [ ] ; else { var e = b ; b || ( b = this . xmlDoc . nodeName ? this . xmlDoc : this . xmlDoc . responseXML ) ; b || dhtmlxError . throwError ( "LoadXML" ,
"Incorrect XML" , [ b || this . xmlDoc , this . mainObject ] ) ; b . nodeName . indexOf ( "document" ) != - 1 ? e = b : ( e = b , b = b . ownerDocument ) ; var f = XPathResult . ANY _TYPE ; if ( d == "single" ) f = XPathResult . FIRST _ORDERED _NODE _TYPE ; var g = [ ] , h = b . evaluate ( a , e , function ( ) { return c } , f , null ) ; if ( f == XPathResult . FIRST _ORDERED _NODE _TYPE ) return h . singleNodeValue ; for ( var i = h . iterateNext ( ) ; i ; ) g [ g . length ] = i , i = h . iterateNext ( ) ; return g } } ; function z ( ) { if ( ! this . catches ) this . catches = [ ] ; return this } z . prototype . catchError = function ( a , b ) { this . catches [ a ] = b } ;
z . prototype . throwError = function ( a , b , c ) { if ( this . catches [ a ] ) return this . catches [ a ] ( a , b , c ) ; if ( this . catches . ALL ) return this . catches . ALL ( a , b , c ) ; alert ( "Error type: " + a + "\nDescription: " + b ) ; return null } ; window . dhtmlxError = new z ;
dtmlXMLLoaderObject . prototype . doXPathOpera = function ( a , b ) { var c = a . replace ( /[\/]+/gi , "/" ) . split ( "/" ) , d = null , e = 1 ; if ( ! c . length ) return [ ] ; if ( c [ 0 ] == "." ) d = [ b ] ; else if ( c [ 0 ] == "" ) d = ( this . xmlDoc . responseXML || this . xmlDoc ) . getElementsByTagName ( c [ e ] . replace ( /\[[^\]]*\]/g , "" ) ) , e ++ ; else return [ ] ; for ( ; e < c . length ; e ++ ) d = this . _getAllNamedChilds ( d , c [ e ] ) ; c [ e - 1 ] . indexOf ( "[" ) != - 1 && ( d = this . _filterXPath ( d , c [ e - 1 ] ) ) ; return d } ;
dtmlXMLLoaderObject . prototype . _filterXPath = function ( a , b ) { for ( var c = [ ] , b = b . replace ( /[^\[]*\[\@/g , "" ) . replace ( /[\[\]\@]*/g , "" ) , d = 0 ; d < a . length ; d ++ ) a [ d ] . getAttribute ( b ) && ( c [ c . length ] = a [ d ] ) ; return c } ;
dtmlXMLLoaderObject . prototype . _getAllNamedChilds = function ( a , b ) { var c = [ ] ; _isKHTML && ( b = b . toUpperCase ( ) ) ; for ( var d = 0 ; d < a . length ; d ++ ) for ( var e = 0 ; e < a [ d ] . childNodes . length ; e ++ ) _isKHTML ? a [ d ] . childNodes [ e ] . tagName && a [ d ] . childNodes [ e ] . tagName . toUpperCase ( ) == b && ( c [ c . length ] = a [ d ] . childNodes [ e ] ) : a [ d ] . childNodes [ e ] . tagName == b && ( c [ c . length ] = a [ d ] . childNodes [ e ] ) ; return c } ; function dhtmlXHeir ( a , b ) { for ( var c in b ) typeof b [ c ] == "function" && ( a [ c ] = b [ c ] ) ; return a }
function dhtmlxEvent ( a , b , c ) { a . addEventListener ? a . addEventListener ( b , c , ! 1 ) : a . attachEvent && a . attachEvent ( "on" + b , c ) } dtmlXMLLoaderObject . prototype . xslDoc = null ; dtmlXMLLoaderObject . prototype . setXSLParamValue = function ( a , b , c ) { if ( ! c ) c = this . xslDoc ; if ( c . responseXML ) c = c . responseXML ; var d = this . doXPath ( "/xsl:stylesheet/xsl:variable[@name='" + a + "']" , c , "http://www.w3.org/1999/XSL/Transform" , "single" ) ; if ( d != null ) d . firstChild . nodeValue = b } ;
dtmlXMLLoaderObject . prototype . doXSLTransToObject = function ( a , b ) { if ( ! a ) a = this . xslDoc ; if ( a . responseXML ) a = a . responseXML ; if ( ! b ) b = this . xmlDoc ; if ( b . responseXML ) b = b . responseXML ; if ( _isIE ) { d = new ActiveXObject ( "Msxml2.DOMDocument.3.0" ) ; try { b . transformNodeToObject ( a , d ) } catch ( c ) { d = b . transformNode ( a ) } } else { if ( ! this . XSLProcessor ) this . XSLProcessor = new XSLTProcessor , this . XSLProcessor . importStylesheet ( a ) ; var d = this . XSLProcessor . transformToDocument ( b ) } return d } ;
dtmlXMLLoaderObject . prototype . doXSLTransToString = function ( a , b ) { var c = this . doXSLTransToObject ( a , b ) ; return typeof c == "string" ? c : this . doSerialization ( c ) } ; dtmlXMLLoaderObject . prototype . doSerialization = function ( a ) { if ( ! a ) a = this . xmlDoc ; if ( a . responseXML ) a = a . responseXML ; if ( _isIE ) return a . xml ; else { var b = new XMLSerializer ; return b . serializeToString ( a ) } } ;
dhtmlxEventable = function ( a ) { a . dhx _SeverCatcherPath = "" ; a . attachEvent = function ( a , c , d ) { a = "ev_" + a . toLowerCase ( ) ; this [ a ] || ( this [ a ] = new this . eventCatcher ( d || this ) ) ; return a + ":" + this [ a ] . addEvent ( c ) } ; a . callEvent = function ( a , c ) { a = "ev_" + a . toLowerCase ( ) ; return this [ a ] ? this [ a ] . apply ( this , c ) : ! 0 } ; a . checkEvent = function ( a ) { return ! ! this [ "ev_" + a . toLowerCase ( ) ] } ; a . eventCatcher = function ( a ) { var c = [ ] , d = function ( ) { for ( var d = ! 0 , f = 0 ; f < c . length ; f ++ ) if ( c [ f ] != null ) var g = c [ f ] . apply ( a , arguments ) , d = d && g ; return d } ; d . addEvent = function ( a ) { typeof a !=
"function" && ( a = eval ( a ) ) ; return a ? c . push ( a ) - 1 : ! 1 } ; d . removeEvent = function ( a ) { c [ a ] = null } ; return d } ; a . detachEvent = function ( a ) { if ( a != ! 1 ) { var c = a . split ( ":" ) ; this [ c [ 0 ] ] . removeEvent ( c [ 1 ] ) } } ; a . detachAllEvents = function ( ) { for ( var a in this ) a . indexOf ( "ev_" ) == 0 && delete this [ a ] } } ;
function dataProcessor ( a ) { this . serverProcessor = a ; this . action _param = "!nativeeditor_status" ; this . object = null ; this . updatedRows = [ ] ; this . autoUpdate = ! 0 ; this . updateMode = "cell" ; this . _tMode = "GET" ; this . post _delim = "_" ; this . _waitMode = 0 ; this . _in _progress = { } ; this . _invalid = { } ; this . mandatoryFields = [ ] ; this . messages = [ ] ; this . styles = { updated : "font-weight:bold;" , inserted : "font-weight:bold;" , deleted : "text-decoration : line-through;" , invalid : "background-color:FFE0E0;" , invalid _cell : "border-bottom:2px solid red;" , clear : "font-weight:normal;text-decoration:none;" } ;
this . enableUTFencoding ( ! 0 ) ; dhtmlxEventable ( this ) ; return this }
dataProcessor . prototype = { setTransactionMode : function ( a , b ) { this . _tMode = a ; this . _tSend = b } , escape : function ( a ) { return this . _utf ? encodeURIComponent ( a ) : escape ( a ) } , enableUTFencoding : function ( a ) { this . _utf = convertStringToBoolean ( a ) } , setDataColumns : function ( a ) { this . _columns = typeof a == "string" ? a . split ( "," ) : a } , getSyncState : function ( ) { return ! this . updatedRows . length } , enableDataNames : function ( a ) { this . _endnm = convertStringToBoolean ( a ) } , enablePartialDataSend : function ( a ) { this . _changed = convertStringToBoolean ( a ) } , setUpdateMode : function ( a ,
b ) { this . autoUpdate = a == "cell" ; this . updateMode = a ; this . dnd = b } , ignore : function ( a , b ) { this . _silent _mode = ! 0 ; a . call ( b || window ) ; this . _silent _mode = ! 1 } , setUpdated : function ( a , b , c ) { if ( ! this . _silent _mode ) { var d = this . findRow ( a ) , c = c || "updated" , e = this . obj . getUserData ( a , this . action _param ) ; e && c == "updated" && ( c = e ) ; b ? ( this . set _invalid ( a , ! 1 ) , this . updatedRows [ d ] = a , this . obj . setUserData ( a , this . action _param , c ) , this . _in _progress [ a ] && ( this . _in _progress [ a ] = "wait" ) ) : this . is _invalid ( a ) || ( this . updatedRows . splice ( d , 1 ) , this . obj . setUserData ( a ,
this . action _param , "" ) ) ; b || this . _clearUpdateFlag ( a ) ; this . markRow ( a , b , c ) ; b && this . autoUpdate && this . sendData ( a ) } } , _clearUpdateFlag : function ( ) { } , markRow : function ( a , b , c ) { var d = "" , e = this . is _invalid ( a ) ; e && ( d = this . styles [ e ] , b = ! 0 ) ; if ( this . callEvent ( "onRowMark" , [ a , b , c , e ] ) && ( d = this . styles [ b ? c : "clear" ] + d , this . obj [ this . _methods [ 0 ] ] ( a , d ) , e && e . details ) ) { d += this . styles [ e + "_cell" ] ; for ( var f = 0 ; f < e . details . length ; f ++ ) if ( e . details [ f ] ) this . obj [ this . _methods [ 1 ] ] ( a , f , d ) } } , getState : function ( a ) { return this . obj . getUserData ( a ,
this . action _param ) } , is _invalid : function ( a ) { return this . _invalid [ a ] } , set _invalid : function ( a , b , c ) { c && ( b = { value : b , details : c , toString : function ( ) { return this . value . toString ( ) } } ) ; this . _invalid [ a ] = b } , checkBeforeUpdate : function ( ) { return ! 0 } , sendData : function ( a ) { if ( ! this . _waitMode || ! ( this . obj . mytype == "tree" || this . obj . _h2 ) ) { this . obj . editStop && this . obj . editStop ( ) ; if ( typeof a == "undefined" || this . _tSend ) return this . sendAllData ( ) ; if ( this . _in _progress [ a ] ) return ! 1 ; this . messages = [ ] ; if ( ! this . checkBeforeUpdate ( a ) && this . callEvent ( "onValidatationError" ,
[ a , this . messages ] ) ) return ! 1 ; this . _beforeSendData ( this . _getRowData ( a ) , a ) } } , _beforeSendData : function ( a , b ) { if ( ! this . callEvent ( "onBeforeUpdate" , [ b , this . getState ( b ) , a ] ) ) return ! 1 ; this . _sendData ( a , b ) } , serialize : function ( a , b ) { if ( typeof a == "string" ) return a ; if ( typeof b != "undefined" ) return this . serialize _one ( a , "" ) ; else { var c = [ ] , d = [ ] , e ; for ( e in a ) a . hasOwnProperty ( e ) && ( c . push ( this . serialize _one ( a [ e ] , e + this . post _delim ) ) , d . push ( e ) ) ; c . push ( "ids=" + this . escape ( d . join ( "," ) ) ) ; return c . join ( "&" ) } } , serialize _one : function ( a ,
b ) { if ( typeof a == "string" ) return a ; var c = [ ] , d ; for ( d in a ) a . hasOwnProperty ( d ) && c . push ( this . escape ( ( b || "" ) + d ) + "=" + this . escape ( a [ d ] ) ) ; return c . join ( "&" ) } , _sendData : function ( a , b ) { if ( a ) { if ( ! this . callEvent ( "onBeforeDataSending" , b ? [ b , this . getState ( b ) , a ] : [ null , null , a ] ) ) return ! 1 ; b && ( this . _in _progress [ b ] = ( new Date ) . valueOf ( ) ) ; var c = new dtmlXMLLoaderObject ( this . afterUpdate , this , ! 0 ) , d = this . serverProcessor + ( this . _user ? getUrlSymbol ( this . serverProcessor ) + [ "dhx_user=" + this . _user , "dhx_version=" + this . obj . getUserData ( 0 ,
"version" ) ] . join ( "&" ) : "" ) ; this . _tMode != "POST" ? c . loadXML ( d + ( d . indexOf ( "?" ) != - 1 ? "&" : "?" ) + this . serialize ( a , b ) ) : c . loadXML ( d , ! 0 , this . serialize ( a , b ) ) ; this . _waitMode ++ } } , sendAllData : function ( ) { if ( this . updatedRows . length ) { this . messages = [ ] ; for ( var a = ! 0 , b = 0 ; b < this . updatedRows . length ; b ++ ) a &= this . checkBeforeUpdate ( this . updatedRows [ b ] ) ; if ( ! a && ! this . callEvent ( "onValidatationError" , [ "" , this . messages ] ) ) return ! 1 ; if ( this . _tSend ) this . _sendData ( this . _getAllData ( ) ) ; else for ( b = 0 ; b < this . updatedRows . length ; b ++ ) if ( ! this . _in _progress [ this . updatedRows [ b ] ] &&
! this . is _invalid ( this . updatedRows [ b ] ) && ( this . _beforeSendData ( this . _getRowData ( this . updatedRows [ b ] ) , this . updatedRows [ b ] ) , this . _waitMode && ( this . obj . mytype == "tree" || this . obj . _h2 ) ) ) break } } , _getAllData : function ( ) { for ( var a = { } , b = ! 1 , c = 0 ; c < this . updatedRows . length ; c ++ ) { var d = this . updatedRows [ c ] ; ! this . _in _progress [ d ] && ! this . is _invalid ( d ) && this . callEvent ( "onBeforeUpdate" , [ d , this . getState ( d ) ] ) && ( a [ d ] = this . _getRowData ( d , d + this . post _delim ) , b = ! 0 , this . _in _progress [ d ] = ( new Date ) . valueOf ( ) ) } return b ? a : null } , setVerificator : function ( a ,
b ) { this . mandatoryFields [ a ] = b || function ( a ) { return a != "" } } , clearVerificator : function ( a ) { this . mandatoryFields [ a ] = ! 1 } , findRow : function ( a ) { for ( var b = 0 , b = 0 ; b < this . updatedRows . length ; b ++ ) if ( a == this . updatedRows [ b ] ) break ; return b } , defineAction : function ( a , b ) { if ( ! this . _uActions ) this . _uActions = [ ] ; this . _uActions [ a ] = b } , afterUpdateCallback : function ( a , b , c , d ) { var e = a , f = c != "error" && c != "invalid" ; f || this . set _invalid ( a , c ) ; if ( this . _uActions && this . _uActions [ c ] && ! this . _uActions [ c ] ( d ) ) return delete this . _in _progress [ e ] ; this . _in _progress [ e ] !=
"wait" && this . setUpdated ( a , ! 1 ) ; var g = a ; switch ( c ) { case "update" : case "updated" : case "inserted" : case "insert" : b != a && ( this . obj [ this . _methods [ 2 ] ] ( a , b ) , a = b ) ; break ; case "delete" : case "deleted" : return this . obj . setUserData ( a , this . action _param , "true_deleted" ) , this . obj [ this . _methods [ 3 ] ] ( a ) , delete this . _in _progress [ e ] , this . callEvent ( "onAfterUpdate" , [ a , c , b , d ] ) } this . _in _progress [ e ] != "wait" ? ( f && this . obj . setUserData ( a , this . action _param , "" ) , delete this . _in _progress [ e ] ) : ( delete this . _in _progress [ e ] , this . setUpdated ( b ,
! 0 , this . obj . getUserData ( a , this . action _param ) ) ) ; this . callEvent ( "onAfterUpdate" , [ a , c , b , d ] ) } , afterUpdate : function ( a , b , c , d , e ) { e . getXMLTopNode ( "data" ) ; if ( e . xmlDoc . responseXML ) { for ( var f = e . doXPath ( "//data/action" ) , g = 0 ; g < f . length ; g ++ ) { var h = f [ g ] , i = h . getAttribute ( "type" ) , k = h . getAttribute ( "sid" ) , j = h . getAttribute ( "tid" ) ; a . afterUpdateCallback ( k , j , i , h ) } a . finalizeUpdate ( ) } } , finalizeUpdate : function ( ) { this . _waitMode && this . _waitMode -- ; ( this . obj . mytype == "tree" || this . obj . _h2 ) && this . updatedRows . length && this . sendData ( ) ;
this . callEvent ( "onAfterUpdateFinish" , [ ] ) ; this . updatedRows . length || this . callEvent ( "onFullSync" , [ ] ) } , init : function ( a ) { this . obj = a ; this . obj . _dp _init && this . obj . _dp _init ( this ) } , setOnAfterUpdate : function ( a ) { this . attachEvent ( "onAfterUpdate" , a ) } , enableDebug : function ( ) { } , setOnBeforeUpdateHandler : function ( a ) { this . attachEvent ( "onBeforeDataSending" , a ) } , setAutoUpdate : function ( a , b ) { a = a || 2E3 ; this . _user = b || ( new Date ) . valueOf ( ) ; this . _need _update = ! 1 ; this . _loader = null ; this . _update _busy = ! 1 ; this . attachEvent ( "onAfterUpdate" ,
function ( a , b , c , g ) { this . afterAutoUpdate ( a , b , c , g ) } ) ; this . attachEvent ( "onFullSync" , function ( ) { this . fullSync ( ) } ) ; var c = this ; window . setInterval ( function ( ) { c . loadUpdate ( ) } , a ) } , afterAutoUpdate : function ( a , b ) { return b == "collision" ? ( this . _need _update = ! 0 , ! 1 ) : ! 0 } , fullSync : function ( ) { if ( this . _need _update == ! 0 ) this . _need _update = ! 1 , this . loadUpdate ( ) ; return ! 0 } , getUpdates : function ( a , b ) { if ( this . _update _busy ) return ! 1 ; else this . _update _busy = ! 0 ; this . _loader = this . _loader || new dtmlXMLLoaderObject ( ! 0 ) ; this . _loader . async =
! 0 ; this . _loader . waitCall = b ; this . _loader . loadXML ( a ) } , _v : function ( a ) { return a . firstChild ? a . firstChild . nodeValue : "" } , _a : function ( a ) { for ( var b = [ ] , c = 0 ; c < a . length ; c ++ ) b [ c ] = this . _v ( a [ c ] ) ; return b } , loadUpdate : function ( ) { var a = this , b = this . obj . getUserData ( 0 , "version" ) , c = this . serverProcessor + getUrlSymbol ( this . serverProcessor ) + [ "dhx_user=" + this . _user , "dhx_version=" + b ] . join ( "&" ) , c = c . replace ( "editing=true&" , "" ) ; this . getUpdates ( c , function ( ) { var b = a . _loader . doXPath ( "//userdata" ) ; a . obj . setUserData ( 0 , "version" , a . _v ( b [ 0 ] ) ) ;
var c = a . _loader . doXPath ( "//update" ) ; if ( c . length ) { a . _silent _mode = ! 0 ; for ( var f = 0 ; f < c . length ; f ++ ) { var g = c [ f ] . getAttribute ( "status" ) , h = c [ f ] . getAttribute ( "id" ) , i = c [ f ] . getAttribute ( "parent" ) ; switch ( g ) { case "inserted" : a . callEvent ( "insertCallback" , [ c [ f ] , h , i ] ) ; break ; case "updated" : a . callEvent ( "updateCallback" , [ c [ f ] , h , i ] ) ; break ; case "deleted" : a . callEvent ( "deleteCallback" , [ c [ f ] , h , i ] ) } } a . _silent _mode = ! 1 } a . _update _busy = ! 1 ; a = null } ) } } ;
if ( window . dhtmlXGridObject ) dhtmlXGridObject . prototype . _init _point _connector = dhtmlXGridObject . prototype . _init _point , dhtmlXGridObject . prototype . _init _point = function ( ) { var a = function ( a ) { a = a . replace ( /(\?|\&)connector[^\f]*/g , "" ) ; return a + ( a . indexOf ( "?" ) != - 1 ? "&" : "?" ) + "connector=true" + ( this . hdr . rows . length > 0 ? "&dhx_no_header=1" : "" ) } , b = function ( b ) { return a . call ( this , b ) + ( this . _connector _sorting || "" ) + ( this . _connector _filter || "" ) } , c = function ( a , c , d ) { this . _connector _sorting = "&dhx_sort[" + c + "]=" + d ; return b . call ( this ,
a ) } , d = function ( a , c , d ) { for ( var h = 0 ; h < c . length ; h ++ ) c [ h ] = "dhx_filter[" + c [ h ] + "]=" + encodeURIComponent ( d [ h ] ) ; this . _connector _filter = "&" + c . join ( "&" ) ; return b . call ( this , a ) } ; this . attachEvent ( "onCollectValues" , function ( a ) { return this . _con _f _used [ a ] ? typeof this . _con _f _used [ a ] == "object" ? this . _con _f _used [ a ] : ! 1 : ! 0 } ) ; this . attachEvent ( "onDynXLS" , function ( ) { this . xmlFileUrl = b . call ( this , this . xmlFileUrl ) ; return ! 0 } ) ; this . attachEvent ( "onBeforeSorting" , function ( a , b , d ) { if ( b == "connector" ) { var h = this ; this . clearAndLoad ( c . call ( this ,
this . xmlFileUrl , a , d ) , function ( ) { h . setSortImgState ( ! 0 , a , d ) } ) ; return ! 1 } return ! 0 } ) ; this . attachEvent ( "onFilterStart" , function ( a , b ) { return this . _con _f _used . length ? ( this . clearAndLoad ( d . call ( this , this . xmlFileUrl , a , b ) ) , ! 1 ) : ! 0 } ) ; this . attachEvent ( "onXLE" , function ( ) { } ) ; this . _init _point _connector && this . _init _point _connector ( ) } , dhtmlXGridObject . prototype . _con _f _used = [ ] , dhtmlXGridObject . prototype . _in _header _connector _text _filter = function ( a , b ) { this . _con _f _used [ b ] || ( this . _con _f _used [ b ] = 1 ) ; return this . _in _header _text _filter ( a ,
b ) } , dhtmlXGridObject . prototype . _in _header _connector _select _filter = function ( a , b ) { this . _con _f _used [ b ] || ( this . _con _f _used [ b ] = 2 ) ; return this . _in _header _select _filter ( a , b ) } , dhtmlXGridObject . prototype . load _connector = dhtmlXGridObject . prototype . load , dhtmlXGridObject . prototype . load = function ( a , b , c ) { if ( ! this . _colls _loaded && this . cellType ) { for ( var d = [ ] , e = 0 ; e < this . cellType . length ; e ++ ) ( this . cellType [ e ] . indexOf ( "co" ) == 0 || this . _con _f _used [ e ] == 2 ) && d . push ( e ) ; d . length && ( arguments [ 0 ] += ( arguments [ 0 ] . indexOf ( "?" ) != - 1 ? "&" :
"?" ) + "connector=true&dhx_colls=" + d . join ( "," ) ) } return this . load _connector . apply ( this , arguments ) } , dhtmlXGridObject . prototype . _parseHead _connector = dhtmlXGridObject . prototype . _parseHead , dhtmlXGridObject . prototype . _parseHead = function ( a , b , c ) { this . _parseHead _connector . apply ( this , arguments ) ; if ( ! this . _colls _loaded ) { for ( var d = this . xmlLoader . doXPath ( "./coll_options" , arguments [ 0 ] ) , e = 0 ; e < d . length ; e ++ ) { var f = d [ e ] . getAttribute ( "for" ) , g = [ ] , h = null ; this . cellType [ f ] == "combo" && ( h = this . getColumnCombo ( f ) ) ; this . cellType [ f ] . indexOf ( "co" ) ==
0 && ( h = this . getCombo ( f ) ) ; for ( var i = this . xmlLoader . doXPath ( "./item" , d [ e ] ) , k = 0 ; k < i . length ; k ++ ) { var j = i [ k ] . getAttribute ( "value" ) ; if ( h ) { var l = i [ k ] . getAttribute ( "label" ) || j ; h . addOption ? h . addOption ( [ [ j , l ] ] ) : h . put ( j , l ) ; g [ g . length ] = l } else g [ g . length ] = j } this . _con _f _used [ f * 1 ] && ( this . _con _f _used [ f * 1 ] = g ) } this . _colls _loaded = ! 0 } } ;
if ( window . dataProcessor ) dataProcessor . prototype . init _original = dataProcessor . prototype . init , dataProcessor . prototype . init = function ( a ) { this . init _original ( a ) ; a . _dataprocessor = this ; this . setTransactionMode ( "POST" , ! 0 ) ; this . serverProcessor += ( this . serverProcessor . indexOf ( "?" ) != - 1 ? "&" : "?" ) + "editing=true" } ; dhtmlxError . catchError ( "LoadXML" , function ( a , b , c ) { c [ 0 ] . status != 0 && alert ( c [ 0 ] . responseText ) } ) ; window . dhtmlXScheduler = window . scheduler = { version : 3 } ; dhtmlxEventable ( scheduler ) ;
scheduler . init = function ( a , b , c ) { b = b || new Date ; c = c || "week" ; scheduler . date . init ( ) ; this . _obj = typeof a == "string" ? document . getElementById ( a ) : a ; this . _els = [ ] ; this . _scroll = ! 0 ; this . _quirks = _isIE && document . compatMode == "BackCompat" ; this . _quirks7 = _isIE && navigator . appVersion . indexOf ( "MSIE 8" ) == - 1 ; this . get _elements ( ) ; this . init _templates ( ) ; this . set _actions ( ) ; dhtmlxEvent ( window , "resize" , function ( ) { window . clearTimeout ( scheduler . _resize _timer ) ; scheduler . _resize _timer = window . setTimeout ( function ( ) { scheduler . callEvent ( "onSchedulerResize" ,
[ ] ) && scheduler . update _view ( ) } , 100 ) } ) ; this . set _sizes ( ) ; scheduler . callEvent ( "onSchedulerReady" , [ ] ) ; this . setCurrentView ( b , c ) } ; scheduler . xy = { nav _height : 22 , min _event _height : 40 , scale _width : 50 , bar _height : 20 , scroll _width : 18 , scale _height : 20 , month _scale _height : 20 , menu _width : 25 , margin _top : 0 , margin _left : 0 , editor _width : 140 } ; scheduler . keys = { edit _save : 13 , edit _cancel : 27 } ;
scheduler . set _sizes = function ( ) { var a = this . _x = this . _obj . clientWidth - this . xy . margin _left , b = this . _y = this . _obj . clientHeight - this . xy . margin _top , c = this . _table _view ? 0 : this . xy . scale _width + this . xy . scroll _width , d = this . _table _view ? - 1 : this . xy . scale _width ; this . set _xy ( this . _els . dhx _cal _navline [ 0 ] , a , this . xy . nav _height , 0 , 0 ) ; this . set _xy ( this . _els . dhx _cal _header [ 0 ] , a - c , this . xy . scale _height , d , this . xy . nav _height + ( this . _quirks ? - 1 : 1 ) ) ; var e = this . _els . dhx _cal _navline [ 0 ] . offsetHeight ; if ( e > 0 ) this . xy . nav _height = e ; var f = this . xy . scale _height +
this . xy . nav _height + ( this . _quirks ? - 2 : 0 ) ; this . set _xy ( this . _els . dhx _cal _data [ 0 ] , a , b - ( f + 2 ) , 0 , f + 2 ) } ; scheduler . set _xy = function ( a , b , c , d , e ) { a . style . width = Math . max ( 0 , b ) + "px" ; a . style . height = Math . max ( 0 , c ) + "px" ; if ( arguments . length > 3 ) a . style . left = d + "px" , a . style . top = e + "px" } ;
scheduler . get _elements = function ( ) { for ( var a = this . _obj . getElementsByTagName ( "DIV" ) , b = 0 ; b < a . length ; b ++ ) { var c = a [ b ] . className ; this . _els [ c ] || ( this . _els [ c ] = [ ] ) ; this . _els [ c ] . push ( a [ b ] ) ; var d = scheduler . locale . labels [ a [ b ] . getAttribute ( "name" ) || c ] ; if ( d ) a [ b ] . innerHTML = d } } ;
scheduler . set _actions = function ( ) { for ( var a in this . _els ) if ( this . _click [ a ] ) for ( var b = 0 ; b < this . _els [ a ] . length ; b ++ ) this . _els [ a ] [ b ] . onclick = scheduler . _click [ a ] ; this . _obj . onselectstart = function ( ) { return ! 1 } ; this . _obj . onmousemove = function ( a ) { scheduler . _on _mouse _move ( a || event ) } ; this . _obj . onmousedown = function ( a ) { scheduler . _on _mouse _down ( a || event ) } ; this . _obj . onmouseup = function ( a ) { scheduler . _on _mouse _up ( a || event ) } ; this . _obj . ondblclick = function ( a ) { scheduler . _on _dbl _click ( a || event ) } } ;
scheduler . select = function ( a ) { if ( ! this . _table _view && this . getEvent ( a ) . _timed && this . _select _id != a ) this . editStop ( ! 1 ) , this . unselect ( ) , this . _select _id = a , this . updateEvent ( a ) } ; scheduler . unselect = function ( a ) { if ( ! ( a && a != this . _select _id ) ) { var b = this . _select _id ; this . _select _id = null ; b && this . updateEvent ( b ) } } ; scheduler . getState = function ( ) { return { mode : this . _mode , date : this . _date , min _date : this . _min _date , max _date : this . _max _date , editor _id : this . _edit _id , lightbox _id : this . _lightbox _id , new _event : this . _new _event } } ;
scheduler . _click = { dhx _cal _data : function ( a ) { var b = a ? a . target : event . srcElement , c = scheduler . _locate _event ( b ) , a = a || event ; if ( ! ( c && ! scheduler . callEvent ( "onClick" , [ c , a ] ) || scheduler . config . readonly ) ) if ( c ) { scheduler . select ( c ) ; var d = b . className ; if ( d . indexOf ( "_icon" ) != - 1 ) scheduler . _click . buttons [ d . split ( " " ) [ 1 ] . replace ( "icon_" , "" ) ] ( c ) } else scheduler . _close _not _saved ( ) } , dhx _cal _prev _button : function ( ) { scheduler . _click . dhx _cal _next _button ( 0 , - 1 ) } , dhx _cal _next _button : function ( a , b ) { scheduler . setCurrentView ( scheduler . date . add ( scheduler . date [ scheduler . _mode +
"_start" ] ( scheduler . _date ) , b || 1 , scheduler . _mode ) ) } , dhx _cal _today _button : function ( ) { scheduler . setCurrentView ( new Date ) } , dhx _cal _tab : function ( ) { var a = this . getAttribute ( "name" ) , b = a . substring ( 0 , a . search ( "_tab" ) ) ; scheduler . setCurrentView ( scheduler . _date , b ) } , buttons : { "delete" : function ( a ) { var b = scheduler . locale . labels . confirm _deleting ; ( ! b || confirm ( b ) ) && scheduler . deleteEvent ( a ) } , edit : function ( a ) { scheduler . edit ( a ) } , save : function ( ) { scheduler . editStop ( ! 0 ) } , details : function ( a ) { scheduler . showLightbox ( a ) } , cancel : function ( ) { scheduler . editStop ( ! 1 ) } } } ;
scheduler . addEventNow = function ( a , b , c ) { var d = { } ; a && a . constructor . toString ( ) . match ( /object/i ) !== null && ( d = a , a = null ) ; var e = ( this . config . event _duration || this . config . time _step ) * 6E4 ; a || ( a = Math . round ( ( new Date ) . valueOf ( ) / e ) * e ) ; var f = new Date ( a ) ; if ( ! b ) { var g = this . config . first _hour ; g > f . getHours ( ) && ( f . setHours ( g ) , a = f . valueOf ( ) ) ; b = a + e } var h = new Date ( b ) ; f . valueOf ( ) == h . valueOf ( ) && h . setTime ( h . valueOf ( ) + e ) ; d . start _date = d . start _date || f ; d . end _date = d . end _date || h ; d . text = d . text || this . locale . labels . new _event ; d . id = this . _drag _id =
this . uid ( ) ; this . _drag _mode = "new-size" ; this . _loading = ! 0 ; this . addEvent ( d ) ; this . callEvent ( "onEventCreated" , [ this . _drag _id , c ] ) ; this . _loading = ! 1 ; this . _drag _event = { } ; this . _on _mouse _up ( c ) } ;
scheduler . _on _dbl _click = function ( a , b ) { b = b || a . target || a . srcElement ; if ( ! this . config . readonly ) { var c = b . className . split ( " " ) [ 0 ] ; switch ( c ) { case "dhx_scale_holder" : case "dhx_scale_holder_now" : case "dhx_month_body" : case "dhx_wa_day_data" : if ( ! scheduler . config . dblclick _create ) break ; var d = this . _mouse _coords ( a ) , e = this . _min _date . valueOf ( ) + ( d . y * this . config . time _step + ( this . _table _view ? 0 : d . x ) * 1440 ) * 6E4 , e = this . _correct _shift ( e ) ; this . addEventNow ( e , null , a ) ; break ; case "dhx_body" : case "dhx_wa_ev_body" : case "dhx_cal_event_line" : case "dhx_cal_event_clear" : var f =
this . _locate _event ( b ) ; if ( ! this . callEvent ( "onDblClick" , [ f , a ] ) ) break ; this . config . details _on _dblclick || this . _table _view || ! this . getEvent ( f ) . _timed ? this . showLightbox ( f ) : this . edit ( f ) ; break ; case "" : if ( b . parentNode ) return scheduler . _on _dbl _click ( a , b . parentNode ) ; default : var g = this [ "dblclick_" + c ] ; g && g . call ( this , a ) } } } ;
scheduler . _mouse _coords = function ( a ) { var b , c = document . body , d = document . documentElement ; b = a . pageX || a . pageY ? { x : a . pageX , y : a . pageY } : { x : a . clientX + ( c . scrollLeft || d . scrollLeft || 0 ) - c . clientLeft , y : a . clientY + ( c . scrollTop || d . scrollTop || 0 ) - c . clientTop } ; b . x -= getAbsoluteLeft ( this . _obj ) + ( this . _table _view ? 0 : this . xy . scale _width ) ; b . y -= getAbsoluteTop ( this . _obj ) + this . xy . nav _height + ( this . _dy _shift || 0 ) + this . xy . scale _height - this . _els . dhx _cal _data [ 0 ] . scrollTop ; b . ev = a ; var e = this [ "mouse_" + this . _mode ] ; if ( e ) return e . call ( this ,
b ) ; if ( this . _table _view ) { for ( var f = 0 , f = 1 ; f < this . _colsS . heights . length ; f ++ ) if ( this . _colsS . heights [ f ] > b . y ) break ; b . y = ( Math . max ( 0 , Math . ceil ( b . x / this . _cols [ 0 ] ) - 1 ) + Math . max ( 0 , f - 1 ) * 7 ) * 1440 / this . config . time _step ; b . x = 0 } else b . x = Math . max ( 0 , Math . ceil ( b . x / this . _cols [ 0 ] ) - 1 ) , b . y = Math . max ( 0 , Math . ceil ( b . y * 60 / ( this . config . time _step * this . config . hour _size _px ) ) - 1 ) + this . config . first _hour * ( 60 / this . config . time _step ) ; return b } ;
scheduler . _close _not _saved = function ( ) { if ( ( new Date ) . valueOf ( ) - ( scheduler . _new _event || 0 ) > 500 && scheduler . _edit _id ) { var a = scheduler . locale . labels . confirm _closing ; ( ! a || confirm ( a ) ) && scheduler . editStop ( scheduler . config . positive _closing ) } } ; scheduler . _correct _shift = function ( a , b ) { return a -= ( ( new Date ( scheduler . _min _date ) ) . getTimezoneOffset ( ) - ( new Date ( a ) ) . getTimezoneOffset ( ) ) * 6E4 * ( b ? - 1 : 1 ) } ;
scheduler . _on _mouse _move = function ( a ) { if ( this . _drag _mode ) { var b = this . _mouse _coords ( a ) ; if ( ! this . _drag _pos || b . custom || this . _drag _pos . x != b . x || this . _drag _pos . y != b . y ) { this . _edit _id != this . _drag _id && this . _close _not _saved ( ) ; this . _drag _pos = b ; if ( this . _drag _mode == "create" ) { this . _close _not _saved ( ) ; this . _loading = ! 0 ; var c = this . _min _date . valueOf ( ) + ( b . y * this . config . time _step + ( this . _table _view ? 0 : b . x ) * 1440 ) * 6E4 , c = this . _correct _shift ( c ) ; if ( ! this . _drag _start ) { this . _drag _start = c ; return } var d = c ; if ( d == this . _drag _start ) return ;
this . _drag _id = this . uid ( ) ; this . addEvent ( new Date ( this . _drag _start ) , new Date ( d ) , this . locale . labels . new _event , this . _drag _id , b . fields ) ; this . callEvent ( "onEventCreated" , [ this . _drag _id , a ] ) ; this . _loading = ! 1 ; this . _drag _mode = "new-size" } var e = this . getEvent ( this . _drag _id ) ; if ( this . _drag _mode == "move" ) c = this . _min _date . valueOf ( ) + ( b . y * this . config . time _step + b . x * 1440 ) * 6E4 , ! b . custom && this . _table _view && ( c += this . date . time _part ( e . start _date ) * 1E3 ) , c = this . _correct _shift ( c ) , d = e . end _date . valueOf ( ) - ( e . start _date . valueOf ( ) - c ) ;
else { c = e . start _date . valueOf ( ) ; if ( this . _table _view ) d = this . _min _date . valueOf ( ) + b . y * this . config . time _step * 6E4 + ( b . custom ? 0 : 864E5 ) , this . _mode == "month" && ( d = this . _correct _shift ( d , ! 1 ) ) ; else if ( d = this . date . date _part ( new Date ( e . end _date ) ) . valueOf ( ) + b . y * this . config . time _step * 6E4 , this . _els . dhx _cal _data [ 0 ] . style . cursor = "s-resize" , this . _mode == "week" || this . _mode == "day" ) d = this . _correct _shift ( d ) ; if ( this . _drag _mode == "new-size" ) if ( d <= this . _drag _start ) var f = b . shift || ( this . _table _view && ! b . custom ? 864E5 : 0 ) , c = d - ( b . shift ?
0 : f ) , d = this . _drag _start + ( f || this . config . time _step * 6E4 ) ; else c = this . _drag _start ; else d <= c && ( d = c + this . config . time _step * 6E4 ) } var g = new Date ( d - 1 ) , h = new Date ( c ) ; if ( this . _table _view || g . getDate ( ) == h . getDate ( ) && g . getHours ( ) < this . config . last _hour || scheduler . _wa && scheduler . _wa . _dnd ) e . start _date = h , e . end _date = new Date ( d ) , this . config . update _render ? this . update _view ( ) : this . updateEvent ( this . _drag _id ) ; this . _table _view && this . for _rendered ( this . _drag _id , function ( a ) { a . className += " dhx_in_move" } ) } } else if ( scheduler . checkEvent ( "onMouseMove" ) ) { var i =
this . _locate _event ( a . target || a . srcElement ) ; this . callEvent ( "onMouseMove" , [ i , a ] ) } } ; scheduler . _on _mouse _context = function ( a , b ) { return this . callEvent ( "onContextMenu" , [ this . _locate _event ( b ) , a ] ) } ;
scheduler . _on _mouse _down = function ( a , b ) { if ( ! this . config . readonly && ! this . _drag _mode ) { b = b || a . target || a . srcElement ; if ( a . button == 2 || a . ctrlKey ) return this . _on _mouse _context ( a , b ) ; switch ( b . className . split ( " " ) [ 0 ] ) { case "dhx_cal_event_line" : case "dhx_cal_event_clear" : if ( this . _table _view ) this . _drag _mode = "move" ; break ; case "dhx_header" : case "dhx_title" : case "dhx_wa_ev_body" : this . _drag _mode = "move" ; break ; case "dhx_footer" : this . _drag _mode = "resize" ; break ; case "dhx_scale_holder" : case "dhx_scale_holder_now" : case "dhx_month_body" : case "dhx_matrix_cell" : this . _drag _mode =
"create" ; break ; case "" : if ( b . parentNode ) return scheduler . _on _mouse _down ( a , b . parentNode ) ; default : this . _drag _id = this . _drag _mode = null } if ( this . _drag _mode ) { var c = this . _locate _event ( b ) ; ! this . config [ "drag_" + this . _drag _mode ] || ! this . callEvent ( "onBeforeDrag" , [ c , this . _drag _mode , a ] ) ? this . _drag _mode = this . _drag _id = 0 : ( this . _drag _id = c , this . _drag _event = scheduler . _lame _copy ( { } , this . _copy _event ( this . getEvent ( this . _drag _id ) || { } ) ) ) } this . _drag _start = null } } ;
scheduler . _on _mouse _up = function ( a ) { if ( this . _drag _mode && this . _drag _id ) { this . _els . dhx _cal _data [ 0 ] . style . cursor = "default" ; var b = this . getEvent ( this . _drag _id ) ; if ( this . _drag _event . _dhx _changed || ! this . _drag _event . start _date || b . start _date . valueOf ( ) != this . _drag _event . start _date . valueOf ( ) || b . end _date . valueOf ( ) != this . _drag _event . end _date . valueOf ( ) ) { var c = this . _drag _mode == "new-size" ; if ( this . callEvent ( "onBeforeEventChanged" , [ b , a , c ] ) ) if ( c && this . config . edit _on _create ) { this . unselect ( ) ; this . _new _event = new Date ; if ( this . _table _view ||
this . config . details _on _create ) return this . _drag _mode = null , this . showLightbox ( this . _drag _id ) ; this . _drag _pos = ! 0 ; this . _select _id = this . _edit _id = this . _drag _id } else this . _new _event || this . callEvent ( c ? "onEventAdded" : "onEventChanged" , [ this . _drag _id , this . getEvent ( this . _drag _id ) ] ) ; else c ? this . deleteEvent ( b . id , ! 0 ) : ( this . _drag _event . _dhx _changed = ! 1 , scheduler . _lame _copy ( b , this . _drag _event ) , this . updateEvent ( b . id ) ) } this . _drag _pos && this . render _view _data ( ) } this . _drag _pos = this . _drag _mode = null } ;
scheduler . update _view = function ( ) { this . _reset _scale ( ) ; if ( this . _load _mode && this . _load ( ) ) return this . _render _wait = ! 0 ; this . render _view _data ( ) } ;
scheduler . setCurrentView = function ( a , b ) { a = a || this . _date ; b = b || this . _mode ; if ( this . callEvent ( "onBeforeViewChange" , [ this . _mode , this . _date , b , a ] ) ) { var c = "dhx_cal_data" , d = this . _mode == b && this . config . preserve _scroll ? this . _els [ c ] [ 0 ] . scrollTop : ! 1 ; if ( this [ this . _mode + "_view" ] && b && this . _mode != b ) this [ this . _mode + "_view" ] ( ! 1 ) ; this . _close _not _saved ( ) ; var e = "dhx_multi_day" ; this . _els [ e ] && ( this . _els [ e ] [ 0 ] . parentNode . removeChild ( this . _els [ e ] [ 0 ] ) , this . _els [ e ] = null ) ; this . _mode = b ; this . _date = a ; this . _table _view = this . _mode ==
"month" ; for ( var f = this . _els . dhx _cal _tab , g = 0 ; g < f . length ; g ++ ) f [ g ] . className = "dhx_cal_tab" + ( f [ g ] . getAttribute ( "name" ) == this . _mode + "_tab" ? " active" : "" ) ; var h = this [ this . _mode + "_view" ] ; h ? h ( ! 0 ) : this . update _view ( ) ; if ( typeof d == "number" ) this . _els [ c ] [ 0 ] . scrollTop = d ; this . callEvent ( "onViewChange" , [ this . _mode , this . _date ] ) } } ;
scheduler . _render _x _header = function ( a , b , c , d ) { var e = document . createElement ( "DIV" ) ; e . className = "dhx_scale_bar" ; this . set _xy ( e , this . _cols [ a ] - 1 , this . xy . scale _height - 2 , b , 0 ) ; e . innerHTML = this . templates [ this . _mode + "_scale_date" ] ( c , this . _mode ) ; d . appendChild ( e ) } ;
scheduler . _reset _scale = function ( ) { if ( this . templates [ this . _mode + "_date" ] ) { var a = this . _els . dhx _cal _header [ 0 ] , b = this . _els . dhx _cal _data [ 0 ] , c = this . config ; a . innerHTML = "" ; b . scrollTop = 0 ; b . innerHTML = "" ; var d = ( c . readonly || ! c . drag _resize ? " dhx_resize_denied" : "" ) + ( c . readonly || ! c . drag _move ? " dhx_move_denied" : "" ) ; if ( d ) b . className = "dhx_cal_data" + d ; this . _cols = [ ] ; this . _colsS = { height : 0 } ; this . _dy _shift = 0 ; this . set _sizes ( ) ; var e = parseInt ( a . style . width ) , f = 0 , g , h , i , k ; h = this . date [ this . _mode + "_start" ] ( new Date ( this . _date . valueOf ( ) ) ) ;
g = i = this . _table _view ? scheduler . date . week _start ( h ) : h ; k = this . date . date _part ( new Date ) ; var j = scheduler . date . add ( h , 1 , this . _mode ) , l = 7 ; if ( ! this . _table _view ) { var o = this . date [ "get_" + this . _mode + "_end" ] ; o && ( j = o ( h ) ) ; l = Math . round ( ( j . valueOf ( ) - h . valueOf ( ) ) / 864E5 ) } this . _min _date = g ; this . _els . dhx _cal _date [ 0 ] . innerHTML = this . templates [ this . _mode + "_date" ] ( h , j , this . _mode ) ; for ( var m = 0 ; m < l ; m ++ ) { this . _cols [ m ] = Math . floor ( e / ( l - m ) ) ; this . _render _x _header ( m , f , g , a ) ; if ( ! this . _table _view ) { var n = document . createElement ( "DIV" ) , p =
"dhx_scale_holder" ; g . valueOf ( ) == k . valueOf ( ) && ( p = "dhx_scale_holder_now" ) ; n . className = p + " " + this . templates . week _date _class ( g , k ) ; this . set _xy ( n , this . _cols [ m ] - 1 , c . hour _size _px * ( c . last _hour - c . first _hour ) , f + this . xy . scale _width + 1 , 0 ) ; b . appendChild ( n ) ; this . callEvent ( "onScaleAdd" , [ n , g ] ) } g = this . date . add ( g , 1 , "day" ) ; e -= this . _cols [ m ] ; f += this . _cols [ m ] ; this . _colsS [ m ] = ( this . _cols [ m - 1 ] || 0 ) + ( this . _colsS [ m - 1 ] || ( this . _table _view ? 0 : this . xy . scale _width + 2 ) ) ; this . _colsS . col _length = l + 1 } this . _max _date = g ; this . _colsS [ l ] = this . _cols [ l -
1 ] + this . _colsS [ l - 1 ] ; if ( this . _table _view ) this . _reset _month _scale ( b , h , i ) ; else { this . _reset _hours _scale ( b , h , i ) ; if ( c . multi _day ) { var q = "dhx_multi_day" ; this . _els [ q ] && ( this . _els [ q ] [ 0 ] . parentNode . removeChild ( this . _els [ q ] [ 0 ] ) , this . _els [ q ] = null ) ; var v = this . _els . dhx _cal _navline [ 0 ] , s = v . offsetHeight + this . _els . dhx _cal _header [ 0 ] . offsetHeight + 1 , r = document . createElement ( "DIV" ) ; r . className = q ; r . style . visibility = "hidden" ; this . set _xy ( r , this . _colsS [ this . _colsS . col _length - 1 ] + this . xy . scroll _width , 0 , 0 , s ) ; b . parentNode . insertBefore ( r ,
b ) ; var u = r . cloneNode ( ! 0 ) ; u . className = q + "_icon" ; u . style . visibility = "hidden" ; this . set _xy ( u , this . xy . scale _width , 0 , 0 , s ) ; r . appendChild ( u ) ; this . _els [ q ] = [ r , u ] ; this . _els [ q ] [ 0 ] . onclick = this . _click . dhx _cal _data } if ( this . config . mark _now ) { var t = new Date ; if ( t < this . _max _date && t > this . _min _date && t . getHours ( ) >= this . config . first _hour && t . getHours ( ) < this . config . last _hour ) { var A = this . locate _holder _day ( t ) , B = t . getHours ( ) * 60 + t . getMinutes ( ) , y = document . createElement ( "DIV" ) ; y . className = "dhx_now_time" ; y . style . top = Math . round ( ( B *
6E4 - this . config . first _hour * 36E5 ) * this . config . hour _size _px / 36E5 ) % ( this . config . hour _size _px * 24 ) + 1 + "px" ; b . childNodes [ A ] . appendChild ( y ) } } } } } ;
scheduler . _reset _hours _scale = function ( a ) { var b = document . createElement ( "DIV" ) ; b . className = "dhx_scale_holder" ; for ( var c = new Date ( 1980 , 1 , 1 , this . config . first _hour , 0 , 0 ) , d = this . config . first _hour * 1 ; d < this . config . last _hour ; d ++ ) { var e = document . createElement ( "DIV" ) ; e . className = "dhx_scale_hour" ; e . style . height = this . config . hour _size _px - ( this . _quirks ? 0 : 1 ) + "px" ; e . style . width = this . xy . scale _width + "px" ; e . innerHTML = scheduler . templates . hour _scale ( c ) ; b . appendChild ( e ) ; c = this . date . add ( c , 1 , "hour" ) } a . appendChild ( b ) ; if ( this . config . scroll _hour ) a . scrollTop =
this . config . hour _size _px * ( this . config . scroll _hour - this . config . first _hour ) } ;
scheduler . _reset _month _scale = function ( a , b , c ) { var d = scheduler . date . add ( b , 1 , "month" ) , e = new Date ; this . date . date _part ( e ) ; this . date . date _part ( c ) ; var f = Math . ceil ( Math . round ( ( d . valueOf ( ) - c . valueOf ( ) ) / 864E5 ) / 7 ) , g = [ ] , h = Math . floor ( a . clientHeight / f ) - 22 ; this . _colsS . height = h + 22 ; for ( var i = this . _colsS . heights = [ ] , k = 0 ; k <= 7 ; k ++ ) g [ k ] = " style='height:" + h + "px; width:" + ( ( this . _cols [ k ] || 0 ) - 1 ) + "px;' " ; var j = 0 ; this . _min _date = c ; for ( var l = "<table cellpadding='0' cellspacing='0'>" , k = 0 ; k < f ; k ++ ) { l += "<tr>" ; for ( var o = 0 ; o < 7 ; o ++ ) { l +=
"<td" ; var m = "" ; c < b ? m = "dhx_before" : c >= d ? m = "dhx_after" : c . valueOf ( ) == e . valueOf ( ) && ( m = "dhx_now" ) ; l += " class='" + m + " " + this . templates . month _date _class ( c , e ) + "' " ; l += "><div class='dhx_month_head'>" + this . templates . month _day ( c ) + "</div><div class='dhx_month_body' " + g [ o ] + "></div></td>" ; c = this . date . add ( c , 1 , "day" ) } l += "</tr>" ; i [ k ] = j ; j += this . _colsS . height } l += "</table>" ; this . _max _date = c ; a . innerHTML = l ; return c } ;
scheduler . getLabel = function ( a , b ) { for ( var c = this . config . lightbox . sections , d = 0 ; d < c . length ; d ++ ) if ( c [ d ] . map _to == a ) for ( var e = c [ d ] . options , f = 0 ; f < e . length ; f ++ ) if ( e [ f ] . key == b ) return e [ f ] . label ; return "" } ; scheduler . updateCollection = function ( a , b ) { var c = scheduler . serverList ( a ) ; if ( ! c ) return ! 1 ; c . splice ( 0 , c . length ) ; c . push . apply ( c , b || [ ] ) ; scheduler . callEvent ( "onOptionsLoad" , [ ] ) ; scheduler . resetLightbox ( ) ; return ! 0 } ; scheduler . _lame _copy = function ( a , b ) { for ( var c in b ) a [ c ] = b [ c ] ; return a } ;
scheduler . date = { init : function ( ) { for ( var a = scheduler . locale . date . month _short , b = scheduler . locale . date . month _short _hash = { } , c = 0 ; c < a . length ; c ++ ) b [ a [ c ] ] = c ; a = scheduler . locale . date . month _full ; b = scheduler . locale . date . month _full _hash = { } ; for ( c = 0 ; c < a . length ; c ++ ) b [ a [ c ] ] = c } , date _part : function ( a ) { a . setHours ( 0 ) ; a . setMinutes ( 0 ) ; a . setSeconds ( 0 ) ; a . setMilliseconds ( 0 ) ; return a } , time _part : function ( a ) { return ( a . valueOf ( ) / 1E3 - a . getTimezoneOffset ( ) * 60 ) % 86400 } , week _start : function ( a ) { var b = a . getDay ( ) ; scheduler . config . start _on _monday &&
( b === 0 ? b = 6 : b -- ) ; return this . date _part ( this . add ( a , - 1 * b , "day" ) ) } , month _start : function ( a ) { a . setDate ( 1 ) ; return this . date _part ( a ) } , year _start : function ( a ) { a . setMonth ( 0 ) ; return this . month _start ( a ) } , day _start : function ( a ) { return this . date _part ( a ) } , add : function ( a , b , c ) { var d = new Date ( a . valueOf ( ) ) ; switch ( c ) { case "day" : d . setDate ( d . getDate ( ) + b ) ; if ( a . getDate ( ) == d . getDate ( ) && b ) { do d . setTime ( d . getTime ( ) + 36E5 ) ; while ( a . getDate ( ) == d . getDate ( ) ) } break ; case "week" : d . setDate ( d . getDate ( ) + 7 * b ) ; break ; case "month" : d . setMonth ( d . getMonth ( ) +
b ) ; break ; case "year" : d . setYear ( d . getFullYear ( ) + b ) ; break ; case "hour" : d . setHours ( d . getHours ( ) + b ) ; break ; case "minute" : d . setMinutes ( d . getMinutes ( ) + b ) ; break ; default : return scheduler . date [ "add_" + c ] ( a , b , c ) } return d } , to _fixed : function ( a ) { return a < 10 ? "0" + a : a } , copy : function ( a ) { return new Date ( a . valueOf ( ) ) } , date _to _str : function ( a , b ) { a = a . replace ( /%[a-zA-Z]/g , function ( a ) { switch ( a ) { case "%d" : return '"+scheduler.date.to_fixed(date.getDate())+"' ; case "%m" : return '"+scheduler.date.to_fixed((date.getMonth()+1))+"' ; case "%j" : return '"+date.getDate()+"' ;
case "%n" : return '"+(date.getMonth()+1)+"' ; case "%y" : return '"+scheduler.date.to_fixed(date.getFullYear()%100)+"' ; case "%Y" : return '"+date.getFullYear()+"' ; case "%D" : return '"+scheduler.locale.date.day_short[date.getDay()]+"' ; case "%l" : return '"+scheduler.locale.date.day_full[date.getDay()]+"' ; case "%M" : return '"+scheduler.locale.date.month_short[date.getMonth()]+"' ; case "%F" : return '"+scheduler.locale.date.month_full[date.getMonth()]+"' ; case "%h" : return '"+scheduler.date.to_fixed((date.getHours()+11)%12+1)+"' ;
case "%g" : return '"+((date.getHours()+11)%12+1)+"' ; case "%G" : return '"+date.getHours()+"' ; case "%H" : return '"+scheduler.date.to_fixed(date.getHours())+"' ; case "%i" : return '"+scheduler.date.to_fixed(date.getMinutes())+"' ; case "%a" : return '"+(date.getHours()>11?"pm":"am")+"' ; case "%A" : return '"+(date.getHours()>11?"PM":"AM")+"' ; case "%s" : return '"+scheduler.date.to_fixed(date.getSeconds())+"' ; case "%W" : return '"+scheduler.date.to_fixed(scheduler.date.getISOWeek(date))+"' ; default : return a } } ) ; b && ( a = a . replace ( /date\.get/g ,
"date.getUTC" ) ) ; return new Function ( "date" , 'return "' + a + '";' ) } , str _to _date : function ( a , b ) { for ( var c = "var temp=date.split(/[^0-9a-zA-Z]+/g);" , d = a . match ( /%[a-zA-Z]/g ) , e = 0 ; e < d . length ; e ++ ) switch ( d [ e ] ) { case "%j" : case "%d" : c += "set[2]=temp[" + e + "]||1;" ; break ; case "%n" : case "%m" : c += "set[1]=(temp[" + e + "]||1)-1;" ; break ; case "%y" : c += "set[0]=temp[" + e + "]*1+(temp[" + e + "]>50?1900:2000);" ; break ; case "%g" : case "%G" : case "%h" : case "%H" : c += "set[3]=temp[" + e + "]||0;" ; break ; case "%i" : c += "set[4]=temp[" + e + "]||0;" ; break ; case "%Y" : c +=
"set[0]=temp[" + e + "]||0;" ; break ; case "%a" : case "%A" : c += "set[3]=set[3]%12+((temp[" + e + "]||'').toLowerCase()=='am'?0:12);" ; break ; case "%s" : c += "set[5]=temp[" + e + "]||0;" ; break ; case "%M" : c += "set[1]=scheduler.locale.date.month_short_hash[temp[" + e + "]]||0;" ; break ; case "%F" : c += "set[1]=scheduler.locale.date.month_full_hash[temp[" + e + "]]||0;" } var f = "set[0],set[1],set[2],set[3],set[4],set[5]" ; b && ( f = " Date.UTC(" + f + ")" ) ; return new Function ( "date" , "var set=[0,0,1,0,0,0]; " + c + " return new Date(" + f + ");" ) } , getISOWeek : function ( a ) { if ( ! a ) return ! 1 ;
var b = a . getDay ( ) ; b === 0 && ( b = 7 ) ; var c = new Date ( a . valueOf ( ) ) ; c . setDate ( a . getDate ( ) + ( 4 - b ) ) ; var d = c . getFullYear ( ) , e = Math . round ( ( c . getTime ( ) - ( new Date ( d , 0 , 1 ) ) . getTime ( ) ) / 864E5 ) , f = 1 + Math . floor ( e / 7 ) ; return f } , getUTCISOWeek : function ( a ) { return this . getISOWeek ( a ) } } ;
scheduler . locale = { date : { month _full : "January,February,March,April,May,June,July,August,September,October,November,December" . split ( "," ) , month _short : "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" . split ( "," ) , day _full : "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday" . split ( "," ) , day _short : "Sun,Mon,Tue,Wed,Thu,Fri,Sat" . split ( "," ) } , labels : { dhx _cal _today _button : "Today" , day _tab : "Day" , week _tab : "Week" , month _tab : "Month" , new _event : "New event" , icon _save : "Save" , icon _cancel : "Cancel" , icon _details : "Details" ,
icon _edit : "Edit" , icon _delete : "Delete" , confirm _closing : "" , confirm _deleting : "Event will be deleted permanently, are you sure?" , section _description : "Description" , section _time : "Time period" , full _day : "Full day" , confirm _recurring : "Do you want to edit the whole set of repeated events?" , section _recurring : "Repeat event" , button _recurring : "Disabled" , button _recurring _open : "Enabled" , agenda _tab : "Agenda" , date : "Date" , description : "Description" , year _tab : "Year" , week _agenda _tab : "Agenda" } } ;
scheduler . config = { default _date : "%j %M %Y" , month _date : "%F %Y" , load _date : "%Y-%m-%d" , week _date : "%l" , day _date : "%D, %F %j" , hour _date : "%H:%i" , month _day : "%d" , xml _date : "%m/%d/%Y %H:%i" , api _date : "%d-%m-%Y %H:%i" , hour _size _px : 42 , time _step : 5 , start _on _monday : 1 , first _hour : 0 , last _hour : 24 , readonly : ! 1 , drag _resize : 1 , drag _move : 1 , drag _create : 1 , dblclick _create : 1 , edit _on _create : 1 , details _on _create : 0 , click _form _details : 0 , cascade _event _display : ! 1 , cascade _event _count : 4 , cascade _event _margin : 30 , drag _lightbox : ! 0 , preserve _scroll : ! 0 ,
server _utc : ! 1 , positive _closing : ! 1 , icons _edit : [ "icon_save" , "icon_cancel" ] , icons _select : [ "icon_details" , "icon_edit" , "icon_delete" ] , buttons _left : [ "dhx_save_btn" , "dhx_cancel_btn" ] , buttons _right : [ "dhx_delete_btn" ] , lightbox : { sections : [ { name : "description" , height : 200 , map _to : "text" , type : "textarea" , focus : ! 0 } , { name : "time" , height : 72 , type : "time" , map _to : "auto" } ] } , repeat _date _of _end : "01.01.2010" } ; scheduler . templates = { } ;
scheduler . init _templates = function ( ) { var a = scheduler . date . date _to _str , b = scheduler . config , c = function ( a , b ) { for ( var c in b ) a [ c ] || ( a [ c ] = b [ c ] ) } ; c ( scheduler . templates , { day _date : a ( b . default _date ) , month _date : a ( b . month _date ) , week _date : function ( a , b ) { return scheduler . templates . day _date ( a ) + " – " + scheduler . templates . day _date ( scheduler . date . add ( b , - 1 , "day" ) ) } , day _scale _date : a ( b . default _date ) , month _scale _date : a ( b . week _date ) , week _scale _date : a ( b . day _date ) , hour _scale : a ( b . hour _date ) , time _picker : a ( b . hour _date ) , event _date : a ( b . hour _date ) ,
month _day : a ( b . month _day ) , xml _date : scheduler . date . str _to _date ( b . xml _date , b . server _utc ) , load _format : a ( b . load _date , b . server _utc ) , xml _format : a ( b . xml _date , b . server _utc ) , api _date : scheduler . date . str _to _date ( b . api _date ) , event _header : function ( a , b ) { return scheduler . templates . event _date ( a ) + " - " + scheduler . templates . event _date ( b ) } , event _text : function ( a , b , c ) { return c . text } , event _class : function ( ) { return "" } , month _date _class : function ( ) { return "" } , week _date _class : function ( ) { return "" } , event _bar _date : function ( a ) { return scheduler . templates . event _date ( a ) +
" " } , event _bar _text : function ( a , b , c ) { return c . text } } ) ; this . callEvent ( "onTemplatesReady" , [ ] ) } ; scheduler . uid = function ( ) { if ( ! this . _seed ) this . _seed = ( new Date ) . valueOf ( ) ; return this . _seed ++ } ; scheduler . _events = { } ; scheduler . clearAll = function ( ) { this . _events = { } ; this . _loaded = { } ; this . clear _view ( ) } ;
scheduler . addEvent = function ( a , b , c , d , e ) { if ( ! arguments . length ) return this . addEventNow ( ) ; var f = a ; if ( arguments . length != 1 ) f = e || { } , f . start _date = a , f . end _date = b , f . text = c , f . id = d ; f . id = f . id || scheduler . uid ( ) ; f . text = f . text || "" ; if ( typeof f . start _date == "string" ) f . start _date = this . templates . api _date ( f . start _date ) ; if ( typeof f . end _date == "string" ) f . end _date = this . templates . api _date ( f . end _date ) ; var g = ( this . config . event _duration || this . config . time _step ) * 6E4 ; f . start _date . valueOf ( ) == f . end _date . valueOf ( ) && f . end _date . setTime ( f . end _date . valueOf ( ) +
g ) ; f . _timed = this . is _one _day _event ( f ) ; var h = ! this . _events [ f . id ] ; this . _events [ f . id ] = f ; this . event _updated ( f ) ; this . _loading || this . callEvent ( h ? "onEventAdded" : "onEventChanged" , [ f . id , f ] ) } ; scheduler . deleteEvent = function ( a , b ) { var c = this . _events [ a ] ; if ( b || this . callEvent ( "onBeforeEventDelete" , [ a , c ] ) && this . callEvent ( "onConfirmedBeforeEventDelete" , [ a , c ] ) ) c && ( delete this . _events [ a ] , this . unselect ( a ) , this . event _updated ( c ) ) , this . callEvent ( "onEventDeleted" , [ a ] ) } ; scheduler . getEvent = function ( a ) { return this . _events [ a ] } ;
scheduler . setEvent = function ( a , b ) { this . _events [ a ] = b } ; scheduler . for _rendered = function ( a , b ) { for ( var c = this . _rendered . length - 1 ; c >= 0 ; c -- ) this . _rendered [ c ] . getAttribute ( "event_id" ) == a && b ( this . _rendered [ c ] , c ) } ; scheduler . changeEventId = function ( a , b ) { if ( a != b ) { var c = this . _events [ a ] ; if ( c ) c . id = b , this . _events [ b ] = c , delete this . _events [ a ] ; this . for _rendered ( a , function ( a ) { a . setAttribute ( "event_id" , b ) } ) ; if ( this . _select _id == a ) this . _select _id = b ; if ( this . _edit _id == a ) this . _edit _id = b ; this . callEvent ( "onEventIdChange" , [ a , b ] ) } } ;
( function ( ) { for ( var a = "text,Text,start_date,StartDate,end_date,EndDate" . split ( "," ) , b = function ( a ) { return function ( b ) { return scheduler . getEvent ( b ) [ a ] } } , c = function ( a ) { return function ( b , c ) { var d = scheduler . getEvent ( b ) ; d [ a ] = c ; d . _changed = ! 0 ; d . _timed = this . is _one _day _event ( d ) ; scheduler . event _updated ( d , ! 0 ) } } , d = 0 ; d < a . length ; d += 2 ) scheduler [ "getEvent" + a [ d + 1 ] ] = b ( a [ d ] ) , scheduler [ "setEvent" + a [ d + 1 ] ] = c ( a [ d ] ) } ) ( ) ; scheduler . event _updated = function ( a ) { this . is _visible _events ( a ) ? this . render _view _data ( ) : this . clear _event ( a . id ) } ;
scheduler . is _visible _events = function ( a ) { return a . start _date < this . _max _date && this . _min _date < a . end _date } ; scheduler . is _one _day _event = function ( a ) { var b = a . end _date . getDate ( ) - a . start _date . getDate ( ) ; return b ? ( b < 0 && ( b = Math . ceil ( ( a . end _date . valueOf ( ) - a . start _date . valueOf ( ) ) / 864E5 ) ) , b == 1 && ! a . end _date . getHours ( ) && ! a . end _date . getMinutes ( ) && ( a . start _date . getHours ( ) || a . start _date . getMinutes ( ) ) ) : a . start _date . getMonth ( ) == a . end _date . getMonth ( ) && a . start _date . getFullYear ( ) == a . end _date . getFullYear ( ) } ;
scheduler . get _visible _events = function ( ) { var a = [ ] , b = this [ "filter_" + this . _mode ] , c ; for ( c in this . _events ) if ( this . is _visible _events ( this . _events [ c ] ) && ( this . _table _view || this . config . multi _day || this . _events [ c ] . _timed ) ) ( ! b || b ( c , this . _events [ c ] ) ) && a . push ( this . _events [ c ] ) ; return a } ;
scheduler . render _view _data = function ( a , b ) { if ( ! a ) { if ( this . _not _render ) { this . _render _wait = ! 0 ; return } this . _render _wait = ! 1 ; this . clear _view ( ) ; a = this . get _visible _events ( ) } if ( this . config . multi _day && ! this . _table _view ) { for ( var c = [ ] , d = [ ] , e = 0 ; e < a . length ; e ++ ) a [ e ] . _timed ? c . push ( a [ e ] ) : d . push ( a [ e ] ) ; this . _rendered _location = this . _els . dhx _multi _day [ 0 ] ; this . _table _view = ! 0 ; this . render _data ( d , b ) ; this . _table _view = ! 1 ; this . _rendered _location = this . _els . dhx _cal _data [ 0 ] ; this . _table _view = ! 1 ; this . render _data ( c , b ) } else this . _rendered _location =
this . _els . dhx _cal _data [ 0 ] , this . render _data ( a , b ) } ; scheduler . render _data = function ( a , b ) { for ( var a = this . _pre _render _events ( a , b ) , c = 0 ; c < a . length ; c ++ ) this . _table _view ? this . render _event _bar ( a [ c ] ) : this . render _event ( a [ c ] ) } ;
scheduler . _pre _render _events = function ( a , b ) { var c = this . xy . bar _height , d = this . _colsS . heights , e = this . _colsS . heights = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , f = this . _els . dhx _cal _data [ 0 ] , a = this . _table _view ? this . _pre _render _events _table ( a , b ) : this . _pre _render _events _line ( a , b ) ; if ( this . _table _view ) if ( b ) this . _colsS . heights = d ; else { var g = f . firstChild ; if ( g . rows ) { for ( var h = 0 ; h < g . rows . length ; h ++ ) { e [ h ] ++ ; if ( e [ h ] * c > this . _colsS . height - 22 ) { for ( var i = g . rows [ h ] . cells , k = 0 ; k < i . length ; k ++ ) i [ k ] . childNodes [ 1 ] . style . height = e [ h ] * c + "px" ; e [ h ] = ( e [ h - 1 ] ||
0 ) + i [ 0 ] . offsetHeight } e [ h ] = ( e [ h - 1 ] || 0 ) + g . rows [ h ] . cells [ 0 ] . offsetHeight } e . unshift ( 0 ) ; if ( g . parentNode . offsetHeight < g . parentNode . scrollHeight && ! g . _h _fix ) { for ( h = 0 ; h < g . rows . length ; h ++ ) { var j = g . rows [ h ] . cells [ 6 ] . childNodes [ 0 ] , l = j . offsetWidth - scheduler . xy . scroll _width + "px" ; j . style . width = l ; j . nextSibling . style . width = l } g . _h _fix = ! 0 } } else if ( ! a . length && this . _els . dhx _multi _day [ 0 ] . style . visibility == "visible" && ( e [ 0 ] = - 1 ) , a . length || e [ 0 ] == - 1 ) { var o = g . parentNode . childNodes , m = ( e [ 0 ] + 1 ) * c + 1 + "px" ; f . style . top = this . _els . dhx _cal _navline [ 0 ] . offsetHeight +
this . _els . dhx _cal _header [ 0 ] . offsetHeight + parseInt ( m ) + "px" ; f . style . height = this . _obj . offsetHeight - parseInt ( f . style . top ) - ( this . xy . margin _top || 0 ) + "px" ; var n = this . _els . dhx _multi _day [ 0 ] ; n . style . height = m ; n . style . visibility = e [ 0 ] == - 1 ? "hidden" : "visible" ; n = this . _els . dhx _multi _day [ 1 ] ; n . style . height = m ; n . style . visibility = e [ 0 ] == - 1 ? "hidden" : "visible" ; n . className = e [ 0 ] ? "dhx_multi_day_icon" : "dhx_multi_day_icon_small" ; this . _dy _shift = ( e [ 0 ] + 1 ) * c ; e [ 0 ] = 0 } } return a } ;
scheduler . _get _event _sday = function ( a ) { return Math . floor ( ( a . start _date . valueOf ( ) - this . _min _date . valueOf ( ) ) / 864E5 ) } ;
scheduler . _pre _render _events _line = function ( a , b ) { a . sort ( function ( a , b ) { return a . start _date . valueOf ( ) == b . start _date . valueOf ( ) ? a . id > b . id ? 1 : - 1 : a . start _date > b . start _date ? 1 : - 1 } ) ; for ( var c = [ ] , d = [ ] , e = 0 ; e < a . length ; e ++ ) { var f = a [ e ] , g = f . start _date . getHours ( ) , h = f . end _date . getHours ( ) ; f . _sday = this . _get _event _sday ( f ) ; c [ f . _sday ] || ( c [ f . _sday ] = [ ] ) ; if ( ! b ) { f . _inner = ! 1 ; for ( var i = c [ f . _sday ] ; i . length && i [ i . length - 1 ] . end _date <= f . start _date ; ) i . splice ( i . length - 1 , 1 ) ; for ( var k = ! 1 , j = 0 ; j < i . length ; j ++ ) if ( i [ j ] . end _date . valueOf ( ) < f . start _date . valueOf ( ) ) { k =
! 0 ; f . _sorder = i [ j ] . _sorder ; i . splice ( j , 1 ) ; f . _inner = ! 0 ; break } if ( i . length ) i [ i . length - 1 ] . _inner = ! 0 ; if ( ! k ) if ( i . length ) if ( i . length <= i [ i . length - 1 ] . _sorder ) { if ( i [ i . length - 1 ] . _sorder ) for ( j = 0 ; j < i . length ; j ++ ) { var l = ! 1 ; for ( k = 0 ; k < i . length ; k ++ ) if ( i [ k ] . _sorder == j ) { l = ! 0 ; break } if ( ! l ) { f . _sorder = j ; break } } else f . _sorder = 0 ; f . _inner = ! 0 } else { l = i [ 0 ] . _sorder ; for ( j = 1 ; j < i . length ; j ++ ) if ( i [ j ] . _sorder > l ) l = i [ j ] . _sorder ; f . _sorder = l + 1 ; f . _inner = ! 1 } else f . _sorder = 0 ; i . push ( f ) ; i . length > ( i . max _count || 0 ) ? ( i . max _count = i . length , f . _count =
i . length ) : f . _count = f . _count ? f . _count : 1 } if ( g < this . config . first _hour || h >= this . config . last _hour ) if ( d . push ( f ) , a [ e ] = f = this . _copy _event ( f ) , g < this . config . first _hour && ( f . start _date . setHours ( this . config . first _hour ) , f . start _date . setMinutes ( 0 ) ) , h >= this . config . last _hour && ( f . end _date . setMinutes ( 0 ) , f . end _date . setHours ( this . config . last _hour ) ) , f . start _date > f . end _date || g == this . config . last _hour ) a . splice ( e , 1 ) , e -- } if ( ! b ) { for ( e = 0 ; e < a . length ; e ++ ) a [ e ] . _count = c [ a [ e ] . _sday ] . max _count ; for ( e = 0 ; e < d . length ; e ++ ) d [ e ] . _count = c [ d [ e ] . _sday ] . max _count } return a } ;
scheduler . _time _order = function ( a ) { a . sort ( function ( a , c ) { return a . start _date . valueOf ( ) == c . start _date . valueOf ( ) ? a . _timed && ! c . _timed ? 1 : ! a . _timed && c . _timed ? - 1 : a . id > c . id ? 1 : - 1 : a . start _date > c . start _date ? 1 : - 1 } ) } ;
scheduler . _pre _render _events _table = function ( a , b ) { this . _time _order ( a ) ; for ( var c = [ ] , d = [ [ ] , [ ] , [ ] , [ ] , [ ] , [ ] , [ ] ] , e = this . _colsS . heights , f , g = this . _cols . length , h = 0 ; h < a . length ; h ++ ) { var i = a [ h ] , k = f || i . start _date , j = i . end _date ; if ( k < this . _min _date ) k = this . _min _date ; if ( j > this . _max _date ) j = this . _max _date ; var l = this . locate _holder _day ( k , ! 1 , i ) ; i . _sday = l % g ; var o = this . locate _holder _day ( j , ! 0 , i ) || g ; i . _eday = o % g || g ; i . _length = o - l ; i . _sweek = Math . floor ( ( this . _correct _shift ( k . valueOf ( ) , 1 ) - this . _min _date . valueOf ( ) ) / ( 864E5 * g ) ) ; var m =
d [ i . _sweek ] , n ; for ( n = 0 ; n < m . length ; n ++ ) if ( m [ n ] . _eday <= i . _sday ) break ; if ( ! i . _sorder || ! b ) i . _sorder = n ; if ( i . _sday + i . _length <= g ) f = null , c . push ( i ) , m [ n ] = i , e [ i . _sweek ] = m . length - 1 ; else { var p = this . _copy _event ( i ) ; p . _length = g - i . _sday ; p . _eday = g ; p . _sday = i . _sday ; p . _sweek = i . _sweek ; p . _sorder = i . _sorder ; p . end _date = this . date . add ( k , p . _length , "day" ) ; c . push ( p ) ; m [ n ] = p ; f = p . end _date ; e [ i . _sweek ] = m . length - 1 ; h -- } } return c } ; scheduler . _copy _dummy = function ( ) { this . start _date = new Date ( this . start _date ) ; this . end _date = new Date ( this . end _date ) } ;
scheduler . _copy _event = function ( a ) { this . _copy _dummy . prototype = a ; return new this . _copy _dummy } ; scheduler . _rendered = [ ] ; scheduler . clear _view = function ( ) { for ( var a = 0 ; a < this . _rendered . length ; a ++ ) { var b = this . _rendered [ a ] ; b . parentNode && b . parentNode . removeChild ( b ) } this . _rendered = [ ] } ; scheduler . updateEvent = function ( a ) { var b = this . getEvent ( a ) ; this . clear _event ( a ) ; b && this . is _visible _events ( b ) && this . render _view _data ( [ b ] , ! 0 ) } ;
scheduler . clear _event = function ( a ) { this . for _rendered ( a , function ( a , c ) { a . parentNode && a . parentNode . removeChild ( a ) ; scheduler . _rendered . splice ( c , 1 ) } ) } ;
scheduler . render _event = function ( a ) { var b = scheduler . xy . menu _width ; if ( ! ( a . _sday < 0 ) ) { var c = scheduler . locate _holder ( a . _sday ) ; if ( c ) { var d = a . start _date . getHours ( ) * 60 + a . start _date . getMinutes ( ) , e = a . end _date . getHours ( ) * 60 + a . end _date . getMinutes ( ) || scheduler . config . last _hour * 60 , f = Math . round ( ( d * 6E4 - this . config . first _hour * 36E5 ) * this . config . hour _size _px / 36E5 ) % ( this . config . hour _size _px * 24 ) + 1 , g = Math . max ( scheduler . xy . min _event _height , ( e - d ) * this . config . hour _size _px / 60 ) + 1 , h = Math . floor ( ( c . clientWidth - b ) / a . _count ) , i =
a . _sorder * h + 1 ; a . _inner || ( h *= a . _count - a . _sorder ) ; if ( this . config . cascade _event _display ) var k = this . config . cascade _event _count , j = this . config . cascade _event _margin , i = a . _sorder % k * j , l = a . _inner ? ( a . _count - a . _sorder - 1 ) % k * j / 2 : 0 , h = Math . floor ( c . clientWidth - b - i - l ) ; var o = this . _render _v _bar ( a . id , b + i , f , h , g , a . _text _style , scheduler . templates . event _header ( a . start _date , a . end _date , a ) , scheduler . templates . event _text ( a . start _date , a . end _date , a ) ) ; this . _rendered . push ( o ) ; c . appendChild ( o ) ; i = i + parseInt ( c . style . left , 10 ) + b ; if ( this . _edit _id ==
a . id ) { o . style . zIndex = 1 ; h = Math . max ( h - 4 , scheduler . xy . editor _width ) ; o = document . createElement ( "DIV" ) ; o . setAttribute ( "event_id" , a . id ) ; this . set _xy ( o , h , g - 20 , i , f + 14 ) ; o . className = "dhx_cal_editor" ; var m = document . createElement ( "DIV" ) ; this . set _xy ( m , h - 6 , g - 26 ) ; m . style . cssText += ";margin:2px 2px 2px 2px;overflow:hidden;" ; o . appendChild ( m ) ; this . _els . dhx _cal _data [ 0 ] . appendChild ( o ) ; this . _rendered . push ( o ) ; m . innerHTML = "<textarea class='dhx_cal_editor'>" + a . text + "</textarea>" ; if ( this . _quirks7 ) m . firstChild . style . height = g -
12 + "px" ; this . _editor = m . firstChild ; this . _editor . onkeypress = function ( a ) { if ( ( a || event ) . shiftKey ) return ! 0 ; var b = ( a || event ) . keyCode ; b == scheduler . keys . edit _save && scheduler . editStop ( ! 0 ) ; b == scheduler . keys . edit _cancel && scheduler . editStop ( ! 1 ) } ; this . _editor . onselectstart = function ( a ) { return ( a || event ) . cancelBubble = ! 0 } ; m . firstChild . focus ( ) ; this . _els . dhx _cal _data [ 0 ] . scrollLeft = 0 ; m . firstChild . select ( ) } if ( this . _select _id == a . id ) { if ( this . config . cascade _event _display && this . _drag _mode ) o . style . zIndex = 1 ; for ( var n = this . config [ "icons_" +
( this . _edit _id == a . id ? "edit" : "select" ) ] , p = "" , q = a . color ? "background-color:" + a . color + ";" : "" , v = a . textColor ? "color:" + a . textColor + ";" : "" , s = 0 ; s < n . length ; s ++ ) p += "<div class='dhx_menu_icon " + n [ s ] + "' style='" + q + "" + v + "' title='" + this . locale . labels [ n [ s ] ] + "'></div>" ; var r = this . _render _v _bar ( a . id , i - b + 1 , f , b , n . length * 20 + 26 , "" , "<div style='" + q + "" + v + "' class='dhx_menu_head'></div>" , p , ! 0 ) ; r . style . left = i - b + 1 ; this . _els . dhx _cal _data [ 0 ] . appendChild ( r ) ; this . _rendered . push ( r ) } } } } ;
scheduler . _render _v _bar = function ( a , b , c , d , e , f , g , h , i ) { var k = document . createElement ( "DIV" ) , j = this . getEvent ( a ) , l = "dhx_cal_event" , o = scheduler . templates . event _class ( j . start _date , j . end _date , j ) ; o && ( l = l + " " + o ) ; var m = j . color ? "background-color:" + j . color + ";" : "" , n = j . textColor ? "color:" + j . textColor + ";" : "" , p = '<div event_id="' + a + '" class="' + l + '" style="position:absolute; top:' + c + "px; left:" + b + "px; width:" + ( d - 4 ) + "px; height:" + e + "px;" + ( f || "" ) + '">' ; p += '<div class="dhx_header" style=" width:' + ( d - 6 ) + "px;" + m + '" > </div>' ;
p += '<div class="dhx_title" style="' + m + "" + n + '">' + g + "</div>" ; p += '<div class="dhx_body" style=" width:' + ( d - ( this . _quirks ? 4 : 14 ) ) + "px; height:" + ( e - ( this . _quirks ? 20 : 30 ) ) + "px;" + m + "" + n + '">' + h + "</div>" ; p += '<div class="dhx_footer" style=" width:' + ( d - 8 ) + "px;" + ( i ? " margin-top:-1px;" : "" ) + "" + m + "" + n + '" ></div></div>' ; k . innerHTML = p ; return k . firstChild } ; scheduler . locate _holder = function ( a ) { return this . _mode == "day" ? this . _els . dhx _cal _data [ 0 ] . firstChild : this . _els . dhx _cal _data [ 0 ] . childNodes [ a ] } ;
scheduler . locate _holder _day = function ( a , b ) { var c = Math . floor ( ( this . _correct _shift ( a , 1 ) - this . _min _date ) / 864E5 ) ; b && this . date . time _part ( a ) && c ++ ; return c } ;
scheduler . render _event _bar = function ( a ) { var b = this . _rendered _location , c = this . _colsS [ a . _sday ] , d = this . _colsS [ a . _eday ] ; d == c && ( d = this . _colsS [ a . _eday + 1 ] ) ; var e = this . xy . bar _height , f = this . _colsS . heights [ a . _sweek ] + ( this . _colsS . height ? this . xy . month _scale _height + 2 : 2 ) + a . _sorder * e , g = document . createElement ( "DIV" ) , h = a . _timed ? "dhx_cal_event_clear" : "dhx_cal_event_line" , i = scheduler . templates . event _class ( a . start _date , a . end _date , a ) ; i && ( h = h + " " + i ) ; var k = a . color ? "background-color:" + a . color + ";" : "" , j = a . textColor ? "color:" +
a . textColor + ";" : "" , l = '<div event_id="' + a . id + '" class="' + h + '" style="position:absolute; top:' + f + "px; left:" + c + "px; width:" + ( d - c - 15 ) + "px;" + j + "" + k + "" + ( a . _text _style || "" ) + '">' ; a . _timed && ( l += scheduler . templates . event _bar _date ( a . start _date , a . end _date , a ) ) ; l += scheduler . templates . event _bar _text ( a . start _date , a . end _date , a ) + "</div>" ; l += "</div>" ; g . innerHTML = l ; this . _rendered . push ( g . firstChild ) ; b . appendChild ( g . firstChild ) } ;
scheduler . _locate _event = function ( a ) { for ( var b = null ; a && ! b && a . getAttribute ; ) b = a . getAttribute ( "event_id" ) , a = a . parentNode ; return b } ; scheduler . edit = function ( a ) { if ( this . _edit _id != a ) this . editStop ( ! 1 , a ) , this . _edit _id = a , this . updateEvent ( a ) } ; scheduler . editStop = function ( a , b ) { if ( ! ( b && this . _edit _id == b ) ) { var c = this . getEvent ( this . _edit _id ) ; if ( c ) { if ( a ) c . text = this . _editor . value ; this . _editor = this . _edit _id = null ; this . updateEvent ( c . id ) ; this . _edit _stop _event ( c , a ) } } } ;
scheduler . _edit _stop _event = function ( a , b ) { this . _new _event ? ( b ? this . callEvent ( "onEventAdded" , [ a . id , a ] ) : this . deleteEvent ( a . id , ! 0 ) , this . _new _event = null ) : b && this . callEvent ( "onEventChanged" , [ a . id , a ] ) } ; scheduler . getEvents = function ( a , b ) { var c = [ ] , d ; for ( d in this . _events ) { var e = this . _events [ d ] ; e && e . start _date < b && e . end _date > a && c . push ( e ) } return c } ; scheduler . _loaded = { } ;
scheduler . _load = function ( a , b ) { a = a || this . _load _url ; a += ( a . indexOf ( "?" ) == - 1 ? "?" : "&" ) + "timeshift=" + ( new Date ) . getTimezoneOffset ( ) ; this . config . prevent _cache && ( a += "&uid=" + this . uid ( ) ) ; var c , b = b || this . _date ; if ( this . _load _mode ) { for ( var d = this . templates . load _format , b = this . date [ this . _load _mode + "_start" ] ( new Date ( b . valueOf ( ) ) ) ; b > this . _min _date ; ) b = this . date . add ( b , - 1 , this . _load _mode ) ; c = b ; for ( var e = ! 0 ; c < this . _max _date ; ) c = this . date . add ( c , 1 , this . _load _mode ) , this . _loaded [ d ( b ) ] && e ? b = this . date . add ( b , 1 , this . _load _mode ) :
e = ! 1 ; var f = c ; do c = f , f = this . date . add ( c , - 1 , this . _load _mode ) ; while ( f > b && this . _loaded [ d ( f ) ] ) ; if ( c <= b ) return ! 1 ; for ( dhtmlxAjax . get ( a + "&from=" + d ( b ) + "&to=" + d ( c ) , function ( a ) { scheduler . on _load ( a ) } ) ; b < c ; ) this . _loaded [ d ( b ) ] = ! 0 , b = this . date . add ( b , 1 , this . _load _mode ) } else dhtmlxAjax . get ( a , function ( a ) { scheduler . on _load ( a ) } ) ; this . callEvent ( "onXLS" , [ ] ) ; return ! 0 } ;
scheduler . on _load = function ( a ) { this . _loading = ! 0 ; var b ; b = this . _process ? this [ this . _process ] . parse ( a . xmlDoc . responseText ) : this . _magic _parser ( a ) ; this . _not _render = ! 0 ; for ( var c = 0 ; c < b . length ; c ++ ) this . callEvent ( "onEventLoading" , [ b [ c ] ] ) && this . addEvent ( b [ c ] ) ; this . _not _render = ! 1 ; this . _render _wait && this . render _view _data ( ) ; this . _loading = ! 1 ; this . _after _call && this . _after _call ( ) ; this . _after _call = null ; this . callEvent ( "onXLE" , [ ] ) } ; scheduler . json = { } ;
scheduler . json . parse = function ( a ) { if ( typeof a == "string" ) eval ( "scheduler._temp = " + a + ";" ) , a = scheduler . _temp ; for ( var b = [ ] , c = 0 ; c < a . length ; c ++ ) a [ c ] . start _date = scheduler . templates . xml _date ( a [ c ] . start _date ) , a [ c ] . end _date = scheduler . templates . xml _date ( a [ c ] . end _date ) , b . push ( a [ c ] ) ; return b } ; scheduler . parse = function ( a , b ) { this . _process = b ; this . on _load ( { xmlDoc : { responseText : a } } ) } ; scheduler . load = function ( a , b , c ) { if ( typeof b == "string" ) this . _process = b , b = c ; this . _load _url = a ; this . _after _call = b ; this . _load ( a , this . _date ) } ;
scheduler . setLoadMode = function ( a ) { a == "all" && ( a = "" ) ; this . _load _mode = a } ; scheduler . refresh = function ( ) { alert ( "not implemented" ) } ; scheduler . serverList = function ( a , b ) { return b ? this . serverList [ a ] = b . slice ( 0 ) : this . serverList [ a ] = this . serverList [ a ] || [ ] } ; scheduler . _userdata = { } ;
scheduler . _magic _parser = function ( a ) { var b ; if ( ! a . getXMLTopNode ) { var c = a . xmlDoc . responseText , a = new dtmlXMLLoaderObject ( function ( ) { } ) ; a . loadXMLString ( c ) } b = a . getXMLTopNode ( "data" ) ; if ( b . tagName != "data" ) return [ ] ; for ( var d = a . doXPath ( "//coll_options" ) , e = 0 ; e < d . length ; e ++ ) { var f = d [ e ] . getAttribute ( "for" ) , g = this . serverList [ f ] ; if ( g ) { g . splice ( 0 , g . length ) ; for ( var h = a . doXPath ( ".//item" , d [ e ] ) , i = 0 ; i < h . length ; i ++ ) { for ( var k = h [ i ] , j = k . attributes , l = { key : h [ i ] . getAttribute ( "value" ) , label : h [ i ] . getAttribute ( "label" ) } , o = 0 ; o <
j . length ; o ++ ) { var m = j [ o ] ; if ( ! ( m . nodeName == "value" || m . nodeName == "label" ) ) l [ m . nodeName ] = m . nodeValue } g . push ( l ) } } } d . length && scheduler . callEvent ( "onOptionsLoad" , [ ] ) ; for ( var n = a . doXPath ( "//userdata" ) , e = 0 ; e < n . length ; e ++ ) { var p = this . xmlNodeToJSON ( n [ e ] ) ; this . _userdata [ p . name ] = p . text } var q = [ ] ; b = a . doXPath ( "//event" ) ; for ( e = 0 ; e < b . length ; e ++ ) q [ e ] = this . xmlNodeToJSON ( b [ e ] ) , q [ e ] . text = q [ e ] . text || q [ e ] . _tagvalue , q [ e ] . start _date = this . templates . xml _date ( q [ e ] . start _date ) , q [ e ] . end _date = this . templates . xml _date ( q [ e ] . end _date ) ;
return q } ; scheduler . xmlNodeToJSON = function ( a ) { for ( var b = { } , c = 0 ; c < a . attributes . length ; c ++ ) b [ a . attributes [ c ] . name ] = a . attributes [ c ] . value ; for ( c = 0 ; c < a . childNodes . length ; c ++ ) { var d = a . childNodes [ c ] ; d . nodeType == 1 && ( b [ d . tagName ] = d . firstChild ? d . firstChild . nodeValue : "" ) } if ( ! b . text ) b . text = a . firstChild ? a . firstChild . nodeValue : "" ; return b } ;
scheduler . attachEvent ( "onXLS" , function ( ) { if ( this . config . show _loading === ! 0 ) { var a ; a = this . config . show _loading = document . createElement ( "DIV" ) ; a . className = "dhx_loading" ; a . style . left = Math . round ( ( this . _x - 128 ) / 2 ) + "px" ; a . style . top = Math . round ( ( this . _y - 15 ) / 2 ) + "px" ; this . _obj . appendChild ( a ) } } ) ; scheduler . attachEvent ( "onXLE" , function ( ) { var a ; if ( ( a = this . config . show _loading ) && typeof a == "object" ) this . _obj . removeChild ( a ) , this . config . show _loading = ! 0 } ) ;
scheduler . ical = { parse : function ( a ) { var b = a . match ( RegExp ( this . c _start + "[^\u000c]*" + this . c _end , "" ) ) ; if ( b . length ) { b [ 0 ] = b [ 0 ] . replace ( /[\r\n]+(?=[a-z \t])/g , " " ) ; b [ 0 ] = b [ 0 ] . replace ( /\;[^:\r\n]*/g , "" ) ; for ( var c = [ ] , d , e = RegExp ( "(?:" + this . e _start + ")([^\u000c]*?)(?:" + this . e _end + ")" , "g" ) ; d = e . exec ( b ) ; ) { for ( var f = { } , g , h = /[^\r\n]+[\r\n]+/g ; g = h . exec ( d [ 1 ] ) ; ) this . parse _param ( g . toString ( ) , f ) ; if ( f . uid && ! f . id ) f . id = f . uid ; c . push ( f ) } return c } } , parse _param : function ( a , b ) { var c = a . indexOf ( ":" ) ; if ( c != - 1 ) { var d = a . substr ( 0 , c ) . toLowerCase ( ) ,
e = a . substr ( c + 1 ) . replace ( /\\\,/g , "," ) . replace ( /[\r\n]+$/ , "" ) ; d == "summary" ? d = "text" : d == "dtstart" ? ( d = "start_date" , e = this . parse _date ( e , 0 , 0 ) ) : d == "dtend" && ( d = "end_date" , e = b . start _date && b . start _date . getHours ( ) == 0 ? this . parse _date ( e , 24 , 0 ) : this . parse _date ( e , 23 , 59 ) ) ; b [ d ] = e } } , parse _date : function ( a , b , c ) { var d = a . split ( "T" ) ; d [ 1 ] && ( b = d [ 1 ] . substr ( 0 , 2 ) , c = d [ 1 ] . substr ( 2 , 2 ) ) ; var e = d [ 0 ] . substr ( 0 , 4 ) , f = parseInt ( d [ 0 ] . substr ( 4 , 2 ) , 10 ) - 1 , g = d [ 0 ] . substr ( 6 , 2 ) ; return scheduler . config . server _utc && ! d [ 1 ] ? new Date ( Date . UTC ( e , f , g , b ,
c ) ) : new Date ( e , f , g , b , c ) } , c _start : "BEGIN:VCALENDAR" , e _start : "BEGIN:VEVENT" , e _end : "END:VEVENT" , c _end : "END:VCALENDAR" } ; scheduler . formSection = function ( a ) { for ( var b = this . config . lightbox . sections , c = 0 ; c < b . length ; c ++ ) if ( b [ c ] . name == a ) break ; var d = b [ c ] , e = document . getElementById ( d . id ) . nextSibling ; return { getValue : function ( a ) { return scheduler . form _blocks [ d . type ] . get _value ( e , a || { } , d ) } , setValue : function ( a , b ) { return scheduler . form _blocks [ d . type ] . set _value ( e , a , b || { } , d ) } } } ;
scheduler . form _blocks = { template : { render : function ( a ) { var b = ( a . height || "30" ) + "px" ; return "<div class='dhx_cal_ltext dhx_cal_template' style='height:" + b + ";'></div>" } , set _value : function ( a , b ) { a . innerHTML = b || "" } , get _value : function ( a ) { return a . innerHTML || "" } , focus : function ( ) { } } , textarea : { render : function ( a ) { var b = ( a . height || "130" ) + "px" ; return "<div class='dhx_cal_ltext' style='height:" + b + ";'><textarea></textarea></div>" } , set _value : function ( a , b ) { a . firstChild . value = b || "" } , get _value : function ( a ) { return a . firstChild . value } ,
focus : function ( a ) { var b = a . firstChild ; b . select ( ) ; b . focus ( ) } } , select : { render : function ( a ) { for ( var b = ( a . height || "23" ) + "px" , c = "<div class='dhx_cal_ltext' style='height:" + b + ";'><select style='width:100%;'>" , d = 0 ; d < a . options . length ; d ++ ) c += "<option value='" + a . options [ d ] . key + "'>" + a . options [ d ] . label + "</option>" ; c += "</select></div>" ; return c } , set _value : function ( a , b ) { if ( typeof b == "undefined" ) b = ( a . firstChild . options [ 0 ] || { } ) . value ; a . firstChild . value = b || "" } , get _value : function ( a ) { return a . firstChild . value } , focus : function ( a ) { var b =
a . firstChild ; b . select && b . select ( ) ; b . focus ( ) } } , time : { render : function ( ) { var a = scheduler . config , b = this . date . date _part ( new Date ) , c = 1440 , d = 0 ; scheduler . config . limit _time _select && ( c = 60 * a . last _hour + 1 , d = 60 * a . first _hour , b . setHours ( a . first _hour ) ) ; for ( var e = "<select>" , f = d , g = b . getDate ( ) ; f < c ; ) { var h = this . templates . time _picker ( b ) ; e += "<option value='" + f + "'>" + h + "</option>" ; b . setTime ( b . valueOf ( ) + this . config . time _step * 6E4 ) ; var i = b . getDate ( ) != g ? 1 : 0 , f = i * 1440 + b . getHours ( ) * 60 + b . getMinutes ( ) } e += "</select> <select>" ; for ( f =
1 ; f < 32 ; f ++ ) e += "<option value='" + f + "'>" + f + "</option>" ; e += "</select> <select>" ; for ( f = 0 ; f < 12 ; f ++ ) e += "<option value='" + f + "'>" + this . locale . date . month _full [ f ] + "</option>" ; e += "</select> <select>" ; b = b . getFullYear ( ) - 5 ; for ( f = 0 ; f < 10 ; f ++ ) e += "<option value='" + ( b + f ) + "'>" + ( b + f ) + "</option>" ; e += "</select> " ; return "<div style='height:30px;padding-top:0px;font-size:inherit;' class='dhx_section_time'>" + e + "<span style='font-weight:normal; font-size:10pt;'> – </span>" + e + "</div>" } , set _value : function ( a ,
b , c ) { function d ( a , b , c ) { a [ b + 0 ] . value = Math . round ( ( c . getHours ( ) * 60 + c . getMinutes ( ) ) / scheduler . config . time _step ) * scheduler . config . time _step ; a [ b + 1 ] . value = c . getDate ( ) ; a [ b + 2 ] . value = c . getMonth ( ) ; a [ b + 3 ] . value = c . getFullYear ( ) } var e = a . getElementsByTagName ( "select" ) ; if ( scheduler . config . full _day ) { if ( ! a . _full _day ) { var f = "<label class='dhx_fullday'><input type='checkbox' name='full_day' value='true'> " + scheduler . locale . labels . full _day + " </label></input>" ; scheduler . config . wide _form || ( f = a . previousSibling . innerHTML +
f ) ; a . previousSibling . innerHTML = f ; a . _full _day = ! 0 } var g = a . previousSibling . getElementsByTagName ( "input" ) [ 0 ] , h = scheduler . date . time _part ( c . start _date ) === 0 && scheduler . date . time _part ( c . end _date ) === 0 && c . end _date . valueOf ( ) - c . start _date . valueOf ( ) < 1728E5 ; g . checked = h ; for ( var i in e ) e [ i ] . disabled = g . checked ; g . onclick = function ( ) { if ( g . checked ) { var a = new Date ( c . start _date ) , b = new Date ( c . end _date ) ; scheduler . date . date _part ( a ) ; b = scheduler . date . add ( a , 1 , "day" ) } for ( var f in e ) e [ f ] . disabled = g . checked ; d ( e , 0 , a || c . start _date ) ;
d ( e , 4 , b || c . end _date ) } } if ( scheduler . config . auto _end _date && scheduler . config . event _duration ) for ( var k = function ( ) { c . start _date = new Date ( e [ 3 ] . value , e [ 2 ] . value , e [ 1 ] . value , 0 , e [ 0 ] . value ) ; c . end _date . setTime ( c . start _date . getTime ( ) + scheduler . config . event _duration * 6E4 ) ; d ( e , 4 , c . end _date ) } , j = 0 ; j < 4 ; j ++ ) e [ j ] . onchange = k ; d ( e , 0 , c . start _date ) ; d ( e , 4 , c . end _date ) } , get _value : function ( a , b ) { s = a . getElementsByTagName ( "select" ) ; b . start _date = new Date ( s [ 3 ] . value , s [ 2 ] . value , s [ 1 ] . value , 0 , s [ 0 ] . value ) ; b . end _date = new Date ( s [ 7 ] . value ,
s [ 6 ] . value , s [ 5 ] . value , 0 , s [ 4 ] . value ) ; if ( b . end _date <= b . start _date ) b . end _date = scheduler . date . add ( b . start _date , scheduler . config . time _step , "minute" ) } , focus : function ( a ) { a . getElementsByTagName ( "select" ) [ 0 ] . focus ( ) } } } ;
scheduler . showCover = function ( a ) { if ( a ) { a . style . display = "block" ; var b = window . pageYOffset || document . body . scrollTop || document . documentElement . scrollTop , c = window . pageXOffset || document . body . scrollLeft || document . documentElement . scrollLeft , d = window . innerHeight || document . documentElement . clientHeight ; a . style . top = b ? Math . round ( b + Math . max ( ( d - a . offsetHeight ) / 2 , 0 ) ) + "px" : Math . round ( Math . max ( ( d - a . offsetHeight ) / 2 , 0 ) + 9 ) + "px" ; a . style . left = document . documentElement . scrollWidth > document . body . offsetWidth ? Math . round ( c + ( document . body . offsetWidth -
a . offsetWidth ) / 2 ) + "px" : Math . round ( ( document . body . offsetWidth - a . offsetWidth ) / 2 ) + "px" } this . show _cover ( ) } ; scheduler . showLightbox = function ( a ) { if ( a && this . callEvent ( "onBeforeLightbox" , [ a ] ) ) { var b = this . _get _lightbox ( ) ; this . showCover ( b ) ; this . _fill _lightbox ( a , b ) ; this . callEvent ( "onLightbox" , [ a ] ) } } ;
scheduler . _fill _lightbox = function ( a , b ) { var c = this . getEvent ( a ) , d = b . getElementsByTagName ( "span" ) ; scheduler . templates . lightbox _header ? ( d [ 1 ] . innerHTML = "" , d [ 2 ] . innerHTML = scheduler . templates . lightbox _header ( c . start _date , c . end _date , c ) ) : ( d [ 1 ] . innerHTML = this . templates . event _header ( c . start _date , c . end _date , c ) , d [ 2 ] . innerHTML = ( this . templates . event _bar _text ( c . start _date , c . end _date , c ) || "" ) . substr ( 0 , 70 ) ) ; for ( var e = this . config . lightbox . sections , f = 0 ; f < e . length ; f ++ ) { var g = document . getElementById ( e [ f ] . id ) . nextSibling ,
h = this . form _blocks [ e [ f ] . type ] ; h . set _value . call ( this , g , c [ e [ f ] . map _to ] , c , e [ f ] ) ; e [ f ] . focus && h . focus . call ( this , g ) } scheduler . _lightbox _id = a } ; scheduler . _lightbox _out = function ( a ) { for ( var b = this . config . lightbox . sections , c = 0 ; c < b . length ; c ++ ) { var d = document . getElementById ( b [ c ] . id ) , d = d ? d . nextSibling : d , e = this . form _blocks [ b [ c ] . type ] , f = e . get _value . call ( this , d , a , b [ c ] ) ; b [ c ] . map _to != "auto" && ( a [ b [ c ] . map _to ] = f ) } return a } ;
scheduler . _empty _lightbox = function ( ) { var a = scheduler . _lightbox _id , b = this . getEvent ( a ) , c = this . _get _lightbox ( ) ; this . _lightbox _out ( b ) ; b . _timed = this . is _one _day _event ( b ) ; this . setEvent ( b . id , b ) ; this . _edit _stop _event ( b , ! 0 ) ; this . render _view _data ( ) } ; scheduler . hide _lightbox = function ( ) { this . hideCover ( this . _get _lightbox ( ) ) ; this . _lightbox _id = null ; this . callEvent ( "onAfterLightbox" , [ ] ) } ; scheduler . hideCover = function ( a ) { if ( a ) a . style . display = "none" ; this . hide _cover ( ) } ;
scheduler . hide _cover = function ( ) { this . _cover && this . _cover . parentNode . removeChild ( this . _cover ) ; this . _cover = null } ; scheduler . show _cover = function ( ) { this . _cover = document . createElement ( "DIV" ) ; this . _cover . className = "dhx_cal_cover" ; var a = document . height !== void 0 ? document . height : document . body . offsetHeight , b = document . documentElement ? document . documentElement . scrollHeight : 0 ; this . _cover . style . height = Math . max ( a , b ) + "px" ; document . body . appendChild ( this . _cover ) } ;
scheduler . save _lightbox = function ( ) { if ( ! this . checkEvent ( "onEventSave" ) || this . callEvent ( "onEventSave" , [ this . _lightbox _id , this . _lightbox _out ( { id : this . _lightbox _id } ) , this . _new _event ] ) ) this . _empty _lightbox ( ) , this . hide _lightbox ( ) } ; scheduler . startLightbox = function ( a , b ) { this . _lightbox _id = a ; this . showCover ( b ) } ; scheduler . endLightbox = function ( a , b ) { this . _edit _stop _event ( scheduler . getEvent ( this . _lightbox _id ) , a ) ; a && scheduler . render _view _data ( ) ; this . hideCover ( b ) } ;
scheduler . resetLightbox = function ( ) { scheduler . _lightbox && scheduler . _lightbox . parentNode . removeChild ( scheduler . _lightbox ) ; scheduler . _lightbox = null } ; scheduler . cancel _lightbox = function ( ) { this . callEvent ( "onEventCancel" , [ this . _lightbox _id , this . _new _event ] ) ; this . endLightbox ( ! 1 ) ; this . hide _lightbox ( ) } ;
scheduler . _init _lightbox _events = function ( ) { this . _get _lightbox ( ) . onclick = function ( a ) { var b = a ? a . target : event . srcElement ; if ( ! b . className ) b = b . previousSibling ; if ( b && b . className ) switch ( b . className ) { case "dhx_save_btn" : scheduler . save _lightbox ( ) ; break ; case "dhx_delete_btn" : var c = scheduler . locale . labels . confirm _deleting ; if ( ! c || confirm ( c ) ) scheduler . deleteEvent ( scheduler . _lightbox _id ) , scheduler . _new _event = null , scheduler . hide _lightbox ( ) ; break ; case "dhx_cancel_btn" : scheduler . cancel _lightbox ( ) ; break ; default : if ( b . getAttribute ( "dhx_button" ) ) scheduler . callEvent ( "onLightboxButton" ,
[ b . className , b , a ] ) ; else if ( b . className . indexOf ( "dhx_custom_button_" ) != - 1 ) { var d = b . parentNode . getAttribute ( "index" ) , e = scheduler . form _blocks [ scheduler . config . lightbox . sections [ d ] . type ] , f = b . parentNode . parentNode ; e . button _click ( d , b , f , f . nextSibling ) } } } ; this . _get _lightbox ( ) . onkeydown = function ( a ) { switch ( ( a || event ) . keyCode ) { case scheduler . keys . edit _save : if ( ( a || event ) . shiftKey ) break ; scheduler . save _lightbox ( ) ; break ; case scheduler . keys . edit _cancel : scheduler . cancel _lightbox ( ) } } } ;
scheduler . setLightboxSize = function ( ) { var a = this . _lightbox ; if ( a ) { var b = a . childNodes [ 1 ] ; b . style . height = "0px" ; b . style . height = b . scrollHeight + "px" ; a . style . height = b . scrollHeight + 50 + "px" ; b . style . height = b . scrollHeight + "px" } } ; scheduler . _init _dnd _events = function ( ) { dhtmlxEvent ( document . body , "mousemove" , scheduler . _move _while _dnd ) ; dhtmlxEvent ( document . body , "mouseup" , scheduler . _finish _dnd ) ; scheduler . _init _dnd _events = function ( ) { } } ;
scheduler . _move _while _dnd = function ( a ) { if ( scheduler . _dnd _start _lb ) { if ( ! document . dhx _unselectable ) document . body . className += " dhx_unselectable" , document . dhx _unselectable = ! 0 ; var b = scheduler . _get _lightbox ( ) , c = a && a . target ? [ a . pageX , a . pageY ] : [ event . clientX , event . clientY ] ; b . style . top = scheduler . _lb _start [ 1 ] + c [ 1 ] - scheduler . _dnd _start _lb [ 1 ] + "px" ; b . style . left = scheduler . _lb _start [ 0 ] + c [ 0 ] - scheduler . _dnd _start _lb [ 0 ] + "px" } } ;
scheduler . _ready _to _dnd = function ( a ) { var b = scheduler . _get _lightbox ( ) ; scheduler . _lb _start = [ parseInt ( b . style . left , 10 ) , parseInt ( b . style . top , 10 ) ] ; scheduler . _dnd _start _lb = a && a . target ? [ a . pageX , a . pageY ] : [ event . clientX , event . clientY ] } ; scheduler . _finish _dnd = function ( ) { if ( scheduler . _lb _start ) scheduler . _lb _start = scheduler . _dnd _start _lb = ! 1 , document . body . className = document . body . className . replace ( " dhx_unselectable" , "" ) , document . dhx _unselectable = ! 1 } ;
scheduler . _get _lightbox = function ( ) { if ( ! this . _lightbox ) { var a = document . createElement ( "DIV" ) ; a . className = "dhx_cal_light" ; scheduler . config . wide _form && ( a . className += " dhx_cal_light_wide" ) ; scheduler . form _blocks . recurring && ( a . className += " dhx_cal_light_rec" ) ; /msie|MSIE 6/ . test ( navigator . userAgent ) && ( a . className += " dhx_ie6" ) ; a . style . visibility = "hidden" ; var b = this . _lightbox _template , c = this . config . buttons _left ; scheduler . locale . labels . dhx _save _btn = scheduler . locale . labels . icon _save ; scheduler . locale . labels . dhx _cancel _btn =
scheduler . locale . labels . icon _cancel ; scheduler . locale . labels . dhx _delete _btn = scheduler . locale . labels . icon _delete ; for ( var d = 0 ; d < c . length ; d ++ ) b += "<div class='dhx_btn_set'><div dhx_button='1' class='" + c [ d ] + "'></div><div>" + scheduler . locale . labels [ c [ d ] ] + "</div></div>" ; c = this . config . buttons _right ; for ( d = 0 ; d < c . length ; d ++ ) b += "<div class='dhx_btn_set' style='float:right;'><div dhx_button='1' class='" + c [ d ] + "'></div><div>" + scheduler . locale . labels [ c [ d ] ] + "</div></div>" ; b += "</div>" ; a . innerHTML = b ; if ( scheduler . config . drag _lightbox ) a . firstChild . onmousedown =
scheduler . _ready _to _dnd , a . firstChild . onselectstart = function ( ) { return ! 1 } , a . firstChild . style . cursor = "pointer" , scheduler . _init _dnd _events ( ) ; document . body . insertBefore ( a , document . body . firstChild ) ; this . _lightbox = a ; for ( var e = this . config . lightbox . sections , b = "" , d = 0 ; d < e . length ; d ++ ) { var f = this . form _blocks [ e [ d ] . type ] ; if ( f ) { e [ d ] . id = "area_" + this . uid ( ) ; var g = "" ; e [ d ] . button && ( g = "<div class='dhx_custom_button' index='" + d + "'><div class='dhx_custom_button_" + e [ d ] . button + "'></div><div>" + this . locale . labels [ "button_" +
e [ d ] . button ] + "</div></div>" ) ; this . config . wide _form && ( b += "<div class='dhx_wrap_section'>" ) ; b += "<div id='" + e [ d ] . id + "' class='dhx_cal_lsection'>" + g + this . locale . labels [ "section_" + e [ d ] . name ] + "</div>" + f . render . call ( this , e [ d ] ) ; b += "</div>" } } var h = a . getElementsByTagName ( "div" ) ; h [ 1 ] . innerHTML = b ; this . setLightboxSize ( ) ; this . _init _lightbox _events ( this ) ; a . style . display = "none" ; a . style . visibility = "visible" } return this . _lightbox } ; scheduler . _lightbox _template = "<div class='dhx_cal_ltitle'><span class='dhx_mark'> </span><span class='dhx_time'></span><span class='dhx_title'></span></div><div class='dhx_cal_larea'></div>" ;
scheduler . _dp _init = function ( a ) { a . _methods = [ "setEventTextStyle" , "" , "changeEventId" , "deleteEvent" ] ; this . attachEvent ( "onEventAdded" , function ( b ) { ! this . _loading && this . validId ( b ) && a . setUpdated ( b , ! 0 , "inserted" ) } ) ; this . attachEvent ( "onConfirmedBeforeEventDelete" , function ( b ) { if ( this . validId ( b ) ) { var c = a . getState ( b ) ; if ( c == "inserted" || this . _new _event ) return a . setUpdated ( b , ! 1 ) , ! 0 ; if ( c == "deleted" ) return ! 1 ; if ( c == "true_deleted" ) return ! 0 ; a . setUpdated ( b , ! 0 , "deleted" ) ; return ! 1 } } ) ; this . attachEvent ( "onEventChanged" , function ( b ) { ! this . _loading &&
this . validId ( b ) && a . setUpdated ( b , ! 0 , "updated" ) } ) ; a . _getRowData = function ( a ) { var c = this . obj . getEvent ( a ) , d = { } , e ; for ( e in c ) e . indexOf ( "_" ) != 0 && ( d [ e ] = c [ e ] && c [ e ] . getUTCFullYear ? this . obj . templates . xml _format ( c [ e ] ) : c [ e ] ) ; return d } ; a . _clearUpdateFlag = function ( ) { } ; a . attachEvent ( "insertCallback" , scheduler . _update _callback ) ; a . attachEvent ( "updateCallback" , scheduler . _update _callback ) ; a . attachEvent ( "deleteCallback" , function ( a , c ) { this . obj . setUserData ( c , this . action _param , "true_deleted" ) ; this . obj . deleteEvent ( c ) } ) } ;
scheduler . setUserData = function ( a , b , c ) { a ? this . getEvent ( a ) [ b ] = c : this . _userdata [ b ] = c } ; scheduler . getUserData = function ( a , b ) { return a ? this . getEvent ( a ) [ b ] : this . _userdata [ b ] } ; scheduler . setEventTextStyle = function ( a , b ) { this . for _rendered ( a , function ( a ) { a . style . cssText += ";" + b } ) ; var c = this . getEvent ( a ) ; c . _text _style = b ; this . event _updated ( c ) } ; scheduler . validId = function ( ) { return ! 0 } ;
scheduler . _update _callback = function ( a ) { var b = scheduler . xmlNodeToJSON ( a . firstChild ) ; b . text = b . text || b . _tagvalue ; b . start _date = scheduler . templates . xml _date ( b . start _date ) ; b . end _date = scheduler . templates . xml _date ( b . end _date ) ; scheduler . addEvent ( b ) } ;