var JQueryAmerenScrubAndEncodeHtml=function(){function u(n){var t="",i;return n.each(function(){t+=f($(this))}),i=o(t),e(i)}function f(n){return n.html()}function e(n){return $("<div/>").text(n).html()}function o(r){var u=$("<div><\/div>").html(s(r));return u.find("."+i).remove(),n?u.find("input, select").not(n).remove():u.find("input, select").remove(),t&&u.find(t).remove(),h(u),u.html()}function s(n){var r="<![CDATA[",u="]\]>",f='<dt class="'+i+'">\n'+r+"\n",e="\n"+u+"\n<\/dt>",t=n.replace(/<script[^>]*>/gi,f).replace(/<\/script[^>]*>/gi,e);return t=t.replace(/<\!\[CDATA\[\s+\/\/<\!\[CDATA\[/,r),t.replace(/\/\/\]\]>\s*\]\]>/,u)}function h(n){n.find("script").remove();$("form",n).each(function(){$(this).after($("<div><\/div>").html($(this).html()));$(this).remove()});r(n)}function r(n){$(n).children().each(function(){c(this);r(this)})}function c(n){var i=$(n)[0].attributes,t,f,r,u;if(i)for(t=0,f=i.length;t<f;t++)r=i[t],r&&(u=r.name||"",u.toLowerCase().indexOf("on")===0&&$(n).removeAttr(u))}function l(n){t=n}function a(t){n=t}var i="JQueryAmerenScrubAndEncodeHtmlNeuterScript",n,t;return{scrubbedAndEncodedHtml:u,setRemoveElementSelector:l,setKeepInputElementSelector:a}}(),isProcessing,ameren,HtmlExportLinks;(function(n){n.fn.scrubbedAndEncodedHtml=function(t){var i=n.extend({removeElementSelector:null,keepInputElementSelector:null},t||{});return JQueryAmerenScrubAndEncodeHtml.setRemoveElementSelector(i.removeElementSelector),JQueryAmerenScrubAndEncodeHtml.setKeepInputElementSelector(i.keepInputElementSelector),JQueryAmerenScrubAndEncodeHtml.scrubbedAndEncodedHtml(this)}})(jQuery);ameren=ameren||{};ameren.util=ameren.util||{};ameren.util.url={getParameterByName:function(n){var t=RegExp("[?&]"+n+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}};ameren.util.globalflag={StatusCheckFlag:function(n,t){var t=typeof t!="undefined"?t:!1;typeof t=="boolean"&&n!=null&&n!=""&&t&&$("#"+n).addClass("hidden")}};isProcessing=!1;ameren.util.ajax={initProcessing:function(n){n!=null&&n!=""&&$("#"+n).dialog({autoOpen:!1,width:"auto",height:60,modal:!0,resizable:!1,open:function(){$(this).siblings("div.ui-dialog-titlebar").remove();$(this).css("border","2px solid #333");$(this).css("height","40px")}})},showProcessing:function(n){if(n!=null&&n!=""){var t=$("#"+n);t!=undefined&&(isProcessing=!0,setTimeout(function(){isProcessing&&t.dialog("open")},500))}},hideProcessing:function(n){if(isProcessing=!1,n!=null&&n!=""){var t=$("#"+n);t!=undefined&&t.dialog("isOpen")&&t.dialog("close")}}};ameren.util.dates={convert:function(n){return n.constructor===Date?n:n.constructor===Array?new Date(n[0],n[1],n[2]):n.constructor===Number?new Date(n):n.constructor===String?new Date(n):typeof n=="object"?new Date(n.year,n.month,n.date):NaN},convertJson:function(n){var t=parseInt(n.substring(6).replace(")/","")),i=t>0?t:0;return new Date(i)},compare:function(n,t){return isFinite(n=this.convert(n).valueOf())&&isFinite(t=this.convert(t).valueOf())?(n>t)-(n<t):NaN},inRange:function(n,t,i){return isFinite(n=this.convert(n).valueOf())&&isFinite(t=this.convert(t).valueOf())&&isFinite(i=this.convert(i).valueOf())?t<=n&&n<=i:NaN}};ameren.util.form={populateSelect:function(n){$("#"+n.selectID).empty();var t="";prompt&&(t+='<option value="">'+n.prompt+"<\/option>");n.jsonData&&n.jsonData.length>0&&(typeof n.jsonData[0]=="object"?$.each(n.jsonData,function(i,r){t+='<option value="'+r[n.valueField]+'">'+r[n.displyField]+"<\/option>"}):typeof n.jsonData[0]=="string"&&$.each(n.jsonData,function(n,i){t+='<option value="'+i+'">'+i+"<\/option>"}));$("#"+n.selectID).append(t)},initSelect2:function(n,t,i,r,u,f){typeof f=="undefined"&&(f=100);formatSelection=u?u.formatSelection:$.fn.select2.defaults.formatSelection;formatResult=u?u.formatResult:$.fn.select2.defaults.formatResult;$(n).select2({initSelection:function(n,i){$(n.val().split(";")).each(function(){var n=this,r=this;$(t).each(function(){if($(this).attr("id")==n)return r=$(this).attr("text"),!1});i({id:n,text:r})})},data:t,query:function(n){var t=$(this.data).filter(function(t,i){return typeof n.term=="undefined"||n.term==""||i.text.toUpperCase().indexOf(n.term.toUpperCase())>=0});n.callback({results:t.slice((n.page-1)*f,n.page*f),more:t.length>=n.page*f})},placeholder:r,formatSelection:formatSelection,formatResult:formatResult})}};typeof console=="undefined"&&(console={});typeof console.log=="undefined"&&(console.log=function(){});ameren.util.CSRF=function(){function t(){return $("input[name="+n+"]").val()}function i(){$.ajaxSetup({cache:!1,beforeSend:function(i){i.setRequestHeader(n,t())},error:function(n){switch(n.status){case 400:return;case 403:console.log("Login Issue : Forbidden");window.location=n.responseJSON;return}Common.ajax.handleError(n.responseText,"Request Failed","Request failed. Please try again.")}})}var n="__RequestVerificationToken";return{init:i}}().init();ameren=ameren||{};ameren.model=ameren.model||{};ameren.model.settings=ameren.model.settings||{};ameren.model.settings={OverrideGlobalAjaxErrorHandler:function(n){return this.overrideGlobalAjaxErrorHandler=this.overrideGlobalAjaxErrorHandler||!1,typeof n!="undefined"&&(this.overrideGlobalAjaxErrorHandler=n),this.overrideGlobalAjaxErrorHandler==!0}};HtmlExportLinks=function(){function n(){a=$("#excelExportLink");t=$("#ExcelExportJQuerySelector");i=$("#HtmlExportFileName");r=$("#htmlExportForm");u=$("#htmlExportString");f=$("#htmlExportType");v=$("#pdfExportLink");e=$("#PdfPageOrientation");o=$("#PdfExportJQuerySelector");y=$("#printLink");p=$("#PageHeader");w=$("#PageFooter")}function s(n,t,i){n||(n=o.val());l("PDF",n,t,i,".invisiblePdf")}function h(n,i,r){n||(n=t.val());l("Excel",n,i,r,".invisibleExcel")}function c(){window.print()}function l(n,t,o,s){o&&i.val(o);s&&e.val(s);f.val(n);u.val($(t).scrubbedAndEncodedHtml());r.submit()}var a,t,i,r,u,f,v,e,o,y,p,w;return $(document).ready(function(){$("body").on("click","#excelExportLink",function(t){t.preventDefault();n();h()});$("body").on("click","#pdfExportLink",function(t){t.preventDefault();n();$(".grid tr").css("page-break-inside","avoid");s()});$("body").on("click","#printLink",function(t){t.preventDefault();n();c()})}),{printReport:c,exportToExcel:h,exportToPDF:s}}()