

/* compile-prolog.js */
window.Timeline_isCompiled=true;


/* timeline-api.js */
(function(){var C="2.2.1";
var D=("Timeline_isCompiled" in window)&&window.Timeline_isCompiled;
var I=false;
if(document.location.search.length>0){var B=document.location.search.substr(1).split("&");
for(var E=0;
E<B.length;
E++){if(B[E]=="timeline-use-local-resources"){I=true;
}}}var H=function(){if("Timeline" in window){return ;
}window.Timeline=new Object();
window.Timeline.DateTime=window.SimileAjax.DateTime;
var V=false;
var S=["timeline.js","band.js","themes.js","ethers.js","ether-painters.js","event-utils.js","labellers.js","sources.js","original-painter.js","detailed-painter.js","overview-painter.js","compact-painter.js","decorators.js","units.js"];
var O=["timeline.css","ethers.css","events.css"];
var Q=["timeline.js","labellers.js"];
var X=[];
var U=["cs","de","en","es","fr","it","nl","ru","se","tr","vi","zh"];
try{var L=["en"],K="en",c=null;
var M=function(d){var g=d.split("&");
for(var e=0;
e<g.length;
e++){var f=g[e].split("=");
if(f[0]=="locales"){L=L.concat(f[1].split(","));
}else{if(f[0]=="defaultLocale"){K=f[1];
}else{if(f[0]=="forceLocale"){c=f[1];
L=L.concat(f[1].split(","));
}else{if(f[0]=="bundle"){V=f[1]!="false";
}}}}}};
(function(){if(typeof Timeline_urlPrefix=="string"){Timeline.urlPrefix=Timeline_urlPrefix;
if(typeof Timeline_parameters=="string"){M(Timeline_parameters);
}}else{var k=document.documentElement.getElementsByTagName("head");
for(var j=0;
j<k.length;
j++){var d=k[j].getElementsByTagName("script");
for(var g=0;
g<d.length;
g++){var e=d[g].src;
var f=e.indexOf("timeline-api.js");
if(f>=0){Timeline.urlPrefix=e.substr(0,f);
var l=e.indexOf("?");
if(l>0){M(e.substr(l+1));
}return ;
}}}throw new Error("Failed to derive URL prefix for Timeline API code files");
}})();
var J=function(d,e){SimileAjax.includeJavascriptFiles(document,d,e);
};
var b=function(d,e){SimileAjax.includeCssFiles(document,d,e);
};
if(!D){if(V){J(Timeline.urlPrefix,["timeline-bundle.js"]);
b(Timeline.urlPrefix,["timeline-bundle.css"]);
}else{J(Timeline.urlPrefix+"scripts/",S);
b(Timeline.urlPrefix+"styles/",O);
}}var R=[];
R[K]=true;
var P=function(d){for(var e=0;
e<U.length;
e++){if(d==U[e]){R[d]=true;
return true;
}}return false;
};
var W=function(d){if(P(d)){return d;
}var e=d.indexOf("-");
if(e>0&&P(d.substr(0,e))){return d.substr(0,e);
}return null;
};
for(var Y=0;
Y<L.length;
Y++){W(L[Y]);
}var N=K;
var T=("language" in navigator?navigator.language:navigator.browserLanguage).split(";");
for(var Y=0;
Y<T.length;
Y++){var Z=W(T[Y]);
if(Z!=null){N=Z;
break;
}}if(!D){for(var Y=0;
Y<U.length;
Y++){var Z=U[Y];
if(R[Z]){J(Timeline.urlPrefix+"scripts/l10n/"+Z+"/",Q);
b(Timeline.urlPrefix+"styles/l10n/"+Z+"/",X);
}}}if(c==null){Timeline.serverLocale=K;
Timeline.clientLocale=N;
}else{Timeline.serverLocale=c;
Timeline.clientLocale=c;
}}catch(a){alert(a);
}};
if(typeof SimileAjax=="undefined"&&!D){window.SimileAjax_onLoad=H;
var A=I?"http://127.0.0.1:9999/ajax/api/simile-ajax-api.js?bundle=false":"http://api.simile-widgets.org/ajax/"+C+"/simile-ajax-api.js";
if(typeof Timeline_ajax_url=="string"){A=Timeline_ajax_url;
}var G=function(){var J=document.createElement("script");
J.type="text/javascript";
J.language="JavaScript";
J.src=A;
document.getElementsByTagName("head")[0].appendChild(J);
};
if(document.body==null){try{document.write("<script src='"+A+"' type='text/javascript'><\/script>");
}catch(F){G();
}}else{G();
}}else{H();
}})();


