function BaseIndicator(n,t){this.indicatorType=n;var i={valueScale:"",indicatorTrend:INDICATOR_TREND.DESIRABLE_INCREASE,indicatorYTDCalculation:INDICATOR_CALCULATION.AVERAGE,indicatorGraphInterval:INDICATOR_GRAPH_INTERVAL.MONTHLY,alternateName:""};t=$.extend({},i,t),this.options=t,this.isTouchDevice=Modernizr.touch,this.isMobile=$("#is-mobile").is(":visible"),this.isTablet=$("#is-tablet").is(":visible"),this.albertaTimeGraph=null,this.interProvincialBarGraph=null,this.typePieChart=null,this.typeBarChart=null,$(function(){var n=$("[href="+location.hash+"]");n&&n.tab("show")}),$('a[data-toggle="tab"]').bind("shown",function(n){n.target.hash=="#albertatab"?$("#embed_dataset").show():$("#embed_dataset").hide()});$("#categoryTab li").on("click",function(){})}function GetEmbedChartData(){var n=$("#ComparisonHeader").text(),t=$("#embed_dataset a").attr("href"),r=t.slice(-9),i=$("#embedSizePicker li.selected").find("span").text(),u=i.slice(0,3),f=i.slice(-3);$("#embedCodeTextArea").text('<div><iframe width="'+u+'px" title="'+n+'" height="'+f+'px" src="https://data.iae.alberta.ca/w/'+r+'" frameborder="0" scrolling="no"><a href="'+t+'" title="'+n+'" target="_blank">'+n+"</a></iframe></div>").focus(function(){$(this).select()})}var INDICATOR_TREND={DESIRABLE_INCREASE:{value:0,desc:"Increase is good"},DESIRABLE_DECREASE:{value:1,desc:"Decrease is good"},NEUTRAL:{value:1,desc:"No opinion on value"}},INDICATOR_CALCULATION={AVERAGE:{value:0,displayText:" (AVERAGE)"},YTD:{value:1,displayText:" (YR TO DATE)"}},INDICATOR_GRAPH_INTERVAL={MONTHLY:{type:"monthly",englishMonthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],englishShortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},YEARLY:{type:"monthly",englishMonthNames:["","","","","","","","","","","",""],englishShortMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},QUARTERLY_JAN_START:{type:"quarterly",englishMonthNames:["Quarter 1","Quarter 2","Quarter 3","Quarter 4","Quarter 1","Quarter 2","Quarter 3","Quarter 4","Quarter 1","Quarter 2","Quarter 3","Quarter 4"],englishShortMonthNames:["Q1","Q2","Q3","Q4","Q1","Q2","Q3","Q4","Q1","Q2","Q3","Q4"]},QUARTERLY_MAR_START:{type:"quarterly",englishMonthNames:["Quarter 1","Quarter 2","Quarter 3","Quarter 4","Quarter 1","Quarter 2","Quarter 3","Quarter 4","Quarter 1","Quarter 2","Quarter 3","Quarter 4"],englishShortMonthNames:["Q1","Q2","Q3","Q4","Q1","Q2","Q3","Q4","Q1","Q2","Q3","Q4"]}},COMPARISON_CALCULATION={YEAR_OVER_YEAR:{value:0,displayText:"YR over YR"},PERCENT_CHANGE:{value:1,displayText:"% Change"}},NO_VALUE="-";BaseIndicator.prototype.generateTouchOrClickLanguage=function(){var n="<p>Mouse over the graph for more detail or use the sliders below to zoom</p>",t="<p>Mouse over the bars for more detail</p>",i="<p>Mouse over the chart for more detail</p>",r="<p>Touch the graph for more detail</p>",u="<p>Touch a bar for more detail</p>",f="<p>Touch the chart for more detail</p>";this.isTouchDevice?($("#ABTimeInstructions").html(r),$("#interProvBarInstructions, #typeBarInstructions").html(u),$("#typePieInstructions").html(f)):($("#ABTimeInstructions").html(n),$("#interProvBarInstructions, #typeBarInstructions").html(t),$("#typePieInstructions").html(i))},BaseIndicator.prototype.initializeAlbertaTimeGraph=function(n){var c=this.options.alternateName.length>0?this.options.alternateName:this.indicatorType,t=new AmCharts.makeChart("ABTimeDiv",{type:"serial",theme:"light","export":{enabled:!0,libs:{path:"http://www.amcharts.com/lib/3/plugins/export/libs/"}},valueAxes:[{title:c+" "+this.options.valueScale,axisAlpha:0,dashLength:1}]}),f,i,e,r;t.pathToImages=$.Urls.baseImageUrl+"amcharts/",t.zoomOutButton={backgroundColor:"#000000",backgroundAlpha:.15},t.zoomOutText="",t.dataProvider=n,t.categoryField="date",t.balloon.bulletSize=5,t.balloon.fontSize=13,t.numberFormatter={precision:1,decimalSeparator:".",thousandsSeparator:","},t.percentFormatter={precision:1,decimalSeparator:".",thousandsSeparator:","};var o=n.slice(n.length-1),l=n.slice(0),h=o[0].date.getFullYear()-l[0].date.getFullYear(),u=this,s=12;return(u.options.indicatorGraphInterval===INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START||u.options.indicatorGraphInterval===INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START)&&(s=4),u.options.indicatorGraphInterval===INDICATOR_GRAPH_INTERVAL.YEARLY&&(s=1),o.length!=0&&(t.addListener("dataUpdated",function(){var n=o[0].date.getMonth(),i=o[0].date.getFullYear(),r=5;h<5?($("#zoom-5-year").addClass("disabled"),$("#zoom-10-year").addClass("disabled"),r=1):h<10&&$("#zoom-10-year").addClass("disabled");$("#albertatab .zoom-scale span.zoom").on("click",function(){var r=$(this).attr("data-length");$(this).hasClass("disabled")||t.zoomToDates(new Date(i-r,n),new Date(i,n)),$("#albertatab .zoom-scale span.zoom").removeClass("selected"),$(this).addClass("selected")});t.zoomToDates(new Date(i-r,n),new Date(i,n))}),t.addListener("zoomed",function(){})),t.addListener("zoomed",function(n){var r=n.startDate.getMonth(),f=n.endDate.getMonth(),i;u.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START?(r=r/3,f=f/3,AmCharts.shortMonthNames=["Q1","Q1","Q1","Q2","Q2","Q2","Q3","Q3","Q3","Q4","Q4","Q4"]):u.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START&&(r=(r-2)/3,f=(f-2)/3,AmCharts.shortMonthNames=["Q1","Q1","Q1","Q2","Q2","Q2","Q3","Q3","Q3","Q4","Q4","Q4"]);var h=u.options.indicatorGraphInterval.englishShortMonthNames[r],c=u.options.indicatorGraphInterval.englishShortMonthNames[f],l=n.startDate.getFullYear(),a=n.endDate.getFullYear();$("#albertatab .zoom-range").html("<span class='month'>"+h+"</span><span class='year'>"+l+"</span> to <span class='month'>"+c+"</span><span class='year'>"+a+"</span>"),u.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.YEARLY&&$("#albertatab div.zoom-range span.month").hide();var e=t.startIndex,o=t.endIndex,v=t.dataProvider.length-1;$("#albertatab .zoom-scale span.zoom").removeClass("selected"),o===v&&(i=(o-e)/s,e===0?i==1||i==5||i==10?$("#zoom-"+i+"-year").addClass("selected"):$("#zoom-all").addClass("selected"):$("#zoom-"+i+"-year").addClass("selected"))}),f=t.categoryAxis,f.parseDates=!0,f.equalSpacing=!0,f.inside=!1,f.gridAlpha=.15,f.position="top",f.axisColor="#DADADA",f.minorGridEnabled=!0,i=new AmCharts.AmGraph,i.id="g1",i.connect=!0,i.title="Alberta",i.valueField="alberta",i.bullet="round",i.bulletColor="#FFFFFF",i.bulletBorderAlpha=1,i.bulletBorderColor="#FFFFFF",i.bulletSize=5,i.connect=!1,i.gapPeriod=400,i.lineThickness=2,i.lineColor="#67B7DC",i.hideBulletsCount=12,i.useLineColorForBulletBorder=!0,i.balloonText=this.indicatorType+"\n[[value]] "+this.options.valueScale,t.addGraph(i),e=new AmCharts.ChartCursor,e.pan=!1,e.valueLineEnabled=!0,e.cursorPosition="mouse",e.zoomable=!0,e.categoryBalloonDateFormat="MMM YYYY",t.addChartCursor(e),r=new AmCharts.ChartScrollbar,r.graph="g1",r.offset=30,r.scrollbarHeight=80,r.backgroundAlpha=.5,r.selectedGraphLineColor="#999999",r.selectedGraphLineAlpha=1,r.selectedBackgroundAlpha=.1,r.selectedBackgroundColor="#888888",r.graphFillAlpha=.6,r.graphLineAlpha=.5,r.autoGridCount=!0,r.color="#444444",t.addChartScrollbar(r),this.albertaTimeGraph=t,this},BaseIndicator.prototype.renderAlbertaTimeGraph=function(){var n,t;this.albertaTimeGraph.write("ABTimeDiv"),n=this,$('a[data-toggle="tab"]').bind("shown",function(t){t.target.hash=="#albertatab"&&n.albertaTimeGraph.invalidateSize()}),t='<ul id="embedSizePicker"><li><span>500x425</span><div class="sizePreview small" style="width:2.5em; height:2.05em;"></div></li><li class="selected"><span>760x646</span><div class="sizePreview medium" style="width:4em; height:3.3em;"></div></li><li><span>950x808</span><div class="sizePreview large" style="width:5.5em; height:4.6em;"></div></li></ul>',$("#chartContainer").append('<div id="embedChartArea"><textarea id="embedCodeTextArea"></textarea>'+t+'<input id="closeEmbed" type="button" value="Close" class="btn btn-info" /></div>'),$("#embedCodeTextArea").focus(function(){$(this).select()}).mouseup(function(n){n.preventDefault()});$("#closeEmbed").on("click",function(){$("#embedChartArea").hide()});$("#embedSizePicker li").on("click",function(){$("#embedSizePicker li.selected").removeClass("selected"),$(this).addClass("selected"),GetEmbedChartData()});$("#embed_dataset a").on("click",function(){GetEmbedChartData(),$("#embedChartArea").toggle()});return this},BaseIndicator.prototype.removeColourFromArrowImages=function(){$("td img[src*=red]").each(function(){$(this).attr("src",$(this).attr("src").replace("red","gray"))}),$("td img[src*=green]").each(function(){$(this).attr("src",$(this).attr("src").replace("green","gray"))})},BaseIndicator.prototype.populateAlbertaTable=function(n,t){var r,i,u;n.length!=0&&(r=n[n.length-1].date,i=r.getMonth(),this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START?i=i/3:this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START&&(i=(i-2)/3),$("#albertaAnalysis").text("Analysis - "+this.options.indicatorGraphInterval.englishMonthNames[i]+" "+r.getFullYear()),$("#latestMonthTitle").html(this.options.indicatorGraphInterval.englishMonthNames[i]),$("#latestMonthOneYearEarlierTitle").html((r.getFullYear()-1).toString()),$("#latestMonthYearTitle").html(r.getFullYear().toString()),this.options.indicatorGraphInterval===INDICATOR_GRAPH_INTERVAL.YEARLY?$("#IndicatorLatestDate").val(r.getFullYear()):this.options.indicatorGraphInterval===INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START||this.options.indicatorGraphInterval===INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START?$("#IndicatorLatestDate").val(this.options.indicatorGraphInterval.englishShortMonthNames[i]+" "+r.getFullYear()):$("#IndicatorLatestDate").val(this.options.indicatorGraphInterval.englishShortMonthNames[i]+" "+r.getFullYear()),this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START?$("#yearToLatestMonthTitle").html("Q1 - "+this.options.indicatorGraphInterval.englishShortMonthNames[i]+this.options.indicatorYTDCalculation.displayText):this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START?$("#yearToLatestMonthTitle").html("Q1 - "+this.options.indicatorGraphInterval.englishShortMonthNames[i]+this.options.indicatorYTDCalculation.displayText):$("#yearToLatestMonthTitle").html("JAN - "+this.options.indicatorGraphInterval.englishShortMonthNames[i]+this.options.indicatorYTDCalculation.displayText),$("#yearToLatestMonthOneYearEarlierTitle").html((r.getFullYear()-1).toString()),$("#yearToLatestMonthYearTitle").html(r.getFullYear().toString()),u=t[0].albertaTrendForLatestMonth.yearOverYear,$("#latestMonthTrendIcon").html(this.getTrendImage(parseFloat(u))),$("#latestMonthOneYearEarlier").html(t[0].albertaTrendForLatestMonth.oneYearEarlier),$("#latestMonth").html(t[0].albertaTrendForLatestMonth.value),$("#latestMonthYearOverYear").html(u),$("#yearToLatestMonthOneYearEarlier").html(t[0].albertaTrendYearToDate.oneYearEarlier),$("#yearToLatestMonth").html(t[0].albertaTrendYearToDate.value),$("#yearToLatestMonthYearOverYear").html(t[0].albertaTrendYearToDate.yearOverYear))},BaseIndicator.prototype.initializeInterProvincialBarGraph=function(n){var h,t,o,u,i;$(n).each(function(){(this.currentValue==""||this.lastYearValue=="")&&(this.color="#FFFFFF",this.YOYChange=NO_VALUE),this.currentValue>0&&this.lastYearValue==0&&(this.color="#FFFFFF",this.YOYChange=NO_VALUE),(this.currentValue<0||this.lastYearValue<0)&&(this.color="#FFFFFF",this.YOYChange=NO_VALUE)});var s=this.options.alternateName.length>0?this.options.alternateName:this.indicatorType,r=$("#interProvincialDateSelect option:selected").text().split(" "),e="",f="";return r[0]=="Quarter"?(e=r[0]+" "+r[1],f=r[2]):(e=r[0],f=r[1]),h=f-1,t=new AmCharts.makeChart("interProvBarDiv",{type:"serial",theme:"light","export":{enabled:!0,libs:{path:"http://www.amcharts.com/lib/3/plugins/export/libs/"}},valueAxes:[{title:s+" (YR over YR % change)",axisAlpha:1,dashLength:5,unit:"%",gridAlpha:.2,axisColor:"#DADADA"}]}),t.dataProvider=n,t.categoryField="where",t.balloon.fontSize=13,o=t.categoryAxis,o.gridPosition="start",t.numberFormatter={precision:1,decimalSeparator:".",thousandsSeparator:","},t.usePrefixes=!0,t.prefixesOfBigNumbers=[{number:1e6,prefix:"M"},{number:1e9,prefix:"B"},{number:1e12,prefix:"T"}],u=new AmCharts.ValueAxis,u.gridAlpha=.2,u.axisColor="#DADADA",u.axisAlpha=1,u.dashLength=5,u.unit="%",u.title=this.indicatorType+" (YR over YR % change)",t.addValueAxis(u),i=new AmCharts.AmGraph,i.valueField="YOYChange",i.descriptionField="fullName",i.balloonText=r[0]=="Quarter"?"[[fullName]]\nQ"+r[1]+": [[value]]%\n":"[[fullName]]\n"+r[0].substring(0,3)+" "+r[1]+": [[value]]%\n",i.type="column",i.lineAlpha=0,i.lineColor="#67B7DC",i.fillAlphas=.8,i.colorField="color",t.addGraph(i),this.interProvincialBarGraph=t,this},BaseIndicator.prototype.renderInterProvincialBarGraph=function(){this.interProvincialBarGraph.write("interProvBarDiv");var n=this;$('a[data-toggle="tab"]').bind("shown",function(t){(t.target.hash=="#interprovincialtab"||t.target.hash=="#interProvGraphBar")&&n.interProvincialBarGraph.invalidateSize()})},BaseIndicator.prototype.populateInterProvinceTable=function(n,t,i,r,u){var o=new Date(n),s=o.getFullYear()-1,h=o.getFullYear(),f=o.getMonth(),c,l,e,a;this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START?f=f/3:this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START&&(f=(f-2)/3),c=this.options.indicatorGraphInterval.englishMonthNames[f],l=this.options.indicatorGraphInterval.englishShortMonthNames[f],$("#interProvTable").remove(),$("#interProvGridDiv").append('<table id="interProvTable" class="dataTable table-bordered table-striped table-condensed"><thead></thead><tbody></tbody><tfoot></tfoot></table>'),e="JAN",e=this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START?"Q1":this.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START?"Q1":"JAN",$("#interProvTable thead").append('<tr class="gridHeader1 hidden-xs"><td>'+i+'</td><td id="interProvMonthNameTitle" colspan="4">'+c+'</td><td id="interProvYTDTitle" colspan="3" class="ytd">'+e+" - "+l+this.options.indicatorYTDCalculation.displayText+"</td></tr>"),$("#interProvTable thead").append('<tr class="gridHeader2"><td>'+r+'</td><td><span class="visible-lg-block">Trend</span></td><td>'+s+"</td><td>"+h+"</td><td>"+u+'</td><td class="hidden-xs ytd">'+s+'</td><td class="hidden-xs ytd">'+h+'</td><td class="hidden-xs ytd">'+u+"</td></tr>"),a=this,$.each(t,function(n,t){$("#interProvTable tbody").append(a.buildTableRow(t))})},BaseIndicator.prototype.initializeTypePieChart=function(n,t,i){var r=new AmCharts.makeChart("typePieDiv",{type:"pie",theme:"light",valueField:i,titleField:t,dataProvider:n,"export":{enabled:!0,libs:{path:"http://www.amcharts.com/lib/3/plugins/export/libs/"}}}),u;return r.balloonText="[[title]]\n[[value]] "+this.options.valueScale,r.balloon.fontSize=13,r.colors=["#4D4D4D","#5DA5DA","#FAA43A","#60BD68","#F17CB0","#B2912F","#B276B2","#DECF3F","#F15854","#B0DE09","#996633","#0D52D1","#8A0CCF","#FCD202","#04D215","#333333","#000000","#57032A","#CA9726","#990000","#754DEB"],r.numberFormatter={precision:1,decimalSeparator:".",thousandsSeparator:","},r.percentFormatter={precision:1,decimalSeparator:".",thousandsSeparator:","},r.startDuration=0,r.pullOutDuration=0,r.usePrefixes=!0,r.prefixesOfBigNumbers=[{number:1e6,prefix:"M"},{number:1e9,prefix:"B"},{number:1e12,prefix:"T"}],(this.isMobile||this.isTablet)&&(r.labelsEnabled=!1),u=new AmCharts.AmLegend,u.align="center",u.markerType="circle",r.addLegend(u),this.typePieChart=r,this},BaseIndicator.prototype.renderTypePieChart=function(){this.typePieChart.write("typePieDiv");var n=this;$('a[data-toggle="tab"]').bind("shown",function(t){(t.target.hash=="#typetab"||t.target.hash=="#typeGraphPie")&&n.typePieChart.invalidateSize()})},BaseIndicator.prototype.initializeTypeBarChart=function(n,t,i){var v=this.options.alternateName.length>0?this.options.alternateName:this.indicatorType,r=new AmCharts.makeChart("typeBarDiv",{type:"serial",theme:"light","export":{enabled:!0,libs:{path:"http://www.amcharts.com/lib/3/plugins/export/libs/"}},valueAxes:[{title:v+" "+this.options.valueScale,axisAlpha:1,dashLength:5,unit:"",gridAlpha:.2,axisColor:"#DADADA",minimum:0}]}),s=$.Colours.provinceChartColour,h=$.Colours.albertaChartColour,c=t.getFullYear()-1,l=t.getFullYear(),a=this.options.indicatorGraphInterval.englishShortMonthNames[t.getMonth()],o,u,f,e;return $("#typeLegendPrevYear").html(c.toString()+'<span style="background:'+s+';">&nbsp;</span>'),$("#typeLegendCurrYear").html(l.toString()+'<span style="background:'+h+';">&nbsp;</span>'),r.dataProvider=n,r.categoryField=i,r.balloon.fontSize=13,r.sequencedAnimation=!1,r.numberFormatter={precision:1,decimalSeparator:".",thousandsSeparator:","},r.usePrefixes=!0,r.prefixesOfBigNumbers=[{number:1e6,prefix:"M"},{number:1e9,prefix:"B"},{number:1e12,prefix:"T"}],o=r.categoryAxis,o.gridPosition="start",o.labelRotation=45,u=new AmCharts.ValueAxis,u.gridAlpha=.2,u.axisColor="#DADADA",u.axisAlpha=1,u.dashLength=5,u.title=this.indicatorType+" "+this.options.valueScale,u.minimum=0,r.addValueAxis(u),f=new AmCharts.AmGraph,f.valueField="lastYearValue",f.balloonText="[[category]]\n"+a+" "+c+": [[value]] "+this.options.valueScale,f.type="column",f.lineAlpha=0,f.lineColor=s,f.fillAlphas=.8,r.addGraph(f),e=new AmCharts.AmGraph,e.valueField="currentValue",e.balloonText="[[category]]\n"+a+" "+l+": [[value]] "+this.options.valueScale,e.type="column",e.lineAlpha=0,e.lineColor=h,e.fillAlphas=.8,r.addGraph(e),this.typeBarChart=r,this},BaseIndicator.prototype.renderTypeBarChart=function(){this.typeBarChart.write("typeBarDiv");var n=this;$('a[data-toggle="tab"]').bind("shown",function(t){(t.target.hash=="#typetab"||t.target.hash=="#typeGraphBar")&&n.typeBarChart.invalidateSize()})},BaseIndicator.prototype.getTrendImage=function(n,t){t=typeof t!="undefined"?t:this.options.indicatorTrend,iconImage=t==INDICATOR_TREND.DESIRABLE_INCREASE?n>0?"fa-arrow-circle-o-up isPositive":n<0?"fa-arrow-circle-o-down isNegative":"fa-dot-circle-o isNeutral":t==INDICATOR_TREND.DESIRABLE_DECREASE?n<0?"fa-arrow-circle-o-down isPositive":n>0?"fa-arrow-circle-o-up isNegative":"fa-dot-circle-o isNeutral":n>0?"fa-arrow-circle-o-up isNeutral":n<0?"fa-arrow-circle-o-down isNeutral":"fa-dot-circle-o isNeutral";return"<i class='fa "+iconImage+"'></i>"},BaseIndicator.prototype.initializeDropDown=function(n,t){this.sortByDate(t);var r=this.options.indicatorGraphInterval.englishMonthNames.length,i=this;$.each(t,function(t,u){var e=u.date,f=e.getMonth();i.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_JAN_START?f=f/3:i.options.indicatorGraphInterval==INDICATOR_GRAPH_INTERVAL.QUARTERLY_MAR_START&&(f=(f-2)/3),t<r&&n.append($("<option></option>").attr("value",t).text(i.options.indicatorGraphInterval.englishMonthNames[f]+" "+e.getFullYear()))})},BaseIndicator.prototype.sortByDate=function(n){return n.sort(function(n,t){return n.date>t.date?-1:n.date<t.date?1:0}),n},BaseIndicator.prototype.sortBySortValue=function(n){return n.sort(function(n,t){return n.sortValue>t.sortValue?1:n.sortValue<t.sortValue?-1:0}),n},BaseIndicator.prototype.buildTableRow=function(n){n.lastYearValue==0&&n.currentValue>0&&(n.YOYChange=NO_VALUE),n.YTDLastYearValue==0&&n.YTDCurrentValue>0&&(n.YTDYOYChange=NO_VALUE);return'<tr class="'+n.shortDisplayName+'"><td><span class="hidden-xs" title="'+n.displayName+'">'+n.displayName+'</span><span class="visible-xs">'+n.shortDisplayName+"</span></td><td>"+this.getTrendImage(parseFloat(n.YOYChange),n.typeTrend)+"</td><td>"+n.lastYearValue+"</td><td>"+n.currentValue+"</td><td>"+n.YOYChange+'</td><td class="hidden-xs ytd">'+n.YTDLastYearValue+'</td><td class="hidden-xs ytd">'+n.YTDCurrentValue+'</td><td class="hidden-xs ytd">'+n.YTDYOYChange+"</td></tr>"},$(document).ready(function(){function n(){function e(n){var t=[];return $.each(n,function(n,i){t.push({date:new Date(parseInt(i.When.substring(6))),dataDate:parseInt(i.When.substring(6)),alberta:parseFloat(i.Alberta).toFixed(1),saskatchewan:parseFloat(i.Saskatchewan).toFixed(1),manitoba:parseFloat(i.Manitoba).toFixed(1),britishColumbia:parseFloat(i.BritishColumbia).toFixed(1),canada:parseFloat(i.Canada).toFixed(1),quebec:parseFloat(i.Quebec).toFixed(1),ontario:parseFloat(i.Ontario).toFixed(1),novaScotia:parseFloat(i.NovaScotia).toFixed(1),newBrunswick:parseFloat(i.NewBrunswick).toFixed(1),princeEdwardIsland:parseFloat(i.PrinceEdwardIsland).toFixed(1),newfoundlandandandlabrador:parseFloat(i.NewfoundlandAndLabrador).toFixed(1)})}),t}function o(i){n.initializeDropDown($("#interProvincialDateSelect"),i),$("#interProvincialDateSelect").on("change",function(){var r=i[$(this).val()].dataDate,u=$.getJSON($.Urls.baseUrl+t+"/RefreshYTDData",{javaScriptDateTime:r});$.when(u).done(function(t){var u=s(t.interProvGridData),i;n.initializeInterProvincialBarGraph(u),n.albertaTimeGraph.numberFormatter={precision:0,decimalSeparator:".",thousandsSeparator:","},n.renderInterProvincialBarGraph(),i=h(t.interProvGridData),n.populateInterProvinceTable(r,i,"Provinces","Unadjusted, $/week",COMPARISON_CALCULATION.PERCENT_CHANGE.displayText)})}).change()}function s(t){var r=!1,i=[];return $.each(t,function(n,t){t.DisplayInBarChart==!0&&(i.push({where:t.BarChartDisplayName,fullName:t.DisplayName,currentValue:t.CurrentValue,lastYearValue:t.LastYearValue,YOYChange:t.YOYChange,YTDCurrentValue:t.YTDCurrentValue,YTDLastYearValue:t.YTDLastYearValue,YTDYOYChange:t.YTDYOYChange,color:t.BarChartColor,sortValue:t.BarChartSort}),t.BarChartDisplayName=="AB"?$("#interProvLegendAB").html('Alberta <span style="background:'+t.BarChartColor+';">&nbsp;</span>'):t.BarChartDisplayName=="CA"?$("#interProvLegendCA").html('Canada <span style="background:'+t.BarChartColor+';">&nbsp;</span>'):r||(r=!0,$("#interProvLegendPROV").html('Other Provinces <span style="background:'+t.BarChartColor+';">&nbsp;</span>')))}),n.sortBySortValue(i),i}function h(t){var i=[];return $.each(t,function(n,t){i.push({displayName:t.TableDisplayName,shortDisplayName:t.BarChartDisplayName,currentValue:t.CurrentDisplayValue,lastYearValue:t.LastYearDisplayValue,YOYChange:t.YOYChangeDisplay,YTDCurrentValue:t.YTDCurrentDisplayValue,YTDLastYearValue:t.YTDLastYearDisplayValue,YTDYOYChange:t.YTDYOYChangeDisplay,sortValue:t.TableSort})}),n.sortBySortValue(i),i}var n=new BaseIndicator("Average Weekly Earnings",{indicatorGraphInterval:INDICATOR_GRAPH_INTERVAL.MONTHLY,indicatorYTDCalculation:INDICATOR_CALCULATION.AVERAGE,valueScale:"($/week)"}),t="AverageWeeklyEarnings",r=$.getJSON($.Urls.baseUrl+t+"/Data"),u="http://www5.statcan.gc.ca/cansim/a26?lang=eng&retrLang=eng&id=2810026&paSer=&pattern=&stByVal=1&p1=1&p2=-1&tabMode=dataTable&csid=",c=$.Urls.baseApiUrl+t,f="Adapted from Statistics Canada, <A HREF='"+u+"' TARGET='_BLANK'>Cansim table 281-0026</A> (Average weekly earnings). This does not constitute an endorsement by Statistics Canada of this product.",i;$(window).resize(function(){n.isMobile=$("#is-mobile").is(":visible"),n.isTablet=$("#is-tablet").is(":visible"),n.pieChart!=null&&(n.pieChart.labelsEnabled=!(n.isMobile||n.isTablet))}),i=$.Deferred(),AmCharts.ready(function(){i.resolve()}),$.when(i,r).done(function(t,i){n.generateTouchOrClickLanguage();var r=e(i[0].albertaData);n.initializeAlbertaTimeGraph(r).renderAlbertaTimeGraph(),n.populateAlbertaTable(r,i),$(".graphDataSource").html(f),o(r.lenth>12?r.slice(r.length-12):r.slice(1))})}n()})