WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}} ; try { /* module-key = 'com.atlassian.confluence.extra.team-calendars:timeline-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/timeline.js' */ if(typeof links==="undefined"){links={}}if(typeof google==="undefined"){google=undefined}links.Timeline=function(a){if(!a){return}this.dom={};this.conversion={};this.eventParams={};this.groups=[];this.groupIndexes={};this.items=[];this.renderQueue={show:[],hide:[],update:[]};this.renderedItems=[];this.clusterGenerator=new links.Timeline.ClusterGenerator(this);this.currentClusters=[];this.selection=undefined;this.listeners={};this.size={actualHeight:0,axis:{characterMajorHeight:0,characterMajorWidth:0,characterMinorHeight:0,characterMinorWidth:0,height:0,labelMajorTop:0,labelMinorTop:0,line:0,lineMajorWidth:0,lineMinorHeight:0,lineMinorTop:0,lineMinorWidth:0,top:0},contentHeight:0,contentLeft:0,contentWidth:0,frameHeight:0,frameWidth:0,groupsLeft:0,groupsWidth:0,items:{top:0}};this.dom.container=a;this.options={width:"100%",height:"auto",minHeight:0,autoHeight:true,eventMargin:10,eventMarginAxis:20,dragAreaWidth:10,min:undefined,max:undefined,zoomMin:10,zoomMax:1000*60*60*24*365*10000,moveable:true,zoomable:true,selectable:true,editable:false,snapEvents:true,groupChangeable:true,showCurrentTime:true,showCustomTime:false,showMajorLabels:true,showMinorLabels:true,showNavigation:false,showButtonNew:false,groupsOnRight:false,axisOnTop:false,stackEvents:true,animate:true,animateZoom:true,cluster:false,style:"box",customStackOrder:false,locale:"en",MONTHS:new Array("January","February","March","April","May","June","July","August","September","October","November","December"),DAYS:new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),MONTHS_SHORT:new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"),DAYS_SHORT:new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"),ZOOM_IN:"Zoom in",ZOOM_OUT:"Zoom out",MOVE_LEFT:"Move left",MOVE_RIGHT:"Move right",NEW:"New",CREATE_NEW_EVENT:"Create new event"};this.clientTimeOffset=0;var c=this.dom;while(c.container.hasChildNodes()){c.container.removeChild(c.container.firstChild)}this.step=new links.Timeline.StepDate();this.itemTypes={box:links.Timeline.ItemBox,range:links.Timeline.ItemRange,dot:links.Timeline.ItemDot};this.data=[];this.firstDraw=true;this.setVisibleChartRange(undefined,undefined,false);this.render();var b=this;setTimeout(function(){b.trigger("ready")},0)};links.Timeline.prototype.draw=function(b,a){this.setOptions(a);this.setData(b);if(a&&(a.start||a.end)){this.setVisibleChartRange(a.start,a.end)}else{if(this.firstDraw){this.setVisibleChartRangeAuto()}}this.firstDraw=false};links.Timeline.prototype.setOptions=function(b){if(b){for(var d in b){if(b.hasOwnProperty(d)){this.options[d]=b[d]}}if(typeof links.locales!=="undefined"&&this.options.locale!=="en"){var c=links.locales[this.options.locale];if(c){for(var a in c){if(c.hasOwnProperty(a)){this.options[a]=c[a]}}}}if(b.showButtonAdd!=undefined){this.options.showButtonNew=b.showButtonAdd;console.log("WARNING: Option showButtonAdd is deprecated. Use showButtonNew instead")}if(b.intervalMin!=undefined){this.options.zoomMin=b.intervalMin;console.log("WARNING: Option intervalMin is deprecated. Use zoomMin instead")}if(b.intervalMax!=undefined){this.options.zoomMax=b.intervalMax;console.log("WARNING: Option intervalMax is deprecated. Use zoomMax instead")}if(b.scale&&b.step){this.step.setScale(b.scale,b.step)}}this.options.autoHeight=(this.options.height==="auto")};links.Timeline.prototype.addItemType=function(a,b){this.itemTypes[a]=b};links.Timeline.mapColumnIds=function(b){var c={},f=b.getNumberOfColumns(),e=true;for(var a=0;a0){d.addRows(g)}var f=links.Timeline.mapColumnIds(d);for(a in j){if(j.hasOwnProperty(a)){var b=f[a];if(b==undefined){var h=j[a];var c="string";if(typeof(h)=="number"){c="number"}else{if(typeof(h)=="boolean"){c="boolean"}else{if(h instanceof Date){c="datetime"}}}b=d.addColumn(c,a)}d.setValue(e,b,j[a])}}}else{if(links.Timeline.isArray(d)){var k=d[e];if(k==undefined){k={};d[e]=k}for(a in j){if(j.hasOwnProperty(a)){k[a]=j[a]}}}else{throw"Cannot update data, unknown type of data"}}};links.Timeline.prototype.getItemIndex=function(f){var g=f,j=this.dom,h=j.items.frame,b=this.items,c=undefined;while(g.parentNode&&g.parentNode!==h){g=g.parentNode}if(g.parentNode===h){for(var d=0,a=b.length;da.valueOf()){b=new Date(a.valueOf())}this.applyRange(f,b);if(e==undefined||e==true){this.render({animate:false})}else{this.recalcConversion()}};links.Timeline.prototype.setVisibleChartRangeAuto=function(){var a=this.getDataRange(true);this.setVisibleChartRange(a.min,a.max)};links.Timeline.prototype.setVisibleChartRangeNow=function(){var a=new Date();var b=(this.end.valueOf()-this.start.valueOf());var d=new Date(a.valueOf()-b/2);var c=new Date(d.valueOf()+b);this.setVisibleChartRange(d,c)};links.Timeline.prototype.getVisibleChartRange=function(){return{start:new Date(this.start.valueOf()),end:new Date(this.end.valueOf())}};links.Timeline.prototype.getDataRange=function(b){var g=this.items,d=undefined,h=undefined;if(g){for(var f=0,e=g.length;f0){this.render({animate:j?j.animate:undefined,renderTimesLeft:(c-1)})}}};links.Timeline.prototype.repaint=function(){var b=this.repaintFrame();var a=this.repaintAxis();var d=this.repaintGroups();var c=this.repaintItems();this.repaintCurrentTime();this.repaintCustomTime();return(b||a||d||c)};links.Timeline.prototype.reflowFrame=function(){var f=this.dom,d=this.options,e=this.size,b=false;var a=f.frame?f.frame.offsetWidth:0,c=f.frame?f.frame.children[0].clientHeight:0;b=b||(e.frameWidth!==a);b=b||(e.frameHeight!==c);e.frameWidth=a;e.frameHeight=c;return b};links.Timeline.prototype.repaintFrame=function(){var b=false,d=this.dom,j=this.options,h=this.size;if(!d.frame){d.frame=document.createElement("DIV");d.frame.className="timeline-frame";d.frame.style.position="relative";d.frame.style.overflowX="hidden";d.frame.style.overflowY="auto";d.container.appendChild(d.frame);b=true}var g=j.autoHeight?(h.actualHeight+"px"):(j.height||"100%");var a=j.width||"100%";b=b||(d.frame.style.height!=g);b=b||(d.frame.style.width!=a);d.frame.style.height=j.viewHeight?j.viewHeight:g;d.frame.style.width=a;if(!d.content){d.content=document.createElement("DIV");d.content.style.position="relative";d.content.style.overflow="hidden";d.frame.appendChild(d.content);var e=document.createElement("DIV");e.style.position="absolute";e.style.left="0px";e.style.top="0px";e.style.height="100%";e.style.width="0px";d.content.appendChild(e);d.contentTimelines=e;var c=this.eventParams,f=this;if(!c.onMouseDown){c.onMouseDown=function(k){f.onMouseDown(k)};links.Timeline.addEventListener(d.content,"mousedown",c.onMouseDown)}if(!c.onTouchStart){c.onTouchStart=function(k){f.onTouchStart(k)};links.Timeline.addEventListener(d.content,"touchstart",c.onTouchStart)}if(!c.onDblClick){c.onDblClick=function(k){f.onDblClick(k)};links.Timeline.addEventListener(d.content,"dblclick",c.onDblClick)}b=true}d.content.style.left=h.contentLeft+"px";d.content.style.top="0px";d.content.style.width=h.contentWidth+"px";d.content.style.height=g;this.repaintNavigation();this.reflowAxis();this.repaintAxis();return b};links.Timeline.prototype.reflowAxis=function(){var j=false,h=this.dom,o=this.options,n=this.size,l=h.axis;var k=(l&&l.characterMinor)?l.characterMinor.clientWidth:0,g=(l&&l.characterMinor)?l.characterMinor.clientHeight:0,b=(l&&l.characterMajor)?l.characterMajor.clientWidth:0,e=(l&&l.characterMajor)?l.characterMajor.clientHeight:0,d=(o.showMinorLabels?g:0)+(o.showMajorLabels?e:0);var f=h.frame?h.frame.children[0].clientHeight:n.frameHeight;var a=o.axisOnTop?0:f-d,c=o.axisOnTop?d:a;j=j||(n.axis.top!==a);j=j||(n.axis.line!==c);j=j||(n.axis.height!==d);n.axis.top=a;n.axis.line=c;n.axis.height=d;n.axis.labelMajorTop=o.axisOnTop?0:c+(o.showMinorLabels?g:0);n.axis.labelMinorTop=o.axisOnTop?(o.showMajorLabels?e:0):c;n.axis.lineMinorTop=o.axisOnTop?n.axis.labelMinorTop:0;n.axis.lineMinorHeight=o.showMajorLabels?n.frameHeight-e:n.frameHeight;if(l&&l.minorLines&&l.minorLines.length){n.axis.lineMinorWidth=l.minorLines[0].offsetWidth}else{n.axis.lineMinorWidth=1}if(l&&l.majorLines&&l.majorLines.length){n.axis.lineMajorWidth=l.majorLines[0].offsetWidth}else{n.axis.lineMajorWidth=1}j=j||(n.axis.characterMinorWidth!==k);j=j||(n.axis.characterMinorHeight!==g);j=j||(n.axis.characterMajorWidth!==b);j=j||(n.axis.characterMajorHeight!==e);n.axis.characterMinorWidth=k;n.axis.characterMinorHeight=g;n.axis.characterMajorWidth=b;n.axis.characterMajorHeight=e;var m=Math.max(n.frameHeight-d,0);n.contentLeft=o.groupsOnRight?0:n.groupsWidth;n.contentWidth=Math.max(n.frameWidth-n.groupsWidth,0);n.contentHeight=m;n.axis.lineMinorHeight=m;return j};links.Timeline.prototype.repaintAxis=function(){var f=false,j=this.dom,r=this.options,q=this.size,e=this.step;var g=j.axis;if(!g){g={};j.axis=g}if(!q.axis.properties){q.axis.properties={}}if(!g.minorTexts){g.minorTexts=[]}if(!g.minorLines){g.minorLines=[]}if(!g.majorTexts){g.majorTexts=[]}if(!g.majorLines){g.majorLines=[]}if(!g.frame){g.frame=document.createElement("DIV");g.frame.style.position="absolute";g.frame.style.left="0px";g.frame.style.top="0px";j.content.appendChild(g.frame)}j.content.removeChild(g.frame);g.frame.style.width=(q.contentWidth)+"px";g.frame.style.height=(q.axis.height)+"px";var d=this.screenToTime(0);var h=this.screenToTime(q.contentWidth);if(q.axis.characterMinorWidth){this.minimumStep=this.screenToTime(q.axis.characterMinorWidth*6)-this.screenToTime(0);e.setRange(d,h,this.minimumStep)}var o=this.repaintAxisCharacters();f=f||o;this.repaintAxisStartOverwriting();e.start();var a=undefined;var l=0;while(!e.end()&&l<1000){l++;var p=e.getCurrent(),n=this.timeToScreen(p),k=e.isMajor();if(r.showMinorLabels){this.repaintAxisMinorText(n,e.getLabelMinor(r))}if(k&&r.showMajorLabels){if(n>0){if(a==undefined){a=n}this.repaintAxisMajorText(n,e.getLabelMajor(r))}this.repaintAxisMajorLine(n)}else{this.repaintAxisMinorLine(n)}e.next()}if(r.showMajorLabels){var c=this.screenToTime(0),m=this.step.getLabelMajor(r,c),b=m.length*q.axis.characterMajorWidth+10;if(a==undefined||be){var c=l[e];a.removeChild(c);l.splice(e,1)}var d=b.axis.minorLines;e=j.minorLineNum;while(d.length>e){var f=d[e];a.removeChild(f);d.splice(e,1)}var m=b.axis.majorTexts;e=j.majorTextNum;while(m.length>e){var h=m[e];a.removeChild(h);m.splice(e,1)}var g=b.axis.majorLines;e=j.majorLineNum;while(g.length>e){var k=g[e];a.removeChild(k);g.splice(e,1)}};links.Timeline.prototype.repaintAxisHorizontal=function(){var e=this.dom.axis,d=this.size,c=this.options;var a=(c.showMinorLabels||c.showMajorLabels);if(a){if(!e.backgroundLine){var f=document.createElement("DIV");f.className="timeline-axis";f.style.position="absolute";f.style.left="0px";f.style.width="100%";f.style.border="none";e.frame.insertBefore(f,e.frame.firstChild);e.backgroundLine=f}if(e.backgroundLine){e.backgroundLine.style.top=d.axis.top+"px";e.backgroundLine.style.height=d.axis.height+"px"}}else{if(e.backgroundLine){e.frame.removeChild(e.backgroundLine);delete e.backgroundLine}}if(a){if(e.line){var b=e.frame.removeChild(e.line);e.frame.appendChild(b)}else{var b=document.createElement("DIV");b.className="timeline-axis";b.style.position="absolute";b.style.left="0px";b.style.width="100%";b.style.height="0px";e.frame.appendChild(b);e.line=b}e.line.style.top=d.axis.line+"px"}else{if(e.line&&e.line.parentElement){e.frame.removeChild(e.line);delete e.line}}};links.Timeline.prototype.repaintAxisMinorText=function(h,j){var k=this.size,b=this.dom,e=k.axis.properties,a=b.axis.frame,g=b.axis.minorTexts,c=e.minorTextNum,f;if(c0)||(j.update.length>0)||(j.hide.length>0);while(n=j.show.shift()){n.showDOM(a);n.getImageUrls(c);b.push(n)}while(n=j.update.shift()){n.updateDOM(a);n.getImageUrls(c);k=AJS.$.inArray(n,this.renderedItems);if(k==-1){b.push(n)}}while(n=j.hide.shift()){n.hideDOM(a);k=AJS.$.inArray(n,this.renderedItems);if(k!=-1){b.splice(k,1)}}AJS.$.each(b,function(q,p){p.updatePosition(m)});this.repaintDeleteButton();this.repaintDragAreas();f.content.appendChild(a);if(c.length){var l=function(){m.render()};var e=false;links.imageloader.loadAll(c,l,e)}return d};links.Timeline.prototype.reflowGroups=function(){var f=false,m=this.options,l=this.size,d=this.dom;var j=0;var b=this.groups;var g=this.dom.groups?this.dom.groups.labels:[];for(var e=0,c=b.length;e-k.contentWidth&&h<2*k.contentWidth);e.currentTime.style.display=d?"":"none";e.currentTime.style.left=h+"px";e.currentTime.title="Current time: "+f;if(this.currentTimeTimer!=undefined){clearTimeout(this.currentTimeTimer);delete this.currentTimeTimer}var j=this;var g=function(){j.repaintCurrentTime()};var c=1/this.conversion.factor/2;if(c<30){c=30}this.currentTimeTimer=setTimeout(g,c)};links.Timeline.prototype.repaintCustomTime=function(){var c=this.options,g=this.dom,d=this.size;if(!c.showCustomTime){if(g.customTime){g.contentTimelines.removeChild(g.customTime);delete g.customTime}return}if(!g.customTime){var b=document.createElement("DIV");b.className="timeline-customtime";b.style.position="absolute";b.style.top="0px";b.style.height="100%";var e=document.createElement("DIV");e.style.position="relative";e.style.top="0px";e.style.left="-10px";e.style.height="100%";e.style.width="20px";b.appendChild(e);g.contentTimelines.appendChild(b);g.customTime=b;this.customTime=new Date()}var a=this.timeToScreen(this.customTime),f=(a>-d.contentWidth&&a<2*d.contentWidth);g.customTime.style.display=f?"":"none";g.customTime.style.left=a+"px";g.customTime.title="Time: "+this.customTime};links.Timeline.prototype.repaintDeleteButton=function(){var d=this,g=this.dom,f=g.items.frame;var h=g.items.deleteButton;if(!h){h=document.createElement("DIV");h.className="timeline-navigation-delete";h.style.position="absolute";f.appendChild(h);g.items.deleteButton=h}var a=this.selection?this.selection.index:-1,c=this.selection?this.items[a]:undefined;if(c&&c.rendered&&this.isEditable(c)){var b=c.getRight(this),e=c.top;h.style.left=b+"px";h.style.top=e+"px";h.style.display="";f.removeChild(h);f.appendChild(h)}else{h.style.display="none"}};links.Timeline.prototype.repaintDragAreas=function(){var k=this,m=this.options,d=this.dom,a=this.dom.items.frame;var c=d.items.dragLeft;if(!c){c=document.createElement("DIV");c.className="timeline-event-range-drag-left";c.style.position="absolute";a.appendChild(c);d.items.dragLeft=c}var e=d.items.dragRight;if(!e){e=document.createElement("DIV");e.className="timeline-event-range-drag-right";e.style.position="absolute";a.appendChild(e);d.items.dragRight=e}var f=this.selection?this.selection.index:-1,l=this.selection?this.items[f]:undefined;if(l&&l.rendered&&this.isEditable(l)&&(l instanceof links.Timeline.ItemRange)){var b=this.timeToScreen(l.start),h=this.timeToScreen(l.end),g=l.top,j=l.height;c.style.left=b+"px";c.style.top=g+"px";c.style.width=m.dragAreaWidth+"px";c.style.height=j+"px";c.style.display="";a.removeChild(c);a.appendChild(c);e.style.left=(h-m.dragAreaWidth)+"px";e.style.top=g+"px";e.style.width=m.dragAreaWidth+"px";e.style.height=j+"px";e.style.display="";a.removeChild(e);a.appendChild(e)}else{c.style.display="none";e.style.display="none"}};links.Timeline.prototype.repaintNavigation=function(){var l=this,m=this.options,g=this.dom,e=g.frame,f=g.navBar;if(!f){var a=m.showButtonNew&&m.editable;var d=m.showNavigation&&(m.zoomable||m.moveable);if(d||a){f=document.createElement("DIV");f.style.position="absolute";f.className="timeline-navigation";if(m.groupsOnRight){f.style.left="10px"}else{f.style.right="32px"}if(m.axisOnTop){f.style.bottom="10px"}else{f.style.top="10px"}g.navBar=f;g.container.appendChild(f)}if(a){f.addButton=document.createElement("DIV");f.addButton.className="timeline-navigation-new";f.addButton.title=m.CREATE_NEW_EVENT;var j=function(o){links.Timeline.preventDefault(o);links.Timeline.stopPropagation(o);var t=l.size.contentWidth;var s=t/2;var v=l.screenToTime(s-t/10);var n=l.screenToTime(s+t/10);if(m.snapEvents){l.step.snap(v);l.step.snap(n)}var q=m.NEW;var u=l.groups.length?l.groups[0].content:undefined;var r=true;l.addItem({start:v,end:n,content:q,group:u},r);var p=(l.items.length-1);l.selectItem(p);l.applyAdd=true;l.trigger("add");if(l.applyAdd){l.render({animate:false});l.selectItem(p)}else{l.deleteItem(p)}};links.Timeline.addEventListener(f.addButton,"mousedown",j);f.appendChild(f.addButton)}if(a&&d){f.addButton.style.borderRightWidth="1px";f.addButton.style.borderRightStyle="solid"}if(d){if(m.zoomable){f.zoomInButton=document.createElement("DIV");f.zoomInButton.className="timeline-navigation-zoom-in";f.zoomInButton.title=this.options.ZOOM_IN;var c=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.zoom(0.4);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.zoomInButton,"mousedown",c);f.appendChild(f.zoomInButton);f.zoomOutButton=document.createElement("DIV");f.zoomOutButton.className="timeline-navigation-zoom-out";f.zoomOutButton.title=this.options.ZOOM_OUT;var h=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.zoom(-0.4);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.zoomOutButton,"mousedown",h);f.appendChild(f.zoomOutButton)}if(m.moveable){f.moveLeftButton=document.createElement("DIV");f.moveLeftButton.className="timeline-navigation-move-left";f.moveLeftButton.title=this.options.MOVE_LEFT;var k=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.move(-0.2);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.moveLeftButton,"mousedown",k);f.appendChild(f.moveLeftButton);f.moveRightButton=document.createElement("DIV");f.moveRightButton.className="timeline-navigation-move-right";f.moveRightButton.title=this.options.MOVE_RIGHT;var b=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.move(0.2);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.moveRightButton,"mousedown",b);f.appendChild(f.moveRightButton)}}}};links.Timeline.prototype.setCurrentTime=function(b){var a=new Date();this.clientTimeOffset=(b.valueOf()-a.valueOf());this.repaintCurrentTime()};links.Timeline.prototype.getCurrentTime=function(){var a=new Date();return new Date(a.valueOf()+this.clientTimeOffset)};links.Timeline.prototype.setCustomTime=function(a){this.customTime=new Date(a.valueOf());this.repaintCustomTime()};links.Timeline.prototype.getCustomTime=function(){return new Date(this.customTime.valueOf())};links.Timeline.prototype.setScale=function(b,a){this.step.setScale(b,a);this.render()};links.Timeline.prototype.setAutoScale=function(a){this.step.setAutoScale(a);this.render()};links.Timeline.prototype.redraw=function(){this.setData(this.data)};links.Timeline.prototype.checkResize=function(){this.render()};links.Timeline.prototype.isEditable=function(a){if(a){if(a.editable!=undefined){return a.editable}else{return this.options.editable}}return false};links.Timeline.prototype.recalcConversion=function(){this.conversion.offset=this.start.valueOf();this.conversion.factor=this.size.contentWidth/(this.end.valueOf()-this.start.valueOf())};links.Timeline.prototype.screenToTime=function(a){var b=this.conversion;return new Date(a/b.factor+b.offset)};links.Timeline.prototype.timeToScreen=function(b){var a=this.conversion;return(b.valueOf()-a.offset)*a.factor};links.Timeline.prototype.onTouchStart=function(c){var e=this.eventParams,b=this;if(e.touchDown){return}e.touchDown=true;e.zoomed=false;this.onMouseDown(c);if(!e.onTouchMove){e.onTouchMove=function(f){b.onTouchMove(f)};links.Timeline.addEventListener(document,"touchmove",e.onTouchMove)}if(!e.onTouchEnd){e.onTouchEnd=function(f){b.onTouchEnd(f)};links.Timeline.addEventListener(document,"touchend",e.onTouchEnd)}var d=links.Timeline.getTarget(c);var a=this.getItemIndex(d);e.doubleTapStartPrev=e.doubleTapStart;e.doubleTapStart=(new Date()).valueOf();e.doubleTapItemPrev=e.doubleTapItem;e.doubleTapItem=a;links.Timeline.preventDefault(c)};links.Timeline.prototype.onTouchMove=function(d){var g=this.eventParams;if(d.scale&&d.scale!==1){g.zoomed=true}if(!g.zoomed){this.onMouseMove(d)}else{if(this.options.zoomable){g.zoomed=true;var f=d.scale,b=(g.end.valueOf()-g.start.valueOf()),c=b/f,e=c-b,h=new Date(parseInt(g.start.valueOf()-e/2)),a=new Date(parseInt(g.end.valueOf()+e/2));this.setVisibleChartRange(h,a);this.trigger("rangechange")}}links.Timeline.preventDefault(d)};links.Timeline.prototype.onTouchEnd=function(d){var f=this.eventParams;var c=this;f.touchDown=false;if(f.zoomed){this.trigger("rangechanged")}if(f.onTouchMove){links.Timeline.removeEventListener(document,"touchmove",f.onTouchMove);delete f.onTouchMove}if(f.onTouchEnd){links.Timeline.removeEventListener(document,"touchend",f.onTouchEnd);delete f.onTouchEnd}this.onMouseUp(d);var g=500;var a=(new Date()).valueOf();var e=links.Timeline.getTarget(d);var b=this.getItemIndex(e);if(f.doubleTapStartPrev&&(a-f.doubleTapStartPrev)=1){D.moved=true}if(D.customTime){var o=this.timeToScreen(D.customTime);var q=o+t;this.customTime=this.screenToTime(q);this.repaintCustomTime();this.trigger("timechange")}else{if(D.editItem){this.trigger("moved");var B=this.items[D.itemIndex],f,C;if(D.itemDragLeft){f=D.itemLeft+t;C=D.itemRight;B.start=this.screenToTime(f);if(e.snapEvents){this.step.snap(B.start);f=this.timeToScreen(B.start)}if(f>C){f=C;B.start=this.screenToTime(f)}}else{if(D.itemDragRight){f=D.itemLeft;C=D.itemRight+t;B.end=this.screenToTime(C);if(e.snapEvents){this.step.snap(B.end);C=this.timeToScreen(B.end)}if(C=1){g=0.9}if(g<=-1){g=-0.9}if(g<0){g=g/(1+g)}var e=(this.start.valueOf()-h);var d=(this.end.valueOf()-h);var a=new Date(this.start.valueOf()-e*g);var f=new Date(this.end.valueOf()-d*g);var c=(f.valueOf()-a.valueOf());var b=Number(this.options.zoomMin)||10;if(b<10){b=10}if(c>=b){this.applyRange(a,f,h);this.render({animate:this.options.animate&&this.options.animateZoom})}};links.Timeline.prototype.move=function(b){var d=(this.end.valueOf()-this.start.valueOf());var a=new Date(this.start.valueOf()+d*b);var c=new Date(this.end.valueOf()+d*b);this.applyRange(a,c);this.render()};links.Timeline.prototype.applyRange=function(b,e,a){var c=b.valueOf();var n=e.valueOf();var d=(n-c);var q=this.options;var k=1000*60*60*24*365;var h=Number(q.zoomMin)||10;if(h<10){h=10}var p=Number(q.zoomMax)||10000*k;if(p>10000*k){p=10000*k}if(p=m){var l=1000*60*60*24;m=g+l}if(p>(m-g)){p=(m-g)}if(h>(m-g)){h=(m-g)}}if(c>=n){n+=1000*60*60*24}if(dp){var o=(d-p);var j=a?(a.valueOf()-c)/d:0.5;c+=Math.round(o*j);n-=Math.round(o*(1-j))}if(g!=undefined){var o=(c-g);if(o<0){c-=o;n-=o}}if(m!=undefined){var o=(m-n);if(o<0){c+=o;n+=o}}this.start=new Date(c);this.end=new Date(n)};links.Timeline.prototype.confirmDeleteItem=function(a){this.applyDelete=true;if(!this.isSelected(a)){this.selectItem(a)}this.trigger("delete");if(this.applyDelete){this.deleteItem(a)}delete this.applyDelete};links.Timeline.prototype.deleteItem=function(a,c){if(a>=this.items.length){throw"Cannot delete row, index out of range"}if(this.selection){if(this.selection.index==a){this.unselectItem()}else{if(this.selection.index>a){this.selection.index--}}}var b=this.items.splice(a,1)[0];this.renderQueue.hide.push(b);if(this.data){if(google&&google.visualization&&this.data instanceof google.visualization.DataTable){this.data.removeRow(a)}else{if(links.Timeline.isArray(this.data)){this.data.splice(a,1)}else{throw"Cannot delete row from data, unknown data type"}}}if(this.options.cluster){this.clusterGenerator.updateData()}if(!c){this.render()}};links.Timeline.prototype.deleteAllItems=function(){this.unselectItem();this.clearItems();this.deleteGroups();if(this.data){if(google&&google.visualization&&this.data instanceof google.visualization.DataTable){this.data.removeRows(0,this.data.getNumberOfRows())}else{if(links.Timeline.isArray(this.data)){this.data.splice(0,this.data.length)}else{throw"Cannot delete row from data, unknown data type"}}}if(this.options.cluster){this.clusterGenerator.updateData()}this.render()};links.Timeline.prototype.getGroupFromHeight=function(b){var c,d,a=this.groups;if(a.length){if(this.options.axisOnTop){for(c=a.length-1;c>=0;c--){d=a[c];if(b>d.top){return d}}}else{for(c=0;cd.top){return d}}}return d}return undefined};links.Timeline.Item=function(c,a){if(c){this.start=c.start;this.end=c.end;this.content=c.content;this.className=c.className;this.editable=c.editable;this.group=c.group}this.top=0;this.left=0;this.width=0;this.height=0;this.lineWidth=0;this.dotWidth=0;this.dotHeight=0;this.rendered=false;if(a){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b]}}}};links.Timeline.Item.prototype.reflow=function(){return false};links.Timeline.Item.prototype.getImageUrls=function(a){if(this.dom){links.imageloader.filterImageUrls(this.dom,a)}};links.Timeline.Item.prototype.select=function(){};links.Timeline.Item.prototype.unselect=function(){};links.Timeline.Item.prototype.createDOM=function(){};links.Timeline.Item.prototype.showDOM=function(a){};links.Timeline.Item.prototype.hideDOM=function(a){};links.Timeline.Item.prototype.updateDOM=function(){};links.Timeline.Item.prototype.updatePosition=function(a){};links.Timeline.Item.prototype.isRendered=function(){return this.rendered};links.Timeline.Item.prototype.isVisible=function(b,a){return false};links.Timeline.Item.prototype.setPosition=function(b,a){};links.Timeline.Item.prototype.getRight=function(a){return 0};links.Timeline.Item.prototype.getWidth=function(a){return this.width||0};links.Timeline.ItemBox=function(b,a){links.Timeline.Item.call(this,b,a)};links.Timeline.ItemBox.prototype=new links.Timeline.Item();links.Timeline.ItemBox.prototype.reflow=function(){var e=this.dom,c=e.dot.offsetHeight,d=e.dot.offsetWidth,a=e.line.offsetWidth,b=((this.dotHeight!=c)||(this.dotWidth!=d)||(this.lineWidth!=a));this.dotHeight=c;this.dotWidth=d;this.lineWidth=a;return b};links.Timeline.ItemBox.prototype.select=function(){var a=this.dom;links.Timeline.addClassName(a,"timeline-event-selected");links.Timeline.addClassName(a.line,"timeline-event-selected");links.Timeline.addClassName(a.dot,"timeline-event-selected")};links.Timeline.ItemBox.prototype.unselect=function(){var a=this.dom;links.Timeline.removeClassName(a,"timeline-event-selected");links.Timeline.removeClassName(a.line,"timeline-event-selected");links.Timeline.removeClassName(a.dot,"timeline-event-selected")};links.Timeline.ItemBox.prototype.createDOM=function(){var c=document.createElement("DIV");c.style.position="absolute";c.style.left=this.left+"px";c.style.top=this.top+"px";var b=document.createElement("DIV");b.className="timeline-event-content";b.innerHTML=this.content;c.appendChild(b);var d=document.createElement("DIV");d.style.position="absolute";d.style.width="0px";c.line=d;var a=document.createElement("DIV");a.style.position="absolute";a.style.width="0px";a.style.height="0px";c.dot=a;this.dom=c;this.updateDOM();return c};links.Timeline.ItemBox.prototype.showDOM=function(a){var b=this.dom;if(!b){b=this.createDOM()}if(b.parentNode!=a){if(b.parentNode){this.hideDOM()}a.appendChild(b);a.insertBefore(b.line,a.firstChild);a.appendChild(b.dot);this.rendered=true}};links.Timeline.ItemBox.prototype.hideDOM=function(){var c=this.dom;if(c){var b=c.parentNode;if(b){var a=function(d){if(d&&d.parentNode){d.parentNode.removeChild(d)}};a(c.line);a(c.dot);a(c);this.rendered=false}}};links.Timeline.ItemBox.prototype.updateDOM=function(){var b=this.dom;if(b){var c=b.line;var a=b.dot;b.firstChild.innerHTML=this.content;b.className="timeline-event timeline-event-box";c.className="timeline-event timeline-event-line";a.className="timeline-event timeline-event-dot";if(this.isCluster){links.Timeline.addClassName(b,"timeline-event-cluster");links.Timeline.addClassName(c,"timeline-event-cluster");links.Timeline.addClassName(a,"timeline-event-cluster")}if(this.className){links.Timeline.addClassName(b,this.className);links.Timeline.addClassName(c,this.className);links.Timeline.addClassName(a,this.className)}}};links.Timeline.ItemBox.prototype.updatePosition=function(g){var e=this.dom;if(e){var c=g.timeToScreen(this.start),f=g.options.axisOnTop,a=g.size.axis.top,d=g.size.axis.height,h=(g.options.box&&g.options.box.align)?g.options.box.align:undefined;e.style.top=this.top+"px";if(h=="right"){e.style.left=(c-this.width)+"px"}else{if(h=="left"){e.style.left=(c)+"px"}else{e.style.left=(c-this.width/2)+"px"}}var j=e.line;var b=e.dot;j.style.left=(c-this.lineWidth/2)+"px";b.style.left=(c-this.dotWidth/2)+"px";if(f){j.style.top=d+"px";j.style.height=Math.max(this.top-d,0)+"px";b.style.top=(d-this.dotHeight/2)+"px"}else{j.style.top=(this.top+this.height)+"px";j.style.height=Math.max(a-this.top-this.height,0)+"px";b.style.top=(a-this.dotHeight/2)+"px"}}};links.Timeline.ItemBox.prototype.isVisible=function(b,a){if(this.cluster){return false}return(this.start>b)&&(this.start2*a){b=2*a}e.style.top=this.top+"px";e.style.left=d+"px";e.style.width=Math.max(b-d,1)+"px"}};links.Timeline.ItemRange.prototype.isVisible=function(b,a){if(this.cluster){return false}return(this.end>b)&&(this.startb)&&(this.start=this.items.length){throw"Cannot get item, index out of range"}var c=this.items[a];var b={};b.start=new Date(c.start.valueOf());if(c.end){b.end=new Date(c.end.valueOf())}b.content=c.content;if(c.group){b.group=this.getGroupName(c.group)}if("className" in c){b.className=this.getGroupName(c.className)}if(c.hasOwnProperty("editable")&&(typeof c.editable!="undefined")){b.editable=c.editable}return b};links.Timeline.prototype.addItem=function(a,b){var c=[a];this.addItems(c,b)};links.Timeline.prototype.addItems=function(d,c){var b=this,a=this.items;AJS.$.each(d,function(g,e){var f=a.length;a.push(b.createItem(e));b.updateData(f,e)});if(this.options.cluster){this.clusterGenerator.updateData()}if(!c){this.render({animate:false})}};links.Timeline.prototype.createItem=function(a){var c=a.end?"range":this.options.style;var e={start:a.start,end:a.end,content:a.content,className:a.className,editable:a.editable,group:this.getGroup(a.group)};var d,b=this.options;if(b.axisOnTop){d=this.size.axis.height+b.eventMarginAxis+b.eventMargin/2}else{d=this.size.contentHeight-b.eventMarginAxis-b.eventMargin/2}if(c in this.itemTypes){return new this.itemTypes[c](e,{top:d})}console.log('ERROR: Unknown event style "'+c+'"');return new links.Timeline.Item(e,{top:d})};links.Timeline.prototype.changeItem=function(b,a,d){var e=this.items[b];if(!e){throw"Cannot change item, index out of range"}var c=this.createItem({start:a.hasOwnProperty("start")?a.start:e.start,end:a.hasOwnProperty("end")?a.end:e.end,content:a.hasOwnProperty("content")?a.content:e.content,group:a.hasOwnProperty("group")?a.group:this.getGroupName(e.group),className:a.hasOwnProperty("className")?a.className:e.className,editable:a.hasOwnProperty("editable")?a.editable:e.editable});this.items[b]=c;this.renderQueue.hide.push(e);this.renderQueue.show.push(c);this.updateData(b,a);if(this.options.cluster){this.clusterGenerator.updateData()}if(!d){this.render({animate:false});c.select()}};links.Timeline.prototype.deleteGroups=function(){this.groups=[];this.groupIndexes={}};links.Timeline.prototype.getGroup=function(g){var b=this.groups,c=this.groupIndexes,e=undefined;var f=c[g];if(f==undefined&&g!=undefined){e={content:g,labelTop:0,lineTop:0};b.push(e);b=b.sort(function(j,h){if(j.content>h.content){return 1}if(j.content0){if(g[0].row!=undefined){var e=g[0].row;if(this.items[e]){var j=this.items[e];this.selectItem(e);var a=j.start;var c=j.end;var k;if(c!=undefined){k=(c.valueOf()+a.valueOf())/2}else{k=a.valueOf()}var f=(this.end.valueOf()-this.start.valueOf()),d=new Date(k-f/2),b=new Date(k+f/2);if(!h){this.setVisibleChartRange(d,b)}return true}}}else{this.unselectItem()}return false};links.Timeline.prototype.getSelection=function(){var a=[];if(this.selection){a.push({row:this.selection.index})}return a};links.Timeline.prototype.selectItem=function(a){this.unselectItem();this.selection=undefined;if(this.items[a]!=undefined){var c=this.items[a],b=c.dom;this.selection={index:a};if(c&&c.dom){if(this.isEditable(c)){c.dom.style.cursor="move"}c.select()}this.repaintDeleteButton();this.repaintDragAreas()}};links.Timeline.prototype.isSelected=function(a){return(this.selection&&this.selection.index==a)};links.Timeline.prototype.unselectItem=function(){if(this.selection){var b=this.items[this.selection.index];if(b&&b.dom){var a=b.dom;a.style.cursor="";b.unselect()}this.selection=undefined;this.repaintDeleteButton();this.repaintDragAreas()}};links.Timeline.prototype.stackItems=function(b){if(this.groups.length>0){return}if(b==undefined){b=false}var a=this.stack;if(!a){a={};this.stack=a}a.sortedItems=this.stackOrder(this.renderedItems);a.finalItems=this.stackCalculateFinal(a.sortedItems);if(b||a.timer){var d=this;var c=function(){var e=d.stackMoveOneStep(a.sortedItems,a.finalItems);d.repaint();if(!e){a.timer=setTimeout(c,30)}else{delete a.timer}};if(!a.timer){a.timer=setTimeout(c,30)}}else{this.stackMoveToFinal(a.sortedItems,a.finalItems)}};links.Timeline.prototype.stackCancelAnimation=function(){if(this.stack&&this.stack.timer){clearTimeout(this.stack.timer);delete this.stack.timer}};links.Timeline.prototype.stackOrder=function(a){var c=a.concat([]);var b=this.options.customStackOrder&&(typeof this.options.customStackOrder==="function")?this.options.customStackOrder:function(e,d){if((e instanceof links.Timeline.ItemRange)&&!(d instanceof links.Timeline.ItemRange)){return -1}if(!(e instanceof links.Timeline.ItemRange)&&(d instanceof links.Timeline.ItemRange)){return 1}result=(e.start-d.start);if(!result){result=(d.width-e.width)}if(!result){result=(d.bottom-e.bottom)}return result};c.sort(b);return c};links.Timeline.prototype.stackCalculateFinal=function(l){var p,o,j=this.size,d=j.axis.top,g=j.axis.height,a=this.options,t=a.axisOnTop,c=a.eventMargin,n=a.eventMarginAxis,f=[];for(p=0,o=l.length;ph)?1:-1);if(Math.abs(g)>4){a=g/4}var b=parseInt(h+a);if(b!=f){c=false}k.top=b;k.bottom=k.top+k.height}else{k.top=d.top;k.bottom=d.bottom}k.left=d.left;k.right=d.right}return c};links.Timeline.prototype.stackMoveToFinal=function(a,b){for(i=0,iMax=b.length;i=g;c--){var d=h[c];if(j(e,d,b)){if(c!=a){return d}}}return undefined};links.Timeline.prototype.collision=function(b,a,c){if(c==undefined){c=0}return(b.left-ca.left&&b.top-ca.top)};links.Timeline.prototype.trigger=function(d){var c=null,b,a;switch(d){case"rangechange":case"rangechanged":c={start:new Date(this.start.valueOf()),end:new Date(this.end.valueOf())};break;case"timechange":case"timechanged":c={time:new Date(this.customTime.valueOf())};break;case"add":b=this.eventParams.mouseX-links.Timeline.getAbsoluteLeft(this.dom.content);a=this.screenToTime(b);c={start:a};break}links.events.trigger(this,d,c);if(google&&google.visualization){google.visualization.events.trigger(this,d,c)}};links.Timeline.prototype.clusterItems=function(){if(!this.options.cluster){return}var b=this.clusterGenerator.getClusters(this.conversion.factor);if(this.clusters!=b){var a=this.renderQueue;if(this.clusters){AJS.$.each(this.clusters,function(d,c){a.hide.push(c);AJS.$.each(c.items,function(f,e){e.cluster=undefined})})}AJS.$.each(b,function(d,c){AJS.$.each(c.items,function(f,e){e.cluster=c})});this.clusters=b}};links.Timeline.prototype.filterItems=function(){var a=this.renderQueue,d=(this.end-this.start),e=new Date(this.start.valueOf()-d),b=new Date(this.end.valueOf()+d);function c(f){AJS.$.each(f,function(h,g){var k=g.rendered;var j=g.isVisible(e,b);if(k!=j){if(k){a.hide.push(g)}if(j&&AJS.$.inArray(g,a.show)==-1){a.show.push(g)}}})}c(this.items);if(this.clusters){c(this.clusters)}};links.Timeline.ClusterGenerator=function(a){this.timeline=a;this.clear()};links.Timeline.ClusterGenerator.prototype.clear=function(){this.items=[];this.groups={};this.clearCache()};links.Timeline.ClusterGenerator.prototype.clearCache=function(){this.cache={};this.cacheLevel=-1;this.cache[this.cacheLevel]=[]};links.Timeline.ClusterGenerator.prototype.setData=function(a,b){this.items=a||[];this.dataChanged=true;this.applyOnChangedLevel=true;if(b&&b.applyOnChangedLevel){this.applyOnChangedLevel=b.applyOnChangedLevel}};links.Timeline.ClusterGenerator.prototype.updateData=function(){this.dataChanged=true;this.applyOnChangedLevel=false};links.Timeline.ClusterGenerator.prototype.filterData=function(){var b=this.items||[];var a={};this.groups=a;AJS.$.each(b,function(e,d){var g=d.group?d.group.content:"";var f=a[g];if(!f){f=[];a[g]=f}f.push(d);if(d.start){if(d.end){d.center=(d.start.valueOf()+d.end.valueOf())/2}else{d.center=d.start.valueOf()}}});for(var c in a){if(a.hasOwnProperty(c)){a[c].sort(function(e,d){return(e.center-d.center)})}}this.dataChanged=false};links.Timeline.ClusterGenerator.prototype.getClusters=function(K){var a=-1,b=2,x=0,H=5;if(K>0){a=Math.round(Math.log(100/K)/Math.log(b));x=Math.pow(b,a);if(this.timeline.groups&&this.timeline.groups.length){x*=4}}if(this.dataChanged){var w=(a!=this.cacheLevel);var D=this.applyOnChangedLevel?w:true;if(D){this.clearCache();this.filterData()}}this.cacheLevel=a;var h=this.cache[a];if(!h){h=[];for(var q in this.groups){if(this.groups.hasOwnProperty(q)){var r=this.groups[q];var z=r.length;var G=0;while(G=0&&(J.center-r[E].center)=0&&(J.center-h[A].center)H){var n=v-H+1;var d=[];var t=undefined;var y=undefined;var F=undefined;var f=false;var g=0;var u=G;while(d.length'+g+" events";var o=J.group?J.group.content:undefined;if(f){I=this.timeline.createItem({start:new Date(y),end:new Date(F),content:B,group:o})}else{I=this.timeline.createItem({start:new Date(t),content:B,group:o})}I.isCluster=true;I.items=d;AJS.$.each(I.items,function(k,j){j.cluster=I});h.push(I);G+=n}else{delete J.cluster;G+=1}}}}this.cache[a]=h}return h};links.events=links.events||{listeners:[],indexOf:function(b){var d=this.listeners;for(var c=0,a=this.listeners.length;cthis._end.valueOf())};links.Timeline.StepDate.prototype.next=function(){var b=this.current.valueOf();if(this.current.getMonth()<6){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case links.Timeline.StepDate.SCALE.SECOND:this.current=new Date(this.current.valueOf()+this.step*1000);break;case links.Timeline.StepDate.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+this.step*1000*60);break;case links.Timeline.StepDate.SCALE.HOUR:this.current=new Date(this.current.valueOf()+this.step*1000*60*60);var a=this.current.getHours();this.current.setHours(a-(a%this.step));break;case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case links.Timeline.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case links.Timeline.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:break}}else{switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case links.Timeline.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case links.Timeline.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case links.Timeline.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case links.Timeline.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case links.Timeline.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:break}}if(this.step!=1){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:if(this.current.getMilliseconds()0){this.step=a}this.autoScale=false};links.Timeline.StepDate.prototype.setAutoScale=function(a){this.autoScale=a};links.Timeline.StepDate.prototype.setMinimumStep=function(f){if(f==undefined){return}var b=(1000*60*60*24*30*12);var a=(1000*60*60*24*30);var e=(1000*60*60*24);var g=(1000*60*60);var d=(1000*60);var h=(1000);var c=(1);if(b*1000>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=1000}if(b*500>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=500}if(b*100>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=100}if(b*50>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=50}if(b*10>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=10}if(b*5>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=5}if(b>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=1}if(a*3>f){this.scale=links.Timeline.StepDate.SCALE.MONTH;this.step=3}if(a>f){this.scale=links.Timeline.StepDate.SCALE.MONTH;this.step=1}if(e*5>f){this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=5}if(e*2>f){this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=2}if(e>f){this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=1}if(e/2>f){this.scale=links.Timeline.StepDate.SCALE.WEEKDAY;this.step=1}if(g*4>f){this.scale=links.Timeline.StepDate.SCALE.HOUR;this.step=4}if(g>f){this.scale=links.Timeline.StepDate.SCALE.HOUR;this.step=1}if(d*15>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=15}if(d*10>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=10}if(d*5>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=5}if(d>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=1}if(h*15>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=15}if(h*10>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=10}if(h*5>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=5}if(h>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=1}if(c*200>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=200}if(c*100>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=100}if(c*50>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=50}if(c*10>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=10}if(c*5>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=5}if(c>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=1}};links.Timeline.StepDate.prototype.snap=function(a){if(this.scale==links.Timeline.StepDate.SCALE.YEAR){var b=a.getFullYear()+Math.round(a.getMonth()/12);a.setFullYear(Math.round(b/this.step)*this.step);a.setMonth(0);a.setDate(0);a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.MONTH){if(a.getDate()>15){a.setDate(1);a.setMonth(a.getMonth()+1)}else{a.setDate(1)}a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.DAY||this.scale==links.Timeline.StepDate.SCALE.WEEKDAY){switch(this.step){case 5:case 2:a.setHours(Math.round(a.getHours()/24)*24);break;default:a.setHours(Math.round(a.getHours()/12)*12);break}a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.HOUR){switch(this.step){case 4:a.setMinutes(Math.round(a.getMinutes()/60)*60);break;default:a.setMinutes(Math.round(a.getMinutes()/30)*30);break}a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.MINUTE){switch(this.step){case 15:case 10:a.setMinutes(Math.round(a.getMinutes()/5)*5);a.setSeconds(0);break;case 5:a.setSeconds(Math.round(a.getSeconds()/60)*60);break;default:a.setSeconds(Math.round(a.getSeconds()/30)*30);break}a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.SECOND){switch(this.step){case 15:case 10:a.setSeconds(Math.round(a.getSeconds()/5)*5);a.setMilliseconds(0);break;case 5:a.setMilliseconds(Math.round(a.getMilliseconds()/1000)*1000);break;default:a.setMilliseconds(Math.round(a.getMilliseconds()/500)*500);break}}else{if(this.scale==links.Timeline.StepDate.SCALE.MILLISECOND){var c=this.step>5?this.step/2:1;a.setMilliseconds(Math.round(a.getMilliseconds()/c)*c)}}}}}}}};links.Timeline.StepDate.prototype.isMajor=function(){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:return(this.current.getMilliseconds()==0);case links.Timeline.StepDate.SCALE.SECOND:return(this.current.getSeconds()==0);case links.Timeline.StepDate.SCALE.MINUTE:return(this.current.getHours()==0)&&(this.current.getMinutes()==0);case links.Timeline.StepDate.SCALE.HOUR:return(this.current.getHours()==0);case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:return(this.current.getDate()==1);case links.Timeline.StepDate.SCALE.MONTH:return(this.current.getMonth()==0);case links.Timeline.StepDate.SCALE.YEAR:return false;default:return false}};links.Timeline.StepDate.prototype.getLabelMinor=function(b,a){if(a==undefined){a=this.current}switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:return String(a.getMilliseconds());case links.Timeline.StepDate.SCALE.SECOND:return String(a.getSeconds());case links.Timeline.StepDate.SCALE.MINUTE:return this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2);case links.Timeline.StepDate.SCALE.HOUR:return this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2);case links.Timeline.StepDate.SCALE.WEEKDAY:return b.DAYS_SHORT[a.getDay()]+" "+a.getDate();case links.Timeline.StepDate.SCALE.DAY:return String(a.getDate());case links.Timeline.StepDate.SCALE.MONTH:return b.MONTHS_SHORT[a.getMonth()];case links.Timeline.StepDate.SCALE.YEAR:return String(a.getFullYear());default:return""}};links.Timeline.StepDate.prototype.getLabelMajor=function(b,a){if(a==undefined){a=this.current}switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:return this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2)+":"+this.addZeros(a.getSeconds(),2);case links.Timeline.StepDate.SCALE.SECOND:return a.getDate()+" "+b.MONTHS[a.getMonth()]+" "+this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2);case links.Timeline.StepDate.SCALE.MINUTE:return b.DAYS[a.getDay()]+" "+a.getDate()+" "+b.MONTHS[a.getMonth()]+" "+a.getFullYear();case links.Timeline.StepDate.SCALE.HOUR:return b.DAYS[a.getDay()]+" "+a.getDate()+" "+b.MONTHS[a.getMonth()]+" "+a.getFullYear();case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:return b.MONTHS[a.getMonth()]+" "+a.getFullYear();case links.Timeline.StepDate.SCALE.MONTH:return String(a.getFullYear());default:return""}};links.Timeline.StepDate.prototype.addZeros=function(b,a){var c=""+b;while(c.length=0){d="DOMMouseScroll"}b.addEventListener(d,c,a)}else{b.attachEvent("on"+d,c)}};links.Timeline.removeEventListener=function(b,d,c,a){if(b.removeEventListener){if(a===undefined){a=false}if(d==="mousewheel"&&navigator.userAgent.indexOf("Firefox")>=0){d="DOMMouseScroll"}b.removeEventListener(d,c,a)}else{b.detachEvent("on"+d,c)}};links.Timeline.getTarget=function(a){if(!a){a=window.event}var b;if(a.target){b=a.target}else{if(a.srcElement){b=a.srcElement}}if(b.nodeType!=undefined&&b.nodeType==3){b=b.parentNode}return b};links.Timeline.stopPropagation=function(a){if(!a){a=window.event}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}};links.Timeline.preventDefault=function(a){if(!a){a=window.event}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};links.Timeline.getAbsoluteLeft=function(b){var f=document.documentElement;var a=document.body;var d=b.offsetLeft;var c=b.offsetParent;while(c!=null&&c!=a&&c!=f){d+=c.offsetLeft;d-=c.scrollLeft;c=c.offsetParent}return d};links.Timeline.getAbsoluteTop=function(b){var f=document.documentElement;var a=document.body;var d=b.offsetTop;var c=b.offsetParent;while(c!=null&&c!=a&&c!=f){d+=c.offsetTop;d-=c.scrollTop;c=c.offsetParent}return d};links.Timeline.getPageY=function(c){if("pageY" in c){return c.pageY}else{var b;if(("targetTouches" in c)&&c.targetTouches.length){b=c.targetTouches[0].clientY}else{b=c.clientY}var d=document.documentElement;var a=document.body;return b+(d&&d.scrollTop||a&&a.scrollTop||0)-(d&&d.clientTop||a&&a.clientTop||0)}};links.Timeline.getPageX=function(c){if("pageY" in c){return c.pageX}else{var b;if(("targetTouches" in c)&&c.targetTouches.length){b=c.targetTouches[0].clientX}else{b=c.clientX}var d=document.documentElement;var a=document.body;return b+(d&&d.scrollLeft||a&&a.scrollLeft||0)-(d&&d.clientLeft||a&&a.clientLeft||0)}};links.Timeline.addClassName=function(c,b){var a=c.className.split(" ");if(AJS.$.inArray(b,a)==-1){a.push(b);c.className=a.join(" ")}};links.Timeline.removeClassName=function(d,c){var b=d.className.split(" ");var a=AJS.$.inArray(c,b);if(a!=-1){b.splice(a,1);d.className=b.join(" ")}};links.Timeline.isArray=function(a){if(a instanceof Array){return true}return(Object.prototype.toString.call(a)==="[object Array]")};links.Timeline.parseJSONDate=function(b){if(b==undefined){return undefined}if(b instanceof Date){return b}var a=b.match(/\/Date\((-?\d+)([-\+]?\d{2})?(\d{2})?\)\//i);if(a){var c=a[2]?(3600000*a[2])+(60000*a[3]*(a[2]/Math.abs(a[2]))):0;return new Date((1*a[1])+c)}return Date.parse(b)}; }catch(e){WRMCB(e)};