/* timeline-bundle.js */
Timeline._Band=function(K,J,O){if(K.autoWidth&&typeof J.width=="string"){J.width=J.width.indexOf("%")>-1?0:parseInt(J.width);
}this._timeline=K;
this._bandInfo=J;
this._index=O;
this._locale=("locale" in J)?J.locale:Timeline.getDefaultLocale();
this._timeZone=("timeZone" in J)?J.timeZone:0;
this._labeller=("labeller" in J)?J.labeller:(("createLabeller" in K.getUnit())?K.getUnit().createLabeller(this._locale,this._timeZone):new Timeline.GregorianDateLabeller(this._locale,this._timeZone));
this._theme=J.theme;
this._zoomIndex=("zoomIndex" in J)?J.zoomIndex:0;
this._zoomSteps=("zoomSteps" in J)?J.zoomSteps:null;
this._dragging=false;
this._changing=false;
this._originalScrollSpeed=5;
this._scrollSpeed=this._originalScrollSpeed;
this._onScrollListeners=[];
this._orthogonalDragging=false;
this._viewOrthogonalOffset=0;
this._onOrthogonalScrollListeners=[];
var I=this;
this._syncWithBand=null;
this._syncWithBandHandler=function(A){I._onHighlightBandScroll();
};
this._syncWithBandOrthogonalScrollHandler=function(A){I._onHighlightBandOrthogonalScroll();
};
this._selectorListener=function(A){I._onHighlightBandScroll();
};
var M=this._timeline.getDocument().createElement("div");
M.className="timeline-band-input";
this._timeline.addDiv(M);
this._keyboardInput=document.createElement("input");
this._keyboardInput.type="text";
M.appendChild(this._keyboardInput);
SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keydown",this,"_onKeyDown");
SimileAjax.DOM.registerEventWithObject(this._keyboardInput,"keyup",this,"_onKeyUp");
this._div=this._timeline.getDocument().createElement("div");
this._div.id="timeline-band-"+O;
this._div.className="timeline-band timeline-band-"+O;
this._timeline.addDiv(this._div);
SimileAjax.DOM.registerEventWithObject(this._div,"dblclick",this,"_onDblClick");
SimileAjax.DOM.registerEventWithObject(this._div,"mousedown",this,"_onMouseDown");
SimileAjax.DOM.registerEventWithObject(document.body,"mousemove",this,"_onMouseMove");
SimileAjax.DOM.registerEventWithObject(document.body,"mouseup",this,"_onMouseUp");
SimileAjax.DOM.registerEventWithObject(document.body,"mouseout",this,"_onMouseOut");
var L=this._theme!=null?this._theme.mouseWheel:"scroll";
if(L==="zoom"||L==="scroll"||this._zoomSteps){if(SimileAjax.Platform.browser.isFirefox){SimileAjax.DOM.registerEventWithObject(this._div,"DOMMouseScroll",this,"_onMouseScroll");
}else{SimileAjax.DOM.registerEventWithObject(this._div,"mousewheel",this,"_onMouseScroll");
}}this._innerDiv=this._timeline.getDocument().createElement("div");
this._innerDiv.className="timeline-band-inner";
this._div.appendChild(this._innerDiv);
this._ether=J.ether;
J.ether.initialize(this,K);
this._etherPainter=J.etherPainter;
J.etherPainter.initialize(this,K);
this._eventSource=J.eventSource;
if(this._eventSource){this._eventListener={onAddMany:function(){I._onAddMany();
},onClear:function(){I._onClear();
}};
this._eventSource.addListener(this._eventListener);
}this._eventPainter=J.eventPainter;
this._eventTracksNeeded=0;
this._eventTrackIncrement=0;
J.eventPainter.initialize(this,K);
this._decorators=("decorators" in J)?J.decorators:[];
for(var N=0;
N<this._decorators.length;
N++){this._decorators[N].initialize(this,K);
}this._supportsOrthogonalScrolling=("supportsOrthogonalScrolling" in this._eventPainter)&&this._eventPainter.supportsOrthogonalScrolling();
if(this._supportsOrthogonalScrolling){this._scrollBar=this._timeline.getDocument().createElement("div");
this._scrollBar.id="timeline-band-scrollbar-"+O;
this._scrollBar.className="timeline-band-scrollbar";
this._timeline.addDiv(this._scrollBar);
this._scrollBar.innerHTML='<div class="timeline-band-scrollbar-thumb"> </div>';
var P=this._scrollBar.firstChild;
if(SimileAjax.Platform.browser.isIE){P.style.cursor="move";
}else{P.style.cursor="-moz-grab";
}SimileAjax.DOM.registerEventWithObject(P,"mousedown",this,"_onScrollBarMouseDown");
}};
Timeline._Band.SCROLL_MULTIPLES=5;
Timeline._Band.prototype.dispose=function(){this.closeBubble();
if(this._eventSource){this._eventSource.removeListener(this._eventListener);
this._eventListener=null;
this._eventSource=null;
}this._timeline=null;
this._bandInfo=null;
this._labeller=null;
this._ether=null;
this._etherPainter=null;
this._eventPainter=null;
this._decorators=null;
this._onScrollListeners=null;
this._syncWithBandHandler=null;
this._syncWithBandOrthogonalScrollHandler=null;
this._selectorListener=null;
this._div=null;
this._innerDiv=null;
this._keyboardInput=null;
this._scrollBar=null;
};
Timeline._Band.prototype.addOnScrollListener=function(B){this._onScrollListeners.push(B);
};
Timeline._Band.prototype.removeOnScrollListener=function(D){for(var C=0;
C<this._onScrollListeners.length;
C++){if(this._onScrollListeners[C]==D){this._onScrollListeners.splice(C,1);
break;
}}};
Timeline._Band.prototype.addOnOrthogonalScrollListener=function(B){this._onOrthogonalScrollListeners.push(B);
};
Timeline._Band.prototype.removeOnOrthogonalScrollListener=function(D){for(var C=0;
C<this._onOrthogonalScrollListeners.length;
C++){if(this._onOrthogonalScrollListeners[C]==D){this._onOrthogonalScrollListeners.splice(C,1);
break;
}}};
Timeline._Band.prototype.setSyncWithBand=function(D,C){if(this._syncWithBand){this._syncWithBand.removeOnScrollListener(this._syncWithBandHandler);
this._syncWithBand.removeOnOrthogonalScrollListener(this._syncWithBandOrthogonalScrollHandler);
}this._syncWithBand=D;
this._syncWithBand.addOnScrollListener(this._syncWithBandHandler);
this._syncWithBand.addOnOrthogonalScrollListener(this._syncWithBandOrthogonalScrollHandler);
this._highlight=C;
this._positionHighlight();
};
Timeline._Band.prototype.getLocale=function(){return this._locale;
};
Timeline._Band.prototype.getTimeZone=function(){return this._timeZone;
};
Timeline._Band.prototype.getLabeller=function(){return this._labeller;
};
Timeline._Band.prototype.getIndex=function(){return this._index;
};
Timeline._Band.prototype.getEther=function(){return this._ether;
};
Timeline._Band.prototype.getEtherPainter=function(){return this._etherPainter;
};
Timeline._Band.prototype.getEventSource=function(){return this._eventSource;
};
Timeline._Band.prototype.getEventPainter=function(){return this._eventPainter;
};
Timeline._Band.prototype.getTimeline=function(){return this._timeline;
};
Timeline._Band.prototype.updateEventTrackInfo=function(D,C){this._eventTrackIncrement=C;
if(D>this._eventTracksNeeded){this._eventTracksNeeded=D;
}};
Timeline._Band.prototype.checkAutoWidth=function(){if(!this._timeline.autoWidth){return ;
}var E=this._eventPainter.getType()=="overview";
var G=E?this._theme.event.overviewTrack.autoWidthMargin:this._theme.event.track.autoWidthMargin;
var H=Math.ceil((this._eventTracksNeeded+G)*this._eventTrackIncrement);
H+=E?this._theme.event.overviewTrack.offset:this._theme.event.track.offset;
var F=this._bandInfo;
if(H!=F.width){F.width=H;
}};
Timeline._Band.prototype.layout=function(){this.paint();
};
Timeline._Band.prototype.paint=function(){this._etherPainter.paint();
this._paintDecorators();
this._paintEvents();
};
Timeline._Band.prototype.softLayout=function(){this.softPaint();
};
Timeline._Band.prototype.softPaint=function(){this._etherPainter.softPaint();
this._softPaintDecorators();
this._softPaintEvents();
};
Timeline._Band.prototype.setBandShiftAndWidth=function(E,F){var G=this._keyboardInput.parentNode;
var H=E+Math.floor(F/2);
if(this._timeline.isHorizontal()){this._div.style.top=E+"px";
this._div.style.height=F+"px";
G.style.top=H+"px";
G.style.left="-1em";
}else{this._div.style.left=E+"px";
this._div.style.width=F+"px";
G.style.left=H+"px";
G.style.top="-1em";
}};
Timeline._Band.prototype.getViewWidth=function(){if(this._timeline.isHorizontal()){return this._div.offsetHeight;
}else{return this._div.offsetWidth;
}};
Timeline._Band.prototype.setViewLength=function(B){this._viewLength=B;
this._recenterDiv();
this._onChanging();
};
Timeline._Band.prototype.getViewLength=function(){return this._viewLength;
};
Timeline._Band.prototype.getTotalViewLength=function(){return Timeline._Band.SCROLL_MULTIPLES*this._viewLength;
};
Timeline._Band.prototype.getViewOffset=function(){return this._viewOffset;
};
Timeline._Band.prototype.getMinDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset);
};
Timeline._Band.prototype.getMaxDate=function(){return this._ether.pixelOffsetToDate(this._viewOffset+Timeline._Band.SCROLL_MULTIPLES*this._viewLength);
};
Timeline._Band.prototype.getMinVisibleDate=function(){return this._ether.pixelOffsetToDate(0);
};
Timeline._Band.prototype.getMinVisibleDateAfterDelta=function(B){return this._ether.pixelOffsetToDate(B);
};
Timeline._Band.prototype.getMaxVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength);
};
Timeline._Band.prototype.getMaxVisibleDateAfterDelta=function(B){return this._ether.pixelOffsetToDate(this._viewLength+B);
};
Timeline._Band.prototype.getCenterVisibleDate=function(){return this._ether.pixelOffsetToDate(this._viewLength/2);
};
Timeline._Band.prototype.setMinVisibleDate=function(B){if(!this._changing){this._moveEther(Math.round(-this._ether.dateToPixelOffset(B)));
}};
Timeline._Band.prototype.setMaxVisibleDate=function(B){if(!this._changing){this._moveEther(Math.round(this._viewLength-this._ether.dateToPixelOffset(B)));
}};
Timeline._Band.prototype.setCenterVisibleDate=function(B){if(!this._changing){this._moveEther(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(B)));
}};
Timeline._Band.prototype.dateToPixelOffset=function(B){return this._ether.dateToPixelOffset(B)-this._viewOffset;
};
Timeline._Band.prototype.pixelOffsetToDate=function(B){return this._ether.pixelOffsetToDate(B+this._viewOffset);
};
Timeline._Band.prototype.getViewOrthogonalOffset=function(){return this._viewOrthogonalOffset;
};
Timeline._Band.prototype.setViewOrthogonalOffset=function(B){this._viewOrthogonalOffset=Math.max(0,B);
};
Timeline._Band.prototype.createLayerDiv=function(F,H){var G=this._timeline.getDocument().createElement("div");
G.className="timeline-band-layer"+(typeof H=="string"?(" "+H):"");
G.style.zIndex=F;
this._innerDiv.appendChild(G);
var E=this._timeline.getDocument().createElement("div");
E.className="timeline-band-layer-inner";
if(SimileAjax.Platform.browser.isIE){E.style.cursor="move";
}else{E.style.cursor="-moz-grab";
}G.appendChild(E);
return E;
};
Timeline._Band.prototype.removeLayerDiv=function(B){this._innerDiv.removeChild(B.parentNode);
};
Timeline._Band.prototype.scrollToCenter=function(F,E){var D=this._ether.dateToPixelOffset(F);
if(D<-this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(D+this._viewLength));
}else{if(D>3*this._viewLength/2){this.setCenterVisibleDate(this.pixelOffsetToDate(D-this._viewLength));
}}this._autoScroll(Math.round(this._viewLength/2-this._ether.dateToPixelOffset(F)),E);
};
Timeline._Band.prototype.showBubbleForEvent=function(E){var D=this.getEventSource().getEvent(E);
if(D){var F=this;
this.scrollToCenter(D.getStart(),function(){F._eventPainter.showBubble(D);
});
}};
Timeline._Band.prototype.zoom=function(H,G,I,K){if(!this._zoomSteps){return ;
}G+=this._viewOffset;
var J=this._ether.pixelOffsetToDate(G);
var L=this._ether.zoom(H);
this._etherPainter.zoom(L);
this._moveEther(Math.round(-this._ether.dateToPixelOffset(J)));
this._moveEther(G);
};
Timeline._Band.prototype._onMouseDown=function(F,D,E){if(!this._dragging){this.closeBubble();
this._dragging=true;
this._dragX=D.clientX;
this._dragY=D.clientY;
return this._cancelEvent(D);
}};
Timeline._Band.prototype._onMouseMove=function(K,H,I){if(this._dragging||this._orthogonalDragging){var L=H.clientX-this._dragX;
var N=H.clientY-this._dragY;
this._dragX=H.clientX;
this._dragY=H.clientY;
}if(this._dragging){if(this._timeline.isHorizontal()){this._moveEther(L,N);
}else{this._moveEther(N,L);
}}else{if(this._orthogonalDragging){var J=this.getViewWidth();
var M=this._scrollBar.firstChild;
if(this._timeline.isHorizontal()){this._moveEther(0,-N*J/M.offsetHeight);
}else{this._moveEther(0,-L*J/M.offsetWidth);
}}else{return ;
}}this._positionHighlight();
this._showScrollbar();
return this._cancelEvent(H);
};
Timeline._Band.prototype._onMouseUp=function(F,D,E){if(this._dragging){this._dragging=false;
}else{if(this._orthogonalDragging){this._orthogonalDragging=false;
}else{return ;
}}this._keyboardInput.focus();
this._bounceBack();
return this._cancelEvent(D);
};
Timeline._Band.prototype._onMouseOut=function(F,D,E){if(E==document.body){if(this._dragging){this._dragging=false;
}else{if(this._orthogonalDragging){this._orthogonalDragging=false;
}else{return ;
}}this._bounceBack();
return this._cancelEvent(D);
}};
Timeline._Band.prototype._onScrollBarMouseDown=function(F,D,E){if(!this._orthogonalDragging){this.closeBubble();
this._orthogonalDragging=true;
this._dragX=D.clientX;
this._dragY=D.clientY;
return this._cancelEvent(D);
}};
Timeline._Band.prototype._onMouseScroll=function(P,N,R){var M=new Date();
M=M.getTime();
if(!this._lastScrollTime||((M-this._lastScrollTime)>50)){this._lastScrollTime=M;
var O=0;
if(N.wheelDelta){O=N.wheelDelta/120;
}else{if(N.detail){O=-N.detail/3;
}}var Q=this._theme.mouseWheel;
if(this._zoomSteps||Q==="zoom"){var J=SimileAjax.DOM.getEventRelativeCoordinates(N,P);
if(O!=0){var K;
if(O>0){K=true;
}if(O<0){K=false;
}this._timeline.zoom(K,J.x,J.y,P);
}}else{if(Q==="scroll"){var L=50*(O<0?-1:1);
this._moveEther(L);
}}}if(N.stopPropagation){N.stopPropagation();
}N.cancelBubble=true;
if(N.preventDefault){N.preventDefault();
}N.returnValue=false;
};
Timeline._Band.prototype._onDblClick=function(J,F,H){var I=SimileAjax.DOM.getEventRelativeCoordinates(F,J);
var G=I.x-(this._viewLength/2-this._viewOffset);
this._autoScroll(-G);
};
Timeline._Band.prototype._onKeyDown=function(F,D,E){if(!this._dragging){switch(D.keyCode){case 27:break;
case 37:case 38:this._scrollSpeed=Math.min(50,Math.abs(this._scrollSpeed*1.05));
this._moveEther(this._scrollSpeed);
break;
case 39:case 40:this._scrollSpeed=-Math.min(50,Math.abs(this._scrollSpeed*1.05));
this._moveEther(this._scrollSpeed);
break;
default:return true;
}this.closeBubble();
SimileAjax.DOM.cancelEvent(D);
return false;
}return true;
};
Timeline._Band.prototype._onKeyUp=function(F,D,E){if(!this._dragging){this._scrollSpeed=this._originalScrollSpeed;
switch(D.keyCode){case 35:this.setCenterVisibleDate(this._eventSource.getLatestDate());
break;
case 36:this.setCenterVisibleDate(this._eventSource.getEarliestDate());
break;
case 33:this._autoScroll(this._timeline.getPixelLength());
break;
case 34:this._autoScroll(-this._timeline.getPixelLength());
break;
default:return true;
}this.closeBubble();
SimileAjax.DOM.cancelEvent(D);
return false;
}return true;
};
Timeline._Band.prototype._autoScroll=function(F,G){var E=this;
var H=SimileAjax.Graphics.createAnimation(function(B,A){E._moveEther(A);
},0,F,1000,G);
H.run();
};
Timeline._Band.prototype._moveEther=function(C,D){if(D===undefined){D=0;
}this.closeBubble();
if(!this._timeline.shiftOK(this._index,C)){return ;
}this._viewOffset+=C;
this._ether.shiftPixels(-C);
if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px";
}else{this._div.style.top=this._viewOffset+"px";
}if(this._supportsOrthogonalScrolling){if(this._eventPainter.getOrthogonalExtent()<=this.getViewWidth()){this._viewOrthogonalOffset=0;
}else{this._viewOrthogonalOffset=this._viewOrthogonalOffset+D;
}}if(this._viewOffset>-this._viewLength*0.5||this._viewOffset<-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1.5)){this._recenterDiv();
}else{this.softLayout();
}this._onChanging();
};
Timeline._Band.prototype._onChanging=function(){this._changing=true;
this._fireOnScroll();
this._setSyncWithBandDate();
this._changing=false;
};
Timeline._Band.prototype.busy=function(){return(this._changing);
};
Timeline._Band.prototype._fireOnScroll=function(){for(var B=0;
B<this._onScrollListeners.length;
B++){this._onScrollListeners[B](this);
}};
Timeline._Band.prototype._fireOnOrthogonalScroll=function(){for(var B=0;
B<this._onOrthogonalScrollListeners.length;
B++){this._onOrthogonalScrollListeners[B](this);
}};
Timeline._Band.prototype._setSyncWithBandDate=function(){if(this._syncWithBand){var B=this._ether.pixelOffsetToDate(this.getViewLength()/2);
this._syncWithBand.setCenterVisibleDate(B);
}};
Timeline._Band.prototype._onHighlightBandScroll=function(){if(this._syncWithBand){var C=this._syncWithBand.getCenterVisibleDate();
var D=this._ether.dateToPixelOffset(C);
this._moveEther(Math.round(this._viewLength/2-D));
this._positionHighlight();
}};
Timeline._Band.prototype._onHighlightBandOrthogonalScroll=function(){if(this._syncWithBand){this._positionHighlight();
}};
Timeline._Band.prototype._onAddMany=function(){this._paintEvents();
};
Timeline._Band.prototype._onClear=function(){this._paintEvents();
};
Timeline._Band.prototype._positionHighlight=function(){if(this._syncWithBand){var O=this._syncWithBand.getMinVisibleDate();
var K=this._syncWithBand.getMaxVisibleDate();
if(this._highlight){var J=0;
var L=1;
var P=this._syncWithBand.getEventPainter();
if("supportsOrthogonalScrolling" in P&&P.supportsOrthogonalScrolling()){var M=P.getOrthogonalExtent();
var N=this._syncWithBand.getViewWidth();
var I=Math.max(N,M);
L=N/I;
J=-this._syncWithBand.getViewOrthogonalOffset()/I;
}this._etherPainter.setHighlight(O,K,J,L);
}}};
Timeline._Band.prototype._recenterDiv=function(){this._viewOffset=-this._viewLength*(Timeline._Band.SCROLL_MULTIPLES-1)/2;
if(this._timeline.isHorizontal()){this._div.style.left=this._viewOffset+"px";
this._div.style.width=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px";
}else{this._div.style.top=this._viewOffset+"px";
this._div.style.height=(Timeline._Band.SCROLL_MULTIPLES*this._viewLength)+"px";
}this.layout();
};
Timeline._Band.prototype._paintEvents=function(){this._eventPainter.paint();
this._showScrollbar();
this._fireOnOrthogonalScroll();
};
Timeline._Band.prototype._softPaintEvents=function(){this._eventPainter.softPaint();
};
Timeline._Band.prototype._paintDecorators=function(){for(var B=0;
B<this._decorators.length;
B++){this._decorators[B].paint();
}};
Timeline._Band.prototype._softPaintDecorators=function(){for(var B=0;
B<this._decorators.length;
B++){this._decorators[B].softPaint();
}};
Timeline._Band.prototype.closeBubble=function(){SimileAjax.WindowManager.cancelPopups();
};
Timeline._Band.prototype._bounceBack=function(G){if(!this._supportsOrthogonalScrolling){return ;
}var F=0;
if(this._viewOrthogonalOffset<0){var H=this._eventPainter.getOrthogonalExtent();
if(this._viewOrthogonalOffset+H>=this.getViewWidth()){F=this._viewOrthogonalOffset;
}else{F=Math.min(0,this.getViewWidth()-H);
}}if(F!=this._viewOrthogonalOffset){var E=this;
SimileAjax.Graphics.createAnimation(function(B,A){E._viewOrthogonalOffset=B;
E._eventPainter.softPaint();
E._showScrollbar();
E._fireOnOrthogonalScroll();
},this._viewOrthogonalOffset,F,300,function(){E._hideScrollbar();
}).run();
}else{this._hideScrollbar();
}};
Timeline._Band.prototype._showScrollbar=function(){if(!this._supportsOrthogonalScrolling){return ;
}var M=this._eventPainter.getOrthogonalExtent();
var N=this.getViewWidth();
var P=Math.max(N,M);
var K=(N/P);
var L=Math.round(N*K)+"px";
var J=Math.round(-this._viewOrthogonalOffset*K)+"px";
var I=12;
var O=this._scrollBar.firstChild;
if(this._timeline.isHorizontal()){this._scrollBar.style.top=this._div.style.top;
this._scrollBar.style.height=this._div.style.height;
this._scrollBar.style.right="0px";
this._scrollBar.style.width=I+"px";
O.style.top=J;
O.style.height=L;
}else{this._scrollBar.style.left=this._div.style.left;
this._scrollBar.style.width=this._div.style.width;
this._scrollBar.style.bottom="0px";
this._scrollBar.style.height=I+"px";
O.style.left=J;
O.style.width=L;
}if(K>=1&&this._viewOrthogonalOffset==0){this._scrollBar.style.display="none";
}else{this._scrollBar.style.display="block";
}};
Timeline._Band.prototype._hideScrollbar=function(){if(!this._supportsOrthogonalScrolling){return ;
}};
Timeline._Band.prototype._cancelEvent=function(B){SimileAjax.DOM.cancelEvent(B);
return false;
};
Timeline.CompactEventPainter=function(B){this._params=B;
this._onSelectListeners=[];
this._filterMatcher=null;
this._highlightMatcher=null;
this._frc=null;
this._eventIdToElmt={};
};
Timeline.CompactEventPainter.prototype.getType=function(){return"compact";
};
Timeline.CompactEventPainter.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._backLayer=null;
this._eventLayer=null;
this._lineLayer=null;
this._highlightLayer=null;
this._eventIdToElmt=null;
};
Timeline.CompactEventPainter.prototype.supportsOrthogonalScrolling=function(){return true;
};
Timeline.CompactEventPainter.prototype.addOnSelectListener=function(B){this._onSelectListeners.push(B);
};
Timeline.CompactEventPainter.prototype.removeOnSelectListener=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){if(this._onSelectListeners[C]==D){this._onSelectListeners.splice(C,1);
break;
}}};
Timeline.CompactEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
};
Timeline.CompactEventPainter.prototype.setFilterMatcher=function(B){this._filterMatcher=B;
};
Timeline.CompactEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
};
Timeline.CompactEventPainter.prototype.setHighlightMatcher=function(B){this._highlightMatcher=B;
};
Timeline.CompactEventPainter.prototype.paint=function(){var S=this._band.getEventSource();
if(S==null){return ;
}this._eventIdToElmt={};
this._prepareForPainting();
var Y=this._computeMetrics();
var f=this._band.getMinDate();
var T=this._band.getMaxDate();
var V=(this._filterMatcher!=null)?this._filterMatcher:function(A){return true;
};
var Z=(this._highlightMatcher!=null)?this._highlightMatcher:function(A){return -1;
};
var c=S.getEventIterator(f,T);
var X="stackConcurrentPreciseInstantEvents" in this._params&&typeof this._params.stackConcurrentPreciseInstantEvents=="object";
var a="collapseConcurrentPreciseInstantEvents" in this._params&&this._params.collapseConcurrentPreciseInstantEvents;
if(a||X){var U=[];
var R=null;
while(c.hasNext()){var W=c.next();
if(V(W)){if(!W.isInstant()||W.isImprecise()){this.paintEvent(W,Y,this._params.theme,Z(W));
}else{if(R!=null&&R.getStart().getTime()==W.getStart().getTime()){U[U.length-1].push(W);
}else{U.push([W]);
R=W;
}}}}for(var e=0;
e<U.length;
e++){var b=U[e];
if(b.length==1){this.paintEvent(b[0],Y,this._params.theme,Z(W));
}else{var d=-1;
for(var Q=0;
d<0&&Q<b.length;
Q++){d=Z(b[Q]);
}if(X){this.paintStackedPreciseInstantEvents(b,Y,this._params.theme,d);
}else{this.paintCompositePreciseInstantEvents(b,Y,this._params.theme,d);
}}}}else{while(c.hasNext()){var W=c.next();
if(V(W)){this.paintEvent(W,Y,this._params.theme,Z(W));
}}}this._highlightLayer.style.display="block";
this._lineLayer.style.display="block";
this._eventLayer.style.display="block";
this._setOrthogonalOffset(Y);
};
Timeline.CompactEventPainter.prototype.softPaint=function(){this._setOrthogonalOffset(this._computeMetrics());
};
Timeline.CompactEventPainter.prototype.getOrthogonalExtent=function(){var B=this._computeMetrics();
return 2*B.trackOffset+this._tracks.length*B.trackHeight;
};
Timeline.CompactEventPainter.prototype._setOrthogonalOffset=function(C){var D=this._band.getViewOrthogonalOffset();
this._highlightLayer.style.top=this._lineLayer.style.top=this._eventLayer.style.top=D+"px";
};
Timeline.CompactEventPainter.prototype._computeMetrics=function(){var F=this._params.theme;
var E=F.event;
var D={trackOffset:"trackOffset" in this._params?this._params.trackOffset:10,trackHeight:"trackHeight" in this._params?this._params.trackHeight:10,tapeHeight:F.event.tape.height,tapeBottomMargin:"tapeBottomMargin" in this._params?this._params.tapeBottomMargin:2,labelBottomMargin:"labelBottomMargin" in this._params?this._params.labelBottomMargin:5,labelRightMargin:"labelRightMargin" in this._params?this._params.labelRightMargin:5,defaultIcon:E.instant.icon,defaultIconWidth:E.instant.iconWidth,defaultIconHeight:E.instant.iconHeight,customIconWidth:"iconWidth" in this._params?this._params.iconWidth:E.instant.iconWidth,customIconHeight:"iconHeight" in this._params?this._params.iconHeight:E.instant.iconHeight,iconLabelGap:"iconLabelGap" in this._params?this._params.iconLabelGap:2,iconBottomMargin:"iconBottomMargin" in this._params?this._params.iconBottomMargin:2};
if("compositeIcon" in this._params){D.compositeIcon=this._params.compositeIcon;
D.compositeIconWidth=this._params.compositeIconWidth||D.customIconWidth;
D.compositeIconHeight=this._params.compositeIconHeight||D.customIconHeight;
}else{D.compositeIcon=D.defaultIcon;
D.compositeIconWidth=D.defaultIconWidth;
D.compositeIconHeight=D.defaultIconHeight;
}D.defaultStackIcon=("stackConcurrentPreciseInstantEvents" in this._params&&"icon" in this._params.stackConcurrentPreciseInstantEvents)?this._params.stackConcurrentPreciseInstantEvents.icon:D.defaultIcon;
D.defaultStackIconWidth=("stackConcurrentPreciseInstantEvents" in this._params&&"iconWidth" in this._params.stackConcurrentPreciseInstantEvents)?this._params.stackConcurrentPreciseInstantEvents.iconWidth:D.defaultIconWidth;
D.defaultStackIconHeight=("stackConcurrentPreciseInstantEvents" in this._params&&"iconHeight" in this._params.stackConcurrentPreciseInstantEvents)?this._params.stackConcurrentPreciseInstantEvents.iconHeight:D.defaultIconHeight;
return D;
};
Timeline.CompactEventPainter.prototype._prepareForPainting=function(){var D=this._band;
if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
this._backLayer.style.visibility="hidden";
var C=document.createElement("span");
C.className="timeline-event-label";
this._backLayer.appendChild(C);
this._frc=SimileAjax.Graphics.getFontRenderingContext(C);
}this._frc.update();
this._tracks=[];
if(this._highlightLayer!=null){D.removeLayerDiv(this._highlightLayer);
}this._highlightLayer=D.createLayerDiv(105,"timeline-band-highlights");
this._highlightLayer.style.display="none";
if(this._lineLayer!=null){D.removeLayerDiv(this._lineLayer);
}this._lineLayer=D.createLayerDiv(110,"timeline-band-lines");
this._lineLayer.style.display="none";
if(this._eventLayer!=null){D.removeLayerDiv(this._eventLayer);
}this._eventLayer=D.createLayerDiv(115,"timeline-band-events");
this._eventLayer.style.display="none";
};
Timeline.CompactEventPainter.prototype.paintEvent=function(H,G,F,E){if(H.isInstant()){this.paintInstantEvent(H,G,F,E);
}else{this.paintDurationEvent(H,G,F,E);
}};
Timeline.CompactEventPainter.prototype.paintInstantEvent=function(H,G,F,E){if(H.isImprecise()){this.paintImpreciseInstantEvent(H,G,F,E);
}else{this.paintPreciseInstantEvent(H,G,F,E);
}};
Timeline.CompactEventPainter.prototype.paintDurationEvent=function(H,G,F,E){if(H.isImprecise()){this.paintImpreciseDurationEvent(H,G,F,E);
}else{this.paintPreciseDurationEvent(H,G,F,E);
}};
Timeline.CompactEventPainter.prototype.paintPreciseInstantEvent=function(Q,S,L,M){var K={tooltip:Q.getProperty("tooltip")||Q.getText()};
var N={url:Q.getIcon()};
if(N.url==null){N.url=S.defaultIcon;
N.width=S.defaultIconWidth;
N.height=S.defaultIconHeight;
N.className="timeline-event-icon-default";
}else{N.width=Q.getProperty("iconWidth")||S.customIconWidth;
N.height=Q.getProperty("iconHeight")||S.customIconHeight;
}var R={text:Q.getText(),color:Q.getTextColor()||Q.getColor(),className:Q.getClassName()};
var O=this.paintTapeIconLabel(Q.getStart(),K,null,N,R,S,L,M);
var P=this;
var T=function(B,A,C){return P._onClickInstantEvent(O.iconElmtData.elmt,A,Q);
};
SimileAjax.DOM.registerEvent(O.iconElmtData.elmt,"mousedown",T);
SimileAjax.DOM.registerEvent(O.labelElmtData.elmt,"mousedown",T);
this._eventIdToElmt[Q.getID()]=O.iconElmtData.elmt;
};
Timeline.CompactEventPainter.prototype.paintCompositePreciseInstantEvents=function(S,W,O,P){var U=S[0];
var X=[];
for(var N=0;
N<S.length;
N++){X.push(S[N].getProperty("tooltip")||S[N].getText());
}var Z={tooltip:X.join("; ")};
var Q={url:W.compositeIcon,width:W.compositeIconWidth,height:W.compositeIconHeight,className:"timeline-event-icon-composite"};
var V={text:String.substitute(this._params.compositeEventLabelTemplate,[S.length])};
var R=this.paintTapeIconLabel(U.getStart(),Z,null,Q,V,W,O,P);
var T=this;
var Y=function(C,B,A){return T._onClickMultiplePreciseInstantEvent(R.iconElmtData.elmt,B,S);
};
SimileAjax.DOM.registerEvent(R.iconElmtData.elmt,"mousedown",Y);
SimileAjax.DOM.registerEvent(R.labelElmtData.elmt,"mousedown",Y);
for(var N=0;
N<S.length;
N++){this._eventIdToElmt[S[N].getID()]=R.iconElmtData.elmt;
}};
Timeline.CompactEventPainter.prototype.paintStackedPreciseInstantEvents=function(s,AW,Ae,AL){var x="limit" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.limit:10;
var AH="moreMessageTemplate" in this._params.stackConcurrentPreciseInstantEvents?this._params.stackConcurrentPreciseInstantEvents.moreMessageTemplate:"%0 More Events";
var AA=x<=s.length-2;
var AN=this._band;
var Ab=function(A){return Math.round(AN.dateToPixelOffset(A));
};
var AC=function(A){var B={url:A.getIcon()};
if(B.url==null){B.url=AW.defaultStackIcon;
B.width=AW.defaultStackIconWidth;
B.height=AW.defaultStackIconHeight;
B.className="timeline-event-icon-stack timeline-event-icon-default";
}else{B.width=A.getProperty("iconWidth")||AW.customIconWidth;
B.height=A.getProperty("iconHeight")||AW.customIconHeight;
B.className="timeline-event-icon-stack";
}return B;
};
var AJ=AC(s[0]);
var u=5;
var AK=0;
var AF=0;
var AQ=0;
var t=0;
var AU=[];
for(var AR=0;
AR<s.length&&(!AA||AR<x);
AR++){var Af=s[AR];
var i=Af.getText();
var v=AC(Af);
var w=this._frc.computeSize(i);
var AZ={text:i,iconData:v,labelSize:w,iconLeft:AJ.width+AR*u-v.width};
AZ.labelLeft=AJ.width+AR*u+AW.iconLabelGap;
AZ.top=AQ;
AU.push(AZ);
AK=Math.min(AK,AZ.iconLeft);
AQ+=w.height;
AF=Math.max(AF,AZ.labelLeft+w.width);
t=Math.max(t,AZ.top+v.height);
}if(AA){var AE=String.substitute(AH,[s.length-x]);
var AV=this._frc.computeSize(AE);
var AY=AJ.width+(x-1)*u+AW.iconLabelGap;
var AS=AQ;
AQ+=AV.height;
AF=Math.max(AF,AY+AV.width);
}AF+=AW.labelRightMargin;
AQ+=AW.labelBottomMargin;
t+=AW.iconBottomMargin;
var AT=Ab(s[0].getStart());
var y=[];
var AD=Math.ceil(Math.max(t,AQ)/AW.trackHeight);
var Ac=AJ.width+(s.length-1)*u;
for(var AR=0;
AR<AD;
AR++){y.push({start:AK,end:Ac});
}var Aa=Math.ceil(AQ/AW.trackHeight);
for(var AR=0;
AR<Aa;
AR++){var AB=y[AR];
AB.end=Math.max(AB.end,AF);
}var AI=this._fitTracks(AT,y);
var r=AI*AW.trackHeight+AW.trackOffset;
var AP=this._timeline.getDocument().createElement("div");
AP.className="timeline-event-icon-stack";
AP.style.position="absolute";
AP.style.overflow="visible";
AP.style.left=AT+"px";
AP.style.top=r+"px";
AP.style.width=Ac+"px";
AP.style.height=t+"px";
AP.innerHTML="<div style='position: relative'></div>";
this._eventLayer.appendChild(AP);
var AG=this;
var z=function(E){try{var A=parseInt(this.getAttribute("index"));
var C=AP.firstChild.childNodes;
for(var F=0;
F<C.length;
F++){var B=C[F];
if(F==A){B.style.zIndex=C.length;
}else{B.style.zIndex=C.length-F;
}}}catch(D){}};
var Ad=function(C){var H=AU[C];
var F=s[C];
var B=F.getProperty("tooltip")||F.getText();
var D=AG._paintEventLabel({tooltip:B},{text:H.text},AT+H.labelLeft,r+H.top,H.labelSize.width,H.labelSize.height,Ae);
D.elmt.setAttribute("index",C);
D.elmt.onmouseover=z;
var E=SimileAjax.Graphics.createTranslucentImage(H.iconData.url);
var G=AG._timeline.getDocument().createElement("div");
G.className="timeline-event-icon"+("className" in H.iconData?(" "+H.iconData.className):"");
G.style.left=H.iconLeft+"px";
G.style.top=H.top+"px";
G.style.zIndex=(AU.length-C);
G.appendChild(E);
G.setAttribute("index",C);
G.onmouseover=z;
AP.firstChild.appendChild(G);
var A=function(K,J,I){return AG._onClickInstantEvent(D.elmt,J,F);
};
SimileAjax.DOM.registerEvent(G,"mousedown",A);
SimileAjax.DOM.registerEvent(D.elmt,"mousedown",A);
AG._eventIdToElmt[F.getID()]=G;
};
for(var AR=0;
AR<AU.length;
AR++){Ad(AR);
}if(AA){var AM=s.slice(x);
var AO=this._paintEventLabel({tooltip:AE},{text:AE},AT+AY,r+AS,AV.width,AV.height,Ae);
var AX=function(A,C,B){return AG._onClickMultiplePreciseInstantEvent(AO.elmt,C,AM);
};
SimileAjax.DOM.registerEvent(AO.elmt,"mousedown",AX);
for(var AR=0;
AR<AM.length;
AR++){this._eventIdToElmt[AM[AR].getID()]=AO.elmt;
}}};
Timeline.CompactEventPainter.prototype.paintImpreciseInstantEvent=function(R,T,L,M){var V={tooltip:R.getProperty("tooltip")||R.getText()};
var O={start:R.getStart(),end:R.getEnd(),latestStart:R.getLatestStart(),earliestEnd:R.getEarliestEnd(),color:R.getColor()||R.getTextColor(),isInstant:true};
var N={url:R.getIcon()};
if(N.url==null){N=null;
}else{N.width=R.getProperty("iconWidth")||T.customIconWidth;
N.height=R.getProperty("iconHeight")||T.customIconHeight;
}var S={text:R.getText(),color:R.getTextColor()||R.getColor(),className:R.getClassName()};
var P=this.paintTapeIconLabel(R.getStart(),V,O,N,S,T,L,M);
var Q=this;
var U=N!=null?function(A,C,B){return Q._onClickInstantEvent(P.iconElmtData.elmt,C,R);
}:function(A,C,B){return Q._onClickInstantEvent(P.labelElmtData.elmt,C,R);
};
SimileAjax.DOM.registerEvent(P.labelElmtData.elmt,"mousedown",U);
SimileAjax.DOM.registerEvent(P.impreciseTapeElmtData.elmt,"mousedown",U);
if(N!=null){SimileAjax.DOM.registerEvent(P.iconElmtData.elmt,"mousedown",U);
this._eventIdToElmt[R.getID()]=P.iconElmtData.elmt;
}else{this._eventIdToElmt[R.getID()]=P.labelElmtData.elmt;
}};
Timeline.CompactEventPainter.prototype.paintPreciseDurationEvent=function(R,T,L,M){var V={tooltip:R.getProperty("tooltip")||R.getText()};
var O={start:R.getStart(),end:R.getEnd(),color:R.getColor()||R.getTextColor(),isInstant:false};
var N={url:R.getIcon()};
if(N.url==null){N=null;
}else{N.width=R.getProperty("iconWidth")||T.customIconWidth;
N.height=R.getProperty("iconHeight")||T.customIconHeight;
}var S={text:R.getText(),color:R.getTextColor()||R.getColor(),className:R.getClassName()};
var P=this.paintTapeIconLabel(R.getLatestStart(),V,O,N,S,T,L,M);
var Q=this;
var U=N!=null?function(A,C,B){return Q._onClickInstantEvent(P.iconElmtData.elmt,C,R);
}:function(A,C,B){return Q._onClickInstantEvent(P.labelElmtData.elmt,C,R);
};
SimileAjax.DOM.registerEvent(P.labelElmtData.elmt,"mousedown",U);
SimileAjax.DOM.registerEvent(P.tapeElmtData.elmt,"mousedown",U);
if(N!=null){SimileAjax.DOM.registerEvent(P.iconElmtData.elmt,"mousedown",U);
this._eventIdToElmt[R.getID()]=P.iconElmtData.elmt;
}else{this._eventIdToElmt[R.getID()]=P.labelElmtData.elmt;
}};
Timeline.CompactEventPainter.prototype.paintImpreciseDurationEvent=function(R,T,L,M){var V={tooltip:R.getProperty("tooltip")||R.getText()};
var O={start:R.getStart(),end:R.getEnd(),latestStart:R.getLatestStart(),earliestEnd:R.getEarliestEnd(),color:R.getColor()||R.getTextColor(),isInstant:false};
var N={url:R.getIcon()};
if(N.url==null){N=null;
}else{N.width=R.getProperty("iconWidth")||T.customIconWidth;
N.height=R.getProperty("iconHeight")||T.customIconHeight;
}var S={text:R.getText(),color:R.getTextColor()||R.getColor(),className:R.getClassName()};
var P=this.paintTapeIconLabel(R.getLatestStart(),V,O,N,S,T,L,M);
var Q=this;
var U=N!=null?function(A,C,B){return Q._onClickInstantEvent(P.iconElmtData.elmt,C,R);
}:function(A,C,B){return Q._onClickInstantEvent(P.labelElmtData.elmt,C,R);
};
SimileAjax.DOM.registerEvent(P.labelElmtData.elmt,"mousedown",U);
SimileAjax.DOM.registerEvent(P.tapeElmtData.elmt,"mousedown",U);
if(N!=null){SimileAjax.DOM.registerEvent(P.iconElmtData.elmt,"mousedown",U);
this._eventIdToElmt[R.getID()]=P.iconElmtData.elmt;
}else{this._eventIdToElmt[R.getID()]=P.labelElmtData.elmt;
}};
Timeline.CompactEventPainter.prototype.paintTapeIconLabel=function(AH,r,AE,z,g,i,AF,f){var m=this._band;
var t=function(A){return Math.round(m.dateToPixelOffset(A));
};
var l=t(AH);
var AG=[];
var e=0;
var p=0;
var q=0;
if(AE!=null){e=i.tapeHeight+i.tapeBottomMargin;
p=Math.ceil(i.tapeHeight/i.trackHeight);
var AD=t(AE.end)-l;
var AA=t(AE.start)-l;
for(var n=0;
n<p;
n++){AG.push({start:AA,end:AD});
}q=i.trackHeight-(e%i.tapeHeight);
}var AC=0;
var j=0;
if(z!=null){if("iconAlign" in z&&z.iconAlign=="center"){AC=-Math.floor(z.width/2);
}j=AC+z.width+i.iconLabelGap;
if(p>0){AG[p-1].end=Math.max(AG[p-1].end,j);
}var u=z.height+i.iconBottomMargin+q;
while(u>0){AG.push({start:AC,end:j});
u-=i.trackHeight;
}}var o=g.text;
var x=this._frc.computeSize(o);
var AB=x.height+i.labelBottomMargin+q;
var y=j+x.width+i.labelRightMargin;
if(p>0){AG[p-1].end=Math.max(AG[p-1].end,y);
}for(var h=0;
AB>0;
h++){if(p+h<AG.length){var k=AG[p+h];
k.end=y;
}else{AG.push({start:0,end:y});
}AB-=i.trackHeight;
}var v=this._fitTracks(l,AG);
var w=v*i.trackHeight+i.trackOffset;
var s={};
s.labelElmtData=this._paintEventLabel(r,g,l+j,w+e,x.width,x.height,AF);
if(AE!=null){if("latestStart" in AE||"earliestEnd" in AE){s.impreciseTapeElmtData=this._paintEventTape(r,AE,i.tapeHeight,w,t(AE.start),t(AE.end),AF.event.duration.impreciseColor,AF.event.duration.impreciseOpacity,i,AF);
}if(!AE.isInstant&&"start" in AE&&"end" in AE){s.tapeElmtData=this._paintEventTape(r,AE,i.tapeHeight,w,l,t("earliestEnd" in AE?AE.earliestEnd:AE.end),AE.color,100,i,AF);
}}if(z!=null){s.iconElmtData=this._paintEventIcon(r,z,w+e,l+AC,i,AF);
}return s;
};
Timeline.CompactEventPainter.prototype._fitTracks=function(I,L){var J;
for(J=0;
J<this._tracks.length;
J++){var M=true;
for(var O=0;
O<L.length&&(J+O)<this._tracks.length;
O++){var K=this._tracks[J+O];
var P=L[O];
if(I+P.start<K){M=false;
break;
}}if(M){break;
}}for(var N=0;
N<L.length;
N++){this._tracks[J+N]=I+L[N].end;
}return J;
};
Timeline.CompactEventPainter.prototype._paintEventIcon=function(O,N,J,K,M,L){var P=SimileAjax.Graphics.createTranslucentImage(N.url);
var I=this._timeline.getDocument().createElement("div");
I.className="timeline-event-icon"+("className" in N?(" "+N.className):"");
I.style.left=K+"px";
I.style.top=J+"px";
I.appendChild(P);
if("tooltip" in O&&typeof O.tooltip=="string"){I.title=O.tooltip;
}this._eventLayer.appendChild(I);
return{left:K,top:J,width:M.iconWidth,height:M.iconHeight,elmt:I};
};
Timeline.CompactEventPainter.prototype._paintEventLabel=function(J,P,L,Q,M,N,K){var O=this._timeline.getDocument();
var R=O.createElement("div");
R.className="timeline-event-label";
R.style.left=L+"px";
R.style.width=(M+1)+"px";
R.style.top=Q+"px";
R.innerHTML=P.text;
if("tooltip" in J&&typeof J.tooltip=="string"){R.title=J.tooltip;
}if("color" in P&&typeof P.color=="string"){R.style.color=P.color;
}if("className" in P&&typeof P.className=="string"){R.className+=" "+P.className;
}this._eventLayer.appendChild(R);
return{left:L,top:Q,width:M,height:N,elmt:R};
};
Timeline.CompactEventPainter.prototype._paintEventTape=function(V,O,Q,S,W,P,M,U,T,X){var N=P-W;
var R=this._timeline.getDocument().createElement("div");
R.className="timeline-event-tape";
R.style.left=W+"px";
R.style.top=S+"px";
R.style.width=N+"px";
R.style.height=Q+"px";
if("tooltip" in V&&typeof V.tooltip=="string"){R.title=V.tooltip;
}if(M!=null&&typeof O.color=="string"){R.style.backgroundColor=M;
}if("backgroundImage" in O&&typeof O.backgroundImage=="string"){R.style.backgroundImage="url("+backgroundImage+")";
R.style.backgroundRepeat=("backgroundRepeat" in O&&typeof O.backgroundRepeat=="string")?O.backgroundRepeat:"repeat";
}SimileAjax.Graphics.setOpacity(R,U);
if("className" in O&&typeof O.className=="string"){R.className+=" "+O.className;
}this._eventLayer.appendChild(R);
return{left:W,top:S,width:N,height:Q,elmt:R};
};
Timeline.CompactEventPainter.prototype._createHighlightDiv=function(H,M,K){if(H>=0){var L=this._timeline.getDocument();
var I=K.event;
var N=I.highlightColors[Math.min(H,I.highlightColors.length-1)];
var J=L.createElement("div");
J.style.position="absolute";
J.style.overflow="hidden";
J.style.left=(M.left-2)+"px";
J.style.width=(M.width+4)+"px";
J.style.top=(M.top-2)+"px";
J.style.height=(M.height+4)+"px";
this._highlightLayer.appendChild(J);
}};
Timeline.CompactEventPainter.prototype._onClickMultiplePreciseInstantEvent=function(J,I,L){var H=SimileAjax.DOM.getPageCoordinates(J);
this._showBubble(H.left+Math.ceil(J.offsetWidth/2),H.top+Math.ceil(J.offsetHeight/2),L);
var K=[];
for(var G=0;
G<L.length;
G++){K.push(L[G].getID());
}this._fireOnSelect(K);
I.cancelBubble=true;
SimileAjax.DOM.cancelEvent(I);
return false;
};
Timeline.CompactEventPainter.prototype._onClickInstantEvent=function(H,G,E){var F=SimileAjax.DOM.getPageCoordinates(H);
this._showBubble(F.left+Math.ceil(H.offsetWidth/2),F.top+Math.ceil(H.offsetHeight/2),[E]);
this._fireOnSelect([E.getID()]);
G.cancelBubble=true;
SimileAjax.DOM.cancelEvent(G);
return false;
};
Timeline.CompactEventPainter.prototype._onClickDurationEvent=function(J,K,L){if("pageX" in K){var G=K.pageX;
var H=K.pageY;
}else{var I=SimileAjax.DOM.getPageCoordinates(J);
var G=K.offsetX+I.left;
var H=K.offsetY+I.top;
}this._showBubble(G,H,[L]);
this._fireOnSelect([L.getID()]);
K.cancelBubble=true;
SimileAjax.DOM.cancelEvent(K);
return false;
};
Timeline.CompactEventPainter.prototype.showBubble=function(D){var F=this._eventIdToElmt[D.getID()];
if(F){var E=SimileAjax.DOM.getPageCoordinates(F);
this._showBubble(E.left+F.offsetWidth/2,E.top+F.offsetHeight/2,[D]);
}};
Timeline.CompactEventPainter.prototype._showBubble=function(G,H,L){var I=document.createElement("div");
L=("fillInfoBubble" in L)?[L]:L;
for(var J=0;
J<L.length;
J++){var K=document.createElement("div");
I.appendChild(K);
L[J].fillInfoBubble(K,this._params.theme,this._band.getLabeller());
}SimileAjax.WindowManager.cancelPopups();
SimileAjax.Graphics.createBubbleForContentAndPoint(I,G,H,this._params.theme.event.bubble.width);
};
Timeline.CompactEventPainter.prototype._fireOnSelect=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){this._onSelectListeners[C](D);
}};
Timeline.SpanHighlightDecorator=function(B){this._unit=B.unit!=null?B.unit:SimileAjax.NativeDateUnit;
this._startDate=(typeof B.startDate=="string")?this._unit.parseFromObject(B.startDate):B.startDate;
this._endDate=(typeof B.endDate=="string")?this._unit.parseFromObject(B.endDate):B.endDate;
this._startLabel=B.startLabel!=null?B.startLabel:"";
this._endLabel=B.endLabel!=null?B.endLabel:"";
this._color=B.color;
this._cssClass=B.cssClass!=null?B.cssClass:null;
this._opacity=B.opacity!=null?B.opacity:100;
this._zIndex=(B.inFront!=null&&B.inFront)?113:10;
};
Timeline.SpanHighlightDecorator.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._layerDiv=null;
};
Timeline.SpanHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv);
}this._layerDiv=this._band.createLayerDiv(this._zIndex);
this._layerDiv.setAttribute("name","span-highlight-decorator");
this._layerDiv.style.display="none";
var U=this._band.getMinDate();
var M=this._band.getMaxDate();
if(this._unit.compare(this._startDate,M)<0&&this._unit.compare(this._endDate,U)>0){U=this._unit.later(U,this._startDate);
M=this._unit.earlier(M,this._endDate);
var L=this._band.dateToPixelOffset(U);
var P=this._band.dateToPixelOffset(M);
var R=this._timeline.getDocument();
var S=function(){var A=R.createElement("table");
A.insertRow(0).insertCell(0);
return A;
};
var N=R.createElement("div");
N.className="timeline-highlight-decorator";
if(this._cssClass){N.className+=" "+this._cssClass;
}if(this._color!=null){N.style.backgroundColor=this._color;
}if(this._opacity<100){SimileAjax.Graphics.setOpacity(N,this._opacity);
}this._layerDiv.appendChild(N);
var Q=S();
Q.className="timeline-highlight-label timeline-highlight-label-start";
var T=Q.rows[0].cells[0];
T.innerHTML=this._startLabel;
if(this._cssClass){T.className="label_"+this._cssClass;
}this._layerDiv.appendChild(Q);
var O=S();
O.className="timeline-highlight-label timeline-highlight-label-end";
var V=O.rows[0].cells[0];
V.innerHTML=this._endLabel;
if(this._cssClass){V.className="label_"+this._cssClass;
}this._layerDiv.appendChild(O);
if(this._timeline.isHorizontal()){N.style.left=L+"px";
N.style.width=(P-L)+"px";
Q.style.right=(this._band.getTotalViewLength()-L)+"px";
Q.style.width=(this._startLabel.length)+"em";
O.style.left=P+"px";
O.style.width=(this._endLabel.length)+"em";
}else{N.style.top=L+"px";
N.style.height=(P-L)+"px";
Q.style.bottom=L+"px";
Q.style.height="1.5px";
O.style.top=P+"px";
O.style.height="1.5px";
}}this._layerDiv.style.display="block";
};
Timeline.SpanHighlightDecorator.prototype.softPaint=function(){};
Timeline.PointHighlightDecorator=function(B){this._unit=B.unit!=null?B.unit:SimileAjax.NativeDateUnit;
this._date=(typeof B.date=="string")?this._unit.parseFromObject(B.date):B.date;
this._width=B.width!=null?B.width:10;
this._color=B.color;
this._cssClass=B.cssClass!=null?B.cssClass:"";
this._opacity=B.opacity!=null?B.opacity:100;
};
Timeline.PointHighlightDecorator.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._layerDiv=null;
};
Timeline.PointHighlightDecorator.prototype.paint=function(){if(this._layerDiv!=null){this._band.removeLayerDiv(this._layerDiv);
}this._layerDiv=this._band.createLayerDiv(10);
this._layerDiv.setAttribute("name","span-highlight-decorator");
this._layerDiv.style.display="none";
var K=this._band.getMinDate();
var I=this._band.getMaxDate();
if(this._unit.compare(this._date,I)<0&&this._unit.compare(this._date,K)>0){var L=this._band.dateToPixelOffset(this._date);
var G=L-Math.round(this._width/2);
var J=this._timeline.getDocument();
var H=J.createElement("div");
H.className="timeline-highlight-point-decorator";
H.className+=" "+this._cssClass;
if(this._color!=null){H.style.backgroundColor=this._color;
}if(this._opacity<100){SimileAjax.Graphics.setOpacity(H,this._opacity);
}this._layerDiv.appendChild(H);
if(this._timeline.isHorizontal()){H.style.left=G+"px";
H.style.width=this._width+"px";
}else{H.style.top=G+"px";
H.style.height=this._width+"px";
}}this._layerDiv.style.display="block";
};
Timeline.PointHighlightDecorator.prototype.softPaint=function(){};
Timeline.DetailedEventPainter=function(B){this._params=B;
this._onSelectListeners=[];
this._filterMatcher=null;
this._highlightMatcher=null;
this._frc=null;
this._eventIdToElmt={};
};
Timeline.DetailedEventPainter.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._backLayer=null;
this._eventLayer=null;
this._lineLayer=null;
this._highlightLayer=null;
this._eventIdToElmt=null;
};
Timeline.DetailedEventPainter.prototype.getType=function(){return"detailed";
};
Timeline.DetailedEventPainter.prototype.addOnSelectListener=function(B){this._onSelectListeners.push(B);
};
Timeline.DetailedEventPainter.prototype.removeOnSelectListener=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){if(this._onSelectListeners[C]==D){this._onSelectListeners.splice(C,1);
break;
}}};
Timeline.DetailedEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
};
Timeline.DetailedEventPainter.prototype.setFilterMatcher=function(B){this._filterMatcher=B;
};
Timeline.DetailedEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
};
Timeline.DetailedEventPainter.prototype.setHighlightMatcher=function(B){this._highlightMatcher=B;
};
Timeline.DetailedEventPainter.prototype.paint=function(){var M=this._band.getEventSource();
if(M==null){return ;
}this._eventIdToElmt={};
this._prepareForPainting();
var P=this._params.theme.event;
var R=Math.max(P.track.height,this._frc.getLineHeight());
var S={trackOffset:Math.round(this._band.getViewWidth()/2-R/2),trackHeight:R,trackGap:P.track.gap,trackIncrement:R+P.track.gap,icon:P.instant.icon,iconWidth:P.instant.iconWidth,iconHeight:P.instant.iconHeight,labelWidth:P.label.width};
var L=this._band.getMinDate();
var N=this._band.getMaxDate();
var O=(this._filterMatcher!=null)?this._filterMatcher:function(A){return true;
};
var T=(this._highlightMatcher!=null)?this._highlightMatcher:function(A){return -1;
};
var K=M.getEventReverseIterator(L,N);
while(K.hasNext()){var Q=K.next();
if(O(Q)){this.paintEvent(Q,S,this._params.theme,T(Q));
}}this._highlightLayer.style.display="block";
this._lineLayer.style.display="block";
this._eventLayer.style.display="block";
this._band.updateEventTrackInfo(this._lowerTracks.length+this._upperTracks.length,S.trackIncrement);
};
Timeline.DetailedEventPainter.prototype.softPaint=function(){};
Timeline.DetailedEventPainter.prototype._prepareForPainting=function(){var D=this._band;
if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
this._backLayer.style.visibility="hidden";
var C=document.createElement("span");
C.className="timeline-event-label";
this._backLayer.appendChild(C);
this._frc=SimileAjax.Graphics.getFontRenderingContext(C);
}this._frc.update();
this._lowerTracks=[];
this._upperTracks=[];
if(this._highlightLayer!=null){D.removeLayerDiv(this._highlightLayer);
}this._highlightLayer=D.createLayerDiv(105,"timeline-band-highlights");
this._highlightLayer.style.display="none";
if(this._lineLayer!=null){D.removeLayerDiv(this._lineLayer);
}this._lineLayer=D.createLayerDiv(110,"timeline-band-lines");
this._lineLayer.style.display="none";
if(this._eventLayer!=null){D.removeLayerDiv(this._eventLayer);
}this._eventLayer=D.createLayerDiv(110,"timeline-band-events");
this._eventLayer.style.display="none";
};
Timeline.DetailedEventPainter.prototype.paintEvent=function(H,G,F,E){if(H.isInstant()){this.paintInstantEvent(H,G,F,E);
}else{this.paintDurationEvent(H,G,F,E);
}};
Timeline.DetailedEventPainter.prototype.paintInstantEvent=function(H,G,F,E){if(H.isImprecise()){this.paintImpreciseInstantEvent(H,G,F,E);
}else{this.paintPreciseInstantEvent(H,G,F,E);
}};
Timeline.DetailedEventPainter.prototype.paintDurationEvent=function(H,G,F,E){if(H.isImprecise()){this.paintImpreciseDurationEvent(H,G,F,E);
}else{this.paintPreciseDurationEvent(H,G,F,E);
}};
Timeline.DetailedEventPainter.prototype.paintPreciseInstantEvent=function(d,a,X,Z){var V=this._timeline.getDocument();
var e=d.getText();
var j=d.getStart();
var l=Math.round(this._band.dateToPixelOffset(j));
var n=Math.round(l+a.iconWidth/2);
var f=Math.round(l-a.iconWidth/2);
var h=this._frc.computeSize(e);
var k=this._findFreeTrackForSolid(n,l);
var m=this._paintEventIcon(d,k,f,a,X);
var U=n+X.event.label.offsetFromLine;
var Y=k;
var i=this._getTrackData(k);
if(Math.min(i.solid,i.text)>=U+h.width){i.solid=f;
i.text=U;
}else{i.solid=f;
U=l+X.event.label.offsetFromLine;
Y=this._findFreeTrackForText(k,U+h.width,function(A){A.line=l-2;
});
this._getTrackData(Y).text=f;
this._paintEventLine(d,l,k,Y,a,X);
}var W=Math.round(a.trackOffset+Y*a.trackIncrement+a.trackHeight/2-h.height/2);
var b=this._paintEventLabel(d,e,U,W,h.width,h.height,X);
var c=this;
var g=function(C,B,A){return c._onClickInstantEvent(m.elmt,B,d);
};
SimileAjax.DOM.registerEvent(m.elmt,"mousedown",g);
SimileAjax.DOM.registerEvent(b.elmt,"mousedown",g);
this._createHighlightDiv(Z,m,X);
this._eventIdToElmt[d.getID()]=m.elmt;
};
Timeline.DetailedEventPainter.prototype.paintImpreciseInstantEvent=function(i,f,a,e){var Y=this._timeline.getDocument();
var j=i.getText();
var o=i.getStart();
var d=i.getEnd();
var r=Math.round(this._band.dateToPixelOffset(o));
var u=Math.round(this._band.dateToPixelOffset(d));
var v=Math.round(r+f.iconWidth/2);
var k=Math.round(r-f.iconWidth/2);
var m=this._frc.computeSize(j);
var q=this._findFreeTrackForSolid(u,r);
var p=this._paintEventTape(i,q,r,u,a.event.instant.impreciseColor,a.event.instant.impreciseOpacity,f,a);
var t=this._paintEventIcon(i,q,k,f,a);
var n=this._getTrackData(q);
n.solid=k;
var Z=v+a.event.label.offsetFromLine;
var s=Z+m.width;
var c;
if(s<u){c=q;
}else{Z=r+a.event.label.offsetFromLine;
s=Z+m.width;
c=this._findFreeTrackForText(q,s,function(A){A.line=r-2;
});
this._getTrackData(c).text=k;
this._paintEventLine(i,r,q,c,f,a);
}var b=Math.round(f.trackOffset+c*f.trackIncrement+f.trackHeight/2-m.height/2);
var g=this._paintEventLabel(i,j,Z,b,m.width,m.height,a);
var h=this;
var l=function(C,B,A){return h._onClickInstantEvent(t.elmt,B,i);
};
SimileAjax.DOM.registerEvent(t.elmt,"mousedown",l);
SimileAjax.DOM.registerEvent(p.elmt,"mousedown",l);
SimileAjax.DOM.registerEvent(g.elmt,"mousedown",l);
this._createHighlightDiv(e,t,a);
this._eventIdToElmt[i.getID()]=t.elmt;
};
Timeline.DetailedEventPainter.prototype.paintPreciseDurationEvent=function(g,d,X,b){var W=this._timeline.getDocument();
var h=g.getText();
var m=g.getStart();
var a=g.getEnd();
var o=Math.round(this._band.dateToPixelOffset(m));
var p=Math.round(this._band.dateToPixelOffset(a));
var k=this._frc.computeSize(h);
var l=this._findFreeTrackForSolid(p);
var c=g.getColor();
c=c!=null?c:X.event.duration.color;
var n=this._paintEventTape(g,l,o,p,c,100,d,X);
var i=this._getTrackData(l);
i.solid=o;
var V=o+X.event.label.offsetFromLine;
var Z=this._findFreeTrackForText(l,V+k.width,function(A){A.line=o-2;
});
this._getTrackData(Z).text=o-2;
this._paintEventLine(g,o,l,Z,d,X);
var Y=Math.round(d.trackOffset+Z*d.trackIncrement+d.trackHeight/2-k.height/2);
var e=this._paintEventLabel(g,h,V,Y,k.width,k.height,X);
var f=this;
var j=function(B,A,C){return f._onClickDurationEvent(n.elmt,A,g);
};
SimileAjax.DOM.registerEvent(n.elmt,"mousedown",j);
SimileAjax.DOM.registerEvent(e.elmt,"mousedown",j);
this._createHighlightDiv(b,n,X);
this._eventIdToElmt[g.getID()]=n.elmt;
};
Timeline.DetailedEventPainter.prototype.paintImpreciseDurationEvent=function(o,k,d,h){var a=this._timeline.getDocument();
var p=o.getText();
var w=o.getStart();
var j=o.getLatestStart();
var g=o.getEnd();
var c=o.getEarliestEnd();
var y=Math.round(this._band.dateToPixelOffset(w));
var u=Math.round(this._band.dateToPixelOffset(j));
var z=Math.round(this._band.dateToPixelOffset(g));
var t=Math.round(this._band.dateToPixelOffset(c));
var s=this._frc.computeSize(p);
var v=this._findFreeTrackForSolid(z);
var i=o.getColor();
i=i!=null?i:d.event.duration.color;
var l=this._paintEventTape(o,v,y,z,d.event.duration.impreciseColor,d.event.duration.impreciseOpacity,k,d);
var x=this._paintEventTape(o,v,u,t,i,100,k,d);
var q=this._getTrackData(v);
q.solid=y;
var b=u+d.event.label.offsetFromLine;
var f=this._findFreeTrackForText(v,b+s.width,function(A){A.line=u-2;
});
this._getTrackData(f).text=u-2;
this._paintEventLine(o,u,v,f,k,d);
var e=Math.round(k.trackOffset+f*k.trackIncrement+k.trackHeight/2-s.height/2);
var m=this._paintEventLabel(o,p,b,e,s.width,s.height,d);
var n=this;
var r=function(B,A,C){return n._onClickDurationEvent(x.elmt,A,o);
};
SimileAjax.DOM.registerEvent(x.elmt,"mousedown",r);
SimileAjax.DOM.registerEvent(m.elmt,"mousedown",r);
this._createHighlightDiv(h,x,d);
this._eventIdToElmt[o.getID()]=x.elmt;
};
Timeline.DetailedEventPainter.prototype._findFreeTrackForSolid=function(H,E){for(var F=0;
true;
F++){if(F<this._lowerTracks.length){var G=this._lowerTracks[F];
if(Math.min(G.solid,G.text)>H&&(!(E)||G.line>E)){return F;
}}else{this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
return F;
}if(F<this._upperTracks.length){var G=this._upperTracks[F];
if(Math.min(G.solid,G.text)>H&&(!(E)||G.line>E)){return -1-F;
}}else{this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
return -1-F;
}}};
Timeline.DetailedEventPainter.prototype._findFreeTrackForText=function(K,L,Q){var S;
var R;
var M;
var O;
if(K<0){S=true;
M=-K;
R=this._findFreeUpperTrackForText(M,L);
O=-1-R;
}else{if(K>0){S=false;
M=K+1;
R=this._findFreeLowerTrackForText(M,L);
O=R;
}else{var N=this._findFreeUpperTrackForText(0,L);
var P=this._findFreeLowerTrackForText(1,L);
if(P-1<=N){S=false;
M=1;
R=P;
O=R;
}else{S=true;
M=0;
R=N;
O=-1-R;
}}}if(S){if(R==this._upperTracks.length){this._upperTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
}for(var T=M;
T<R;
T++){Q(this._upperTracks[T]);
}}else{if(R==this._lowerTracks.length){this._lowerTracks.push({solid:Number.POSITIVE_INFINITY,text:Number.POSITIVE_INFINITY,line:Number.POSITIVE_INFINITY});
}for(var T=M;
T<R;
T++){Q(this._lowerTracks[T]);
}}return O;
};
Timeline.DetailedEventPainter.prototype._findFreeLowerTrackForText=function(D,E){for(;
D<this._lowerTracks.length;
D++){var F=this._lowerTracks[D];
if(Math.min(F.solid,F.text)>=E){break;
}}return D;
};
Timeline.DetailedEventPainter.prototype._findFreeUpperTrackForText=function(D,E){for(;
D<this._upperTracks.length;
D++){var F=this._upperTracks[D];
if(Math.min(F.solid,F.text)>=E){break;
}}return D;
};
Timeline.DetailedEventPainter.prototype._getTrackData=function(B){return(B<0)?this._upperTracks[-B-1]:this._lowerTracks[B];
};
Timeline.DetailedEventPainter.prototype._paintEventLine=function(P,L,S,N,R,K){var Q=Math.round(R.trackOffset+S*R.trackIncrement+R.trackHeight/2);
var O=Math.round(Math.abs(N-S)*R.trackIncrement);
var T="1px solid "+K.event.label.lineColor;
var M=this._timeline.getDocument().createElement("div");
M.style.position="absolute";
M.style.left=L+"px";
M.style.width=K.event.label.offsetFromLine+"px";
M.style.height=O+"px";
if(S>N){M.style.top=(Q-O)+"px";
M.style.borderTop=T;
}else{M.style.top=Q+"px";
M.style.borderBottom=T;
}M.style.borderLeft=T;
this._lineLayer.appendChild(M);
};
Timeline.DetailedEventPainter.prototype._paintEventIcon=function(P,T,M,S,K){var Q=P.getIcon();
Q=Q!=null?Q:S.icon;
var O=S.trackOffset+T*S.trackIncrement+S.trackHeight/2;
var R=Math.round(O-S.iconHeight/2);
var L=SimileAjax.Graphics.createTranslucentImage(Q);
var N=this._timeline.getDocument().createElement("div");
N.style.position="absolute";
N.style.left=M+"px";
N.style.top=R+"px";
N.appendChild(L);
N.style.cursor="pointer";
if(P._title!=null){N.title=P._title;
}this._eventLayer.appendChild(N);
return{left:M,top:R,width:S.iconWidth,height:S.iconHeight,elmt:N};
};
Timeline.DetailedEventPainter.prototype._paintEventLabel=function(S,R,N,U,O,Q,L){var T=this._timeline.getDocument();
var P=T.createElement("div");
P.style.position="absolute";
P.style.left=N+"px";
P.style.width=O+"px";
P.style.top=U+"px";
P.style.height=Q+"px";
P.style.backgroundColor=L.event.label.backgroundColor;
SimileAjax.Graphics.setOpacity(P,L.event.label.backgroundOpacity);
this._eventLayer.appendChild(P);
var V=T.createElement("div");
V.style.position="absolute";
V.style.left=N+"px";
V.style.width=O+"px";
V.style.top=U+"px";
V.innerHTML=R;
V.style.cursor="pointer";
if(S._title!=null){V.title=S._title;
}var M=S.getTextColor();
if(M==null){M=S.getColor();
}if(M!=null){V.style.color=M;
}this._eventLayer.appendChild(V);
return{left:N,top:U,width:O,height:Q,elmt:V};
};
Timeline.DetailedEventPainter.prototype._paintEventTape=function(S,W,Z,Q,O,X,V,Y){var P=Q-Z;
var N=Y.event.tape.height;
var R=V.trackOffset+W*V.trackIncrement+V.trackHeight/2;
var U=Math.round(R-N/2);
var T=this._timeline.getDocument().createElement("div");
T.style.position="absolute";
T.style.left=Z+"px";
T.style.width=P+"px";
T.style.top=U+"px";
T.style.height=N+"px";
T.style.backgroundColor=O;
T.style.overflow="hidden";
T.style.cursor="pointer";
if(S._title!=null){T.title=S._title;
}SimileAjax.Graphics.setOpacity(T,X);
this._eventLayer.appendChild(T);
return{left:Z,top:U,width:P,height:N,elmt:T};
};
Timeline.DetailedEventPainter.prototype._createHighlightDiv=function(H,M,K){if(H>=0){var L=this._timeline.getDocument();
var I=K.event;
var N=I.highlightColors[Math.min(H,I.highlightColors.length-1)];
var J=L.createElement("div");
J.style.position="absolute";
J.style.overflow="hidden";
J.style.left=(M.left-2)+"px";
J.style.width=(M.width+4)+"px";
J.style.top=(M.top-2)+"px";
J.style.height=(M.height+4)+"px";
J.style.background=N;
this._highlightLayer.appendChild(J);
}};
Timeline.DetailedEventPainter.prototype._onClickInstantEvent=function(H,G,E){var F=SimileAjax.DOM.getPageCoordinates(H);
this._showBubble(F.left+Math.ceil(H.offsetWidth/2),F.top+Math.ceil(H.offsetHeight/2),E);
this._fireOnSelect(E.getID());
G.cancelBubble=true;
SimileAjax.DOM.cancelEvent(G);
return false;
};
Timeline.DetailedEventPainter.prototype._onClickDurationEvent=function(J,K,L){if("pageX" in K){var G=K.pageX;
var H=K.pageY;
}else{var I=SimileAjax.DOM.getPageCoordinates(J);
var G=K.offsetX+I.left;
var H=K.offsetY+I.top;
}this._showBubble(G,H,L);
this._fireOnSelect(L.getID());
K.cancelBubble=true;
SimileAjax.DOM.cancelEvent(K);
return false;
};
Timeline.DetailedEventPainter.prototype.showBubble=function(D){var F=this._eventIdToElmt[D.getID()];
if(F){var E=SimileAjax.DOM.getPageCoordinates(F);
this._showBubble(E.left+F.offsetWidth/2,E.top+F.offsetHeight/2,D);
}};
Timeline.DetailedEventPainter.prototype._showBubble=function(F,G,J){var H=document.createElement("div");
var I=this._params.theme.event.bubble;
J.fillInfoBubble(H,this._params.theme,this._band.getLabeller());
SimileAjax.WindowManager.cancelPopups();
SimileAjax.Graphics.createBubbleForContentAndPoint(H,F,G,I.width,null,I.maxHeight);
};
Timeline.DetailedEventPainter.prototype._fireOnSelect=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){this._onSelectListeners[C](D);
}};
Timeline.GregorianEtherPainter=function(B){this._params=B;
this._theme=B.theme;
this._unit=B.unit;
this._multiple=("multiple" in B)?B.multiple:1;
};
Timeline.GregorianEtherPainter.prototype.initialize=function(G,H){this._band=G;
this._timeline=H;
this._backgroundLayer=G.createLayerDiv(0);
this._backgroundLayer.setAttribute("name","ether-background");
this._backgroundLayer.className="timeline-ether-bg";
this._markerLayer=null;
this._lineLayer=null;
var F=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[H.isHorizontal()?"hAlign":"vAlign"];
var E=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,F,E);
this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
};
Timeline.GregorianEtherPainter.prototype.setHighlight=function(E,F,G,H){this._highlight.position(E,F,G,H);
};
Timeline.GregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
}this._markerLayer=this._band.createLayerDiv(100);
this._markerLayer.setAttribute("name","ether-markers");
this._markerLayer.style.display="none";
if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
}this._lineLayer=this._band.createLayerDiv(1);
this._lineLayer.setAttribute("name","ether-lines");
this._lineLayer.style.display="none";
var K=this._band.getMinDate();
var H=this._band.getMaxDate();
var L=this._band.getTimeZone();
var I=this._band.getLabeller();
SimileAjax.DateTime.roundDownToInterval(K,this._unit,L,this._multiple,this._theme.firstDayOfWeek);
var J=this;
var G=function(B){for(var A=0;
A<J._multiple;
A++){SimileAjax.DateTime.incrementByInterval(B,J._unit);
}};
while(K.getTime()<H.getTime()){this._intervalMarkerLayout.createIntervalMarker(K,I,this._unit,this._markerLayer,this._lineLayer);
G(K);
}this._markerLayer.style.display="block";
this._lineLayer.style.display="block";
};
Timeline.GregorianEtherPainter.prototype.softPaint=function(){};
Timeline.GregorianEtherPainter.prototype.zoom=function(B){if(B!=0){this._unit+=B;
}};
Timeline.HotZoneGregorianEtherPainter=function(I){this._params=I;
this._theme=I.theme;
this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,unit:I.unit,multiple:1}];
for(var K=0;
K<I.zones.length;
K++){var N=I.zones[K];
var L=SimileAjax.DateTime.parseGregorianDateTime(N.start).getTime();
var J=SimileAjax.DateTime.parseGregorianDateTime(N.end).getTime();
for(var M=0;
M<this._zones.length&&J>L;
M++){var H=this._zones[M];
if(L<H.endTime){if(L>H.startTime){this._zones.splice(M,0,{startTime:H.startTime,endTime:L,unit:H.unit,multiple:H.multiple});
M++;
H.startTime=L;
}if(J<H.endTime){this._zones.splice(M,0,{startTime:L,endTime:J,unit:N.unit,multiple:(N.multiple)?N.multiple:1});
M++;
H.startTime=J;
L=J;
}else{H.multiple=N.multiple;
H.unit=N.unit;
L=H.endTime;
}}}}};
Timeline.HotZoneGregorianEtherPainter.prototype.initialize=function(G,H){this._band=G;
this._timeline=H;
this._backgroundLayer=G.createLayerDiv(0);
this._backgroundLayer.setAttribute("name","ether-background");
this._backgroundLayer.className="timeline-ether-bg";
this._markerLayer=null;
this._lineLayer=null;
var F=("align" in this._params&&this._params.align!=undefined)?this._params.align:this._theme.ether.interval.marker[H.isHorizontal()?"hAlign":"vAlign"];
var E=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,F,E);
this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
};
Timeline.HotZoneGregorianEtherPainter.prototype.setHighlight=function(C,D){this._highlight.position(C,D);
};
Timeline.HotZoneGregorianEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
}this._markerLayer=this._band.createLayerDiv(100);
this._markerLayer.setAttribute("name","ether-markers");
this._markerLayer.style.display="none";
if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
}this._lineLayer=this._band.createLayerDiv(1);
this._lineLayer.setAttribute("name","ether-lines");
this._lineLayer.style.display="none";
var M=this._band.getMinDate();
var P=this._band.getMaxDate();
var R=this._band.getTimeZone();
var T=this._band.getLabeller();
var O=this;
var Q=function(B,C){for(var A=0;
A<C.multiple;
A++){SimileAjax.DateTime.incrementByInterval(B,C.unit);
}};
var N=0;
while(N<this._zones.length){if(M.getTime()<this._zones[N].endTime){break;
}N++;
}var X=this._zones.length-1;
while(X>=0){if(P.getTime()>this._zones[X].startTime){break;
}X--;
}for(var U=N;
U<=X;
U++){var V=this._zones[U];
var S=new Date(Math.max(M.getTime(),V.startTime));
var W=new Date(Math.min(P.getTime(),V.endTime));
SimileAjax.DateTime.roundDownToInterval(S,V.unit,R,V.multiple,this._theme.firstDayOfWeek);
SimileAjax.DateTime.roundUpToInterval(W,V.unit,R,V.multiple,this._theme.firstDayOfWeek);
while(S.getTime()<W.getTime()){this._intervalMarkerLayout.createIntervalMarker(S,T,V.unit,this._markerLayer,this._lineLayer);
Q(S,V);
}}this._markerLayer.style.display="block";
this._lineLayer.style.display="block";
};
Timeline.HotZoneGregorianEtherPainter.prototype.softPaint=function(){};
Timeline.HotZoneGregorianEtherPainter.prototype.zoom=function(D){if(D!=0){for(var C=0;
C<this._zones.length;
++C){if(this._zones[C]){this._zones[C].unit+=D;
}}}};
Timeline.YearCountEtherPainter=function(B){this._params=B;
this._theme=B.theme;
this._startDate=SimileAjax.DateTime.parseGregorianDateTime(B.startDate);
this._multiple=("multiple" in B)?B.multiple:1;
};
Timeline.YearCountEtherPainter.prototype.initialize=function(G,H){this._band=G;
this._timeline=H;
this._backgroundLayer=G.createLayerDiv(0);
this._backgroundLayer.setAttribute("name","ether-background");
this._backgroundLayer.className="timeline-ether-bg";
this._markerLayer=null;
this._lineLayer=null;
var F=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[H.isHorizontal()?"hAlign":"vAlign"];
var E=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,F,E);
this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
};
Timeline.YearCountEtherPainter.prototype.setHighlight=function(C,D){this._highlight.position(C,D);
};
Timeline.YearCountEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
}this._markerLayer=this._band.createLayerDiv(100);
this._markerLayer.setAttribute("name","ether-markers");
this._markerLayer.style.display="none";
if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
}this._lineLayer=this._band.createLayerDiv(1);
this._lineLayer.setAttribute("name","ether-lines");
this._lineLayer.style.display="none";
var L=new Date(this._startDate.getTime());
var H=this._band.getMaxDate();
var I=this._band.getMinDate().getUTCFullYear()-this._startDate.getUTCFullYear();
L.setUTCFullYear(this._band.getMinDate().getUTCFullYear()-I%this._multiple);
var K=this;
var G=function(B){for(var A=0;
A<K._multiple;
A++){SimileAjax.DateTime.incrementByInterval(B,SimileAjax.DateTime.YEAR);
}};
var J={labelInterval:function(C,A){var B=C.getUTCFullYear()-K._startDate.getUTCFullYear();
return{text:B,emphasized:B==0};
}};
while(L.getTime()<H.getTime()){this._intervalMarkerLayout.createIntervalMarker(L,J,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer);
G(L);
}this._markerLayer.style.display="block";
this._lineLayer.style.display="block";
};
Timeline.YearCountEtherPainter.prototype.softPaint=function(){};
Timeline.QuarterlyEtherPainter=function(B){this._params=B;
this._theme=B.theme;
this._startDate=SimileAjax.DateTime.parseGregorianDateTime(B.startDate);
};
Timeline.QuarterlyEtherPainter.prototype.initialize=function(G,H){this._band=G;
this._timeline=H;
this._backgroundLayer=G.createLayerDiv(0);
this._backgroundLayer.setAttribute("name","ether-background");
this._backgroundLayer.className="timeline-ether-bg";
this._markerLayer=null;
this._lineLayer=null;
var F=("align" in this._params)?this._params.align:this._theme.ether.interval.marker[H.isHorizontal()?"hAlign":"vAlign"];
var E=("showLine" in this._params)?this._params.showLine:this._theme.ether.interval.line.show;
this._intervalMarkerLayout=new Timeline.EtherIntervalMarkerLayout(this._timeline,this._band,this._theme,F,E);
this._highlight=new Timeline.EtherHighlight(this._timeline,this._band,this._theme,this._backgroundLayer);
};
Timeline.QuarterlyEtherPainter.prototype.setHighlight=function(C,D){this._highlight.position(C,D);
};
Timeline.QuarterlyEtherPainter.prototype.paint=function(){if(this._markerLayer){this._band.removeLayerDiv(this._markerLayer);
}this._markerLayer=this._band.createLayerDiv(100);
this._markerLayer.setAttribute("name","ether-markers");
this._markerLayer.style.display="none";
if(this._lineLayer){this._band.removeLayerDiv(this._lineLayer);
}this._lineLayer=this._band.createLayerDiv(1);
this._lineLayer.setAttribute("name","ether-lines");
this._lineLayer.style.display="none";
var J=new Date(0);
var G=this._band.getMaxDate();
J.setUTCFullYear(Math.max(this._startDate.getUTCFullYear(),this._band.getMinDate().getUTCFullYear()));
J.setUTCMonth(this._startDate.getUTCMonth());
var I=this;
var F=function(A){A.setUTCMonth(A.getUTCMonth()+3);
};
var H={labelInterval:function(C,A){var B=(4+(C.getUTCMonth()-I._startDate.getUTCMonth())/3)%4;
if(B!=0){return{text:"Q"+(B+1),emphasized:false};
}else{return{text:"Y"+(C.getUTCFullYear()-I._startDate.getUTCFullYear()+1),emphasized:true};
}}};
while(J.getTime()<G.getTime()){this._intervalMarkerLayout.createIntervalMarker(J,H,SimileAjax.DateTime.YEAR,this._markerLayer,this._lineLayer);
F(J);
}this._markerLayer.style.display="block";
this._lineLayer.style.display="block";
};
Timeline.QuarterlyEtherPainter.prototype.softPaint=function(){};
Timeline.EtherIntervalMarkerLayout=function(R,S,O,Z,W){var Q=R.isHorizontal();
if(Q){if(Z=="Top"){this.positionDiv=function(A,B){A.style.left=B+"px";
A.style.top="0px";
};
}else{this.positionDiv=function(A,B){A.style.left=B+"px";
A.style.bottom="0px";
};
}}else{if(Z=="Left"){this.positionDiv=function(A,B){A.style.top=B+"px";
A.style.left="0px";
};
}else{this.positionDiv=function(A,B){A.style.top=B+"px";
A.style.right="0px";
};
}}var N=O.ether.interval.marker;
var V=O.ether.interval.line;
var P=O.ether.interval.weekend;
var T=(Q?"h":"v")+Z;
var X=N[T+"Styler"];
var U=N[T+"EmphasizedStyler"];
var Y=SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY];
this.createIntervalMarker=function(G,f,e,d,J){var F=Math.round(S.dateToPixelOffset(G));
if(W&&e!=SimileAjax.DateTime.WEEK){var E=R.getDocument().createElement("div");
E.className="timeline-ether-lines";
if(V.opacity<100){SimileAjax.Graphics.setOpacity(E,V.opacity);
}if(Q){E.style.left=F+"px";
}else{E.style.top=F+"px";
}J.appendChild(E);
}if(e==SimileAjax.DateTime.WEEK){var M=O.firstDayOfWeek;
var D=new Date(G.getTime()+(6-M-7)*Y);
var A=new Date(D.getTime()+2*Y);
var C=Math.round(S.dateToPixelOffset(D));
var H=Math.round(S.dateToPixelOffset(A));
var I=Math.max(1,H-C);
var K=R.getDocument().createElement("div");
K.className="timeline-ether-weekends";
if(P.opacity<100){SimileAjax.Graphics.setOpacity(K,P.opacity);
}if(Q){K.style.left=C+"px";
K.style.width=I+"px";
}else{K.style.top=C+"px";
K.style.height=I+"px";
}J.appendChild(K);
}var B=f.labelInterval(G,e);
var L=R.getDocument().createElement("div");
L.innerHTML=B.text;
L.className="timeline-date-label";
if(B.emphasized){L.className+=" timeline-date-label-em";
}this.positionDiv(L,F);
d.appendChild(L);
return L;
};
};
Timeline.EtherHighlight=function(I,G,H,J){var F=I.isHorizontal();
this._highlightDiv=null;
this._createHighlightDiv=function(){if(this._highlightDiv==null){this._highlightDiv=I.getDocument().createElement("div");
this._highlightDiv.setAttribute("name","ether-highlight");
this._highlightDiv.className="timeline-ether-highlight";
var A=H.ether.highlightOpacity;
if(A<100){SimileAjax.Graphics.setOpacity(this._highlightDiv,A);
}J.appendChild(this._highlightDiv);
}};
this.position=function(N,A,B,E){B=B||0;
E=E||1;
this._createHighlightDiv();
var P=Math.round(G.dateToPixelOffset(N));
var C=Math.round(G.dateToPixelOffset(A));
var D=Math.max(C-P,3);
var O=G.getViewWidth()-4;
if(F){this._highlightDiv.style.left=P+"px";
this._highlightDiv.style.width=D+"px";
this._highlightDiv.style.top=Math.round(B*O)+"px";
this._highlightDiv.style.height=Math.round(E*O)+"px";
}else{this._highlightDiv.style.top=P+"px";
this._highlightDiv.style.height=D+"px";
this._highlightDiv.style.left=Math.round(B*O)+"px";
this._highlightDiv.style.width=Math.round(E*O)+"px";
}};
};
Timeline.LinearEther=function(B){this._params=B;
this._interval=B.interval;
this._pixelsPerInterval=B.pixelsPerInterval;
};
Timeline.LinearEther.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._unit=C.getUnit();
if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn);
}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn);
this.shiftPixels(-this._timeline.getPixelLength());
}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn);
this.shiftPixels(-this._timeline.getPixelLength()/2);
}else{this._start=this._unit.makeDefaultValue();
this.shiftPixels(-this._timeline.getPixelLength()/2);
}}}};
Timeline.LinearEther.prototype.setDate=function(B){this._start=this._unit.cloneValue(B);
};
Timeline.LinearEther.prototype.shiftPixels=function(D){var C=this._interval*D/this._pixelsPerInterval;
this._start=this._unit.change(this._start,C);
};
Timeline.LinearEther.prototype.dateToPixelOffset=function(C){var D=this._unit.compare(C,this._start);
return this._pixelsPerInterval*D/this._interval;
};
Timeline.LinearEther.prototype.pixelOffsetToDate=function(D){var C=D*this._interval/this._pixelsPerInterval;
return this._unit.change(this._start,C);
};
Timeline.LinearEther.prototype.zoom=function(F){var H=0;
var E=this._band._zoomIndex;
var G=E;
if(F&&(E>0)){G=E-1;
}if(!F&&(E<(this._band._zoomSteps.length-1))){G=E+1;
}this._band._zoomIndex=G;
this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[G].unit];
this._pixelsPerInterval=this._band._zoomSteps[G].pixelsPerInterval;
H=this._band._zoomSteps[G].unit-this._band._zoomSteps[E].unit;
return H;
};
Timeline.HotZoneEther=function(B){this._params=B;
this._interval=B.interval;
this._pixelsPerInterval=B.pixelsPerInterval;
this._theme=B.theme;
};
Timeline.HotZoneEther.prototype.initialize=function(O,N){this._band=O;
this._timeline=N;
this._unit=N.getUnit();
this._zones=[{startTime:Number.NEGATIVE_INFINITY,endTime:Number.POSITIVE_INFINITY,magnify:1}];
var L=this._params;
for(var J=0;
J<L.zones.length;
J++){var P=L.zones[J];
var R=this._unit.parseFromObject(P.start);
var Q=this._unit.parseFromObject(P.end);
for(var K=0;
K<this._zones.length&&this._unit.compare(Q,R)>0;
K++){var M=this._zones[K];
if(this._unit.compare(R,M.endTime)<0){if(this._unit.compare(R,M.startTime)>0){this._zones.splice(K,0,{startTime:M.startTime,endTime:R,magnify:M.magnify});
K++;
M.startTime=R;
}if(this._unit.compare(Q,M.endTime)<0){this._zones.splice(K,0,{startTime:R,endTime:Q,magnify:P.magnify*M.magnify});
K++;
M.startTime=Q;
R=Q;
}else{M.magnify*=P.magnify;
R=M.endTime;
}}}}if("startsOn" in this._params){this._start=this._unit.parseFromObject(this._params.startsOn);
}else{if("endsOn" in this._params){this._start=this._unit.parseFromObject(this._params.endsOn);
this.shiftPixels(-this._timeline.getPixelLength());
}else{if("centersOn" in this._params){this._start=this._unit.parseFromObject(this._params.centersOn);
this.shiftPixels(-this._timeline.getPixelLength()/2);
}else{this._start=this._unit.makeDefaultValue();
this.shiftPixels(-this._timeline.getPixelLength()/2);
}}}};
Timeline.HotZoneEther.prototype.setDate=function(B){this._start=this._unit.cloneValue(B);
};
Timeline.HotZoneEther.prototype.shiftPixels=function(B){this._start=this.pixelOffsetToDate(B);
};
Timeline.HotZoneEther.prototype.dateToPixelOffset=function(B){return this._dateDiffToPixelOffset(this._start,B);
};
Timeline.HotZoneEther.prototype.pixelOffsetToDate=function(B){return this._pixelOffsetToDate(B,this._start);
};
Timeline.HotZoneEther.prototype.zoom=function(F){var H=0;
var E=this._band._zoomIndex;
var G=E;
if(F&&(E>0)){G=E-1;
}if(!F&&(E<(this._band._zoomSteps.length-1))){G=E+1;
}this._band._zoomIndex=G;
this._interval=SimileAjax.DateTime.gregorianUnitLengths[this._band._zoomSteps[G].unit];
this._pixelsPerInterval=this._band._zoomSteps[G].pixelsPerInterval;
H=this._band._zoomSteps[G].unit-this._band._zoomSteps[E].unit;
return H;
};
Timeline.HotZoneEther.prototype._dateDiffToPixelOffset=function(N,J){var L=this._getScale();
var O=N;
var K=J;
var M=0;
if(this._unit.compare(O,K)<0){var P=0;
while(P<this._zones.length){if(this._unit.compare(O,this._zones[P].endTime)<0){break;
}P++;
}while(this._unit.compare(O,K)<0){var R=this._zones[P];
var Q=this._unit.earlier(K,R.endTime);
M+=(this._unit.compare(Q,O)/(L/R.magnify));
O=Q;
P++;
}}else{var P=this._zones.length-1;
while(P>=0){if(this._unit.compare(O,this._zones[P].startTime)>0){break;
}P--;
}while(this._unit.compare(O,K)>0){var R=this._zones[P];
var Q=this._unit.later(K,R.startTime);
M+=(this._unit.compare(Q,O)/(L/R.magnify));
O=Q;
P--;
}}return M;
};
Timeline.HotZoneEther.prototype._pixelOffsetToDate=function(J,O){var K=this._getScale();
var M=O;
if(J>0){var L=0;
while(L<this._zones.length){if(this._unit.compare(M,this._zones[L].endTime)<0){break;
}L++;
}while(J>0){var I=this._zones[L];
var N=K/I.magnify;
if(I.endTime==Number.POSITIVE_INFINITY){M=this._unit.change(M,J*N);
J=0;
}else{var P=this._unit.compare(I.endTime,M)/N;
if(P>J){M=this._unit.change(M,J*N);
J=0;
}else{M=I.endTime;
J-=P;
}}L++;
}}else{var L=this._zones.length-1;
while(L>=0){if(this._unit.compare(M,this._zones[L].startTime)>0){break;
}L--;
}J=-J;
while(J>0){var I=this._zones[L];
var N=K/I.magnify;
if(I.startTime==Number.NEGATIVE_INFINITY){M=this._unit.change(M,-J*N);
J=0;
}else{var P=this._unit.compare(M,I.startTime)/N;
if(P>J){M=this._unit.change(M,-J*N);
J=0;
}else{M=I.startTime;
J-=P;
}}L--;
}}return M;
};
Timeline.HotZoneEther.prototype._getScale=function(){return this._interval/this._pixelsPerInterval;
};
Timeline.EventUtils={};
Timeline.EventUtils.getNewEventID=function(){if(this._lastEventID==null){this._lastEventID=0;
}this._lastEventID+=1;
return"e"+this._lastEventID;
};
Timeline.EventUtils.decodeEventElID=function(J){var H=J.split("-");
if(H[1]!="tl"){alert("Internal Timeline problem 101, please consult support");
return{band:null,evt:null};
}var I=Timeline.getTimelineFromID(H[2]);
var G=I.getBand(H[3]);
var F=G.getEventSource.getEvent(H[4]);
return{band:G,evt:F};
};
Timeline.EventUtils.encodeEventElID=function(G,F,H,E){return H+"-tl-"+G.timelineID+"-"+F.getIndex()+"-"+E.getID();
};
Timeline.GregorianDateLabeller=function(C,D){this._locale=C;
this._timeZone=D;
};
Timeline.GregorianDateLabeller.monthNames=[];
Timeline.GregorianDateLabeller.dayNames=[];
Timeline.GregorianDateLabeller.labelIntervalFunctions=[];
Timeline.GregorianDateLabeller.getMonthName=function(D,C){return Timeline.GregorianDateLabeller.monthNames[C][D];
};
Timeline.GregorianDateLabeller.prototype.labelInterval=function(D,E){var F=Timeline.GregorianDateLabeller.labelIntervalFunctions[this._locale];
if(F==null){F=Timeline.GregorianDateLabeller.prototype.defaultLabelInterval;
}return F.call(this,D,E);
};
Timeline.GregorianDateLabeller.prototype.labelPrecise=function(B){return SimileAjax.DateTime.removeTimeZoneOffset(B,this._timeZone).toUTCString();
};
Timeline.GregorianDateLabeller.prototype.defaultLabelInterval=function(L,H){var K;
var I=false;
L=SimileAjax.DateTime.removeTimeZoneOffset(L,this._timeZone);
switch(H){case SimileAjax.DateTime.MILLISECOND:K=L.getUTCMilliseconds();
break;
case SimileAjax.DateTime.SECOND:K=L.getUTCSeconds();
break;
case SimileAjax.DateTime.MINUTE:var G=L.getUTCMinutes();
if(G==0){K=L.getUTCHours()+":00";
I=true;
}else{K=G;
}break;
case SimileAjax.DateTime.HOUR:K=L.getUTCHours()+"hr";
break;
case SimileAjax.DateTime.DAY:K=Timeline.GregorianDateLabeller.getMonthName(L.getUTCMonth(),this._locale)+" "+L.getUTCDate();
break;
case SimileAjax.DateTime.WEEK:K=Timeline.GregorianDateLabeller.getMonthName(L.getUTCMonth(),this._locale)+" "+L.getUTCDate();
break;
case SimileAjax.DateTime.MONTH:var G=L.getUTCMonth();
if(G!=0){K=Timeline.GregorianDateLabeller.getMonthName(G,this._locale);
break;
}case SimileAjax.DateTime.YEAR:case SimileAjax.DateTime.DECADE:case SimileAjax.DateTime.CENTURY:case SimileAjax.DateTime.MILLENNIUM:var J=L.getUTCFullYear();
if(J>0){K=L.getUTCFullYear();
}else{K=(1-J)+"BC";
}I=(H==SimileAjax.DateTime.MONTH)||(H==SimileAjax.DateTime.DECADE&&J%100==0)||(H==SimileAjax.DateTime.CENTURY&&J%1000==0);
break;
default:K=L.toUTCString();
}return{text:K,emphasized:I};
};
Timeline.OriginalEventPainter=function(B){this._params=B;
this._onSelectListeners=[];
this._eventPaintListeners=[];
this._filterMatcher=null;
this._highlightMatcher=null;
this._frc=null;
this._eventIdToElmt={};
};
Timeline.OriginalEventPainter.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._backLayer=null;
this._eventLayer=null;
this._lineLayer=null;
this._highlightLayer=null;
this._eventIdToElmt=null;
};
Timeline.OriginalEventPainter.prototype.getType=function(){return"original";
};
Timeline.OriginalEventPainter.prototype.supportsOrthogonalScrolling=function(){return true;
};
Timeline.OriginalEventPainter.prototype.addOnSelectListener=function(B){this._onSelectListeners.push(B);
};
Timeline.OriginalEventPainter.prototype.removeOnSelectListener=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){if(this._onSelectListeners[C]==D){this._onSelectListeners.splice(C,1);
break;
}}};
Timeline.OriginalEventPainter.prototype.addEventPaintListener=function(B){this._eventPaintListeners.push(B);
};
Timeline.OriginalEventPainter.prototype.removeEventPaintListener=function(D){for(var C=0;
C<this._eventPaintListeners.length;
C++){if(this._eventPaintListeners[C]==D){this._eventPaintListeners.splice(C,1);
break;
}}};
Timeline.OriginalEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
};
Timeline.OriginalEventPainter.prototype.setFilterMatcher=function(B){this._filterMatcher=B;
};
Timeline.OriginalEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
};
Timeline.OriginalEventPainter.prototype.setHighlightMatcher=function(B){this._highlightMatcher=B;
};
Timeline.OriginalEventPainter.prototype.paint=function(){var L=this._band.getEventSource();
if(L==null){return ;
}this._eventIdToElmt={};
this._fireEventPaintListeners("paintStarting",null,null);
this._prepareForPainting();
var N=this._computeMetrics();
var M=this._band.getMinDate();
var J=this._band.getMaxDate();
var P=(this._filterMatcher!=null)?this._filterMatcher:function(A){return true;
};
var K=(this._highlightMatcher!=null)?this._highlightMatcher:function(A){return -1;
};
var O=L.getEventReverseIterator(M,J);
while(O.hasNext()){var I=O.next();
if(P(I)){this.paintEvent(I,N,this._params.theme,K(I));
}}this._highlightLayer.style.display="block";
this._lineLayer.style.display="block";
this._eventLayer.style.display="block";
this._band.updateEventTrackInfo(this._tracks.length,N.trackIncrement);
this._fireEventPaintListeners("paintEnded",null,null);
this._setOrthogonalOffset(N);
};
Timeline.OriginalEventPainter.prototype.softPaint=function(){this._setOrthogonalOffset(this._computeMetrics());
};
Timeline.OriginalEventPainter.prototype.getOrthogonalExtent=function(){var B=this._computeMetrics();
return 2*B.trackOffset+this._tracks.length*B.trackIncrement;
};
Timeline.OriginalEventPainter.prototype._setOrthogonalOffset=function(C){var D=this._band.getViewOrthogonalOffset();
this._highlightLayer.style.top=this._lineLayer.style.top=this._eventLayer.style.top=D+"px";
};
Timeline.OriginalEventPainter.prototype._computeMetrics=function(){var E=this._params.theme.event;
var F=Math.max(E.track.height,E.tape.height+this._frc.getLineHeight());
var D={trackOffset:E.track.offset,trackHeight:F,trackGap:E.track.gap,trackIncrement:F+E.track.gap,icon:E.instant.icon,iconWidth:E.instant.iconWidth,iconHeight:E.instant.iconHeight,labelWidth:E.label.width,maxLabelChar:E.label.maxLabelChar,impreciseIconMargin:E.instant.impreciseIconMargin};
return D;
};
Timeline.OriginalEventPainter.prototype._prepareForPainting=function(){var D=this._band;
if(this._backLayer==null){this._backLayer=this._band.createLayerDiv(0,"timeline-band-events");
this._backLayer.style.visibility="hidden";
var C=document.createElement("span");
C.className="timeline-event-label";
this._backLayer.appendChild(C);
this._frc=SimileAjax.Graphics.getFontRenderingContext(C);
}this._frc.update();
this._tracks=[];
if(this._highlightLayer!=null){D.removeLayerDiv(this._highlightLayer);
}this._highlightLayer=D.createLayerDiv(105,"timeline-band-highlights");
this._highlightLayer.style.display="none";
if(this._lineLayer!=null){D.removeLayerDiv(this._lineLayer);
}this._lineLayer=D.createLayerDiv(110,"timeline-band-lines");
this._lineLayer.style.display="none";
if(this._eventLayer!=null){D.removeLayerDiv(this._eventLayer);
}this._eventLayer=D.createLayerDiv(115,"timeline-band-events");
this._eventLayer.style.display="none";
};
Timeline.OriginalEventPainter.prototype.paintEvent=function(H,G,F,E){if(H.isInstant()){this.paintInstantEvent(H,G,F,E);
}else{this.paintDurationEvent(H,G,F,E);
}};
Timeline.OriginalEventPainter.prototype.paintInstantEvent=function(H,G,F,E){if(H.isImprecise()){this.paintImpreciseInstantEvent(H,G,F,E);
}else{this.paintPreciseInstantEvent(H,G,F,E);
}};
Timeline.OriginalEventPainter.prototype.paintDurationEvent=function(H,G,F,E){if(H.isImprecise()){this.paintImpreciseDurationEvent(H,G,F,E);
}else{this.paintPreciseDurationEvent(H,G,F,E);
}};
Timeline.OriginalEventPainter.prototype.paintPreciseInstantEvent=function(h,d,b,c){var Y=this._timeline.getDocument();
var i=h.getText();
var p=h.getStart();
var r=Math.round(this._band.dateToPixelOffset(p));
var t=Math.round(r+d.iconWidth/2);
var j=Math.round(r-d.iconWidth/2);
var m=this._getLabelDivClassName(h);
var l=this._frc.computeSize(i,m);
var X=t+b.event.label.offsetFromLine;
var q=X+l.width;
var Z=q;
var f=this._findFreeTrack(h,Z);
var a=Math.round(d.trackOffset+f*d.trackIncrement+d.trackHeight/2-l.height/2);
var s=this._paintEventIcon(h,f,j,d,b,0);
var e=this._paintEventLabel(h,i,X,a,l.width,l.height,b,m,c);
var o=[s.elmt,e.elmt];
var g=this;
var k=function(C,B,A){return g._onClickInstantEvent(s.elmt,B,h);
};
SimileAjax.DOM.registerEvent(s.elmt,"mousedown",k);
SimileAjax.DOM.registerEvent(e.elmt,"mousedown",k);
var n=this._createHighlightDiv(c,s,b,h);
if(n!=null){o.push(n);
}this._fireEventPaintListeners("paintedEvent",h,o);
this._eventIdToElmt[h.getID()]=s.elmt;
this._tracks[f]=j;
};
Timeline.OriginalEventPainter.prototype.paintImpreciseInstantEvent=function(m,i,d,g){var AD=this._timeline.getDocument();
var o=m.getText();
var v=m.getStart();
var f=m.getEnd();
var y=Math.round(this._band.dateToPixelOffset(v));
var AA=Math.round(this._band.dateToPixelOffset(f));
var AB=Math.round(y+i.iconWidth/2);
var p=Math.round(y-i.iconWidth/2);
var s=this._getLabelDivClassName(m);
var r=this._frc.computeSize(o,s);
var AC=AB+d.event.label.offsetFromLine;
var x=AC+r.width;
var c=Math.max(x,AA);
var k=this._findFreeTrack(m,c);
var n=d.event.tape.height;
var e=Math.round(i.trackOffset+k*i.trackIncrement+n);
var z=this._paintEventIcon(m,k,p,i,d,n);
var j=this._paintEventLabel(m,o,AC,e,r.width,r.height,d,s,g);
var h=m.getColor();
h=h!=null?h:d.event.instant.impreciseColor;
var w=this._paintEventTape(m,k,y,AA,h,d.event.instant.impreciseOpacity,i,d,0);
var u=[z.elmt,j.elmt,w.elmt];
var l=this;
var q=function(C,B,A){return l._onClickInstantEvent(z.elmt,B,m);
};
SimileAjax.DOM.registerEvent(z.elmt,"mousedown",q);
SimileAjax.DOM.registerEvent(w.elmt,"mousedown",q);
SimileAjax.DOM.registerEvent(j.elmt,"mousedown",q);
var t=this._createHighlightDiv(g,z,d,m);
if(t!=null){u.push(t);
}this._fireEventPaintListeners("paintedEvent",m,u);
this._eventIdToElmt[m.getID()]=z.elmt;
this._tracks[k]=p;
};
Timeline.OriginalEventPainter.prototype.paintPreciseDurationEvent=function(k,g,c,e){var Z=this._timeline.getDocument();
var l=k.getText();
var r=k.getStart();
var d=k.getEnd();
var u=Math.round(this._band.dateToPixelOffset(r));
var v=Math.round(this._band.dateToPixelOffset(d));
var o=this._getLabelDivClassName(k);
var n=this._frc.computeSize(l,o);
var Y=u;
var t=Y+n.width;
var a=Math.max(t,v);
var i=this._findFreeTrack(k,a);
var b=Math.round(g.trackOffset+i*g.trackIncrement+c.event.tape.height);
var f=k.getColor();
f=f!=null?f:c.event.duration.color;
var s=this._paintEventTape(k,i,u,v,f,100,g,c,0);
var h=this._paintEventLabel(k,l,Y,b,n.width,n.height,c,o,e);
var q=[s.elmt,h.elmt];
var j=this;
var m=function(C,B,A){return j._onClickDurationEvent(s.elmt,B,k);
};
SimileAjax.DOM.registerEvent(s.elmt,"mousedown",m);
SimileAjax.DOM.registerEvent(h.elmt,"mousedown",m);
var p=this._createHighlightDiv(e,s,c,k);
if(p!=null){q.push(p);
}this._fireEventPaintListeners("paintedEvent",k,q);
this._eventIdToElmt[k.getID()]=s.elmt;
this._tracks[i]=u;
};
Timeline.OriginalEventPainter.prototype.paintImpreciseDurationEvent=function(p,k,e,h){var AE=this._timeline.getDocument();
var q=p.getText();
var y=p.getStart();
var j=p.getLatestStart();
var g=p.getEnd();
var AF=p.getEarliestEnd();
var AA=Math.round(this._band.dateToPixelOffset(y));
var w=Math.round(this._band.dateToPixelOffset(j));
var AC=Math.round(this._band.dateToPixelOffset(g));
var v=Math.round(this._band.dateToPixelOffset(AF));
var t=this._getLabelDivClassName(p);
var s=this._frc.computeSize(q,t);
var AD=w;
var AB=AD+s.width;
var d=Math.max(AB,AC);
var n=this._findFreeTrack(p,d);
var f=Math.round(k.trackOffset+n*k.trackIncrement+e.event.tape.height);
var i=p.getColor();
i=i!=null?i:e.event.duration.color;
var l=this._paintEventTape(p,n,AA,AC,e.event.duration.impreciseColor,e.event.duration.impreciseOpacity,k,e,0);
var z=this._paintEventTape(p,n,w,v,i,100,k,e,1);
var m=this._paintEventLabel(p,q,AD,f,s.width,s.height,e,t,h);
var x=[l.elmt,z.elmt,m.elmt];
var o=this;
var r=function(C,B,A){return o._onClickDurationEvent(z.elmt,B,p);
};
SimileAjax.DOM.registerEvent(z.elmt,"mousedown",r);
SimileAjax.DOM.registerEvent(m.elmt,"mousedown",r);
var u=this._createHighlightDiv(h,z,e,p);
if(u!=null){x.push(u);
}this._fireEventPaintListeners("paintedEvent",p,x);
this._eventIdToElmt[p.getID()]=z.elmt;
this._tracks[n]=AA;
};
Timeline.OriginalEventPainter.prototype._encodeEventElID=function(D,C){return Timeline.EventUtils.encodeEventElID(this._timeline,this._band,D,C);
};
Timeline.OriginalEventPainter.prototype._findFreeTrack=function(G,F){var H=G.getTrackNum();
if(H!=null){return H;
}for(var I=0;
I<this._tracks.length;
I++){var J=this._tracks[I];
if(J>F){break;
}}return I;
};
Timeline.OriginalEventPainter.prototype._paintEventIcon=function(Q,U,N,T,V,M){var R=Q.getIcon();
R=R!=null?R:T.icon;
var S;
if(M>0){S=T.trackOffset+U*T.trackIncrement+M+T.impreciseIconMargin;
}else{var P=T.trackOffset+U*T.trackIncrement+T.trackHeight/2;
S=Math.round(P-T.iconHeight/2);
}var L=SimileAjax.Graphics.createTranslucentImage(R);
var O=this._timeline.getDocument().createElement("div");
O.className=this._getElClassName("timeline-event-icon",Q,"icon");
O.id=this._encodeEventElID("icon",Q);
O.style.left=N+"px";
O.style.top=S+"px";
O.appendChild(L);
if(Q._title!=null){O.title=Q._title;
}this._eventLayer.appendChild(O);
return{left:N,top:S,width:T.iconWidth,height:T.iconHeight,elmt:O};
};
Timeline.OriginalEventPainter.prototype._paintEventLabel=function(S,R,N,U,P,Q,X,W,O){var T=this._timeline.getDocument();
var V=T.createElement("div");
V.className=W;
V.id=this._encodeEventElID("label",S);
V.style.left=N+"px";
V.style.width=P+"px";
V.style.top=U+"px";
V.innerHTML=R;
if(S._title!=null){V.title=S._title;
}var M=S.getTextColor();
if(M==null){M=S.getColor();
}if(M!=null){V.style.color=M;
}if(X.event.highlightLabelBackground&&O>=0){V.style.background=this._getHighlightColor(O,X);
}this._eventLayer.appendChild(V);
return{left:N,top:U,width:P,height:Q,elmt:V};
};
Timeline.OriginalEventPainter.prototype._paintEventTape=function(U,Z,c,S,Q,a,Y,b,T){var R=S-c;
var d=b.event.tape.height;
var X=Y.trackOffset+Z*Y.trackIncrement;
var V=this._timeline.getDocument().createElement("div");
V.className=this._getElClassName("timeline-event-tape",U,"tape");
V.id=this._encodeEventElID("tape"+T,U);
V.style.left=c+"px";
V.style.width=R+"px";
V.style.height=d+"px";
V.style.top=X+"px";
if(U._title!=null){V.title=U._title;
}if(Q!=null){V.style.backgroundColor=Q;
}var W=U.getTapeImage();
var P=U.getTapeRepeat();
P=P!=null?P:"repeat";
if(W!=null){V.style.backgroundImage="url("+W+")";
V.style.backgroundRepeat=P;
}SimileAjax.Graphics.setOpacity(V,a);
this._eventLayer.appendChild(V);
return{left:c,top:X,width:R,height:d,elmt:V};
};
Timeline.OriginalEventPainter.prototype._getLabelDivClassName=function(B){return this._getElClassName("timeline-event-label",B,"label");
};
Timeline.OriginalEventPainter.prototype._getElClassName=function(J,F,H){var G=F.getClassName(),I=[];
if(G){if(H){I.push(H+"-"+G+" ");
}I.push(G+" ");
}I.push(J);
return(I.join(""));
};
Timeline.OriginalEventPainter.prototype._getHighlightColor=function(D,E){var F=E.event.highlightColors;
return F[Math.min(D,F.length-1)];
};
Timeline.OriginalEventPainter.prototype._createHighlightDiv=function(H,L,J,N){var I=null;
if(H>=0){var K=this._timeline.getDocument();
var M=this._getHighlightColor(H,J);
I=K.createElement("div");
I.className=this._getElClassName("timeline-event-highlight",N,"highlight");
I.id=this._encodeEventElID("highlight0",N);
I.style.position="absolute";
I.style.overflow="hidden";
I.style.left=(L.left-2)+"px";
I.style.width=(L.width+4)+"px";
I.style.top=(L.top-2)+"px";
I.style.height=(L.height+4)+"px";
I.style.background=M;
this._highlightLayer.appendChild(I);
}return I;
};
Timeline.OriginalEventPainter.prototype._onClickInstantEvent=function(H,G,E){var F=SimileAjax.DOM.getPageCoordinates(H);
this._showBubble(F.left+Math.ceil(H.offsetWidth/2),F.top+Math.ceil(H.offsetHeight/2),E);
this._fireOnSelect(E.getID());
G.cancelBubble=true;
SimileAjax.DOM.cancelEvent(G);
return false;
};
Timeline.OriginalEventPainter.prototype._onClickDurationEvent=function(J,K,L){if("pageX" in K){var G=K.pageX;
var H=K.pageY;
}else{var I=SimileAjax.DOM.getPageCoordinates(J);
var G=K.offsetX+I.left;
var H=K.offsetY+I.top;
}this._showBubble(G,H,L);
this._fireOnSelect(L.getID());
K.cancelBubble=true;
SimileAjax.DOM.cancelEvent(K);
return false;
};
Timeline.OriginalEventPainter.prototype.showBubble=function(D){var F=this._eventIdToElmt[D.getID()];
if(F){var E=SimileAjax.DOM.getPageCoordinates(F);
this._showBubble(E.left+F.offsetWidth/2,E.top+F.offsetHeight/2,D);
}};
Timeline.OriginalEventPainter.prototype._showBubble=function(F,G,J){var H=document.createElement("div");
var I=this._params.theme.event.bubble;
J.fillInfoBubble(H,this._params.theme,this._band.getLabeller());
SimileAjax.WindowManager.cancelPopups();
SimileAjax.Graphics.createBubbleForContentAndPoint(H,F,G,I.width,null,I.maxHeight);
};
Timeline.OriginalEventPainter.prototype._fireOnSelect=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){this._onSelectListeners[C](D);
}};
Timeline.OriginalEventPainter.prototype._fireEventPaintListeners=function(F,E,G){for(var H=0;
H<this._eventPaintListeners.length;
H++){this._eventPaintListeners[H](this._band,F,E,G);
}};
Timeline.OverviewEventPainter=function(B){this._params=B;
this._onSelectListeners=[];
this._filterMatcher=null;
this._highlightMatcher=null;
};
Timeline.OverviewEventPainter.prototype.initialize=function(D,C){this._band=D;
this._timeline=C;
this._eventLayer=null;
this._highlightLayer=null;
};
Timeline.OverviewEventPainter.prototype.getType=function(){return"overview";
};
Timeline.OverviewEventPainter.prototype.addOnSelectListener=function(B){this._onSelectListeners.push(B);
};
Timeline.OverviewEventPainter.prototype.removeOnSelectListener=function(D){for(var C=0;
C<this._onSelectListeners.length;
C++){if(this._onSelectListeners[C]==D){this._onSelectListeners.splice(C,1);
break;
}}};
Timeline.OverviewEventPainter.prototype.getFilterMatcher=function(){return this._filterMatcher;
};
Timeline.OverviewEventPainter.prototype.setFilterMatcher=function(B){this._filterMatcher=B;
};
Timeline.OverviewEventPainter.prototype.getHighlightMatcher=function(){return this._highlightMatcher;
};
Timeline.OverviewEventPainter.prototype.setHighlightMatcher=function(B){this._highlightMatcher=B;
};
Timeline.OverviewEventPainter.prototype.paint=function(){var L=this._band.getEventSource();
if(L==null){return ;
}this._prepareForPainting();
var O=this._params.theme.event;
var Q={trackOffset:O.overviewTrack.offset,trackHeight:O.overviewTrack.height,trackGap:O.overviewTrack.gap,trackIncrement:O.overviewTrack.height+O.overviewTrack.gap};
var K=this._band.getMinDate();
var M=this._band.getMaxDate();
var N=(this._filterMatcher!=null)?this._filterMatcher:function(A){return true;
};
var R=(this._highlightMatcher!=null)?this._highlightMatcher:function(A){return -1;
};
var J=L.getEventReverseIterator(K,M);
while(J.hasNext()){var P=J.next();
if(N(P)){this.paintEvent(P,Q,this._params.theme,R(P));
}}this._highlightLayer.style.display="block";
this._eventLayer.style.display="block";
this._band.updateEventTrackInfo(this._tracks.length,Q.trackIncrement);
};
Timeline.OverviewEventPainter.prototype.softPaint=function(){};
Timeline.OverviewEventPainter.prototype._prepareForPainting=function(){var B=this._band;
this._tracks=[];
if(this._highlightLayer!=null){B.removeLayerDiv(this._highlightLayer);
}this._highlightLayer=B.createLayerDiv(105,"timeline-band-highlights");
this._highlightLayer.style.display="none";
if(this._eventLayer!=null){B.removeLayerDiv(this._eventLayer);
}this._eventLayer=B.createLayerDiv(110,"timeline-band-events");
this._eventLayer.style.display="none";
};
Timeline.OverviewEventPainter.prototype.paintEvent=function(H,G,F,E){if(H.isInstant()){this.paintInstantEvent(H,G,F,E);
}else{this.paintDurationEvent(H,G,F,E);
}};
Timeline.OverviewEventPainter.prototype.paintInstantEvent=function(N,O,Q,M){var L=N.getStart();
var R=Math.round(this._band.dateToPixelOffset(L));
var J=N.getColor(),K=N.getClassName();
if(K){J=null;
}else{J=J!=null?J:Q.event.duration.color;
}var P=this._paintEventTick(N,R,J,100,O,Q);
this._createHighlightDiv(M,P,Q);
};
Timeline.OverviewEventPainter.prototype.paintDurationEvent=function(Q,R,S,M){var P=Q.getLatestStart();
var N=Q.getEarliestEnd();
var O=Math.round(this._band.dateToPixelOffset(P));
var X=Math.round(this._band.dateToPixelOffset(N));
var T=0;
for(;
T<this._tracks.length;
T++){if(X<this._tracks[T]){break;
}}this._tracks[T]=X;
var U=Q.getColor(),V=Q.getClassName();
if(V){U=null;
}else{U=U!=null?U:S.event.duration.color;
}var W=this._paintEventTape(Q,T,O,X,U,100,R,S,V);
this._createHighlightDiv(M,W,S);
};
Timeline.OverviewEventPainter.prototype._paintEventTape=function(S,P,O,T,Z,X,W,Y,N){var V=W.trackOffset+P*W.trackIncrement;
var Q=T-O;
var R=W.trackHeight;
var U=this._timeline.getDocument().createElement("div");
U.className="timeline-small-event-tape";
if(N){U.className+=" small-"+N;
}U.style.left=O+"px";
U.style.width=Q+"px";
U.style.top=V+"px";
U.style.height=R+"px";
if(Z){U.style.backgroundColor=Z;
}if(X<100){SimileAjax.Graphics.setOpacity(U,X);
}this._eventLayer.appendChild(U);
return{left:O,top:V,width:Q,height:R,elmt:U};
};
Timeline.OverviewEventPainter.prototype._paintEventTick=function(Q,N,L,U,T,V){var P=V.event.overviewTrack.tickHeight;
var S=T.trackOffset-P;
var O=1;
var R=this._timeline.getDocument().createElement("div");
R.className="timeline-small-event-icon";
R.style.left=N+"px";
R.style.top=S+"px";
var M=Q.getClassName();
if(M){R.className+=" small-"+M;
}if(U<100){SimileAjax.Graphics.setOpacity(R,U);
}this._eventLayer.appendChild(R);
return{left:N,top:S,width:O,height:P,elmt:R};
};
Timeline.OverviewEventPainter.prototype._createHighlightDiv=function(H,M,K){if(H>=0){var L=this._timeline.getDocument();
var I=K.event;
var N=I.highlightColors[Math.min(H,I.highlightColors.length-1)];
var J=L.createElement("div");
J.style.position="absolute";
J.style.overflow="hidden";
J.style.left=(M.left-1)+"px";
J.style.width=(M.width+2)+"px";
J.style.top=(M.top-1)+"px";
J.style.height=(M.height+2)+"px";
J.style.background=N;
this._highlightLayer.appendChild(J);
}};
Timeline.OverviewEventPainter.prototype.showBubble=function(B){};
Timeline.DefaultEventSource=function(B){this._events=(B instanceof Object)?B:new SimileAjax.EventIndex();
this._listeners=[];
};
Timeline.DefaultEventSource.prototype.addListener=function(B){this._listeners.push(B);
};
Timeline.DefaultEventSource.prototype.removeListener=function(D){for(var C=0;
C<this._listeners.length;
C++){if(this._listeners[C]==D){this._listeners.splice(C,1);
break;
}}};
Timeline.DefaultEventSource.prototype.loadXML=function(V,P){var N=this._getBaseURL(P);
var U=V.documentElement.getAttribute("wiki-url");
var Q=V.documentElement.getAttribute("wiki-section");
var X=V.documentElement.getAttribute("date-time-format");
var W=this._events.getUnit().getParser(X);
var M=V.documentElement.firstChild;
var T=false;
while(M!=null){if(M.nodeType==1){var R="";
if(M.firstChild!=null&&M.firstChild.nodeType==3){R=M.firstChild.nodeValue;
}var O=(M.getAttribute("isDuration")===null&&M.getAttribute("durationEvent")===null)||M.getAttribute("isDuration")=="false"||M.getAttribute("durationEvent")=="false";
var S=new Timeline.DefaultEventSource.Event({id:M.getAttribute("id"),start:W(M.getAttribute("start")),end:W(M.getAttribute("end")),latestStart:W(M.getAttribute("latestStart")),earliestEnd:W(M.getAttribute("earliestEnd")),instant:O,text:M.getAttribute("title"),description:R,image:this._resolveRelativeURL(M.getAttribute("image"),N),link:this._resolveRelativeURL(M.getAttribute("link"),N),icon:this._resolveRelativeURL(M.getAttribute("icon"),N),color:M.getAttribute("color"),textColor:M.getAttribute("textColor"),hoverText:M.getAttribute("hoverText"),classname:M.getAttribute("classname"),tapeImage:M.getAttribute("tapeImage"),tapeRepeat:M.getAttribute("tapeRepeat"),caption:M.getAttribute("caption"),eventID:M.getAttribute("eventID"),trackNum:M.getAttribute("trackNum")});
S._node=M;
S.getProperty=function(A){return this._node.getAttribute(A);
};
S.setWikiInfo(U,Q);
this._events.add(S);
T=true;
}M=M.nextSibling;
}if(T){this._fire("onAddMany",[]);
}};
Timeline.DefaultEventSource.prototype.loadJSON=function(W,P){var N=this._getBaseURL(P);
var T=false;
if(W&&W.events){var U=("wikiURL" in W)?W.wikiURL:null;
var R=("wikiSection" in W)?W.wikiSection:null;
var M=("dateTimeFormat" in W)?W.dateTimeFormat:null;
var V=this._events.getUnit().getParser(M);
for(var X=0;
X<W.events.length;
X++){var Q=W.events[X];
var O=Q.isDuration||(("durationEvent" in Q)&&!Q.durationEvent)||(("de" in Q)&&!Q.de);
var S=new Timeline.DefaultEventSource.Event({id:("id" in Q)?Q.id:undefined,start:V(Q.start||Q.s),end:V(Q.end||Q.e),latestStart:V(Q.latestStart||Q.ls),earliestEnd:V(Q.earliestEnd||Q.ee),instant:O,text:Q.title||Q.t,description:Q.description||Q.d,image:this._resolveRelativeURL(Q.image,N),link:this._resolveRelativeURL(Q.link,N),icon:this._resolveRelativeURL(Q.icon,N),color:Q.color,textColor:Q.textColor,hoverText:Q.hoverText,classname:Q.classname||Q.c,tapeImage:Q.tapeImage,tapeRepeat:Q.tapeRepeat,caption:Q.caption,eventID:Q.eventID||Q.eid,trackNum:Q.trackNum});
S._obj=Q;
S.getProperty=function(A){return this._obj[A];
};
S.setWikiInfo(U,R);
this._events.add(S);
T=true;
}}if(T){this._fire("onAddMany",[]);
}};
Timeline.DefaultEventSource.prototype.loadSPARQL=function(W,Q){var N=this._getBaseURL(Q);
var Y="iso8601";
var X=this._events.getUnit().getParser(Y);
if(W==null){return ;
}var Z=W.documentElement.firstChild;
while(Z!=null&&(Z.nodeType!=1||Z.nodeName!="results")){Z=Z.nextSibling;
}var U=null;
var R=null;
if(Z!=null){U=Z.getAttribute("wiki-url");
R=Z.getAttribute("wiki-section");
Z=Z.firstChild;
}var T=false;
while(Z!=null){if(Z.nodeType==1){var O={};
var V=Z.firstChild;
while(V!=null){if(V.nodeType==1&&V.firstChild!=null&&V.firstChild.nodeType==1&&V.firstChild.firstChild!=null&&V.firstChild.firstChild.nodeType==3){O[V.getAttribute("name")]=V.firstChild.firstChild.nodeValue;
}V=V.nextSibling;
}if(O["start"]==null&&O["date"]!=null){O["start"]=O["date"];
}var P=(O["isDuration"]===null&&O["durationEvent"]===null)||O["isDuration"]=="false"||O["durationEvent"]=="false";
var S=new Timeline.DefaultEventSource.Event({id:O["id"],start:X(O["start"]),end:X(O["end"]),latestStart:X(O["latestStart"]),earliestEnd:X(O["earliestEnd"]),instant:P,text:O["title"],description:O["description"],image:this._resolveRelativeURL(O["image"],N),link:this._resolveRelativeURL(O["link"],N),icon:this._resolveRelativeURL(O["icon"],N),color:O["color"],textColor:O["textColor"],hoverText:O["hoverText"],caption:O["caption"],classname:O["classname"],tapeImage:O["tapeImage"],tapeRepeat:O["tapeRepeat"],eventID:O["eventID"],trackNum:O["trackNum"]});
S._bindings=O;
S.getProperty=function(A){return this._bindings[A];
};
S.setWikiInfo(U,R);
this._events.add(S);
T=true;
}Z=Z.nextSibling;
}if(T){this._fire("onAddMany",[]);
}};
Timeline.DefaultEventSource.prototype.add=function(B){this._events.add(B);
this._fire("onAddOne",[B]);
};
Timeline.DefaultEventSource.prototype.addMany=function(D){for(var C=0;
C<D.length;
C++){this._events.add(D[C]);
}this._fire("onAddMany",[]);
};
Timeline.DefaultEventSource.prototype.clear=function(){this._events.removeAll();
this._fire("onClear",[]);
};
Timeline.DefaultEventSource.prototype.getEvent=function(B){return this._events.getEvent(B);
};
Timeline.DefaultEventSource.prototype.getEventIterator=function(C,D){return this._events.getIterator(C,D);
};
Timeline.DefaultEventSource.prototype.getEventReverseIterator=function(C,D){return this._events.getReverseIterator(C,D);
};
Timeline.DefaultEventSource.prototype.getAllEventIterator=function(){return this._events.getAllIterator();
};
Timeline.DefaultEventSource.prototype.getCount=function(){return this._events.getCount();
};
Timeline.DefaultEventSource.prototype.getEarliestDate=function(){return this._events.getEarliestDate();
};
Timeline.DefaultEventSource.prototype.getLatestDate=function(){return this._events.getLatestDate();
};
Timeline.DefaultEventSource.prototype._fire=function(J,F){for(var I=0;
I<this._listeners.length;
I++){var H=this._listeners[I];
if(J in H){try{H[J].apply(H,F);
}catch(G){SimileAjax.Debug.exception(G);
}}}};
Timeline.DefaultEventSource.prototype._getBaseURL=function(D){if(D.indexOf("://")<0){var E=this._getBaseURL(document.location.href);
if(D.substr(0,1)=="/"){D=E.substr(0,E.indexOf("/",E.indexOf("://")+3))+D;
}else{D=E+D;
}}var F=D.lastIndexOf("/");
if(F<0){return"";
}else{return D.substr(0,F+1);
}};
Timeline.DefaultEventSource.prototype._resolveRelativeURL=function(C,D){if(C==null||C==""){return C;
}else{if(C.indexOf("://")>0){return C;
}else{if(C.substr(0,1)=="/"){return D.substr(0,D.indexOf("/",D.indexOf("://")+3))+C;
}else{return D+C;
}}}};
Timeline.DefaultEventSource.Event=function(E){function F(A){return(E[A]!=null&&E[A]!="")?E[A]:null;
}var G=E.id?E.id.trim():"";
this._id=G.length>0?G:Timeline.EventUtils.getNewEventID();
this._instant=E.instant||(E.end==null);
this._start=E.start;
this._end=(E.end!=null)?E.end:E.start;
this._latestStart=(E.latestStart!=null)?E.latestStart:(E.instant?this._end:this._start);
this._earliestEnd=(E.earliestEnd!=null)?E.earliestEnd:this._end;
var H=[];
if(this._start>this._latestStart){this._latestStart=this._start;
H.push("start is > latestStart");
}if(this._start>this._earliestEnd){this._earliestEnd=this._latestStart;
H.push("start is > earliestEnd");
}if(this._start>this._end){this._end=this._earliestEnd;
H.push("start is > end");
}if(this._latestStart>this._earliestEnd){this._earliestEnd=this._latestStart;
H.push("latestStart is > earliestEnd");
}if(this._latestStart>this._end){this._end=this._earliestEnd;
H.push("latestStart is > end");
}if(this._earliestEnd>this._end){this._end=this._earliestEnd;
H.push("earliestEnd is > end");
}this._eventID=F("eventID");
this._text=(E.text!=null)?SimileAjax.HTML.deEntify(E.text):"";
if(H.length>0){this._text+=" PROBLEM: "+H.join(", ");
}this._description=SimileAjax.HTML.deEntify(E.description);
this._image=F("image");
this._link=F("link");
this._title=F("hoverText");
this._title=F("caption");
this._icon=F("icon");
this._color=F("color");
this._textColor=F("textColor");
this._classname=F("classname");
this._tapeImage=F("tapeImage");
this._tapeRepeat=F("tapeRepeat");
this._trackNum=F("trackNum");
if(this._trackNum!=null){this._trackNum=parseInt(this._trackNum);
}this._wikiURL=null;
this._wikiSection=null;
};
Timeline.DefaultEventSource.Event.prototype={getID:function(){return this._id;
},isInstant:function(){return this._instant;
},isImprecise:function(){return this._start!=this._latestStart||this._end!=this._earliestEnd;
},getStart:function(){return this._start;
},getEnd:function(){return this._end;
},getLatestStart:function(){return this._latestStart;
},getEarliestEnd:function(){return this._earliestEnd;
},getEventID:function(){return this._eventID;
},getText:function(){return this._text;
},getDescription:function(){return this._description;
},getImage:function(){return this._image;
},getLink:function(){return this._link;
},getIcon:function(){return this._icon;
},getColor:function(){return this._color;
},getTextColor:function(){return this._textColor;
},getClassName:function(){return this._classname;
},getTapeImage:function(){return this._tapeImage;
},getTapeRepeat:function(){return this._tapeRepeat;
},getTrackNum:function(){return this._trackNum;
},getProperty:function(B){return null;
},getWikiURL:function(){return this._wikiURL;
},getWikiSection:function(){return this._wikiSection;
},setWikiInfo:function(D,C){this._wikiURL=D;
this._wikiSection=C;
},fillDescription:function(B){if(this._description){B.innerHTML=this._description;
}},fillWikiInfo:function(F){F.style.display="none";
if(this._wikiURL==null||this._wikiSection==null){return ;
}var G=this.getProperty("wikiID");
if(G==null||G.length==0){G=this.getText();
}if(G==null||G.length==0){return ;
}F.style.display="inline";
G=G.replace(/\s/g,"_");
var H=this._wikiURL+this._wikiSection.replace(/\s/g,"_")+"/"+G;
var E=document.createElement("a");
E.href=H;
E.target="new";
E.innerHTML=Timeline.strings[Timeline.clientLocale].wikiLinkLabel;
F.appendChild(document.createTextNode("["));
F.appendChild(E);
F.appendChild(document.createTextNode("]"));
},fillTime:function(C,D){if(this._instant){if(this.isImprecise()){C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._start)));
C.appendChild(C.ownerDocument.createElement("br"));
C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._end)));
}else{C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._start)));
}}else{if(this.isImprecise()){C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._start)+" ~ "+D.labelPrecise(this._latestStart)));
C.appendChild(C.ownerDocument.createElement("br"));
C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._earliestEnd)+" ~ "+D.labelPrecise(this._end)));
}else{C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._start)));
C.appendChild(C.ownerDocument.createElement("br"));
C.appendChild(C.ownerDocument.createTextNode(D.labelPrecise(this._end)));
}}},fillInfoBubble:function(R,O,V){var U=R.ownerDocument;
var W=this.getText();
var Y=this.getLink();
var P=this.getImage();
if(P!=null){var b=U.createElement("img");
b.src=P;
O.event.bubble.imageStyler(b);
R.appendChild(b);
}var T=U.createElement("div");
var Q=U.createTextNode(W);
if(Y!=null){var X=U.createElement("a");
X.href=Y;
X.appendChild(Q);
T.appendChild(X);
}else{T.appendChild(Q);
}O.event.bubble.titleStyler(T);
R.appendChild(T);
var S=U.createElement("div");
this.fillDescription(S);
O.event.bubble.bodyStyler(S);
R.appendChild(S);
var Z=U.createElement("div");
this.fillTime(Z,V);
O.event.bubble.timeStyler(Z);
R.appendChild(Z);
var a=U.createElement("div");
this.fillWikiInfo(a);
O.event.bubble.wikiStyler(a);
R.appendChild(a);
}};
Timeline.ClassicTheme=new Object();
Timeline.ClassicTheme.implementations=[];
Timeline.ClassicTheme.create=function(C){if(C==null){C=Timeline.getDefaultLocale();
}var D=Timeline.ClassicTheme.implementations[C];
if(D==null){D=Timeline.ClassicTheme._Impl;
}return new D();
};
Timeline.ClassicTheme._Impl=function(){this.firstDayOfWeek=0;
this.autoWidth=false;
this.autoWidthAnimationTime=500;
this.timeline_start=null;
this.timeline_stop=null;
this.ether={backgroundColors:[],highlightOpacity:50,interval:{line:{show:true,opacity:25},weekend:{opacity:30},marker:{hAlign:"Bottom",vAlign:"Right"}}};
this.event={track:{height:10,gap:2,offset:2,autoWidthMargin:1.5},overviewTrack:{offset:20,tickHeight:6,height:2,gap:1,autoWidthMargin:5},tape:{height:4},instant:{icon:Timeline.urlPrefix+"images/dull-blue-circle.png",iconWidth:10,iconHeight:10,impreciseOpacity:20,impreciseIconMargin:3},duration:{impreciseOpacity:20},label:{backgroundOpacity:50,offsetFromLine:3},highlightColors:["#FFFF00","#FFC000","#FF0000","#0000FF"],highlightLabelBackground:false,bubble:{width:250,maxHeight:0,titleStyler:function(B){B.className="timeline-event-bubble-title";
},bodyStyler:function(B){B.className="timeline-event-bubble-body";
},imageStyler:function(B){B.className="timeline-event-bubble-image";
},wikiStyler:function(B){B.className="timeline-event-bubble-wiki";
},timeStyler:function(B){B.className="timeline-event-bubble-time";
}}};
this.mouseWheel="scroll";
};
Timeline.version="pre 2.4.0";
Timeline.ajax_lib_version=SimileAjax.version;
Timeline.display_version=Timeline.version+" (with Ajax lib "+Timeline.ajax_lib_version+")";
Timeline.strings={};
Timeline.HORIZONTAL=0;
Timeline.VERTICAL=1;
Timeline._defaultTheme=null;
Timeline.getDefaultLocale=function(){return Timeline.clientLocale;
};
Timeline.create=function(J,K,L,H){if(Timeline.timelines==null){Timeline.timelines=[];
}var G=Timeline.timelines.length;
Timeline.timelines[G]=null;
var I=new Timeline._Impl(J,K,L,H,G);
Timeline.timelines[G]=I;
return I;
};
Timeline.createBandInfo=function(K){var T=("theme" in K)?K.theme:Timeline.getDefaultTheme();
var P=("decorators" in K)?K.decorators:[];
var M=("eventSource" in K)?K.eventSource:null;
var S=new Timeline.LinearEther({centersOn:("date" in K)?K.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[K.intervalUnit],pixelsPerInterval:K.intervalPixels,theme:T});
var R=new Timeline.GregorianEtherPainter({unit:K.intervalUnit,multiple:("multiple" in K)?K.multiple:1,theme:T,align:("align" in K)?K.align:undefined});
var O={showText:("showEventText" in K)?K.showEventText:true,theme:T};
if("eventPainterParams" in K){for(var N in K.eventPainterParams){O[N]=K.eventPainterParams[N];
}}if("trackHeight" in K){O.trackHeight=K.trackHeight;
}if("trackGap" in K){O.trackGap=K.trackGap;
}var Q=("overview" in K&&K.overview)?"overview":("layout" in K?K.layout:"original");
var L;
if("eventPainter" in K){L=new K.eventPainter(O);
}else{switch(Q){case"overview":L=new Timeline.OverviewEventPainter(O);
break;
case"detailed":L=new Timeline.DetailedEventPainter(O);
break;
default:L=new Timeline.OriginalEventPainter(O);
}}return{width:K.width,eventSource:M,timeZone:("timeZone" in K)?K.timeZone:0,ether:S,etherPainter:R,eventPainter:L,theme:T,decorators:P,zoomIndex:("zoomIndex" in K)?K.zoomIndex:0,zoomSteps:("zoomSteps" in K)?K.zoomSteps:null};
};
Timeline.createHotZoneBandInfo=function(J){var R=("theme" in J)?J.theme:Timeline.getDefaultTheme();
var L=("eventSource" in J)?J.eventSource:null;
var Q=new Timeline.HotZoneEther({centersOn:("date" in J)?J.date:new Date(),interval:SimileAjax.DateTime.gregorianUnitLengths[J.intervalUnit],pixelsPerInterval:J.intervalPixels,zones:J.zones,theme:R});
var P=new Timeline.HotZoneGregorianEtherPainter({unit:J.intervalUnit,zones:J.zones,theme:R,align:("align" in J)?J.align:undefined});
var N={showText:("showEventText" in J)?J.showEventText:true,theme:R};
if("eventPainterParams" in J){for(var M in J.eventPainterParams){N[M]=J.eventPainterParams[M];
}}if("trackHeight" in J){N.trackHeight=J.trackHeight;
}if("trackGap" in J){N.trackGap=J.trackGap;
}var O=("overview" in J&&J.overview)?"overview":("layout" in J?J.layout:"original");
var K;
if("eventPainter" in J){K=new J.eventPainter(N);
}else{switch(O){case"overview":K=new Timeline.OverviewEventPainter(N);
break;
case"detailed":K=new Timeline.DetailedEventPainter(N);
break;
default:K=new Timeline.OriginalEventPainter(N);
}}return{width:J.width,eventSource:L,timeZone:("timeZone" in J)?J.timeZone:0,ether:Q,etherPainter:P,eventPainter:K,theme:R,zoomIndex:("zoomIndex" in J)?J.zoomIndex:0,zoomSteps:("zoomSteps" in J)?J.zoomSteps:null};
};
Timeline.getDefaultTheme=function(){if(Timeline._defaultTheme==null){Timeline._defaultTheme=Timeline.ClassicTheme.create(Timeline.getDefaultLocale());
}return Timeline._defaultTheme;
};
Timeline.setDefaultTheme=function(B){Timeline._defaultTheme=B;
};
Timeline.loadXML=function(E,G){var F=function(A,C,B){alert("Failed to load data xml from "+E+"\n"+A);
};
var H=function(A){var B=A.responseXML;
if(!B.documentElement&&A.responseStream){B.load(A.responseStream);
}G(B,E);
};
SimileAjax.XmlHttp.get(E,F,H);
};
Timeline.loadJSON=function(url,f){var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText);
};
var fDone=function(xmlhttp){f(eval("("+xmlhttp.responseText+")"),url);
};
SimileAjax.XmlHttp.get(url,fError,fDone);
};
Timeline.getTimelineFromID=function(B){return Timeline.timelines[B];
};
Timeline.writeVersion=function(B){document.getElementById(B).innerHTML=this.display_version;
};
Timeline._Impl=function(H,I,J,G,F){SimileAjax.WindowManager.initialize();
this._containerDiv=H;
this._bandInfos=I;
this._orientation=J==null?Timeline.HORIZONTAL:J;
this._unit=(G!=null)?G:SimileAjax.NativeDateUnit;
this._starting=true;
this._autoResizing=false;
this.autoWidth=I&&I[0]&&I[0].theme&&I[0].theme.autoWidth;
this.autoWidthAnimationTime=I&&I[0]&&I[0].theme&&I[0].theme.autoWidthAnimationTime;
this.timelineID=F;
this.timeline_start=I&&I[0]&&I[0].theme&&I[0].theme.timeline_start;
this.timeline_stop=I&&I[0]&&I[0].theme&&I[0].theme.timeline_stop;
this.timeline_at_start=false;
this.timeline_at_stop=false;
this._initialize();
};
Timeline._Impl.prototype.dispose=function(){for(var B=0;
B<this._bands.length;
B++){this._bands[B].dispose();
}this._bands=null;
this._bandInfos=null;
this._containerDiv.innerHTML="";
Timeline.timelines[this.timelineID]=null;
};
Timeline._Impl.prototype.getBandCount=function(){return this._bands.length;
};
Timeline._Impl.prototype.getBand=function(B){return this._bands[B];
};
Timeline._Impl.prototype.finishedEventLoading=function(){this._autoWidthCheck(true);
this._starting=false;
};
Timeline._Impl.prototype.layout=function(){this._autoWidthCheck(true);
this._distributeWidths();
};
Timeline._Impl.prototype.paint=function(){for(var B=0;
B<this._bands.length;
B++){this._bands[B].paint();
}};
Timeline._Impl.prototype.getDocument=function(){return this._containerDiv.ownerDocument;
};
Timeline._Impl.prototype.addDiv=function(B){this._containerDiv.appendChild(B);
};
Timeline._Impl.prototype.removeDiv=function(B){this._containerDiv.removeChild(B);
};
Timeline._Impl.prototype.isHorizontal=function(){return this._orientation==Timeline.HORIZONTAL;
};
Timeline._Impl.prototype.isVertical=function(){return this._orientation==Timeline.VERTICAL;
};
Timeline._Impl.prototype.getPixelLength=function(){return this._orientation==Timeline.HORIZONTAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight;
};
Timeline._Impl.prototype.getPixelWidth=function(){return this._orientation==Timeline.VERTICAL?this._containerDiv.offsetWidth:this._containerDiv.offsetHeight;
};
Timeline._Impl.prototype.getUnit=function(){return this._unit;
};
Timeline._Impl.prototype.getWidthStyle=function(){return this._orientation==Timeline.HORIZONTAL?"height":"width";
};
Timeline._Impl.prototype.loadXML=function(J,H){var F=this;
var G=function(A,C,B){alert("Failed to load data xml from "+J+"\n"+A);
F.hideLoadingMessage();
};
var I=function(A){try{var B=A.responseXML;
if(!B.documentElement&&A.responseStream){B.load(A.responseStream);
}H(B,J);
}finally{F.hideLoadingMessage();
}};
this.showLoadingMessage();
window.setTimeout(function(){SimileAjax.XmlHttp.get(J,G,I);
},0);
};
Timeline._Impl.prototype.loadJSON=function(url,f){var tl=this;
var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText);
tl.hideLoadingMessage();
};
var fDone=function(xmlhttp){try{f(eval("("+xmlhttp.responseText+")"),url);
}finally{tl.hideLoadingMessage();
}};
this.showLoadingMessage();
window.setTimeout(function(){SimileAjax.XmlHttp.get(url,fError,fDone);
},0);
};
Timeline._Impl.prototype._autoWidthScrollListener=function(B){B.getTimeline()._autoWidthCheck(false);
};
Timeline._Impl.prototype._autoWidthCheck=function(K){var I=this;
var L=I._starting;
var J=0;
function G(){var A=I.getWidthStyle();
if(L){I._containerDiv.style[A]=J+"px";
}else{I._autoResizing=true;
var B={};
B[A]=J+"px";
SimileAjax.jQuery(I._containerDiv).animate(B,I.autoWidthAnimationTime,"linear",function(){I._autoResizing=false;
});
}}function H(){var A=0;
var C=I.getPixelWidth();
if(I._autoResizing){return ;
}for(var B=0;
B<I._bands.length;
B++){I._bands[B].checkAutoWidth();
A+=I._bandInfos[B].width;
}if(A>C||K){J=A;
G();
I._distributeWidths();
}}if(!I.autoWidth){return ;
}H();
};
Timeline._Impl.prototype._initialize=function(){var J=this._containerDiv;
var M=J.ownerDocument;
J.className=J.className.split(" ").concat("timeline-container").join(" ");
var P=(this.isHorizontal())?"horizontal":"vertical";
J.className+=" timeline-"+P;
while(J.firstChild){J.removeChild(J.firstChild);
}var I=SimileAjax.Graphics.createTranslucentImage(Timeline.urlPrefix+(this.isHorizontal()?"images/copyright-vertical.png":"images/copyright.png"));
I.className="timeline-copyright";
I.title="SIMILE Timeline - http://www.simile-widgets.org/";
SimileAjax.DOM.registerEvent(I,"click",function(){window.location="http://www.simile-widgets.org/";
});
J.appendChild(I);
this._bands=[];
for(var O=0;
O<this._bandInfos.length;
O++){var K=new Timeline._Band(this,this._bandInfos[O],O);
this._bands.push(K);
}this._distributeWidths();
for(var O=0;
O<this._bandInfos.length;
O++){var L=this._bandInfos[O];
if("syncWith" in L){this._bands[O].setSyncWithBand(this._bands[L.syncWith],("highlight" in L)?L.highlight:false);
}}if(this.autoWidth){for(var O=0;
O<this._bands.length;
O++){this._bands[O].addOnScrollListener(this._autoWidthScrollListener);
}}var N=SimileAjax.Graphics.createMessageBubble(M);
N.containerDiv.className="timeline-message-container";
J.appendChild(N.containerDiv);
N.contentDiv.className="timeline-message";
N.contentDiv.innerHTML="<img src='"+Timeline.urlPrefix+"images/progress-running.gif' /> Loading...";
this.showLoadingMessage=function(){N.containerDiv.style.display="block";
};
this.hideLoadingMessage=function(){N.containerDiv.style.display="none";
};
};
Timeline._Impl.prototype._distributeWidths=function(){var M=this.getPixelLength();
var N=this.getPixelWidth();
var L=0;
for(var T=0;
T<this._bands.length;
T++){var P=this._bands[T];
var O=this._bandInfos[T];
var S=O.width;
var K;
if(typeof S=="string"){var Q=S.indexOf("%");
if(Q>0){var R=parseInt(S.substr(0,Q));
K=Math.round(R*N/100);
}else{K=parseInt(S);
}}else{K=S;
}P.setBandShiftAndWidth(L,K);
P.setViewLength(M);
L+=K;
}};
Timeline._Impl.prototype.shiftOK=function(N,P){var O=P>0,I=P<0;
if((O&&this.timeline_start==null)||(I&&this.timeline_stop==null)||(P==0)){return(true);
}var K=false;
for(var L=0;
L<this._bands.length&&!K;
L++){K=this._bands[L].busy();
}if(K){return(true);
}if((O&&this.timeline_at_start)||(I&&this.timeline_at_stop)){return(false);
}var M=false;
for(var L=0;
L<this._bands.length&&!M;
L++){var J=this._bands[L];
if(O){M=(L==N?J.getMinVisibleDateAfterDelta(P):J.getMinVisibleDate())>=this.timeline_start;
}else{M=(L==N?J.getMaxVisibleDateAfterDelta(P):J.getMaxVisibleDate())<=this.timeline_stop;
}}if(O){this.timeline_at_start=!M;
this.timeline_at_stop=false;
}else{this.timeline_at_stop=!M;
this.timeline_at_start=false;
}return(M);
};
Timeline._Impl.prototype.zoom=function(I,N,J,L){var M=new RegExp("^timeline-band-([0-9]+)$");
var K=null;
var H=M.exec(L.id);
if(H){K=parseInt(H[1]);
}if(K!=null){this._bands[K].zoom(I,N,J,L);
}this.paint();
};


/* labellers.js */
Timeline.GregorianDateLabeller.monthNames["en"]=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
Timeline.GregorianDateLabeller.dayNames["en"]=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];


/* timeline.js */
Timeline.strings["en"]={wikiLinkLabel:"Discuss"};


/* compile-epilog.js */
(function(){var f=null;
if("SimileWidgets_onLoad" in window){if(typeof SimileWidgets_onLoad=="string"){f=eval(SimileWidgets_onLoad);
SimileWidgets_onLoad=null;
}else{if(typeof SimileWidgets_onLoad=="function"){f=SimileWidgets_onLoad;
SimileWidgets_onLoad=null;
}}}if(f!=null){f();
}})();
