var IE=navigator.userAgent.indexOf("MSIE 7.0")!=-1||navigator.userAgent.indexOf("MSIE 6.0")!=-1||navigator.userAgent.indexOf("MSIE 5.5")!=-1;var GK=navigator.userAgent.indexOf("Gecko")!=-1;function debug(b){var a=document.getElementById("debug");if(a){a.innerHTML+=b+" "}}function Animation(d,c,e,b,a){this.element=d;this.steps=c;this.delay=Math.round(e/c);this.callWhenDone=b;this.functionArg=a}Animation.prototype.setPositions=function(b,d,a,c){this.setAnimatePosition(true);this.setStartPosition(b,d);this.setEndPosition(a,c)};Animation.prototype.setAnimatePosition=function(a){this.animatePos=a};Animation.prototype.setStartPosition=function(a,b){this.x1=a;this.y1=b};Animation.prototype.setEndPosition=function(a,b){this.x2=a;this.y2=b};Animation.prototype.setSizes=function(b,d,a,c){this.setAnimateSize(true);this.setStartSize(b,d);this.setEndSize(a,c)};Animation.prototype.setAnimateSize=function(a){this.animateSize=a};Animation.prototype.setStartSize=function(a,b){this.w1=a;this.h1=b};Animation.prototype.setEndSize=function(a,b){this.w2=a;this.h2=b};Animation.prototype.setOpacities=function(b,a){this.setAnimateOpacity(true);this.setStartOpacity(b);this.setEndOpacity(a)};Animation.prototype.setAnimateOpacity=function(a){this.animateOpacity=a};Animation.prototype.setStartOpacity=function(a){this.o1=a};Animation.prototype.setEndOpacity=function(a){this.o2=a};Animation.prototype.start=function(){this.pos=0;this.move()};Animation.prototype.move=function(){var a=this.pos/this.steps;if(this.animatePos){this.element.style.left=Math.round(this.x1+a*(this.x2-this.x1))+"px";this.element.style.top=Math.round(this.y1+a*(this.y2-this.y1))+"px"}if(this.animateSize){this.element.style.width=Math.round(this.w1+a*(this.w2-this.w1))+"px";this.element.style.height=Math.round(this.h1+a*(this.h2-this.h1))+"px"}if(this.animateOpacity){this.element.style.opacity=this.o1+a*(this.o2-this.o1)}if(this.pos<this.steps){this.pos++;Timer.delayedCall(this,"move",this.delay)}else{if(this.callWhenDone){this.callWhenDone(this.functionArg)}}};var EventUtils={getRelativePosX:function(a){return a.x?a.x:a.layerX},getRelativePosX:function(a){return a.y?a.y:a.layerY}};var ElementUtils={show:function(){for(var a=0;a<arguments.length;a++){var b=document.getElementById(arguments[a]);if(b){b.style.display=""}}},hide:function(){for(var a=0;a<arguments.length;a++){var b=document.getElementById(arguments[a]);if(b){b.style.display="none"}}},getEventMouseX:function(a){return a.clientX+Math.max(document.body.scrollLeft,document.documentElement.scrollLeft)},getEventMouseY:function(a){return a.clientY+Math.max(document.body.scrollTop,document.documentElement.scrollTop)},getEventMouseElementX:function(b,a){return ElementUtils.getEventMouseX(b)-ElementUtils.getPosLeft(a)},getEventMouseElementY:function(b,a){return ElementUtils.getEventMouseY(b)-ElementUtils.getPosTop(a)},getOffsetWidth:function(a){return a.offsetWidth},getOffsetHeight:function(a){return a.offsetHeight},getRealPageHeight:function(){if(IE){return window.document.documentElement.offsetHeight}else{return window.innerHeight}},getRealPageWidth:function(){if(IE){return window.document.documentElement.offsetWidth}else{return window.innerWidth}},getOffsetLeft:function(b,a){var c=0;while(b.offsetParent&&b!=a){c+=b.offsetLeft;b=b.offsetParent}return c},getOffsetTop:function(b,a){var c=0;while(b.offsetParent&&b!=a){c+=b.offsetTop;b=b.offsetParent}return c},getPosLeft:function(a){var b=0;while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent}return b},getPosTop:function(a){var b=0;while(a.offsetParent){b+=a.offsetTop;a=a.offsetParent}return b},deleteAllChildren:function(a){while(a.hasChildNodes()){a.removeChild(a.firstChild)}},getPageWidth:function(){if(self.pageXOffset){return self.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){return document.documentElement.clientWidth}else{if(document.body){return document.body.clientWidth}}}},getPageHeight:function(){if(self.pageYOffset){return self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight}else{if(document.body){return document.body.clientHeight}}}},getPageScrollLeft:function(){if(document.documentElement!=null){return document.documentElement.scrollLeft}else{return document.body.scrollLeft}},getPageScrollTop:function(){if(document.documentElement!=null){return document.documentElement.scrollTop}else{return document.body.scrollTop}},addOption:function(c,b,d){var a=document.createElement("option");a.value=b;a.appendChild(document.createTextNode(d));c.appendChild(a)},removeAllOptions:function(a){while(a.length>0){a.remove(0)}}};var EventAttacher={map:new Array(),attach:function(d,c,b,f,a){if(d==null){window["on"+c]=EventAttacher.globalWindowHandler}else{d["on"+c]=EventAttacher.globalHandler}var e=new Object();EventAttacher.map.push(e);e.element=d;e.object=b;e.eventType=c;e.handler=f;e.args=a},attachById:function(a,e,c,f,b){var d=document.getElementById(a);if(d!=null){this.attach(d,e,c,f,b)}},attachOnWindowEvent:function(c,b,d,a){this.attach(null,c,b,d,a)},detachOnWindowEvent:function(b,a,c){detach(null,b,a,c)},detach:function(e,d,a,g){var c=0;for(var b=0;b<EventAttacher.map.length;b++){var f=EventAttacher.map[b];if(f.element==e&&f.eventType==d){c++;if(f.object==a&&f.handler==g){EventAttacher.map.splice(b,1);c--;b--}}}if(c==0){if(e==null){window["on"+d]=null}else{e["on"+d]=null}}},detachOnWindowEvent:function(b,a,c){EventAttacher.detach(null,b,a,c)},detachById:function(a,d,b,e){var c=document.getElementById(a);EventAttacher.detach(c,d,b,e)},globalWindowHandler:function(a){if(!a){a=window.event}EventAttacher.dispatch(a,null,a.type)},globalHandler:function(b){if(!b){b=window.event}var a=this;EventAttacher.dispatch(b,a,b.type)},dispatch:function(e,c,b){for(var a=0;a<EventAttacher.map.length;a++){var d=EventAttacher.map[a];if(d.element==c&&d.eventType==b){d.object[d.handler](e,d.args)}}}};function EventQueue(){this.queue=new Array()}EventQueue.prototype.register=function(b,d,a){var c=new Object();c.object=b;c.method=d;c.arg=a;this.queue.push(c)};EventQueue.prototype.invoke=function(){for(var a=0;a<this.queue.length;a++){var b=this.queue[a];b.object[b.method](b.arg)}};var Timer={map:new Array(),nextId:0,delayedFunction:function(d,b,a){var e=Timer.nextId;Timer.nextId++;var c=new Object();c.fnc=d;c.arg=a;c.tid=window.setTimeout("Timer.globalHandler("+e+")",b);Timer.map["call_"+e]=c;return e},extendFunction:function(d,c,b,a){Timer.cancelCall(d);return Timer.delayedFunction(c,b,a)},delayedCall:function(c,f,b,a){var e=Timer.nextId;Timer.nextId++;if(c==null){c=window}var d=new Object();d.object=c;d.method=f;d.arg=a;d.tid=window.setTimeout("Timer.globalHandler("+e+")",b);Timer.map["call_"+e]=d;return e},extendCall:function(e,c,d,b,a){Timer.cancelCall(e);return Timer.delayedCall(c,d,b,a)},cancelCall:function(b){var a=Timer.map["call_"+b];if(a){window.clearTimeout(a.tid);delete Timer.map["call_"+b]}},globalHandler:function(b){var a=Timer.map["call_"+b];if(a){delete Timer.map["call_"+b];if(a.fnc){a.fnc(a.arg)}else{a.object[a.method](a.arg)}}}};var ObjectUtils={toString:function(c){if(!c){return c}else{var b="";for(var a in c){b+=a+" = "+c[a]+"\n"}return b}},printObject:function(a){alert(this.toString(a))}};var StringUtils={splitByLines:function(a){return a.split(/[\n\r]+/)},removeEmptyStrings:function(b){var a=new Array();for(var c=0;c<b.length;c++){if(b[c]!=""){a.push(b[c])}}return a},splitByLinesAndRemoveEmpty:function(a){return StringUtils.removeEmptyStrings(StringUtils.splitByLines(a))},compareArrays:function(b,a){if(b.length!=a.length){return false}else{var d=b.length;for(var c=0;c<d;c++){if(b[c]!=a[c]){return false}}return true}}};var MainMenuBar={mouseOver:function(b,e,d){var c=document.getElementById(b);var a=document.getElementById(e);c.src=d;a.style.display=""},mouseOut:function(b,e,d){var c=document.getElementById(b);var a=document.getElementById(e);c.src=d;a.style.display="none"}};function openPopup(a){window.open(a,"tastPopupHelp","resizable=yes, location=no, status=no, scrollbars=yes, width=680, height=680").focus()}var EventLineGlobals={eventLines:new Array(),registerEventLine:function(a){this.eventLines[a.eventLineId]=a},toggleEvent:function(c,b){var a=EventLineGlobals.eventLines[c];if(a){a.toggleEvent(b)}},highlightEvent:function(c,b){var a=EventLineGlobals.eventLines[c];if(a){a.highlightEvent(b)}},blurEvent:function(c,b){var a=EventLineGlobals.eventLines[c];if(a){a.blurEvent(b)}}};function EventLineEvent(c,a,b){this.textId=c;this.x=a;this.text=b}function EventLineGraph(a,d,i,h,c,f,g,e,b){this.name=a;this.baseCssClass=i;this.eventCssClass=h;this.maxValue=c;this.minValue=f;this.legendValueElementId=d;this.x=g;this.y=e;this.labels=b}function EventLineZoomLevel(b,c,d,a){this.barWidth=b;this.labelsSpacing=c;this.majorLabels=d;this.viewSpan=a}function EventLineHorizontalLabel(b,a){this.label=b;this.line=a}function EventLineLabel(c,b,a){this.value=c;this.label=b;this.major=a}function EventLine(s,t,g,q,o,y,e,x,a,k,v,z,u,c,d,l,h,p,r,w,n,m,f,b,j,A,B,i){this.eventLineId=s;this.formName=t;this.graphsContainerId=g;this.selectorContainerId=q;this.selectorId=o;this.leftSelectorId=y;this.rightSelectorId=e;this.indicatorContainerId=x;this.indicatorId=a;this.indicatorLabelId=k;this.labelsContainerId=v;this.zoomLevelFieldName=u;this.offsetFieldName=c;this.viewportHeight=d;this.graphHeight=l;this.selectorOffset=h;this.selectorHeight=p;this.selectorBarWidth=A[0].barWidth;this.selectorViewSpan=A[0].viewSpan;this.slotsCount=A[0].viewSpan;this.graphWidth=A[0].viewSpan*A[0].barWidth;this.leftLabelsWidth=r;this.leftLabelsMargin=w;this.topLabelsHeight=n;this.topLabelsMargin=m;this.eventsHeight=f;this.events=b;this.graphs=j;this.zoomLevels=A;this.horizontalLegedElementId=z;this.horizontalVariableName=B;this.verticalLabels=i;this.visibleEventIndex=-1;EventAttacher.attachOnWindowEvent("load",this,"init")}EventLine.prototype.init=function(){this.containerElement=document.getElementById(this.eventLineId);this.graphsContainer=document.getElementById(this.graphsContainerId);this.selectorContainer=document.getElementById(this.selectorContainerId);this.selector=document.getElementById(this.selectorId);this.leftSelector=document.getElementById(this.leftSelectorId);this.rightSelector=document.getElementById(this.rightSelectorId);this.indicatorContainerElement=document.getElementById(this.indicatorContainerId);this.indicatorElement=document.getElementById(this.indicatorId);this.indicatorLabelElement=document.getElementById(this.indicatorLabelId);this.horizontalLegedElement=document.getElementById(this.horizontalLegedElementId);this.labelsContainer=document.getElementById(this.labelsContainerId);this.labelsContainer.style.width=(this.leftLabelsWidth+this.leftLabelsMargin+this.graphWidth)+"px";this.labelsContainer.style.height=(this.topLabelsHeight+this.topLabelsMargin+this.graphHeight+this.selectorHeight)+"px";var a=document.forms[this.formName];this.zoomLevelField=a.elements[this.zoomLevelFieldName];this.offsetField=a.elements[this.offsetFieldName];this.findMaxValue();this.initEvents();this.createSelector();this.initSlots();this.refresh(parseInt(this.zoomLevelField.value),parseInt(this.offsetField.value));this.createVerticalLabels();this.createHorizontalLabels(this.selectorOffset,0,this.topLabelsHeight+this.topLabelsMargin+this.graphHeight+this.eventsHeight+this.selectorHeight,"top",false,null);EventAttacher.attach(this.indicatorContainerElement,"mouseover",this,"graphMouseOver");EventAttacher.attach(this.indicatorContainerElement,"mouseout",this,"graphMouseOut");EventAttacher.attach(this.indicatorContainerElement,"mousemove",this,"graphMouseMove");EventAttacher.attach(this.selector,"mousedown",this,"selectorMouseDown");EventAttacher.attach(this.leftSelector,"mousedown",this,"leftSelectorMouseDown");EventAttacher.attach(this.rightSelector,"mousedown",this,"rightSelectorMouseDown")};EventLine.prototype.findMaxValue=function(){if(this.graphs&&this.graphs.length>0){this.maxValue=this.graphs[0].maxValue;for(var a=1;a<this.graphs.length;a++){if(this.maxValue<this.graphs[a].maxValue){this.maxValue=this.graphs[a].maxValue}}}};EventLine.prototype.createSelector=function(){this.selectorContainer.style.width=(this.selectorBarWidth*this.selectorViewSpan)+"px";for(var d=0;d<this.graphs.length;d++){var m=this.graphs[d];var f=m.x;var e=m.y;var c=0;for(c=0;c<f.length;d++){if(this.selectorOffset<=f[c]){break}}for(var b=0;b<this.selectorViewSpan;b++){var h=this.selectorContainer.childNodes[b];var a=h.style;var g=0;if(c<f.length&&f[c]==this.selectorOffset+b){g=e[c];c++}var l=Math.round((g/this.maxValue)*this.selectorHeight);a.position="absolute";a.left=(b*this.selectorBarWidth)+"px";a.width=(this.selectorBarWidth)+"px";a.top=(this.selectorHeight-l)+"px";a.height=(l)+"px";h.className=m.baseCssClass}}};EventLine.prototype.initSlots=function(){for(var b=0;b<this.graphs.length;b++){var d=this.graphs[b];var c=d.slots=new Array();for(var a=0;a<this.slotsCount;a++){var e=this.graphsContainer.childNodes[b*this.slotsCount+a];e.style.position="absolute";e.style.height="0px";e.style.className=d.baseCssClass;c.push(e)}}};EventLine.prototype.initEvents=function(){this.eventsLookup=new Array();for(var a=0;a<this.events.length;a++){var b=this.events[a];this.eventsLookup[b.x]=b}};EventLine.prototype.refresh=function(o,d){if(!this.graphs||this.graphs.length==0){return}this.offset=d;if(o!=this.zoomLevel){this.zoomLevel=o;var A=this.zoomLevels[this.zoomLevel].viewSpan;for(var w=0;w<this.graphs.length;w++){var n=this.graphs[w].slots;for(var u=0;u<A;u++){n[u].style.display="block"}for(var u=A;u<this.slotsCount;u++){n[u].style.display="none"}}}var p=this.zoomLevels[this.zoomLevel];if(this.offset<this.selectorOffset){this.offset=this.selectorOffset}if(this.offset+p.viewSpan>this.selectorOffset+this.selectorViewSpan){this.offset=this.selectorOffset+this.selectorViewSpan-p.viewSpan}this.zoomLevelField.value=this.zoomLevel;this.offsetField.value=this.offset;this.graphsContainer.style.width=(p.barWidth*p.viewSpan)+"px";this.graphsContainer.style.height=(this.graphHeight)+"px";this.indicatorContainerElement.style.width=(p.barWidth*p.viewSpan)+"px";this.indicatorElement.style.width=(p.barWidth)+"px";this.selector.style.display="block";this.leftSelector.style.display="block";this.rightSelector.style.display="block";this.redrawSelector(this.offset,p.viewSpan);var a=p.barWidth;var e=p.viewSpan;var g=a>2?a-1:a;for(var w=0;w<this.graphs.length;w++){var b=this.graphs[w];var n=b.slots;var m=b.x;var h=b.y;var z=b.labels;var l=b.currentLabels=new Array();var u=0;for(u=0;u<m.length;u++){if(this.offset<=m[u]){break}}for(var r=0;r<n.length;r++){var c=n[r];var f=c.style;var q=0;if(u<m.length&&m[u]==this.offset+r){q=h[u];l.push(z[u]);u++}else{l.push("")}var t=Math.round((q/this.viewportHeight)*this.graphHeight);if(t>this.graphHeight){t=this.graphHeight}f.top=(this.graphHeight-t)+"px";f.height=(t)+"px";f.left=(r*a)+"px";f.width=(g)+"px";c.className=this.eventsLookup[this.offset+r]?b.eventCssClass:b.baseCssClass}}for(var w=0;w<this.events.length;w++){var s=this.events[w];if(this.offset<=s.x&&s.x<this.offset+e){var v=s.element;if(!v){v=s.element=document.createElement("table");v.cellSpacing=0;v.cellPadding=0;v.border=0;v.style.position="absolute";v.style.height=this.eventsHeight+"px";v.style.width=this.eventsHeight+"px";v.className="event-line-event-label";v.insertRow(0).insertCell(0).innerHTML=(w+1);this.graphsContainer.appendChild(v);EventAttacher.attach(v,"mouseover",this,"eventMouseOver",w);EventAttacher.attach(v,"mouseout",this,"eventMouseOut",w)}v.style.left=(a*(s.x-this.offset))+"px";v.style.top=(this.graphHeight)+"px"}else{if(s.element){this.graphsContainer.removeChild(s.element);EventAttacher.detach(v,"mouseover",this,"eventMouseOver");EventAttacher.detach(v,"mouseout",this,"eventMouseOut");s.element=null}}}if(this.horizontalLabels){for(var w=0;w<this.horizontalLabels.length;w++){this.labelsContainer.removeChild(this.horizontalLabels[w].label);this.labelsContainer.removeChild(this.horizontalLabels[w].line)}}this.horizontalLabels=new Array();this.createHorizontalLabels(this.offset,this.zoomLevel,0,"bottom",true,this.horizontalLabels)};EventLine.prototype.blurEvent=function(a){var b=this.events[a];b.element.className="event-line-event-label";document.getElementById(b.textId).className="event-line-event"};EventLine.prototype.eventMouseOut=function(b,a){this.blurEvent(a)};EventLine.prototype.highlightEvent=function(a){var b=this.events[a];b.element.className="event-line-event-label-selected";document.getElementById(b.textId).className="event-line-event-selected"};EventLine.prototype.eventMouseOver=function(b,a){this.highlightEvent(a)};EventLine.prototype.createHorizontalLabels=function(f,m,s,a,k,g){var h=100;var j=this.zoomLevels[m].viewSpan;var e=this.zoomLevels[m].labelsSpacing;var l=this.zoomLevels[m].barWidth;var t=this.zoomLevels[m].majorLabels;var r=e*Math.ceil(f/e)-f;for(var p=r;p<j;p+=e){var c=((p*l)+l/2)+this.leftLabelsWidth+this.leftLabelsMargin;var n=p+f;var o=n%t==0;var d=null;if(k){d=document.createElement("div");d.className=o?"event-line-grid-major":"event-line-grid-major";d.style.position="absolute";d.style.top=(this.topLabelsHeight+this.topLabelsMargin)+"px";d.style.left=c+"px";d.style.width="1px";d.style.height=this.graphHeight+"px"}var b=document.createElement("table");var q=b.insertRow(0).insertCell(0);b.style.position="absolute";b.style.top=s+"px";b.style.left=(c-h/2)+"px";q.style.width=h+"px";q.style.height=this.topLabelsHeight+"px";q.style.textAlign="center";q.style.verticalAlign=a;q.style.fontWeight=o?"bold":"normal";q.innerHTML=n;if(g){g.push(new EventLineHorizontalLabel(b,d))}this.labelsContainer.appendChild(b);if(k){this.labelsContainer.appendChild(d)}}};EventLine.prototype.createVerticalLabels=function(){var a=25;var f=this.zoomLevels[this.zoomLevel];var j=f.barWidth*f.viewSpan;for(var d=0;d<this.verticalLabels.length;d++){var h=this.verticalLabels[d];if(h.labelElement){this.labelsContainer.removeChild(h.labelElement)}if(h.lineElement){this.labelsContainer.removeChild(h.lineElement)}var k=Math.round((h.value/this.viewportHeight)*this.graphHeight);var g=this.graphHeight+this.topLabelsHeight+this.topLabelsMargin-k;var c=document.createElement("div");c.className=h.major?"event-line-grid-major":"event-line-grid-major";c.style.position="absolute";c.style.top=g+"px";c.style.left=(this.leftLabelsWidth+this.leftLabelsMargin)+"px";c.style.height="1px";c.style.width=j+"px";var e=document.createElement("table");var b=e.insertRow(0).insertCell(0);e.style.position="absolute";e.style.top=(g-a/2)+"px";e.style.left="0px";b.style.width=this.leftLabelsWidth+"px";b.style.height=a+"px";b.style.textAlign="right";b.style.fontWeight=h.major?"bold":"normal";b.innerHTML=h.label;this.labelsContainer.appendChild(e);this.labelsContainer.appendChild(c)}};EventLine.prototype.redrawSelectorUsingLeftRight=function(b,a){this.selector.style.left=b+"px";this.selector.style.width=(a-b)+"px";this.leftSelector.style.left=b+"px";this.leftSelector.style.width="2px";this.leftSelector.className="event-line-selector-handle";this.rightSelector.style.left=(a-2)+"px";this.rightSelector.style.width="2px";this.rightSelector.className="event-line-selector-handle"};EventLine.prototype.redrawSelector=function(d,b){var c=this.selectorBarWidth*(d-this.selectorOffset);var a=c+this.selectorBarWidth*b;this.redrawSelectorUsingLeftRight(c,a)};EventLine.prototype.setLegendStatus=function(b){this.indicatorElement.style.display=b?"":"none";this.horizontalLegedElement.style.display=b?"":"none";for(var c=0;c<this.graphs.length;c++){var d=this.graphs[c];var a=document.getElementById(d.legendValueElementId);a.innerHTML=""}};EventLine.prototype.graphMouseOver=function(a){this.setLegendStatus(true)};EventLine.prototype.graphMouseOut=function(a){this.setLegendStatus(false)};EventLine.prototype.graphMouseMove=function(f){var b=ElementUtils.getEventMouseElementX(f,this.indicatorContainerElement);if(b<0){b=0}if(b>this.graphWidth){b=this.graphWidth}var e=this.zoomLevels[this.zoomLevel].barWidth;var h=Math.floor(b/e);for(var c=0;c<this.graphs.length;c++){var g=this.graphs[c];var d=g.currentLabels[h];var a=document.getElementById(g.legendValueElementId);if(d==""){a.innerHTML=""}else{a.innerHTML=": "+d}}this.horizontalLegedElement.innerHTML=this.horizontalVariableName+": "+(h+this.offset);this.indicatorElement.style.left=(h*e)+"px";this.indicatorLabelElement.style.left=(h*e)+"px"};EventLine.prototype.getSelectorWidthPx=function(){return this.selectorBarWidth*this.zoomLevels[this.zoomLevel].viewSpan};EventLine.prototype.getSelectorLeftPx=function(){return this.selectorBarWidth*(this.offset-this.selectorOffset)};EventLine.prototype.getSelectorRightPx=function(){return this.getSelectorLeftPx()+this.getSelectorWidthPx()};EventLine.prototype.selectorMouseDown=function(a){this.startDragX=a.clientX;EventAttacher.attach(document,"mouseup",this,"selectorMouseUp");EventAttacher.attach(document,"mousemove",this,"selectorMouseMove")};EventLine.prototype.selectorMouseMove=function(c){var a=c.clientX-this.startDragX;var d=this.zoomLevels[this.zoomLevel].viewSpan;var b=this.selectorOffset+this.selectorViewSpan;var e=Math.round(this.offset+a/this.selectorBarWidth);if(e<this.selectorOffset){e=this.selectorOffset}if(b<e+d){e=b-d}this.redrawSelector(e,d)};EventLine.prototype.selectorMouseUp=function(c){var a=c.clientX-this.startDragX;var d=this.zoomLevels[this.zoomLevel].viewSpan;var b=this.selectorOffset+this.selectorViewSpan;var e=Math.round(this.offset+a/this.selectorBarWidth);if(e<this.selectorOffset){e=this.selectorOffset}if(b<e+d){e=b-d}this.refresh(this.zoomLevel,e);EventAttacher.detach(document,"mouseup",this,"selectorMouseUp");EventAttacher.detach(document,"mousemove",this,"selectorMouseMove")};EventLine.prototype.leftSelectorMouseDown=function(a){EventAttacher.attach(document,"mouseup",this,"leftSelectorMouseUp");EventAttacher.attach(document,"mousemove",this,"leftSelectorMouseMove")};EventLine.prototype.leftSelectorMouseMove=function(b){var a=ElementUtils.getEventMouseElementX(b,this.selectorContainer);var c=this.getSelectorRightPx();if(a<0){a=0}if(a>c){a=c}this.redrawSelectorUsingLeftRight(a,c)};EventLine.prototype.leftSelectorMouseUp=function(e){var f=this.getSelectorRightPx();var d=ElementUtils.getEventMouseElementX(e,this.selectorContainer);var c=f-d;if(d<0){d=0}if(d>f){d=f}var g=Math.round(this.selectorOffset+d/this.selectorBarWidth);var b=Math.round(c/this.selectorBarWidth);var a=this.getClosestZoomLevel(b);this.refresh(a,g);EventAttacher.detach(document,"mouseup",this,"leftSelectorMouseUp");EventAttacher.detach(document,"mousemove",this,"leftSelectorMouseMove")};EventLine.prototype.rightSelectorMouseDown=function(a){EventAttacher.attach(document,"mouseup",this,"rightSelectorMouseUp");EventAttacher.attach(document,"mousemove",this,"rightSelectorMouseMove")};EventLine.prototype.rightSelectorMouseMove=function(d){var e=this.getSelectorLeftPx();var a=ElementUtils.getEventMouseElementX(d,this.selectorContainer);if(a<e){a=e}if(a>this.selectorWidth){a=this.graphWidth}var c=a-e;var b=Math.round(c/this.selectorBarWidth);this.redrawSelector(this.offset,b)};EventLine.prototype.rightSelectorMouseUp=function(e){var b=ElementUtils.getEventMouseElementX(e,this.selectorContainer);var f=this.getSelectorLeftPx();if(b<f){b=f}if(b>this.selectorWidth){b=this.graphWidth}var d=b-f;var c=Math.round(d/this.selectorBarWidth);var a=this.getClosestZoomLevel(c);var g=Math.round(b/this.selectorBarWidth+this.selectorOffset)-this.zoomLevels[a].viewSpan;this.refresh(a,g);EventAttacher.detach(document,"mouseup",this,"rightSelectorMouseUp");EventAttacher.detach(document,"mousemove",this,"rightSelectorMouseMove")};EventLine.prototype.getClosestZoomLevel=function(a){var b=Math.abs(this.zoomLevels[0].viewSpan-a);var e=0;for(var c=1;c<this.zoomLevels.length;c++){var d=Math.abs(this.zoomLevels[c].viewSpan-a);if(d<b){b=d;e=c}}return e};EventLine.prototype.setEventVisibility=function(c,e){var d=this.events[c];var a=document.getElementById(d.eventElementId);var b=document.getElementById(d.markElementId);if(e){a.style.display="block";b.className="event-line-mark-pressed"}else{a.style.display="none";b.className="event-line-mark"}};EventLine.prototype.toggleEvent=function(a){if(!this.events){return}if(a<0||this.events.length<=a){return}if(this.visibleEventIndex!=-1){this.setEventVisibility(this.visibleEventIndex,false)}if(this.visibleEventIndex!=a){this.setEventVisibility(a,true);this.visibleEventIndex=a}else{this.visibleEventIndex=-1}};var MapsGlobal={MAP_TOOL_ZOOM:1,MAP_TOOL_PAN:2,MAP_TOOL_SELECTOR:3,maps:new Array(),registerMap:function(f,K,s,d,r,I,b,t,B,k,z,j,l,i,q,O,A,c,E,G,M,v,L,H,w,n,F,u,p,Q,y,h,e,o,N,g,D,P,a,m){var x=new Map();this.maps[f]=x;x.fixedSize=K;x.mapControlId=I;x.tilesContainerId=b;x.formName=s;x.actionNameFieldName=d;x.actionParamFieldName=r;x.fieldNameX1=B;x.fieldNameY1=k;x.fieldNameX2=z;x.fieldNameY2=j;x.fieldNameZoomHistory=l;x.debug=location.href.indexOf("?debug-map")!=-1;x.zoomLevels=t;x.points=n;x.lines=F;x.bubbleId=u;x.bubbleTextId=p;x.scaleBarIndicatorId=y;x.scaleTextIndicatorId=Q;x.pointsSelectId=m;if(h&&e){var J=new Map();J.fixedSize=true;J.mapControlId=h;J.tilesContainerId=e;J.mainMap=x;J.zoomLevels=[o];J.zoomLevel=0;J.blockMove=false;x.miniMap=J;x.fieldNameMiniMapVisibility=g;x.miniMapPosition=D;x.miniMapWidth=P;x.miniMapHeight=a;if(N){x.miniMapToggleId=N}}if(i){var C=new MapButtonGoBack(i,x);x.registerGoBackButton(C)}if(q){var C=new MapButtonGoForward(q,x);x.registerGoForwardButton(C)}if(O){new MapButtonZoomPlus(O,x)}if(A){new MapButtonZoomMinus(A,x)}if(c&&E&&G&&t.length>1){new MapZoomSlider(c,E,G,x)}if(M&&v){new MapZoomAndPanButtons(M,v,s,L,x)}if(H&&w){new MapZoomSize(H,s,w,x)}EventAttacher.attachOnWindowEvent("load",x,"init",false)},setMouseModeToPan:function(a){var b=MapsGlobal.maps[a];if(b){b.setMouseModeToPan()}},setMouseModeToZoom:function(a){var b=MapsGlobal.maps[a];if(b){b.setMouseModeToZoom()}},zoomPlus:function(a){var b=MapsGlobal.maps[a];if(b){b.zoomPlus()}},zoomMinus:function(a){var b=MapsGlobal.maps[a];if(b){b.zoomMinus()}},zoomGoBack:function(a){var b=MapsGlobal.maps[a];if(b){b.zoomGoBack()}},zoomGoForward:function(a){var b=MapsGlobal.maps[a];if(b){b.zoomGoForward()}},zoomCanGoBack:function(a){var b=MapsGlobal.maps[a];if(b){return b.zoomCanGoBack()}return false},zoomCanGoForward:function(a){var b=MapsGlobal.maps[a];if(b){return b.zoomCanGoForward()}return false},setSize:function(b,c,a){var d=MapsGlobal.maps[b];if(d){d.setSize(c,a)}},invokeAction:function(a,c){var b=MapsGlobal.maps[mapId];if(b){b.invokeAction(a,c)}}};var MapUtils={computeLength:function(a,b){return Math.sqrt(MapUtils.computeLengthSquared(a,b))},computeLengthSquared:function(a,b){return a*a+b*b},computeDistancePointLine:function(e,c,b,f,a,d){return Math.abs((a-b)*(f-c)-(b-e)*(d-f))/MapUtils.computeLength(a-b,d-f)},computeAngle:function(d,i,c,h,b,g){var f=d-c;var e=i-h;var a=b-c;var j=g-h;return Math.acos((f*a+e*j)/(MapUtils.computeLength(f,e)*MapUtils.computeLength(a,j)))},falseFnc:function(){return false}};function Map(){this.zoomLevel=0;this.tilesNameNumberLength=2;this.zoomHistory=[];this.zoomHistoryPos=-1;this.zoomHistoryMax=100;this.mouseMode=MapsGlobal.MAP_TOOL_PAN;this.selectorBorderWidth=1;this.selectorColor="White";this.selectorOpacity=30;this.selectorBorder=30;this.blockMove=false;this.initListeners=new EventQueue();this.onZoomChange=null;this.updateFieldId=null}function MapZoomState(b,a,d,c){this.x1=b;this.y1=d;this.x2=a;this.y2=c}function MapTile(a){this.img=a;this.points=null;this.url="";this.oldUrl=""}function PointOfInterest(a,f,d,c,e,b){this.x=a;this.y=f;this.showAtZoom=d;this.label=c;this.text=e;this.symbols=b}function MapLine(b,d,a,c,f,e){this.x1=b;this.y1=d;this.x2=a;this.y2=c;this.symbolSpacing=f;this.symbol=e}function MapSymbol(c,b,d,a,f,e){this.name=c;this.url=b;this.width=d;this.height=a;this.centerX=f;this.centerY=e}function MapZoomLevel(h,d,c,a,f,e,g,b){this.tileWidth=h;this.tileHeight=d;this.bottomLeftTileX=c;this.bottomLeftTileY=a;this.tilesNumX=f;this.tilesNumY=e;this.scale=g;this.tilesDir=b}MapZoomLevel.prototype.getMapX1=function(){return this.bottomLeftTileX};MapZoomLevel.prototype.getMapX2=function(){return this.bottomLeftTileX+this.tilesNumX*this.tileWidth*this.scale};MapZoomLevel.prototype.getMapY1=function(){return this.bottomLeftTileY};MapZoomLevel.prototype.getMapY2=function(){return this.bottomLeftTileY+this.tilesNumY*this.tileHeight*this.scale};Map.prototype.getVportRatio=function(){return this.getVportWidth()/this.getVportHeight()};Map.prototype.getVportWidth=function(){return this.vportWidth};Map.prototype.getVportHeight=function(){return this.vportHeight};Map.prototype.fromVportToRealX=function(a){return this.zoomLevels[this.zoomLevel].bottomLeftTileX+this.bottomLeftTileCol*this.getTileRealWidth()+this.fromPxToReal(a-this.bottomLeftTileVportX)};Map.prototype.fromVportToRealY=function(a){return this.zoomLevels[this.zoomLevel].bottomLeftTileY+this.bottomLeftTileRow*this.getTileRealHeight()+this.fromPxToReal(this.vportHeight-a-this.bottomLeftTileVportY)};Map.prototype.fromRealToVportX=function(a){return this.fromRealToPx(a-(this.zoomLevels[this.zoomLevel].bottomLeftTileX+this.bottomLeftTileCol*this.getTileRealWidth()))+this.bottomLeftTileVportX};Map.prototype.fromRealToVportY=function(a){return -this.fromRealToPx(a-(this.zoomLevels[this.zoomLevel].bottomLeftTileY+this.bottomLeftTileRow*this.getTileRealHeight()))-this.bottomLeftTileVportY+this.vportHeight};Map.prototype.getMapX1=function(){return this.fromVportToRealX(0)};Map.prototype.getMapY2=function(){return this.fromVportToRealY(0)};Map.prototype.getMapX2=function(){return this.fromVportToRealX(this.getVportWidth())};Map.prototype.getMapY1=function(){return this.fromVportToRealY(this.getVportHeight())};Map.prototype.getCenterY=function(){return this.fromVportToRealY(0.5*this.getVportHeight())};Map.prototype.getCenterX=function(){return this.fromVportToRealX(0.5*this.getVportWidth())};Map.prototype.getTileRealWidth=function(){return this.fromPxToReal(this.getTileWidth())};Map.prototype.getTileRealHeight=function(){return this.fromPxToReal(this.getTileHeight())};Map.prototype.getTileWidth=function(){return this.zoomLevels[this.zoomLevel].tileWidth};Map.prototype.getTileHeight=function(){return this.zoomLevels[this.zoomLevel].tileHeight};Map.prototype.fromPxToReal=function(a){return a*this.zoomLevels[this.zoomLevel].scale};Map.prototype.fromRealToPx=function(a){return a/this.zoomLevels[this.zoomLevel].scale};Map.prototype.roundAndCapScale=function(a){a=Math.round(a);if(a>this.scaleMax){a=this.scaleMax}if(a<this.scaleMin){a=this.scaleMin}return a};Map.prototype.isPointInsideVport=function(b,a){return 0<=b&&b<this.getVportWidth()&&0<=a&&a<this.getVportHeight()};Map.prototype.getClosestZoomLevel=function(d){var e=-1;var a=0;for(var b=0;b<this.zoomLevels.length;b++){var c=Math.abs(this.zoomLevels[b].scale-d);if(e==-1||c<a){e=b;a=c}}return e};Map.prototype.drawSelector=function(c,e,b,d){c=Math.round(c);e=Math.round(e);b=Math.round(b);d=Math.round(d);if(c>b){var a=b;b=c;c=a}if(e>d){var f=d;d=e;e=f}b-=3*this.selectorBorderWidth;d-=3*this.selectorBorderWidth;if(b<c){b=c}if(d<e){d=e}this.selector.style.display="block";this.selector.style.left=(c)+"px";this.selector.style.top=(e)+"px";this.selector.style.width=(b-c)+"px";this.selector.style.height=(d-e)+"px"};Map.prototype.hideSelector=function(){this.selector.style.display="none"};Map.prototype.hideSelector.getSelectorX1=function(){return this.selectorX1};Map.prototype.hideSelector.getSelectorY1=function(){return this.selectorY1};Map.prototype.hideSelector.getSelectorX2=function(){return this.selectorX2};Map.prototype.hideSelector.getSelectorY2=function(){return this.selectorY2};Map.prototype.formatMetersForDisplay=function(a){if(a>=1000){return(a/1000)+"&nbsp;km"}else{return(a)+"&nbsp;m"}};Map.prototype.updateScaleIndicator=function(){if(!this.hasScaleIndicator){return}var a=this.fromPxToReal(100);var b=Math.floor(Math.log(a)/Math.LN10);var c=Math.pow(10,b);a=Math.floor(a/c)*c;var d=this.fromRealToPx(a);this.scaleBarIndicator.style.width=Math.round(d)+"px";this.scaleTextIndicator.innerHTML=a+"&deg;"};Map.prototype.scaleIndicatorInit=function(){this.scaleBarIndicator=document.getElementById(this.scaleBarIndicatorId);this.scaleTextIndicator=document.getElementById(this.scaleTextIndicatorId);this.hasScaleIndicator=this.scaleBarIndicator&&this.scaleTextIndicator};Map.prototype.mapStartDrag=function(a){this.hideLabels(true);if(this.debug){this.disableDebugShowCoordinates()}EventAttacher.attach(document,"mousemove",this,"mapMouseMove");EventAttacher.attach(document,"mouseup",this,"mapStopDrag");this.draggingStartX=ElementUtils.getEventMouseElementX(a,this.mapControl);this.draggingStartY=ElementUtils.getEventMouseElementY(a,this.mapControl)};Map.prototype.mapStopDrag=function(b){EventAttacher.detach(document,"mousemove",this,"mapMouseMove");EventAttacher.detach(document,"mouseup",this,"mapStopDrag");var a=ElementUtils.getEventMouseElementX(b,this.mapControl);var c=ElementUtils.getEventMouseElementY(b,this.mapControl);switch(this.mouseMode){case MapsGlobal.MAP_TOOL_ZOOM:this.hideSelector();if(this.draggingStartX==a&&this.draggingStartY==c){return}this.zoomMapTo(this.fromVportToRealX(this.draggingStartX),this.fromVportToRealY(this.draggingStartY),this.fromVportToRealX(a),this.fromVportToRealY(c),true,true,false,true);break;case MapsGlobal.MAP_TOOL_PAN:case MapsGlobal.MAP_TOOL_SELECTOR:this.updatePoints();this.updateLines(false);this.updateMainMap();this.updateMiniMap();break}if(this.debug){this.enableDebugShowCoordinates()}};Map.prototype.mapMouseMove=function(d){var a=ElementUtils.getEventMouseElementX(d,this.mapControl);var e=ElementUtils.getEventMouseElementY(d,this.mapControl);switch(this.mouseMode){case MapsGlobal.MAP_TOOL_PAN:case MapsGlobal.MAP_TOOL_SELECTOR:var c=(a-this.draggingStartX);var b=-(e-this.draggingStartY);this.draggingStartX=a;this.draggingStartY=e;this.panMapBy(c,b);if(this.mouseMode==MapsGlobal.MAP_TOOL_SELECTOR){this.selectorX1=this.fromVportToRealX(this.selectorVportX1);this.selectorY1=this.fromVportToRealX(this.selectorVportY1);this.selectorX2=this.fromVportToRealX(this.selectorVportX2);this.selectorY2=this.fromVportToRealX(this.selectorVportY2)}break;case MapsGlobal.MAP_TOOL_ZOOM:this.drawSelector(this.draggingStartX,this.draggingStartY,a,e);break}};Map.prototype.mapMouseWheel=function(a){if(a.wheelDelta<0){this.zoomPlus()}else{this.zoomMinus()}a.cancelBubble=true;return false};Map.prototype.zoomPlus=function(a){this.changeZoomLevel(this.zoomLevel+1,a)};Map.prototype.zoomMinus=function(a){this.changeZoomLevel(this.zoomLevel-1,a)};Map.prototype.registerZoomSlider=function(a){this.zoomSlider=a};Map.prototype.notifyZoomChange=function(){if(this.zoomSlider){this.zoomSlider.zoomChanged()}};Map.prototype.changeZoomLevel=function(b,c){if(b<0){b=0}if(this.zoomLevels.length<=b){b=this.zoomLevels.length-1}if(b==this.zoomLevel){return}var a=this.getCenterX();var d=this.getCenterY();this.setZoomAndCenterTo(b,a,d,true,c,true,true,true)};Map.prototype.zoomMapToInternal=function(t,c,q,a,o,l,n,k,s){if(t>q){var u=t;t=q;q=u}if(c>a){var u=c;c=a;a=u}var v=this.getVportWidth();var e=this.getVportHeight();if((q-t)/(a-c)>v/e){var g=(q-t)*(e/v);var b=(c+a)/2;c=b-g/2;a=b+g/2}else{var h=(a-c)*(v/e);var d=(t+q)/2;t=d-h/2;q=d+h/2}var m=(q-t)/v;var r;var f=-1;for(var p=0;p<this.zoomLevels.length;p++){var j=Math.abs(this.zoomLevels[p].scale-m);if(f==-1||j<r){r=j;f=p}}this.setZoomAndCenterTo(f,(t+q)/2,(c+a)/2,l,n,k,s,true)};Map.prototype.zoomMapTo=function(d,g,c,f,b,h,a,e){if(this.mouseMode==MapsGlobal.MAP_TOOL_SELECTOR){return}this.zoomMapToInternal(d,g,c,f,0,b,h,a,e)};Map.prototype.positionBySelector=function(d,g,c,f,b,h,a,e){if(this.mouseMode!=MapsGlobal.MAP_TOOL_SELECTOR){return}this.selectorX1=d;this.selectorY1=g;this.selectorX2=c;this.selectorY2=f;this.zoomMapToInternal(d,g,c,f,this.selectorBorder,b,h,a,e)};Map.prototype.centerTo=function(b,f,c,e,a,d){this.setZoomAndCenterTo(this.zoomLevel,b,f,c,e,a,d,true)};Map.prototype.setZoomAndCenterTo=function(b,l,j,c,o,d,k,h){this.hideLabels(h);if(b<0){b=0}if(this.zoomLevels.length<=b){b=this.zoomLevels.length-1}if(this.zoomLevel!=b){this.zoomLevel=b;this.updateScaleIndicator()}var f=this.zoomLevels[this.zoomLevel];var m=f.scale*this.vportWidth;var a=f.scale*this.vportHeight;var e=f.scale*f.tileWidth;var n=f.scale*f.tileHeight;if(f.tilesNumX*e<=m){this.bottomLeftTileCol=0;this.bottomLeftTileVportX=Math.round((m-f.tilesNumX*e)/f.scale/2)}else{l=Math.min(l,f.getMapX2()-m/2);l=Math.max(l,f.getMapX1()+m/2);var i=l-m/2;this.bottomLeftTileCol=Math.floor((i-f.bottomLeftTileX)/e);this.bottomLeftTileVportX=Math.round(((this.bottomLeftTileCol*e+f.bottomLeftTileX)-i)/f.scale)}if(f.tilesNumY*n<=a){this.bottomLeftTileRow=0;this.bottomLeftTileVportY=Math.round((a-f.tilesNumY*n)/f.scale/2)}else{j=Math.min(j,f.getMapY2()-a/2);j=Math.max(j,f.getMapY1()+a/2);var g=j-a/2;this.bottomLeftTileRow=Math.floor((g-f.bottomLeftTileY)/n);this.bottomLeftTileVportY=Math.round(((this.bottomLeftTileRow*n+f.bottomLeftTileY)-g)/f.scale)}this.positionTiles();this.updatePoints();this.updateLines(true);if(this.mouseMode==MapsGlobal.MAP_TOOL_SELECTOR){this.selectorVportX1=this.fromRealToVportX(this.selectorX1);this.selectorVportY1=this.fromRealToVportY(this.selectorY1);this.selectorVportX2=this.fromRealToVportX(this.selectorX2);this.selectorVportY2=this.fromRealToVportY(this.selectorY2);this.drawSelector(this.selectorVportX1,this.selectorVportY1,this.selectorVportX2,this.selectorVportY2)}if(d){this.updateMainMap()}if(k){this.updateMiniMap()}if(c){this.zoomSaveState()}if(o){this.notifyZoomChange()}};Map.prototype.show=function(){this.mapControl.style.visibility="visible"};Map.prototype.hide=function(){this.mapControl.style.visibility="hidden"};Map.prototype.isVisible=function(){return this.mapControl.style.visibility!="hidden"};Map.prototype.initMiniMap=function(){if(!this.miniMap){return}this.miniMapToggle=document.getElementById(this.miniMapToggleId);if(this.miniMapToggle){EventAttacher.attach(this.miniMapToggle,"click",this,"hideShowMiniMap")}this.fieldMiniMapVisibility=document.forms[this.formName].elements[this.fieldNameMiniMapVisibility]};Map.prototype.getCssClassForMinimapToggleButton=function(a){if(a){if(this.miniMapPosition=="top left"){return"minimap-toggle-nw-expanded"}if(this.miniMapPosition=="top right"){return"minimap-toggle-ne-expanded"}if(this.miniMapPosition=="bottom left"){return"minimap-toggle-sw-expanded"}if(this.miniMapPosition=="bottom right"){return"minimap-toggle-se-expanded"}}else{if(this.miniMapPosition=="top left"){return"minimap-toggle-nw-collapsed"}if(this.miniMapPosition=="top right"){return"minimap-toggle-ne-collapsed"}if(this.miniMapPosition=="bottom left"){return"minimap-toggle-sw-collapsed"}if(this.miniMapPosition=="bottom right"){return"minimap-toggle-se-collapsed"}}};Map.prototype.getCssClassForMinimap=function(){if(this.miniMapPosition=="top left"){return"minimap-control-nw"}if(this.miniMapPosition=="top right"){return"minimap-control-ne"}if(this.miniMapPosition=="bottom left"){return"minimap-control-sw"}if(this.miniMapPosition=="bottom right"){return"minimap-control-se"}};Map.prototype.hideShowMiniMap=function(){if(!this.miniMap){return}if(this.miniMap.isVisible()){var b=function(a){a.hide()};var c=new Animation(this.miniMap.mapControl,10,400,b,this.miniMap);c.setOpacities(1,0);c.start();this.fieldMiniMapVisibility.value="false";this.miniMapToggle.className=this.getCssClassForMinimapToggleButton(false)}else{this.miniMap.show();var c=new Animation(this.miniMap.mapControl,10,400);c.setOpacities(0,1);c.start();this.fieldMiniMapVisibility.value="true";this.miniMapToggle.className=this.getCssClassForMinimapToggleButton(true)}};Map.prototype.updateMiniMap=function(){if(!this.miniMap){return}this.miniMap.positionBySelector(this.getMapX1(),this.getMapY1(),this.getMapX2(),this.getMapY2(),false,false,false,false)};Map.prototype.updateMainMap=function(){if(!this.mainMap){return}this.mainMap.centerTo(this.getCenterX(),this.getCenterY(),false,false,false,false)};Map.prototype.saveState=function(){if(this.hasHiddenExtentsFields){this.fieldX1.value=this.getMapX1();this.fieldX2.value=this.getMapX2();this.fieldY1.value=this.getMapY1();this.fieldY2.value=this.getMapY2()}};Map.prototype.positionTiles=function(){var h=this.getTileWidth();var a=this.getTileHeight();this.saveState();for(var d=0;d<=this.visibleRows;d++){for(var c=0;c<=this.visibleCols;c++){var e=this.tilesMap[d][c];var b=this.bottomLeftTileCol+c;var g=this.bottomLeftTileRow+d;var f=this.createTileUrl(b,g);if(f!=e.url){e.url=f;e.img.style.visibility="hidden";e.img.src=f}e.img.style.left=(this.bottomLeftTileVportX+(c*h))+"px";e.img.style.top=(this.vportHeight-a-(this.bottomLeftTileVportY+(d*a)))+"px"}}};Map.prototype.panMapBy=function(n,m){var d=this.zoomLevels[this.zoomLevel].tilesNumX;var c=this.zoomLevels[this.zoomLevel].tilesNumY;var k=this.getTileWidth();var j=this.getTileHeight();var e=this.getVportWidth();var l=this.getVportHeight();if(d*k>this.vportWidth){this.bottomLeftTileVportX+=n;var h=this.zoomLevels[this.zoomLevel];if(this.getMapX1()<h.getMapX1()){this.bottomLeftTileVportX=this.bottomLeftTileCol*k}else{if(h.getMapX2()<this.getMapX2()){this.bottomLeftTileVportX=(this.bottomLeftTileCol*k)-(d*k-e)}}while(0<this.bottomLeftTileVportX){this.bottomLeftTileVportX-=k;this.bottomLeftTileCol--;for(var f=0;f<this.visibleRows+1;f++){var b=this.tilesMap[f].pop();this.tilesMap[f].unshift(b)}}while(this.bottomLeftTileVportX+(this.visibleCols+1)*k<this.vportWidth){this.bottomLeftTileVportX+=k;this.bottomLeftTileCol++;for(var f=0;f<this.visibleRows+1;f++){var b=this.tilesMap[f].shift();this.tilesMap[f].push(b)}}}if(c*j>this.vportHeight){this.bottomLeftTileVportY+=m;var h=this.zoomLevels[this.zoomLevel];if(this.getMapY1()<h.getMapY1()){this.bottomLeftTileVportY=this.bottomLeftTileRow*j}else{if(h.getMapY2()<this.getMapY2()){this.bottomLeftTileVportY=(this.bottomLeftTileRow*j)-(c*j-l)}}while(0<this.bottomLeftTileVportY){this.bottomLeftTileVportY-=j;this.bottomLeftTileRow--;var a=this.tilesMap.pop();this.tilesMap.unshift(a)}while(this.bottomLeftTileVportY+(this.visibleRows+1)*j<this.vportHeight){this.bottomLeftTileVportY+=j;this.bottomLeftTileRow++;var g=this.tilesMap.shift();this.tilesMap.push(g)}}this.positionTiles();this.updatePoints();this.updateLines(false)};Map.prototype.formatTileNumber=function(a){var c=a.toString();for(var b=0;b<this.tilesNameNumberLength-c.length;b++){c="0"+c}return c};Map.prototype.createTileUrl=function(a,b){return this.zoomLevels[this.zoomLevel].tilesDir+"/"+this.formatTileNumber(b)+"-"+this.formatTileNumber(a)+".png"};Map.prototype.zoomSaveState=function(){var a=new MapZoomState(this.getMapX1(),this.getMapX2(),this.getMapY1(),this.getMapY2());while(this.zoomHistoryPos+1<this.zoomHistory.length){this.zoomHistory.pop()}this.zoomHistoryPos++;this.zoomHistory.push(a);while(this.zoomHistoryMax<this.zoomHistory.length){this.zoomHistory.shift();this.zoomHistoryPos--}this.zoomHistorySave();this.zoomHistoryFireEvents()};Map.prototype.zoomHistoryMoveAndRestore=function(b){var a=this.zoomHistoryPos+b;if(!(0<=a&&a<this.zoomHistory.length)){return}var c=this.zoomHistory[a];this.zoomMapTo(c.x1,c.y1,c.x2,c.y2,false,true,false,true);this.zoomHistoryPos=a;this.zoomHistoryFireEvents();this.zoomHistorySave()};Map.prototype.zoomHistorySave=function(){if(!this.fieldZoomHistory){return}var c=new Array();c.push(this.zoomHistoryPos);for(var a=0;a<this.zoomHistory.length;a++){var b=this.zoomHistory[a];c.push(b.x1);c.push(b.y1);c.push(b.x2);c.push(b.y2)}this.fieldZoomHistory.value=c.join(" ")};Map.prototype.zoomHistoryRestore=function(){var c=document.forms[this.formName];if(!c){return}this.fieldZoomHistory=c.elements[this.fieldNameZoomHistory];if(!this.fieldZoomHistory){return}var a=this.fieldZoomHistory.value.split(/\s+/);if(a.length%4!=1){return}this.zoomHistoryPos=parseInt(a[0]);var d=(a.length-1)/4;for(var b=0;b<d;b++){this.zoomHistory.push(new MapZoomState(parseFloat(a[4*b+1]),parseFloat(a[4*b+2]),parseFloat(a[4*b+3]),parseFloat(a[4*b+4])))}this.zoomHistoryFireEvents()};Map.prototype.zoomHistoryFireEvents=function(){if(this.goBackButton){this.goBackButton.historyChanged()}if(this.goForwardButton){this.goForwardButton.historyChanged()}};Map.prototype.zoomGoBack=function(){this.zoomHistoryMoveAndRestore(-1)};Map.prototype.zoomGoForward=function(){this.zoomHistoryMoveAndRestore(+1)};Map.prototype.zoomCanGoBack=function(){return this.zoomHistoryPos>0};Map.prototype.zoomCanGoForward=function(){return this.zoomHistoryPos+1<this.zoomHistory.length};Map.prototype.registerGoForwardButton=function(a){this.goForwardButton=a};Map.prototype.registerGoBackButton=function(a){this.goBackButton=a};Map.prototype.setMouseModeToPan=function(){this.setMouseMode(MapsGlobal.MAP_TOOL_PAN)};Map.prototype.setMouseModeToZoom=function(){this.setMouseMode(MapsGlobal.MAP_TOOL_ZOOM)};Map.prototype.setMouseModeToSelector=function(){this.setMouseMode(MapsGlobal.MAP_TOOL_SELECTOR)};Map.prototype.setMouseMode=function(a){this.mouseMode=a;this.setMouseCursors()};Map.prototype.setMouseCursors=function(){if(this.mouseMode==MapsGlobal.MAP_TOOL_PAN){this.tilesContainer.style.cursor="move";this.selector.style.cursor="default"}else{if(this.mouseMode==MapsGlobal.MAP_TOOL_ZOOM){this.tilesContainer.style.cursor="crosshair";this.selector.style.cursor="default"}else{if(this.mouseMode==MapsGlobal.MAP_TOOL_SELECTOR){this.tilesContainer.style.cursor="move";this.selector.style.cursor="move"}else{this.tilesContainer.style.cursor="default";this.selector.style.cursor="default"}}}};Map.prototype.initPoints=function(){if(!this.points){return}for(var d=0;d<this.points.length;d++){var f=this.points[d];var a=f.labelElement=document.createElement("div");a.innerHTML=f.label;a.style.padding="2px";a.style.border="1px solid Black";a.style.backgroundColor="White";a.style.position="absolute";a.style.display="";this.tilesContainer.appendChild(a);for(var b=0;b<f.symbols.length;b++){var e=f.symbols[b];var c=e.element=document.createElement("img");c.src=e.url;c.width=e.width;c.height=e.height;c.style.position="absolute";c.style.cursor="default";c.style.display="";EventAttacher.attach(c,"mouseover",this,"showLabel",d);EventAttacher.attach(c,"mouseout",this,"hideLabel");EventAttacher.attach(c,"click",this,"showAndFixLabel",d);this.tilesContainer.appendChild(c)}}this.initListOfPoints()};Map.prototype.initListOfPoints=function(){if(!this.pointsSelectId){return}var b=document.getElementById(this.pointsSelectId);if(!b){return}ElementUtils.addOption(b,"-1","Select place");for(var a=0;a<this.points.length;a++){ElementUtils.addOption(b,a,this.points[a].label)}EventAttacher.attach(b,"change",this,"pointsSelectChanged")};Map.prototype.pointsSelectChanged=function(){var c=document.getElementById(this.pointsSelectId);var a=parseInt(c.options[c.selectedIndex].value);if(a==-1){return}var b=this.points[a];this.setZoomAndCenterTo(this.zoomLevel,b.x,b.y,true,false,true,true,false);this.showLabel(null,a,true)};Map.prototype.updatePoints=function(){if(!this.points){return}var c=this.getVportWidth();var h=this.getVportHeight();var b=(this.scale-1)/(this.scaleMax-1)*100;for(var f=0;f<this.points.length;f++){var a=this.points[f];a.vx=this.fromRealToVportX(a.x);a.vy=this.fromRealToVportY(a.y);if(0<=a.vx&&a.vx<c&&0<=a.vy&&a.vy<h){for(var e=0;e<a.symbols.length;e++){var d=a.symbols[e];var g=d.element.style;g.display="";g.left=(a.vx-d.centerX)+"px";g.top=(a.vy-d.centerY)+"px"}var k=a.labelElement.style;if(true&&a.showAtZoom<=b){k.display="";k.left=a.vx+"px";k.top=a.vy+"px"}else{k.display="none"}}else{for(var e=0;e<a.symbols.length;e++){a.symbols[e].element.style.display="none"}if(a.labelElement){a.labelElement.style.display="none"}}}};Map.prototype.showAndFixLabel=function(a,b){this.showLabel(a,b,true)};Map.prototype.showLabel=function(c,e,b){if(this.fixedLabel&&!b){return}this.fixedLabel=!!b;var d=this.points[e];var a=this.fromRealToVportX(d.x);var f=this.fromRealToVportY(d.y);this.bubbleText.innerHTML=d.text;this.bubble.style.display="block";this.bubble.style.left=(a+5)+"px";this.bubble.style.top=(f-5-this.bubble.offsetHeight)+"px"};Map.prototype.hideLabels=function(a){if(!this.bubble){return}this.fixedLabel=false;this.bubble.style.display="none";if(a&&this.pointsSelectId){var b=document.getElementById(this.pointsSelectId);if(b){b.selectedIndex=0}}};Map.prototype.hideLabel=function(a){if(this.fixedLabel){return}this.setMouseCursors();this.bubble.style.display="none"};Map.prototype.updateLines=function(k){if(!this.lines){return}var r=this.points?this.points[0].symbols[0].element:null;var D=this.getVportWidth();var e=this.getVportHeight();for(var z=0;z<this.lines.length;z++){var n=this.lines[z];var d=n.symbol.centerX;var b=n.symbol.centerY;if(!n.dots){n.dots=new Array()}var C=this.fromRealToVportX(n.x1);var c=this.fromRealToVportY(n.y1);var B=this.fromRealToVportX(n.x2);var a=this.fromRealToVportY(n.y2);var p=B-C;var o=a-c;var A=Math.sqrt(p*p+o*o);var g=Math.floor(A/n.symbolSpacing);var f=(A-g*n.symbolSpacing)/2;var s=n.symbolSpacing/A;var m=f/A;for(var w=0;w<g;w++){var q=m+w*s;var l=C+q*p-d;var h=c+q*o-b;var v=0<=l&&l<D&&0<=h&&h<e;if(!v){if(w<n.dots.length){n.dots[w].style.display="none"}continue}var u;if(w<n.dots.length){u=n.dots[w]}else{u=document.createElement("img");n.dots.push(u);u.src=n.symbol.url;u.width=n.symbol.width;u.height=n.symbol.height;u.style.position="absolute";if(r){this.tilesContainer.insertBefore(u,r)}else{this.tilesContainer.appendChild(u)}}u.style.display="";u.style.left=l+"px";u.style.top=h+"px"}for(var w=g;w<n.dots.length;w++){n.dots[w].style.display="none"}}};Map.prototype.setSize=function(b,a){this.vportWidth=b;this.vportHeight=a;this.updateMapControlsLayout();this.setZoomAndCenterTo(this.zoomLevel,this.getCenterX(),this.getCenterY(),true,false,false,true,true)};Map.prototype.updateMapControlsLayout=function(){var e=this.getTileWidth();var a=this.getTileHeight();if(!this.fixedSize){this.mapControl.style.left=this.mapControl.offsetLeft+"px";this.mapControl.style.top=this.mapControl.offsetTop+"px"}this.mapControl.style.width=this.vportWidth+"px";this.mapControl.style.height=this.vportHeight+"px";this.tilesContainer.style.left="0px";this.tilesContainer.style.top="0px";this.tilesContainer.style.width=(this.vportWidth)+"px";this.tilesContainer.style.height=(this.vportHeight)+"px";this.visibleCols=Math.floor(this.vportWidth/e)+1;this.visibleRows=Math.floor(this.vportHeight/a)+1;if(this.tilesMap!=null){for(var c=0;c<this.tilesMap.length;c++){for(var b=0;b<this.tilesMap[c].length;b++){var d=this.tilesMap[c][b];this.tilesContainer.removeChild(d.img);if(d.points){this.tilesContainer.removeChild(d.points.getRoot())}}}}this.tilesMap=new Array();for(var c=0;c<this.visibleRows+1;c++){this.tilesMap[c]=new Array();for(var b=0;b<this.visibleCols+1;b++){var d=document.createElement("img");d.onload=function(){this.style.visibility="visible"};this.tilesMap[c][b]=new MapTile(d);d.unselectable="on";d.galleryImg="no";d.style.MozUserFocus="none";d.style.MozUserSelect="none";d.onmousedown=MapUtils.falseFnc;d.style.position="absolute";d.width=e;d.height=a;d.style.left=(b*e)+"px";d.style.top=(c*a)+"px";d.points=null;this.tilesContainer.insertBefore(d,this.selector)}}};Map.prototype.initMapControls=function(){this.mapControl=document.getElementById(this.mapControlId);this.bubble=document.getElementById(this.bubbleId);this.bubbleText=document.getElementById(this.bubbleTextId);if(this.bubble){this.bubble.style.position="absolute"}this.tilesContainer=document.getElementById(this.tilesContainerId);this.tilesContainer.style.position="absolute";this.tilesContainer.style.overflow="hidden";this.tilesContainer.unselectable="on";this.tilesContainer.style.MozUserFocus="none";this.tilesContainer.style.MozUserSelect="none";this.vportWidth=this.mapControl.offsetWidth;this.vportHeight=this.mapControl.offsetHeight;EventAttacher.attach(this.tilesContainer,"mousedown",this,"mapStartDrag");if(IE){EventAttacher.attach(this.tilesContainer,"mousewheel",this,"mapMouseWheel")}this.selector=document.createElement("DIV");this.selector.style.position="absolute";this.selector.style.display="none";this.selector.style.borderStyle="solid";this.selector.style.borderWidth=this.selectorBorderWidth+"px";this.selector.style.borderColor=this.selectorColor;this.selector.style.left="0px";this.selector.style.top="0px";this.selector.style.width="200px";this.selector.style.height="200px";this.tilesContainer.appendChild(this.selector);var a=document.createElement("DIV");a.style.width="100%";a.style.height="100%";a.style.filter="alpha(opacity = "+this.selectorOpacity+")";a.style.opacity=this.selectorOpacity/100;a.style.backgroundColor=this.selectorColor;this.selector.appendChild(a)};Map.prototype.hiddenFieldsInit=function(){var a=document.forms[this.formName];if(!a){this.hasHiddenExtentsFields=false}else{this.fieldX1=a.elements[this.fieldNameX1];this.fieldY1=a.elements[this.fieldNameY1];this.fieldX2=a.elements[this.fieldNameX2];this.fieldY2=a.elements[this.fieldNameY2];this.hasHiddenExtentsFields=!!(this.fieldX1&&this.fieldY1&&this.fieldX2&&this.fieldY2)}};Map.prototype.restoreState=function(){if(this.hasHiddenExtentsFields){var b=parseFloat(this.fieldX1.value);var d=parseFloat(this.fieldY1.value);var a=parseFloat(this.fieldX2.value);var c=parseFloat(this.fieldY2.value);this.zoomMapTo(b,d,a,c,false,false,false,true,true)}else{this.setZoomAndCenterTo(0,0,0,false,false,false,true,true)}if(this.zoomHistoryPos==-1){this.zoomSaveState()}};Map.prototype.enableDebugShowCoordinates=function(){EventAttacher.attach(this.tilesContainer,"mousemove",this,"debugMouseMove")};Map.prototype.disableDebugShowCoordinates=function(){EventAttacher.detach(this.tilesContainer,"mousemove",this,"debugMouseMove")};Map.prototype.debugMouseMove=function(b){var a=ElementUtils.getEventMouseElementX(b,this.mapControl);var d=ElementUtils.getEventMouseElementY(b,this.mapControl);var c=document.getElementById("mapDebugCoordinates");if(c){c.innerHTML="long = "+this.fromVportToRealX(a)+", lat = "+this.fromVportToRealY(d)}};Map.prototype.invokeAction=function(a,c){var b=document.forms[this.formName];b.elements[this.actionNameFieldName].value=a;b.elements[this.actionParamFieldName].value=c;b.submit()};Map.prototype.init=function(a){if(this.miniMap){this.miniMap.init(false);this.miniMap.setMouseModeToSelector()}this.hiddenFieldsInit();this.initMapControls();this.updateMapControlsLayout();this.scaleIndicatorInit();this.zoomHistoryRestore();this.initPoints();if(a){this.restoreState()}this.initMiniMap();this.initListeners.invoke();if(this.debug){this.enableDebugShowCoordinates()}};function MapButtonZoomPlus(a,b){this.element=null;this.map=b;this.elementId=a;this.map.initListeners.register(this,"init",null)}MapButtonZoomPlus.prototype.init=function(){this.element=document.getElementById(this.elementId);EventAttacher.attach(this.element,"click",this,"click")};MapButtonZoomPlus.prototype.click=function(a){this.map.zoomPlus(true)};function MapButtonZoomMinus(a,b){this.element=null;this.map=b;this.elementId=a;this.map.initListeners.register(this,"init",null)}MapButtonZoomMinus.prototype.init=function(){this.element=document.getElementById(this.elementId);EventAttacher.attach(this.element,"click",this,"click")};MapButtonZoomMinus.prototype.click=function(a){this.map.zoomMinus(true)};function MapButtonGoBack(a,b){this.element=null;this.map=b;this.elementId=a;this.map.initListeners.register(this,"init",null)}MapButtonGoBack.prototype.init=function(){this.element=document.getElementById(this.elementId);EventAttacher.attach(this.element,"click",this,"click")};MapButtonGoBack.prototype.click=function(a){this.map.zoomGoBack()};MapButtonGoBack.prototype.historyChanged=function(){if(this.element){this.element.className=this.map.zoomCanGoBack()?"map-icon-back":"map-icon-back-off"}};function MapButtonGoForward(a,b){this.element=null;this.map=b;this.elementId=a;this.map.initListeners.register(this,"init",null)}MapButtonGoForward.prototype.init=function(){this.element=document.getElementById(this.elementId);EventAttacher.attach(this.element,"click",this,"click")};MapButtonGoForward.prototype.click=function(a){this.map.zoomGoForward()};MapButtonGoForward.prototype.historyChanged=function(){if(this.element){this.element.className=this.map.zoomCanGoForward()?"map-icon-forward":"map-icon-forward-off"}};function MapZoomAndPanButtons(e,a,b,c,d){this.zoomElement=null;this.panElement=null;this.panElementId=e;this.zoomElementId=a;this.formName=b;this.fieldNameForMouseMode=c;this.fieldForMouseMode=null;this.map=d;this.map.initListeners.register(this,"init",null)}MapZoomAndPanButtons.prototype.init=function(){this.zoomElement=document.getElementById(this.zoomElementId);this.panElement=document.getElementById(this.panElementId);this.fieldForMouseMode=document.forms[this.formName].elements[this.fieldNameForMouseMode];EventAttacher.attach(this.zoomElement,"click",this,"clickZoom");EventAttacher.attach(this.panElement,"click",this,"clickPan")};MapZoomAndPanButtons.prototype.clickPan=function(a){this.map.setMouseModeToPan();this.fieldForMouseMode.value="pan";this.zoomElement.className="map-icon-zoom-off";this.panElement.className="map-icon-pan"};MapZoomAndPanButtons.prototype.clickZoom=function(a){this.map.setMouseModeToZoom();this.fieldForMouseMode.value="zoom";this.zoomElement.className="map-icon-zoom";this.panElement.className="map-icon-pan-off"};function MapZoomSize(c,b,a,d){this.mapSizes=c;this.formName=b;this.fieldNameForMapSize=a;this.fieldForMapSize=null;this.map=d;this.map.initListeners.register(this,"init",null)}MapZoomSize.prototype.init=function(){var c=document.forms[this.formName];this.fieldForMapSize=c.elements[this.fieldNameForMapSize];for(var b=0;b<this.mapSizes.length;b++){var a=this.mapSizes[b];a.element=document.getElementById(a.elementId);EventAttacher.attach(a.element,"click",this,"click",b)}};MapZoomSize.prototype.click=function(d,e){var a=this.mapSizes[e];this.map.setSize(a.width,a.height);this.fieldForMapSize.value=a.width+" "+a.height;for(var b=0;b<this.mapSizes.length;b++){var a=this.mapSizes[b];var c="map-icon-size-"+b;if(b!=e){c+="-off"}a.element.className=c}};function MapZoomSlider(a,d,b,c){this.slotWidth=a;this.containerElementId=d;this.knobElementId=b;this.map=c;this.scale=0;this.sliding=false;this.map.registerZoomSlider(this);this.map.initListeners.register(this,"init",null)}MapZoomSlider.prototype.init=function(){this.cont=document.getElementById(this.containerElementId);this.knob=document.getElementById(this.knobElementId);this.knob.style.display="block";EventAttacher.attach(this.knob,"mousedown",this,"mouseDown");EventAttacher.attach(this.cont,"click",this,"click");this.zoomChanged()};MapZoomSlider.prototype.capKnobPosition=function(a){if(a<0){a=0}if(a>this.sliderEffectiveWidth){a=this.sliderEffectiveWidth}return a};MapZoomSlider.prototype.setKnobPosition=function(a){this.knob.style.left=(a*this.slotWidth)+"px"};MapZoomSlider.prototype.click=function(a){var b=parseInt(ElementUtils.getEventMouseElementX(a,this.cont)/this.slotWidth);this.setKnobPosition(b);this.map.changeZoomLevel(b,false)};MapZoomSlider.prototype.mouseDown=function(a){this.sliding=true;EventAttacher.attach(document,"mousemove",this,"mouseMove");EventAttacher.attach(document,"mouseup",this,"mouseUp")};MapZoomSlider.prototype.mouseMove=function(a){var b=parseInt(ElementUtils.getEventMouseElementX(a,this.cont)/this.slotWidth);if(b<0){b=0}if(b>=this.map.zoomLevels.length){b=this.map.zoomLevels.length-1}this.setKnobPosition(b)};MapZoomSlider.prototype.mouseUp=function(a){EventAttacher.detach(document,"mousemove",this,"mouseMove");EventAttacher.detach(document,"mouseup",this,"mouseUp")};MapZoomSlider.prototype.zoomChanged=function(){this.setKnobPosition(this.map.zoomLevel)};var QueryBuilderGlobals={builders:new Array(),registerBuilder:function(a){this.builders[a.builderId]=a},updateTotal:function(c,b){var a=this.builders[c];if(a){a.updateTotal(b)}},moveConditionUp:function(c,b){var a=this.builders[c];if(a){a.moveConditionUp(b)}},moveConditionDown:function(c,b){var a=this.builders[c];if(a){a.moveConditionDown(b)}},deleteCondition:function(c,b){var a=this.builders[c];if(a){a.deleteCondition(b)}},changeNumericRangeType:function(c,b){var a=this.builders[c];if(a){a.changeNumericRangeType(b)}},changeDateRangeType:function(c,b){var a=this.builders[c];if(a){a.changeDateRangeType(b)}},toggleMonth:function(d,b,c){var a=this.builders[d];if(a){a.toggleMonth(b,c)}},openList:function(c,b){var a=this.builders[c];if(a){a.openList(b)}},closeList:function(c,b){var a=this.builders[c];if(a){a.closeList(b)}},quickSearchList:function(d,c,b){var a=this.builders[d];if(a){a.quickSearchList(c,b)}},listSelectAll:function(c,b){var a=this.builders[c];if(a){a.listSelectAll(b)}},listDeselectAll:function(c,b){var a=this.builders[c];if(a){a.listDeselectAll(b)}},listItemToggled:function(d,c,b){var a=this.builders[d];if(a){a.listItemToggled(c,b)}},listItemExpandCollapse:function(d,c,a){var b=this.builders[d];if(b){b.listItemExpandCollapse(c,a)}}};function QueryBuilder(e,b,a,c,d){this.formName=b;this.builderId=e;this.updateTotalFieldName=c;this.conditions=d;this.attributesFieldName=a;this.timeoutId=""}QueryBuilder.prototype.updateTotal=function(a){if(typeof(ajaxAnywhere)=="undefined"||!document.getElementById(this.updateTotalFieldName)){return}if(a>0){this.timeoutId=Timer.extendCall(this.timeoutId,this,"doUpdateExpectedTotal",a)}else{this.doUpdateExpectedTotal()}};QueryBuilder.prototype.doUpdateExpectedTotal=function(){document.forms[this.formName].elements[this.updateTotalFieldName].value="true";ajaxAnywhere.submitAJAX(null,null)};QueryBuilder.prototype.moveConditionUp=function(g){var f=document.getElementById(this.conditions[g].conditionDivId);var e=document.forms[this.formName].elements[this.attributesFieldName];var b=e.value.split(",");for(var c=0;c<b.length;c++){if(b[c]==g){if(c!=0){var a=f.previousSibling;var d=f.parentNode;d.removeChild(f);d.insertBefore(f,a);b[c]=b[c-1];b[c-1]=g;e.value=b.join(",");$(f).hide().fadeIn()}return}}};QueryBuilder.prototype.moveConditionDown=function(g){var e=document.getElementById(this.conditions[g].conditionDivId);var d=document.forms[this.formName].elements[this.attributesFieldName];var a=d.value.split(",");for(var b=0;b<a.length;b++){if(a[b]==g){if(b!=a.length-1){var f=e.nextSibling.nextSibling;var c=e.parentNode;c.removeChild(e);c.insertBefore(e,f);a[b]=a[b+1];a[b+1]=g;d.value=a.join(",");$(e).hide().fadeIn()}return}}};QueryBuilder.prototype.deleteCondition=function(e){var d=document.getElementById(this.conditions[e].conditionDivId);var c=document.forms[this.formName].elements[this.attributesFieldName];var a=c.value.split(",");for(var b=0;b<a.length;b++){if(a[b]==e){a.splice(b,1);delete this.conditions[e];c.value=a.join(",");$(d).fadeOut();this.updateTotal(0);return}}};QueryBuilder.prototype.changeNumericRangeType=function(c){var b=this.conditions[c];var a=document.forms[this.formName].elements[b.typeFieldName].selectedIndex;document.getElementById(b.fromId).style.display=(a==0)?"":"none";document.getElementById(b.dashId).style.display=(a==0)?"":"none";document.getElementById(b.toId).style.display=(a==0)?"":"none";document.getElementById(b.leId).style.display=(a==1)?"":"none";document.getElementById(b.geId).style.display=(a==2)?"":"none";document.getElementById(b.eqId).style.display=(a==3)?"":"none";this.updateTotal(0)};QueryBuilder.prototype.changeDateRangeType=function(c){var b=this.conditions[c];var a=document.forms[this.formName].elements[b.typeFieldName].selectedIndex;document.getElementById(b.tdFromMonthId).style.display=(a==0)?"":"none";document.getElementById(b.tdSlashBetweenStartId).style.display=(a==0)?"":"none";document.getElementById(b.tdFromYearId).style.display=(a==0)?"":"none";document.getElementById(b.tdDashId).style.display=(a==0)?"":"none";document.getElementById(b.tdToMonthId).style.display=(a==0)?"":"none";document.getElementById(b.tdSlashBetweenEndId).style.display=(a==0)?"":"none";document.getElementById(b.tdToYearId).style.display=(a==0)?"":"none";document.getElementById(b.tdLeMonthId).style.display=(a==1)?"":"none";document.getElementById(b.tdSlashLeId).style.display=(a==1)?"":"none";document.getElementById(b.tdLeYearId).style.display=(a==1)?"":"none";document.getElementById(b.tdGeMonthId).style.display=(a==2)?"":"none";document.getElementById(b.tdSlashGeId).style.display=(a==2)?"":"none";document.getElementById(b.tdGeYearId).style.display=(a==2)?"":"none";document.getElementById(b.tdEqMonthId).style.display=(a==3)?"":"none";document.getElementById(b.tdSlashEqId).style.display=(a==3)?"":"none";document.getElementById(b.tdEqYearId).style.display=(a==3)?"":"none";this.updateTotal(0)};QueryBuilder.prototype.toggleMonth=function(b,e){var a=this.conditions[b];var d=document.forms[this.formName].elements[a.monthInputs[e]];var c=document.getElementById(a.monthTds[e]);if(d.value=="true"){d.value="false";c.className="query-builder-range-month-delected"}else{d.value="true";c.className="query-builder-range-month-selected"}this.updateTotal(0)};QueryBuilder.prototype.getListItemById=function(c,f,e){var b=f.split(c.idSeparator);var d=c.items[b[0]];if(!e){e=0}for(var a=1;a<b.length-e;a++){d=d.children[b[a]]}return d};QueryBuilder.prototype.openList=function(b){var a=this.conditions[b];document.getElementById(a.showElementId).style.display="none";document.getElementById(a.editElementId).style.display="block";document.forms[this.formName].elements[a.stateFieldName].value="edit"};QueryBuilder.prototype.getSelectedItemText=function(a,b){if(a.checkbox.checked){b.push(a.text)}if(a.children){for(var c in a.children){this.getSelectedItemText(a.children[c],b)}}};QueryBuilder.prototype.closeList=function(d){var b=this.conditions[d];this.prepareList(b);document.getElementById(b.showElementId).style.display="block";document.getElementById(b.editElementId).style.display="none";document.forms[this.formName].elements[b.stateFieldName].value="show";var e=new Array();for(var g in b.items){this.getSelectedItemText(b.items[g],e)}var c=document.getElementById(b.showListElementId);if(e.length>0){if(e.length>5){var a;var f="";for(a=0;a<5;a++){f+=e[a];if(a<4){f+=", "}}c.innerHTML=f+" ... "}else{c.innerHTML=e.join(", ")}}else{c.innerHTML="[<i>nothing selected</i>]"}};QueryBuilder.prototype.prepareListItem=function(b,a){b.itemElement=document.getElementById(b.itemElementId);b.childrenElement=document.getElementById(b.childrenElementId);b.checkbox=document.getElementById(b.checkboxId);b.arrowElementId=document.getElementById(b.arrowElementId);b.textLowerCase=b.text.toLowerCase();b.parent=a;if(b.children){for(var c in b.children){this.prepareListItem(b.children[c],b)}}};QueryBuilder.prototype.prepareList=function(a){if(a.listPrepared){return}for(var b in a.items){this.prepareListItem(a.items[b],null)}a.listPrepared=true};QueryBuilder.prototype.restoreDefaultTreeState=function(a){a.itemElement.style.display="";if(a.children){for(var b in a.children){this.restoreDefaultTreeState(a.children[b])}a.childrenElement.style.display=a.expanded?"":"none"}};QueryBuilder.prototype.quickSearchTree=function(d,a){var b=d.textLowerCase.indexOf(a)!=-1;var c=0;if(d.children){for(var e in d.children){if(this.quickSearchTree(d.children[e],a)){c++}}}d.itemElement.style.display=(b||c>0)?"":"none";if(d.children){d.childrenElement.style.display=(c>0)?"":"none"}return b||c>0};QueryBuilder.prototype.quickSearchList=function(d,b){var c=this.conditions[d];this.prepareList(c);var a=b.value.toLowerCase();c.searchFor=a;if(a==""){for(var e in c.items){this.restoreDefaultTreeState(c.items[e])}}else{for(var e in c.items){this.quickSearchTree(c.items[e],a)}}};QueryBuilder.prototype.listSelectAll=function(a){this.listChangeSelectionAll(a,true)};QueryBuilder.prototype.listDeselectAll=function(a){this.listChangeSelectionAll(a,false)};QueryBuilder.prototype.listItemChangeSelectionAll=function(b,c,e,d){var a=!b.searchFor||c.textLowerCase.indexOf(b.searchFor)!=-1;if(b.autoSelection){if(d||a){c.checkbox.checked=e;d=true}}else{if(a){c.checkbox.checked=e}}if(c.children){for(var f in c.children){this.listItemChangeSelectionAll(b,c.children[f],e,d)}}};QueryBuilder.prototype.listChangeSelectionAll=function(b,c){var a=this.conditions[b];this.prepareList(a);for(var d in a.items){this.listItemChangeSelectionAll(a,a.items[d],c,false)}this.updateTotal(0)};QueryBuilder.prototype.listSelectItem=function(a,b){a.checkbox.checked=b;if(a.children){for(var c in a.children){this.listSelectItem(a.children[c],b)}}};QueryBuilder.prototype.listItemToggled=function(f,b){var d=this.conditions[f];if(d.autoSelection){this.prepareList(d);var e=this.getListItemById(d,b.value,0);this.listSelectItem(e,e.checkbox.checked);var c=e.parent;while(c){var a=true;for(var h in c.children){var g=c.children[h];if(!g.checkbox.checked){a=false;break}}if(a){c.checkbox.checked=true;c=c.parent}else{c.checkbox.checked=false;break}}}this.updateTotal(0)};QueryBuilder.prototype.listItemExpandCollapse=function(d,a){var b=this.conditions[d];this.prepareList(b);var c=this.getListItemById(b,a,0);if(c.expanded){c.expanded=false;c.childrenElement.style.display="none";c.arrowElementId.className="query-builder-list-item-collapsed"}else{c.expanded=true;c.childrenElement.style.display="";c.arrowElementId.className="query-builder-list-item-expanded"}};var Popups={popups:Array(),registerPopup:function(a){this.popups[a.popuId]=a},close:function(b){var a=Popups.popups[b];if(a){a.close()}}};function Popup(b,d,e,c,a){this.popupId=b;this.blackoutId=d;this.contentId=e;this.width=c;this.height=a;EventAttacher.attachOnWindowEvent("load",this,"init")}Popup.prototype.init=function(){var b=document.getElementById(this.blackoutId);var a=document.getElementById(this.contentId);b.style.position="absolute";a.style.position="absolute";this.reposition();b.style.display="";a.style.display="";EventAttacher.attachOnWindowEvent("resize",this,"reposition");EventAttacher.attachOnWindowEvent("scroll",this,"reposition")};Popup.prototype.reposition=function(){var f=document.getElementById(this.blackoutId);var b=document.getElementById(this.contentId);var d=ElementUtils.getPageWidth();var g=ElementUtils.getPageHeight();var h=ElementUtils.getPageScrollLeft();var c=ElementUtils.getPageScrollTop();var a=this.width;var i=this.height;var e=(d-this.width)/2;var j=(g-this.height)/2;f.style.left=h+"px";f.style.top=c+"px";f.style.width=d+"px";f.style.height=g+"px";b.style.left=e+"px";b.style.top=j+"px";b.style.width=a+"px";b.style.height=i+"px"};Popup.prototype.close=function(){var b=document.getElementById(this.blackoutId);var a=document.getElementById(this.contentId);b.style.display="none";a.style.display="none";EventAttacher.detachOnWindowEvent("resize",this,"reposition");EventAttacher.detachOnWindowEvent("scroll",this,"reposition")};function tooltipShow(a,c){var b=document.getElementById(c);tooltipMove(a,c);b.style.visibility="visible"}function tooltipHide(a,c){var b=document.getElementById(c);b.style.visibility="hidden"}function tooltipMove(a,e){var k=document.getElementById(e);if(!a){a=window.event}var h=ElementUtils.getEventMouseX(a);var f=ElementUtils.getEventMouseY(a);var d=ElementUtils.getPageWidth();var g=ElementUtils.getPageHeight();var i=ElementUtils.getPageScrollLeft();var c=ElementUtils.getPageScrollTop();var b=ElementUtils.getOffsetWidth(k);var j=ElementUtils.getOffsetHeight(k);if(i+d-10<h+b){h=h-b-5}else{h=h+25}if(c+g-10<f+j){f=f-j-5}else{f=f+10}k.style.left=h+"px";k.style.top=f+"px"}var AttributesMenu={menus:new Array(),debug:function(a){document.getElementById("debug").innerHTML+=a+"<br>"},delayclose:function(b,a){AttributesMenu.menus[b]=Timer.delayedFunction(AttributesMenu.funct,50,a)},funct:function(a){a.style.display="none"},cancelclose:function(b,a){if(AttributesMenu.menus[b]!=null){Timer.cancelCall(AttributesMenu.menus[b]);delete AttributesMenu.menus[b]}a.style.display="block"}};
