(function(){function B(){var D=new Array();D.push({text:"Show Current",tooltip:{text:"Change the time period of all graphs in this view to show today, the current week, the current month and other time ranges"},menu:[{text:"Day",graphPeriod:"today",scope:this,handler:this.onGraphPeriodClick},{text:"Week",graphPeriod:"this_week",scope:this,handler:this.onGraphPeriodClick},{text:"Month",graphPeriod:"this_month",scope:this,handler:this.onGraphPeriodClick},{text:"Quarter",graphPeriod:"this_quarter",scope:this,handler:this.onGraphPeriodClick},{text:"Year",graphPeriod:"this_year",scope:this,handler:this.onGraphPeriodClick}]});D.push({text:"Show Past",tooltip:{text:"Change the time period of all graphs in this view to show the past six hours, past 24 hours, past seven days and other time ranges"},menu:[{text:"6h",graphPeriod:"past6h",scope:this,handler:this.onGraphPeriodClick},{text:"12h",graphPeriod:"past12h",scope:this,handler:this.onGraphPeriodClick},{text:"24h",graphPeriod:"past24h",scope:this,handler:this.onGraphPeriodClick},{text:"7 Days",graphPeriod:"past_week",scope:this,handler:this.onGraphPeriodClick},{text:"Month",graphPeriod:"past_month",scope:this,handler:this.onGraphPeriodClick},{text:"Year",graphPeriod:"past_year",scope:this,handler:this.onGraphPeriodClick}]});D.push({text:"Shrink/Expand",tooltip:{text:"Change the time period of all graphs in this view to show the hour, day, week, or month that the first graph starts in"},menu:[{text:"To Hour",graphPeriod:"hour",scope:this,handler:this.onGraphPeriodClick},{text:"To Day",graphPeriod:"day",scope:this,handler:this.onGraphPeriodClick},{text:"To Week",graphPeriod:"week",scope:this,handler:this.onGraphPeriodClick},{text:"To Month",graphPeriod:"month",scope:this,handler:this.onGraphPeriodClick},{text:"To Quarter",graphPeriod:"quarter",scope:this,handler:this.onGraphPeriodClick},{text:"To Year",graphPeriod:"year",scope:this,handler:this.onGraphPeriodClick}]});var C=new Ext.menu.DateMenu({scope:this,handler:function(F,E){this.setGraphPeriod("day",E)}});C.picker.startDay=1;D.push({text:"Choose a Day",tooltip:{text:"Change the time period of all graphs in this view to a day selected interactively"},menu:C});D.push({text:"Align",graphPeriod:"align",scope:this,handler:this.onGraphPeriodClick,tooltip:{text:"Set the time period of all graphs in this view to the time period of the <b>first</b> graph"}});D.push("->");D.push({text:"Refresh All",tooltip:{text:"Refresh all graphs in this view"},scope:this,handler:function(){this.eachGraph(function(E){E.updateGraph()},false)}});D.push({text:"Collapse All",tooltip:{text:"Collapse all panels in this view"},scope:this,handler:function(){this.eachGraph(function(E){E.collapse()},false)}});D.push({text:"Expand All",tooltip:{text:"Expand all panels in this view"},scope:this,handler:function(){this.eachGraph(function(E){E.expand()},false)}});return new Ext.Toolbar({items:D})}function A(){this.bbarspinner=new Ext.ux.form.Spinner({style:"text-align:right",value:1,width:40,strategy:{xtype:"number",allowBlank:false,allowDecimals:false,minValue:1,maxValue:12},tooltip:{text:"Specify the number of steps to shift"}});var C=new Array();C.push({text:"&laquo; Year",shiftType:Date.MONTH,shiftValue:-12,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view back in time by the selected count of years"}});C.push({text:"&laquo; Month",shiftType:Date.MONTH,shiftValue:-1,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view back in time by the selected count of months"}});C.push({text:"&laquo; Week",shiftType:Date.DAY,shiftValue:-7,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view back in time by the selected count of weeks"}});C.push({text:"&laquo; Day",shiftType:Date.DAY,shiftValue:-1,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view back in time by the selected count of days"}});C.push({text:"&laquo; Hour",shiftType:Date.HOUR,shiftValue:-1,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view back in time by the selected count of hours"}});C.push({text:"&laquo; Period",scope:this,handler:function(){this.eachGraph(function(E){var D=E.getGraphPeriod();E.shiftGraph(Date.MILLI,-D.getDiff())},false)},tooltip:{text:"Shift all graphs in this view back in time by the currently viewed period for the selected count times"}});C.push(this.bbarspinner);C.push({text:"Period &raquo;",scope:this,handler:function(){this.eachGraph(function(E){var D=E.getGraphPeriod();E.shiftGraph(Date.MILLI,D.getDiff())},false)},tooltip:{text:"Shift all graphs in this view forward in time by the currently viewed period for the selected count times"}});C.push({text:"Hour &raquo;",shiftType:Date.HOUR,shiftValue:1,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view forward in time by the selected count of hours"}});C.push({text:"Day &raquo;",shiftType:Date.DAY,shiftValue:1,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view forward in time by the selected count of days"}});C.push({text:"Week &raquo;",shiftType:Date.DAY,shiftValue:7,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view forward in time by the selected count of weeks"}});C.push({text:"Month &raquo;",shiftType:Date.MONTH,shiftValue:1,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view forward in time by the selected count of months"}});C.push({text:"Year &raquo;",shiftType:Date.MONTH,shiftValue:12,scope:this,handler:this.onGraphShiftClick,tooltip:{text:"Shift all graphs in this view forward in time by the selected count of years"}});return new Ext.Toolbar({items:C})}Ext.ux.CenterPanel=Ext.extend(Ext.Panel,{initComponent:function(){this.tbar=B.call(this);this.bbar=A.call(this);Ext.ux.GraphPanel.superclass.initComponent.call(this)},afterRender:function(){Ext.ux.GraphPanel.superclass.afterRender.call(this);var D=this.bbarspinner.getEl();var C=D.parent();C.setStyle("margin-left","auto");C.setStyle("margin-right","auto");var E=D.findParent("td",10,true);E.setStyle("width","100%");this.tabpanel=this.items.first()},eachGraph:function(D,C){this.tabpanel.getActiveTab().items.each(function(E){E.items.each(function(F){if(C){C=false}else{D.call(F,F)}})})},setGraphPeriod:function(H,E){var F,G=false;var D=this.tabpanel.getActiveTab().items;switch(H){case"past6h":var C=new Date();F=new TimePeriod(C.add(Date.HOUR,-6),C);break;case"past12h":var C=new Date();F=new TimePeriod(C.add(Date.HOUR,-12),C);break;case"past24h":var C=new Date();F=new TimePeriod(C.add(Date.HOUR,-24),C);break;case"past_week":var C=new Date();F=new TimePeriod(C.add(Date.DAY,-7),C);break;case"past_month":var C=new Date();F=new TimePeriod(C.add(Date.MONTH,-1),C);break;case"past_year":var C=new Date();F=new TimePeriod(C.add(Date.MONTH,-12),C);break;case"today":F=new TimePeriod(Date(),Date()).setToDay();break;case"this_week":F=new TimePeriod(Date(),Date()).setToWeek();break;case"this_month":F=new TimePeriod(Date(),Date()).setToMonth();break;case"this_quarter":F=new TimePeriod(Date(),Date()).setToQuarter();break;case"this_year":F=new TimePeriod(Date(),Date()).setToYear();break;case"hour":if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod();F.setToHour();break;case"day":if(E){F=new TimePeriod(E,E)}else{if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod()}F.setToDay();break;case"week":if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod();F.setToWeek();break;case"month":if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod();F.setToMonth();break;case"quarter":if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod();F.setToQuarter();break;case"year":if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod();F.setToYear();break;case"align":G=true;if(D.first().items.getCount()==0){return }F=D.first().items.first().getGraphPeriod();break}this.eachGraph(function(I){I.updateGraphPeriod(F.start,F.end)},G)},onGraphPeriodClick:function(C){this.setGraphPeriod(C.graphPeriod)},onGraphShiftClick:function(D){var C=this.bbarspinner.getValue();if(C<1||C>12){C=1}this.eachGraph(function(E){E.shiftGraph(D.shiftType,D.shiftValue*C)},false)},setGraphOption:function(D){var C=this.tabpanel.getActiveTab().items;switch(D.graphOption){case"altautoscale":fn=function(E){E.setGraphAltAutoscale(D.optionValue);E.updateGraph()};break;case"lowerlimit":fn=function(E){E.setGraphLowerLimit(D.optionValue);E.updateGraph()};break;case"slopemode":fn=function(E){E.setGraphSlopeMode(D.optionValue);E.updateGraph()};break;case"style":fn=function(E){E.setGraphStyle(D.optionValue);E.updateGraph()};break}eachGraph(fn,false)}});Ext.reg("centerpanel",Ext.ux.CenterPanel)})();