function automateGettingStarted(){releaseDate<currentTime&&(releaseDate.setDate(releaseDate.getDate()+expandDays),releaseDate>currentTime?common.showPanel("GetStarted"):common.hidePanel("GetStarted"))}function relativeUrl(n){return n}function resetStates(){inputData.Region=[];inputData.State=[];inputData.Make=[];inputData.Make=[];inputData.Model="";inputData.County="";inputData.City="";$("#radiostate").prop("checked",!1);$("#radioregion").prop("checked",!1);$("#divregions,#divstates,#opregions,#divcounties,#countiesseparator,#trainglecities, #divcities,#divregiondisc,#trainglestateregion,#trainglecounties,#trainglestateregion,#opstates,#opregions").css("display","none");common.hidePanels("collapsedivXYtable,collapseThree,collapseFour");$("#strcounties,#strcities,#txt,#region").html("");$("#opstates option").remove();$("#opregions option").remove();$("#opcounties option").remove();$("#opcities option").remove();$("#opregions").unbind("change")}function hideLoader(n){$("#divfade_"+n).hide()}function showLoader(n){$("#divfade_"+n).css("display","block")}function getandbindMetrics(n,t,i){var r=$(".topicInfo_"+t),u=r.attr("fromClick"),f,e,o,s,h,c;(u===undefined||u===null)&&(jsonObject={},r.removeAttr("fromClick"),localStorage.setItem("invalidMsgCount","0"),localStorage.setItem("selectedQuery",null));$(".scroll").scrollTop(0);$("#ascarrow").hide();$("#descarrow").show();f=$("#RowPer");f.prop("checked",!1);e=$("#ColPer");e.prop("checked",!1);inputData.TopicNum=t;inputData.TopicName=i;inputData.MetricNum="";o="Seltopic_"+n;s=$("#"+o).text();$("#parSelecttopic").html(s);$(".topicpanel").hide();$(".topicinfo_"+n).show();$("#parSelectMetric").html("");$("#stateorregion").html("");$("#strcounties").html("");$("#strcities").html("");$("#liTimeFrameSilder a").click();$("#strbodyclass").html("");$("#trainglebodyclass").css("display","none");common.hidePanels("collapseThree,collapseFive");common.showPanel("SampleQueries");automateGettingStarted();$("#expandQueries").show();$("#collapseQueries").hide();$("#divselctedsasdata").html("");$("#RowPerstrong").html("");$("#ColPerstrong").html("");$("#RowPerspan").css("display","none");$("#ColPerspan").css("display","none");$("#countiesseparator").css("display","none");(jsonObject===undefined||JSON.stringify(jsonObject)==="{}")&&makemodel.clearMakeModels();$("#years-range option").remove();timeframe.setSlider();jsonObject.SasData&&$("#collapseFive:visible").length==0&&($("[data-target='#collapseFive']").click(),common.showPanels("collapseFive"));jsonObject.modelyears&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));jsonObject.Make&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));jsonObject.VPICBodyClass&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));localStorage.setItem("topicName",i);localStorage.setItem("topicId",n);h="divtopic_"+n;$(".divoverview").css("display","none");$("#"+h).css("display","block");c="tpvideo_"+n;$(".hidevideos").css("display","none");$("."+c).css("display","block");selectAttributes("","","");getsamplequeries(n);getallqueries();$(".globalSearch").hide();$("#Searchqueries").val("").attr("placeholder","Search "+i);$("#Searchallqueries").val("").attr("placeholder","Search all Topics");$("#sampleQuieries,#sampleQuieries1").find("a").each(function(){$(this).removeClass("searchQueriesLinkSelected")});$("#topicinfo_"+n+":visible").length===1&&common.toggelPanel("topicinfo_"+n);$("#TopicsVideos_"+n+":visible").length===1&&common.toggelPanel("TopicsVideos_"+n);var l=function(i){if($("#divmetrics").html(i),jsonObject!=null&&jsonObject!=undefined&&jsonObject.metric_num!=undefined&&jsonObject.metric_num>0){var r=$(".radioSelmetricname_"+jsonObject.metric_num);r.click()}else $(".metrics:first").length>0?($(".metrics:first").click(),$(".noInitialCriteriaData").show(),$(".noCriteriaBtn").show()):(getandbindMetricTypes(0,0),noData());$("#currentqquery").html(t);$(".topicinfo_"+n).find("[href='#Panel_"+n+"']").click()},a=function(n){console.log("error",n);alert("System Error Occurred (0210). Please Email NCSARequests@dot.gov")},v="Metrics/MetricView?topicId="+n;common.ajaxGet(v,l,a)}function getandbindMetricTypes(n,t){var f=$("#RowPer"),i,r,u;f.prop("checked",!1);i=$("#ColPer");i.prop("checked",!1);$("#parSelectMetric").html("");$("#parSelectMetricType").html("");$("#region").html("");$("#strcounties").html("");$("#strcities").html("");$("#txt").html("");$("#divselctedsasdata").html("");$("#RowPerstrong").html("");$("#ColPerstrong").html("");$("#RowPerspan").css("display","none");$("#ColPerspan").css("display","none");$("#countiesseparator").css("display","none");inputData.MetricNum=t;inputData.metricidval=n;inputData.Region=[];inputData.State="";inputData.County="";inputData.City="";inputData.Make="";inputData.Model="";inputData.SasData={};r="Selmetricname_"+n;u=$("#"+r).text();$("#parSelectMetric").html(u);common.showPanel("collapseTwo");jsonObject.modelyears&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));jsonObject.Make&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));jsonObject.VPICBodyClass&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));localStorage.setItem("metricId",n);selectAttributes("","","");var e=function(n){if($("#divmetrictypesdetails").html(n),jsonObject!=null&&jsonObject!=undefined&&jsonObject.metrictype_id!=undefined&&jsonObject.metrictype_id>0){var t=$(".radioSelmetrictypename_"+jsonObject.metrictype_id);t.attr("fromClick","retrive");t.click()}else $(".metrictypes:first").length>0?(metricsClick=1,$(".metrictypes:first").click()):bindSasDataElemnts(0,0,0,"")},o=function(){console.log("error");alert("System Error Occurred (0310). Please Email NCSARequests@dot.gov")},s="MetricType/MetricsTypeView?metricId="+n;common.ajaxGet(s,e,o)}function getandbindstates(){var n;inputData.Region=[];inputData.State=[];inputData.County="";inputData.City="";$("#divstates").css("display","block");$("#divcounties").css("display","block");$("#divcities").css("display","block");$("#opstates option").remove();$("#opcounties option").remove();$("#opcities option").remove();$("#opregions").css("display","none");$("#divregions").css("display","none");$("#opregions").css("display","none");$("#divregiondisc").css("display","none");$("#trainglestateregion").css("display","none");$("#trainglecounties").css("display","none");$("#trainglecities").css("display","none");$("#divregiondisc").html("");$("#stateorregion").html("");$("#strcounties").html("");$("#strcities").html("");$(".stateAndCity_Report").show();n=localStorage.getItem("metrictypeidval");bindSasDataFirstList(n);var t=function(n){if(n!==undefined&&n!==null&&(statesdata=n,$.each(n,function(n,t){$("#opstates").append($("<option>",{value:t.StateCode,text:t.StateName,datastatevalue:t.StateName}));console.log($("option").data("dataversion"))}),$("#opstates").select2({dropdownParent:$("#divstates")}).change(function(){}),$(".select2[multiple]").siblings(".select2-container").append('<span class="select-all"><\/span>'),$("#opcities").select2(),$("#opcounties").select2(),$(".select2#opcities").attr("disabled",!0).trigger("select2:updated"),$("#divcities").attr("data-original-title","Please select a State"),$(".select2#opcounties").attr("disabled",!0).trigger("select2:updated"),$("#divcounties").attr("data-original-title","Please select a State"),Object.keys(jsonObject).length>0&&jsonObject.State!==undefined&&jsonObject.State!=="")){var t=jsonObject.State;$("#opstates").val(null).trigger("change");$("#opstates").val(jsonObject.State).trigger("change");$("#opstates_select2 .select2").show();$(".stateAndCity_Report").removeClass("hide");common.showPanel("collapseFour")}},i=function(){alert("System Error Occurred (0510). Please Email NCSARequests@dot.gov")};common.ajaxGet("StateRegion/GetStates",t,i)}function statetexts(){var n,r,u,f,t,i;for(inputData.State=[],n=[],r=$("#opstates option:selected"),u=0;u<r.length;u++)f={value:r[u].getAttribute("value"),text:r[u].getAttribute("datastatevalue")},n.push(f);for(console.log("statetexts",n),t="",i=0;i<n.length;i++)inputData.State.push(n[i].value),t=t+n[i].text,i!==n.length-1&&(t=t+", ");$("#stateorregion").html(t);$("#stateorregion").attr("data-stateText",t);$("#trainglestateregion").css("display",r.length>0?"inline":"none")}function getandbindcounties(n){if(inputData.Region=[],inputData.County=[],statetexts(),$("#trainglestateregion").css("display","none"),$("#trainglecounties").css("display","none"),$("#trainglecities").css("display","none"),$("#trainglecounties").css("display","none"),$("#trainglecities").css("display","none"),$("#strcounties").html(""),$("#opcounties").val("").trigger("select2:updated"),inputData.State.length!==0&&!(inputData.State.length>1)){n=inputData.State[0];var t=$.grep(statesdata,function(t){return t.StateCode===n}),i="StateRegion/GetCounties?id="+t[0].Id,r=function(n){(n!==undefined&&n!==null||Object.keys(jsonObject).length>0&&jsonObject.County!==undefined&&jsonObject.County!=="")&&($("#divcounties").css("display","block"),$("#opcounties").css("display","block"),$("#opcounties option").remove(),$.each(n,function(n,t){$("#opcounties").append($("<option>",{value:t.CountyCode,text:t.CountyName,datacountyvalue:t.CountyName}))}),$("#opcounties").select2({dropdownParent:$("#divcounties")}).change(function(){}),$(".select2[multiple]").siblings(".select2-container").append('<span class="select-all"><\/span>'),$("#opcounties").val(null).trigger("change"),$("#opcounties").val(jsonObject.County).trigger("change"),$("#opcounties_select2 .select2-drop").show(),$("#opcities").attr("disabled",!0),getcountyid(""),$("#opcounties").trigger("select2:updated"))},u=function(){alert("System Error Occurred (0511). Please Email NCSARequests@dot.gov")};common.ajaxGet(i,r,u)}}function getcountyid(){var n,u,r,f,t,i;for(inputData.County=[],n=[],u=$("#opcounties option:selected"),r=0;r<u.length;r++)f={value:u[r].getAttribute("value"),text:u[r].getAttribute("datacountyvalue")},n.push(f);for(console.log("Counties",n),t="",i=0;i<n.length;i++)inputData.County.push(n[i].value),t=t+n[i].text,i!==n.length-1&&(t=t+", ");$(".select2#opcities").attr("disabled",n.length>0).trigger("select2:updated");$("#trainglecounties").css("display",t.length>0?"inline":"none");$("#strcounties").html(t);$("#strcounties").attr("data-countytext",t)}function getandbindcities(n){if(inputData.Region=[],inputData.City=[],statetexts(),$("#GetCities").css("display","none"),$("#trainglecities").css("display","none"),$("#strcities").html(""),$("#opcities").val("").trigger("select2:updated"),inputData.State.length!=0&&!(inputData.State.length>1)){n=inputData.State[0];var t=$.grep(statesdata,function(t){return t.StateCode==n}),i="StateRegion/GetCities?id="+t[0].Id,r=function(n){n!==undefined&&n!==null&&($("#divcities").css("display","block"),$("#opcities").css("display","block"),$("#opcities option").remove(),$("#opcities").select2("destroy"),$.each(n,function(n,t){$("#opcities").append($("<option>",{value:t.CityCode,text:t.CityName,datacityvalue:t.CityName}))}),$("#opcities").select2({dropdownParent:$("#divcities")}).change(function(){}),Object.keys(jsonObject).length>0&&jsonObject.City!==undefined&&jsonObject.City!==""&&($("#opcities").val(null).trigger("change"),$("#opcities").val(jsonObject.City).trigger("change"),$("#opcities_select2 .select2-drop").show(),getcityid("")),$("#opcities").trigger("select2:updated"))},u=function(){alert("System Error Occurred (0512). Please Email NCSARequests@dot.gov")};common.ajaxGet(i,r,u)}}function getcityid(){var t,u,r,f,n,i;for(inputData.City=[],t=[],u=$("#opcities option:selected"),r=0;r<u.length;r++)f={value:u[r].getAttribute("value"),text:u[r].getAttribute("datacityvalue")},t.push(f);for(n="",i=0;i<t.length;i++)inputData.City.push(t[i].value),n=n+t[i].text,i!==t.length-1&&(n=n+", ");$(".select2#opcounties").attr("disabled",t.length>0).trigger("select2:updated");$("#trainglecities").css("display",n.length>0?"inline":"none");$("#strcities").html(n);$("#strcities").attr("data-citytext",n)}function hideDropDowns(){var t,i,o,s,h,r,u,f,e,n;if($("#opcounties").css("display","block"),$("#divcounties").css("display","block"),$("#divcities").css("display","block"),$("#opcities").css("display","block"),t=$("#opstates option:selected"),i=$("#opstates option:selected").text(),$("#txt").html("* Cities with 50K or more populations are listed."),o=t.length>0&&(i.indexOf("Puerto Rico")>=0||i.indexOf("District of Columbia")>=0||t.length>1),t.length===1)$(".stateAndCity_Report").removeClass("hide");else if(jsonObject===undefined||JSON.stringify(jsonObject)==="{}"){if($(".stateAndCity_Report").parent().attr("id")=="sortable2"||$(".stateAndCity_Report").parent().attr("id")=="sortable3"){for(s=$(".stateAndCity_Report")[0],h=$("#sortable1")[0],$(".stateAndCity_Report").removeClass("hide"),h.insertBefore(s,null),$(".stateAndCity_Report").children().css("display","none"),r=$("#sortable2"),u="",n=0;n<r.children().length;n++)u+=r.children()[n].firstChild.textContent+" by ";for(bindBindYourTable(u,"empty"),f=$("#sortable3"),e="",n=0;n<f.children().length;n++)e+=f.children()[n].firstChild.textContent+" by ";bindBindYourTable("empty",e);changeBYTCondition()}$(".stateAndCity_Report").addClass("hide")}o?($("#opcounties").css("display","none"),$("#divcounties").css("display","none"),$("#divcities").css("display","none"),$("#opcities").css("display","none"),$("#txt").html("")):t.length==1?($(".select2#opcities").attr("disabled",!1).trigger("select2:updated"),$("#divcities").removeAttr("data-original-title"),$(".select2#opcounties").attr("disabled",!1).trigger("select2:updated"),$("#divcounties").removeAttr("data-original-title")):t.length==0&&($(".select2#opcities").attr("disabled",!0).trigger("select2:updated"),$("#divcities").attr("data-original-title","Please select a State"),$(".select2#opcounties").attr("disabled",!0).trigger("select2:updated"),$("#divcounties").attr("data-original-title","Please select a State"),$("#opcounties").html(""),$("#opcities").html(""))}function bindCitiesAndCounty(n){getandbindcounties(n);getandbindcities(n);hideDropDowns()}function getandbindregions(){var n;$(".stateAndCity_Report").addClass("hide");$("#divregions").css("display","block");$("#divstates").css("display","none");$("#opregions").css("display","block");$("#opstates").css("display","none");$("#divcounties").css("display","none");$("#divcities").css("display","none");$("#opcounties").css("display","none");$("#opcities").css("display","block");$("#stateorregion").html("");$("#opcounties").val("").trigger("select2:updated");$("#opcities").val("").trigger("select2:updated");$("#txt").html("");$("#trainglestateregion").css("display","none");$("#trainglecounties").css("display","none");$("#trainglecities").css("display","none");$("#strcounties").html("");$("#strcities").html("");$("#txt").html("");$("#divregiondisc").html("");$("#opregions option").remove();inputData.State=[];inputData.County=[];inputData.City=[];n=localStorage.getItem("metrictypeidval");bindSasDataFirstList(n);var t=function(n){if(n!==undefined&&n!==null){regionsdata=n;$.each(n,function(n,t){var i="Region "+t.RegionCode+": "+t.RegionDesc;$("#opregions").append($("<option>",{value:t.RegionCode,text:t.RegionCode,dataregiontext:t.RegionCode}))});$("#opregions").unbind("change");$("#opregions").select2({dropdownParent:$("#divregions")}).on("select2:select",function(t){var i=t.params.data;$.each(n,function(n,t){if(parseInt(i.id)==parseInt(t.RegionCode))return $("#divregiondisc").css("display","block"),$("#divregiondisc").find("#regionid"+t.RegionCode).remove(),$("#divregiondisc").append("<p id= regionid"+t.RegionCode+">"+t.RegionCode+". "+t.RegionDesc+"<\/p>"),!1})});$("#opregions").select2({dropdownParent:$("#divregions")}).on("select2:unselect",function(t){var i=t.params.data;$.each(n,function(n,t){if(i.id&&i.id==t.RegionCode)return $("#divregiondisc").find("#regionid"+t.RegionCode).remove(),!1})});$("#opregions_select2 .select2-drop").hide();$("#opregions_select2").click(function(){$("#opregions_select2 .select2-drop").show()});$(".pnlstates").on("click",function(){$("#collapseFour").hasClass("in")&&$("#opregions_select2 .select2-drop").hide()});if(Object.keys(jsonObject).length>0&&jsonObject.Region!==undefined&&jsonObject.Region!==""){common.showPanel("collapseFour");var t=jsonObject.Region;$.each(n,function(n,i){t.indexOf(i.RegionCode+"")!=-1&&($("#divregiondisc").css("display","block"),$("#divregiondisc").append("<p id= regionid"+i.RegionCode+">"+i.RegionCode+". "+i.RegionDesc+"<\/p>"))});$("#opregions").val(jsonObject.Region).trigger("change");$("#opregions_select2 .select2-drop").show()}$("#opregions").trigger("select2:updated");Object.keys(jsonObject).length>0&&jsonObject.Region!=undefined&&jsonObject.Region!=""&&getregionId("")}},i=function(){alert("System Error Occurred (0513). Please Email NCSARequests@dot.gov")};common.ajaxGet("StateRegion/GetRegions",t,i)}function getregionId(){var t,u,r,f,n,i,e;for(inputData.Region=[],t=[],u=$("#opregions option:selected"),r=0;r<u.length;r++)f={value:u[r].getAttribute("value"),text:u[r].getAttribute("dataregiontext")},t.push(f);for(n="",i=0;i<t.length;i++)inputData.Region.push(t[i].value),e=$.grep(regionsdata,function(n){return n.RegionCode==t[i].value}),n=n+"Region "+t[i].text+": "+e[0].RegionDesc,n=n,i!==t.length-1&&(n=n+"; ");$("#stateorregion").html(n);$("#stateorregion").attr("data-regionstext",n);$("#trainglestateregion").css("display",t.length>0?"inline":"none");$("#trainglecounties").css("display","none");$("#strcounties").html("");$("#strcities").html("");$(".stateAndCity_Report").addClass("hide")}function bindMakeandModel(n){bindmodels(n);hidemakemodedropdowns()}function bindmodels(n){var e,u,i,t,f,o,r;inputData.Model=[];inputData.Make=[];e=$("#selectMakes");u=[];try{e&&(u=e.select2("data"))}catch(a){}for(i=[],t="",f=0;f<u.length;f++)o={value:u[f].id,text:u[f].text},i.push(o);for(inputData.Make=[],$("#selectModels").val("").trigger("select2:updated"),r=0;r<i.length;r++)inputData.Make.push(i[r].value),t=t+i[r].text,r!==i.length-1&&(t=t+", ");if($("#trainglemake").css("display",t.length>0?"inline":"none"),$("#strmake").html(t),$("#strmodel").html(""),inputData.Make.length!==0&&!(inputData.Make.length>1)){n=inputData.Make[0];var s=$.grep(makedata,function(t){return t.MakeCode===Number(n)}),h="MakeModel/GetModels?id="+s[0].Id,c=function(n){if(n!==undefined&&n!==null){if($("#divModel").css("display","block"),$("#selectModels").css("display","block"),$("#selectModels option").remove(),$.each(n,function(n,t){$("#selectModels").append($("<option>",{value:t.ModelCode,text:t.Model,datamodels:t.Model}))}),$("#selectModels").select2({dropdownParent:$("#divModel")}).change(function(){}),$(".select2[multiple]").siblings(".select2-container").append('<span class="select-all"><\/span>'),Object.keys(jsonObject).length>0&&jsonObject.Model!==undefined&&jsonObject.Model!==""){var i=jsonObject.Model,t=makemodel.getSelectedModelIdsByText(jsonObject.Model);$("#selectModels").val(null).trigger("change");$("#selectModels").val(t).trigger("change");$("#selectModels_select2 .select2").show();getmodelid("")}$("#selectModels").trigger("select2:updated")}hidemakemodedropdowns()},l=function(){alert("System Error Occurred (0811). Please Email NCSARequests@dot.gov")};common.ajaxGet(h,c,l)}}function getmodelid(){var i=$("#selectModels option:selected"),n,t;for(inputData.Model=[],n="",t=0;t<i.length;t++)inputData.Model.push(i[t].value),n=n+i[t].text,t!==i.length-1&&(n=n+", ");$("#trainglemodel").css("display",n.length>0?"inline":"none");$("#strmodel").html(n)}function hidemakemodedropdowns(){$("#selectModels").css("display","block");$("#divModel").css("display","block");var n=$("#selectMakes option:selected");n.length>1?($("#divModel").css("display","none"),$("#trainglemodel").css("display","none")):n.length===1?($(".select2#selectModels").attr("disabled",!1).trigger("select2:updated"),$("#divModel").removeAttr("data-original-title"),$("#divModel").css("display","block")):n.length===0&&($(".select2#selectModels").attr("disabled",!0).trigger("select2:updated"),$("#divModel").attr("data-original-title","Please select a Make"),$("#selectModels option").remove())}function bodyClass(n){var n=105;inputData.bodyClass=[];$("#divBodyClass").css("display","block");$("#selectBodyClass option").remove();var t="MakeModel/GetBodyClass?sasdataEleId="+n,i=function(n){if(n!==undefined&&n!==null&&($("#selectBodyClass").css("display","block"),$("#divBodyClass").css("display","block"),$.each(n,function(n,t){$("#selectBodyClass").append($("<option>",{value:t.Code,text:t.Definition,databodyclass:t.Definition}))}),$("#selectBodyClass").select2({dropdownParent:$("#divBodyClass")}).change(function(){}),$(".select2[multiple]").siblings(".select2-container").append('<span class="select-all"><\/span>'),Object.keys(jsonObject).length>0&&jsonObject.VPICBodyClass!==undefined&&jsonObject.VPICBodyClass!=="")){var i=jsonObject.VPICBodyClass,t=makemodel.getSelectedBodyClassIdsByText(jsonObject.VPICBodyClass);$("#selectBodyClass").val(t).trigger("change");$("#selectBodyClass_select2 .select2").show()}},r=function(){alert("20812 ")};common.ajaxGet(t,i,r)}function bindBodyClass(){var i=$("#selectBodyClass option:selected"),n,t;for(inputData.bodyClass=[],n="",t=0;t<i.length;t++)inputData.bodyClass.push(i[t].value),n=n+i[t].text,t!==i.length-1&&(n=n+", ");$("#trainglebodyclass").css("display",n.length>0?"inline":"none");$("#strbodyclass").html(n)}function modelyearsselection(){var n=[],t=$("#selectmodelyears option:selected");$.each(t,function(t,i){n.push(i.text)});t.length>0&&$("#modelyears").html("Model Years: "+n.sort().join(", "));inputData.modelyearsdata=t;$("#modelyearicon").css("display",n.length>0?"inline":"none")}function selectAllSelect2(n){var t=!0,i=!1,u=n.parents("span[class*='select2-container']").siblings("select[multiple]").attr("id"),r=$("#"+u);r.find("option").each(function(n,t){if(!$(t).prop("selected"))return i=!0,!1});t=i?t:!t;r.find("option").prop("selected",t).trigger("change")}function bindSasDataElemnts(n,t,i,r,u){var f=$(".radioSelmetrictypename_"+jsonObject.metrictype_id),s=f.attr("fromClick"),l=f.attr("changeEventFired"),h,e,o,c;s==="retrive"&&l&&(jsonObject={},f.removeAttr("fromClick"),localStorage.setItem("invalidMsgCount","0"));s==="retrive"&&f.attr("changeEventFired",!0);(jsonObject===undefined||JSON.stringify(jsonObject)==="{}")&&makemodel.clearMakeModels();status=="reset"&&($("input:radio[name=divSortable]:first").prop("checked",!0),selectedBuildValue="Table");localStorage.setItem("metrictypeidval",n);localStorage.setItem("metrictype_num",t);localStorage.setItem("isgeogrpahy",i);localStorage.setItem("datasource",r);$("#parSelectMetricType").html(e);$("#divselctedsasdata").html("");inputData.SasData={};inputData.MetricTypeNum=t;inputData.MetricTypeId=n;h="Selmetrictypename_"+n;e=$("#"+h).data("metrictypename");inputData.MetricTypeName=e;inputData.IsGeoGrpahy=i;inputData.DataSource=r;$("#parSelectMetricType").html(e);o=localStorage.getItem("topicName");i==1?$("#divstateregion").css("display","block"):$("#divstateregion").css("display","none");i==1&&(o=="Vehicles"||o=="Drivers"||o=="Occupants")?$("#divMakeModel").css("display","block"):$("#divMakeModel").css("display","none");common.hidePanels("collapseFive");common.hidePanels("selectMakeModel");resetStates();c=localStorage.getItem("metricId");$("#sortable1").html("");$("#sortable2").html("");$("#sortable3").html("");inputData.XTableEle=[];inputData.YTableEle=[];jsonObject.modelyears&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));jsonObject.Make&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));jsonObject.VPICBodyClass&&$("#selectMakeModel:visible").length==0&&($("[data-target='#selectMakeModel']").click(),common.showPanel("selectMakeModel"));bodyClass(u);$.ajax({url:relativeUrl("SasData/SASDataView"),data:{metricTypeId:n,metricId:c},cache:!1,type:"GET",success:function(t){var r,i;$("#divmetrictypesgeographysasdatatables").html(t);r=$("#hdsasdatatables").val();Object.keys(jsonObject).length>0&&jsonObject.selectBYTType!=""&&(i=jsonObject.selectBYTType,$(".btn"+i).click());Object.keys(jsonObject).length>0&&(jsonObject.SelectType=="S"?$("#radiostate").click():jsonObject.SelectType=="R"?$("#radioregion").click():jsonObject.SelectType!==undefined&&common.setinvalidMsgCount());metricsClick==1?(selectedBuildValue="Table",$(".btnSortable:first").click()):bindSasDataFirstList(n);defaultSelection();defaultSelectionbyMetrictype(n)},error:function(){console.log("error");alert("System Error Occurred (0610). Please Email NCSARequests@dot.gov")}})}function bindData(n,t){for(var i=0;i<n.length;i++)t==ob[i].controlId&&$(t).prop("checked",!0)}function hideLoader(n){$("#divfade_"+n).hide()}function showLoader(n){$("#divfade_"+n).css("display","block")}function getandbindAttributesData(n,t,i){var e="hdndataeledesc_"+t,o="hdndataelename_"+t,r=$("#"+o).val(),s=$("#"+e).val(),u="sasdataattributesView_"+t,f="SasCollapase_"+t,k="radiobutton_"+t;if(!$("#"+u).is(":hidden"))return $("#"+u).css("display","none"),$("#"+f).css("display","none"),!1;if(inputData.SasData[r]===undefined||inputData.SasData[r]===null||inputData.SasData[r].length===0)if(inputData.SasData[r]=[],i===RadioButtonSelectionOptionType||i===CheckBoxSelectionOptionType){var h=localStorage.getItem("metricId"),c=localStorage.getItem("metrictypeId"),l={sasdataEleId:t,metricID:h,metrictypeId:c};attributes.fetchdata(l,u,i,t)}else if(i===TextTextboxSelectionOptionType)$("#"+u).html(" "),$("#"+u).css("display","block"),$("#"+u).css("margin-bottom","-2%"),$("#"+u).append('<input type="textbox" style="margin-left:15px;" title= "This allows only texts" onKeyPress="return blockSpecialKeys(event);" maxlength = "30" onchange="SeTextxttributesData('+t+", "+i+')" id= "txtAttributesText_'+t+'" /><p id="" style="color:red;margin-left:15px;">Enter the Actual Posted Number, Assigned Number, or Common Name (if no posted or assigned number).<\/p>'),sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type3!=null&&sasDataObj.type3!=undefined&&sasDataObj.type3.length>0&&AssignAttributeDetails(i,null,null,t);else if(i===NumTextboxSelectionOptionType)$("#"+u).html(" "),$("#"+u).css("display","block"),$("#"+u).css("margin-bottom","-2%"),$("#"+u).append('<input type="text" pattern= "[0-9]" title= "This allows only numbers" onchange="SetNumberxttributesData('+t+", "+i+')" id= "txtAttributesAtrNum_'+t+'" /><p id="ziprangegerr_'+t+'"><\/p>'),sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type4!=null&&sasDataObj.type4!=undefined&&sasDataObj.type4.length>0&&AssignAttributeDetails(i,null,null,t);else if(i===TextRangeSelectionOptionType)$("#"+u).html(" "),$("#"+u).css("display","block"),$("#"+u).append('From: <input style="width:30%" type="textbox" onchange="validateTextFromRange(this,'+t+", "+i+')" id="txtAttributesrangeFromText_'+t+'" />   To: <input style="width:30%" type="textbox" onchange="validateTextToRange(this,'+t+')" id="txtAttributesrangeToText_'+t+'" />'),sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type5!=null&&sasDataObj.type5!=undefined&&sasDataObj.type5.length>0&&AssignAttributeDetails(i,null,null,t);else if(i===NumRangeSelectionOptionTypeType){var a="SasData/GetRanges?Id="+t,v=function(n){if(n!=undefined&&n!=null){$("#"+u).css("display","block");$("#"+u).html(" ");var r=parseInt(n.MinRange),f=parseInt(n.MaxRange);$("#"+u).append('From: <input style="width:15%;" type="number"  id="txtAttributesnumbrangeFrom_'+t+'" onchange="validateRange(this,'+r+","+f+","+t+", "+i+')" min="'+r+'" max= "'+f+'" pattern="[0-9]" title="This allows only numbers"/>   To: <input style="width:15%" type="number"  min="'+r+'" max= "'+n.MaxRange+'"  onchange="validatemaxRange(this,'+r+","+f+","+t+", "+i+')" pattern="[0-9]" title="This allows only numbers" id="txtAttributesnumbrangeTo_'+t+'" /><p id="agerangerr_'+t+'"><\/p><p id="arrangeer2_'+t+'"><\/p>');sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type6!=null&&sasDataObj.type6!=undefined&&sasDataObj.type6.length>0&&AssignAttributeDetails(i,null,null,t)}},y=function(n){console.log(n);alert("System Error Occurred (0612). Please Email NCSARequests@dot.gov")};common.ajaxGet(a,v,y)}else if(i===SliderSelectionOptionType){var p="SasData/GetRanges?Id="+t,w=function(n){var f,e,c,h,o;n!==undefined&&n!=null&&(ageData=n,$("#"+u).css("display","block"),$("#"+u).html(" "),f=parseInt(n.MinRange),e=parseInt(n.MaxRange),$("#titlespan_"+t).text(s+" ("+f+", "+e+")"),c='<div class="row" id="sasdataattributesView_'+t+'"><input type="number" size="1" id="'+r+'_min" style="width:9%;color:#f6931f;font-weight:bold;margin: 1% 0% 0% 4%;text-align:center;height:15%;"><div class = "minuteslider" id="'+r+'"><\/div><input type="number" id="'+r+'_max" size="1"style="width:9%;color:#f6931f;font-weight:bold;text-align:center;margin: 1% 0% 0% 1%;height:15%;"><input style="margin-left:7%;width:20px;height:25px;" type="checkbox" title="Check the box to select the values desired." id="'+r+'_Checkbox" onclick="sliderCheckboxClick('+t+","+r+')"><input type="hidden" value='+f+' id="'+r+'_min_initialvalue" ><input value='+e+' type = "hidden" id = "'+r+'_max_initialvalue" ><\/div><div id="'+r+'_messageDiv" style="padding-left:10px;color:red;"><\/div>',$("#"+u).append(c),r==="AGE"?($("#"+r+"_messageDiv").html(messageDiv),$("#"+r+"_messageDiv").html("Check or un-check the checkbox to select or deselect values.")):$("#"+r+"_messageDiv").html("Check or un-check the checkbox to select or deselect values."),sasDataObj.type7.forEach(function(n){n.controlId===r&&(h=n)}),h?(o=h.code.split(","),r==="VSPD_LIM"?displayslider(f,e,5,t,i,r,o[0],o[o.length-1]):displayslider(f,e,1,t,i,r,o[0],o[o.length-1]),$("#"+r+"_Checkbox").click()):r==="VSPD_LIM"?(console.log("vspd",f+", "+e),displayslider(f,e,5,t,i,r)):displayslider(f,e,1,t,i,r))},b=function(n){console.log(n);alert("System Error Occurred (0613). Please Email NCSARequests@dot.gov")};common.ajaxGet(p,w,b)}else inputData.SasData[r]=[],$("#"+u).css("display","block"),$("#"+u).html(""),$("#"+u).append('<label class="toggle-check"><input type="checkbox" class="toggle-check-input" id="txtNoAttribute_'+t+'" onclick="bindNoAttributesSASDataEle(this,'+t+',7)" ><span class="toggle-check-text"><\/span><\/label >'),sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type7!=null&&sasDataObj.type7!=undefined&&sasDataObj.type7.length>0&&AssignAttributeDetails(i,null,null,t);else $("#"+u).css("display","block"),$("#"+f).css("display","block")}function defaultSelection(){var n=localStorage.getItem("metricId"),t="Attributes/DefaultAttributeView?metricId="+n,i=function(t){var f,e,u,r,i;if(t!=null&&t.length>0)for(i=0;i<=t.length-1;i++)f=t[i],e=f.SasDataEleId,$(".attributDefaultClick_"+e+"_"+n).click();if(jsonObject.SasData&&$("#collapseFive:visible").length==0&&($("[data-target='#collapseFive']").click(),common.showPanel("collapseFive")),jsonObject!=null&&jsonObject!=undefined&&sasDataObj!=null&&sasDataObj!=undefined){u=[];for(r in sasDataObj){for(i=0;i<sasDataObj[r].length;i++)u.indexOf(sasDataObj[r][i].sasdataeleid)==-1&&($(".attributDefaultClick_"+sasDataObj[r][i].sasdataeleid+"_"+jsonObject.metric_num).click(),u.push(sasDataObj[r][i].sasdataeleid));u=[]}}},r=function(){console.log("error");alert("System Error Occurred (0711). Please Email NCSARequests@dot.gov")};common.ajaxGet(t,i,r)}function defaultSelectionbyMetrictype(n){common.log(n,"defaultSelectionbyMetrictype","log");attributes.getMetricTypeData(n,function(n){attributes.selectPanelHeader(n);$("#btnsubmit").prop("disabled",!0);setTimeout(function(){$("#btnsubmit").prop("disabled",!0);attributes.checkSelectControl(n,function(){$("#btnsubmit").prop("disabled",!1)})},1e3)})}function AssignAttributeDetails(n,t,i,r){var e,f,u;switch(n){case 1:case 2:for(f=sasDataObj.type1,u=0;u<f.length;u++)$("#"+f[u].controlId).is(":checked")||($("#"+f[u].controlId).addClass("chkdefaultselectbyfile_"+r),$("#"+f[u].controlId).prop("checked",!0));break;case 3:for(f=sasDataObj.type3,u=0;u<f.length;u++)$("#"+f[u].controlId).val(f[u].sasdataeleid==49?f[u].defintion:f[u].code),$("#"+f[u].controlId).trigger("change");break;case 4:for(f=sasDataObj.type4,u=0;u<f.length;u++)$("#"+f[u].controlId).val(f[u].code),$("#"+f[u].controlId).trigger("change");break;case 5:for(f=sasDataObj.type5,u=0;u<f.length;u++)f[u].code!=null&&f[u].code!=""&&(e=f[u].code.split(","),$("#txtAttributesrangeFromText_"+f[u].sasdataeleid).val(parseInt(e[0])),$("#txtAttributesrangeToText_"+f[u].sasdataeleid).val(parseInt(e[1])),$("#txtAttributesrangeFromText_"+f[u].sasdataeleid).trigger("change"));break;case 6:for(f=sasDataObj.type6,u=0;u<f.length;u++)f[u].code!=null&&f[u].code!=""&&(e=f[u].code.split(","),$("#txtAttributesnumbrangeFrom_"+f[u].sasdataeleid).val(parseInt(e[0])),$("#txtAttributesnumbrangeTo_"+f[u].sasdataeleid).val(parseInt(e[1])),$("#txtAttributesnumbrangeFrom_"+f[u].sasdataeleid).trigger("change"));break;case 8:for(f=sasDataObj.type8,u=0;u<f.length;u++)$("#"+f[u].controlId).val(f[u].code),$("#"+f[u].controlId).trigger("change")}}function validateTextFromRange(n,t,i){var f=n.value,e,r;$("#agerangerr").html("");$("#arrangeer2").html("");var o="hdndataeledesc_"+t,s=$("#"+o).val(),h="hdndataelename_"+t,u=$("#"+h).val();inputData.SasData[u]=[];e="txtAttributesrangeToText_"+t;r=$("#"+e).val();f!=""&&r!=undefined&&r!=""?(inputData.SasData[u].push({code:"'"+f+"' , '"+r+"'",sasdatadesc:s,bindattrType:i,controlId:e,sasdataeleid:t,defintion:f+","+r}),setBackgroundCOlorDataEle(u,t),displaySasDataAttribute()):(setBackgroundCOlorDataEle(u,t),displaySasDataAttribute())}function validateTextToRange(n,t,i){var f=n.value,e,r;$("#agerangerr").html("");$("#arrangeer2").html("");var o="hdndataeledesc_"+t,s=$("#"+o).val(),h="hdndataelename_"+t,u=$("#"+h).val();inputData.SasData[u]=[];e="txtAttributesrangeFromText_"+t;r=$("#"+e).val();f!=""&&r!=undefined&&r!=""?(inputData.SasData[u].push({code:"'"+r+"' , '"+f+"'",sasdatadesc:s,bindattrType:i,controlId:e,sasdataeleid:t,defintion:f+","+r}),setBackgroundCOlorDataEle(u,t),displaySasDataAttribute()):(setBackgroundCOlorDataEle(u,t),displaySasDataAttribute())}function ageFromValidation(n,t){return $("#txtAttributesnumbrangeFrom_"+t).val()===""&&$("#txtAttributesnumbrangeTo_"+t).val()===""?!0:(ageFrom=$("#txtAttributesnumbrangeFrom_"+t).val(),ageFrom===""?($("#"+n).css("color","red"),$("#"+n).html("Please enter age 'From' value."),$("#"+n).css("margin-left","10%"),$("#"+n).css({color:"red"}),!1):($("#"+n).html(""),!0))}function ageToValidation(n,t){return $("#txtAttributesnumbrangeFrom_"+t).val()===""&&$("#txtAttributesnumbrangeTo_"+t).val()===""?!0:(ageTo=$("#txtAttributesnumbrangeTo_"+t).val(),ageTo==""?($("#"+n).css("color","red"),$("#"+n).html("Please enter age 'To' value."),$("#"+n).css("margin-left","10%"),$("#"+n).css({color:"red"}),!1):($("#"+n).html(""),!0))}function validateRange(n,t,i,r,u){var v="hdndataeledesc_"+r,a=$("#"+v).val(),y="hdndataelename_"+r,f=$("#"+y).val(),l,c,s;inputData.SasData[f]=[];var e=n.value,o="agerangerr_"+r,h="arrangeer2_"+r;if(e!=undefined&&e!==""){if(l=parseInt(e),t>l||l>i){$("#"+o).css({color:"red"});n.value="";setBackgroundCOlorDataEle(f,r);displaySasDataAttribute();return}var c="txtAttributesnumbrangeTo_"+r,s=$("#"+c).val(),l=parseInt(s);if(e>l){$("#"+o).html("Maximum value cannot be less than minimum value.");$("#"+o).css({color:"red"});$("#"+o).css("margin-left","5%");n.value="";setBackgroundCOlorDataEle(f,r);displaySasDataAttribute();return}if(e!==""&&e.toString()!=="NaN"&&(c="txtAttributesnumbrangeTo_"+r,s=$("#"+c).val(),s==i.toString())){$("#"+o).html("");$("#"+h).html(i+" includes "+i+" and older.");$("#"+h).css("margin-left","10%");$("#"+h).css({color:"red"});$("#"+h).css("margin-top","-2%");$("#"+h).css({color:"red"});inputData.SasData[f].pop();inputData.SasData[f].push({code:e+" , "+s,sasdatadesc:a,bindattrType:u,controlId:c,sasdataeleid:r,defintion:e+","+s});setBackgroundCOlorDataEle(f,r);displaySasDataAttribute();return}e!=""&&s!=undefined&&s!=""?($("#"+o).html(""),$("#"+h).html(""),inputData.SasData[f].push({code:e+" , "+s,sasdatadesc:a,bindattrType:u,controlId:c,sasdataeleid:r,defintion:e+","+s}),setBackgroundCOlorDataEle(f,r),displaySasDataAttribute()):($("#"+o).html(""),$("#"+h).html(""),setBackgroundCOlorDataEle(f,r),displaySasDataAttribute())}else $("#"+o).html(""),setBackgroundCOlorDataEle(f,r),displaySasDataAttribute();return ageFromValidation(o,r)?ageToValidation(o,r)?void 0:(inputData.SasData[f].pop(),displaySasDataAttribute(),!1):(inputData.SasData[f].pop(),displaySasDataAttribute(),!1)}function validatemaxRange(n,t,i,r,u){var e="agerangerr_"+r,s="arrangeer2_"+r,y="hdndataeledesc_"+r,a=$("#"+y).val(),v,f,o,h;if($("#"+s).html(""),v="hdndataelename_"+r,f=$("#"+v).val(),inputData.SasData[f]=[],o=n.value,o!=undefined&&o!==""){if(h=parseInt(o),t>h||h>i){$("#"+e).html("Range must be "+t+" to "+i+".");$("#"+e).css("margin-left","10%");$("#"+e).css({color:"red"});n.value="";setBackgroundCOlorDataEle(f,r);displaySasDataAttribute();return}var l="txtAttributesnumbrangeFrom_"+r,c=$("#"+l).val(),h=parseInt(c);if(o<h){$("#"+e).html(" Maximum value cannot be less than minimum value. ");$("#"+e).css({color:"red"});$("#"+e).css("margin-left","5%");n.value="";setBackgroundCOlorDataEle(f,r);displaySasDataAttribute();return}if(h!==""&&h.toString()!=="NaN"&&o==i.toString()){$("#"+e).html("");$("#"+s).html(i+" includes "+i+" and older.");$("#"+s).css("margin-left","10%");$("#"+s).css({color:"red"});$("#"+s).css("margin-top","-2%");$("#"+s).css({color:"red"});inputData.SasData[f].pop();inputData.SasData[f].push({code:""+c+" , "+o+"",sasdatadesc:a,bindattrType:u,controlId:l,sasdataeleid:r,defintion:c+","+o});setBackgroundCOlorDataEle(f,r);displaySasDataAttribute();return}o!=""&&c!=undefined&&c!=""?($("#"+e).html(""),$("#"+s).html(""),inputData.SasData[f].push({code:c+" , "+o,sasdatadesc:a,bindattrType:u,controlId:l,sasdataeleid:r,defintion:c+","+o}),setBackgroundCOlorDataEle(f,r),displaySasDataAttribute()):($("#"+e).html(""),$("#"+s).html(""),setBackgroundCOlorDataEle(f,r),displaySasDataAttribute())}else $("#"+e).html(""),$("#"+s).html(""),setBackgroundCOlorDataEle(f,r),displaySasDataAttribute();return ageFromValidation(e,r)?ageToValidation(e,r)?void 0:(inputData.SasData[f].pop(),displaySasDataAttribute(),!1):(inputData.SasData[f].pop(),displaySasDataAttribute(),!1)}function SetRadioButtonAttributesData(n,t,i,r){var o="hdndataeledesc_"+r,s=$("#"+o).val(),h="hdndataelename_"+r,u=$("#"+h).val(),c="selattridesc_"+t,l=$("#"+c).text();inputData.SasData[u]=[];var v="radiobutton_"+r,e="radiobuttonid_"+t,f=$("#"+e),a=f.data("previousState");a?(f.prop("checked",!1),f.data("previousState",!1),inputData.SasData[u]=$.grep(inputData.SasData[u],function(n){return n.code!==i}),$("#orderstatus_"+r).css("background-color","#edeff0")):($("#orderstatus_"+r).css("background-color","rgba(80, 175, 228, 0.43)"),f.prop("checked",!0),f.data("previousState",!0),inputData.SasData[u].push({code:i,sasdatadesc:s,bindattrType:1,controlId:e,type:"radio",sasdataeleid:r,defintion:l}));setBackgroundCOlorDataEle(u,r);displaySasDataAttribute()}function sliderCheckboxClick(n,t){var o="hdndataeledesc_"+n,s=$("#"+o).val(),h="hdndataelename_"+n,i,r,u,f;t=$("#"+h).val();inputData.SasData[t]=[];var e=$("#"+t+"_Checkbox").prop("checked"),c=$("#"+t+"_min").val(),l=$("#"+t+"_max").val();e?($("#"+t+"_Checkbox").attr("title","Uncheck the box to unselect the values."),u=parseInt(c),f=parseInt(l),inputData.SasData[t].push({code:u+","+f,sasdatadesc:s,bindattrType:7,controlId:t,sasdataeleid:n,defintion:u+","+f})):($("#"+t+"_Checkbox").attr("title","Check the box to select the values desired."),inputData.SasData[t]=[],i=$("#"+t+"_min_initialvalue").val(),r=$("#"+t+"_max_initialvalue").val(),$("#"+t).slider("values",0,i),$("#"+t).slider("values",1,r),$("#"+t+"_min").val(i),$("#"+t+"_max").val(r));setBackgroundCOlorDataEle(t,n);displaySasDataAttribute();(n===AgeDataEleId||n===AgeGrp1DataEleId||n===AgeGrp6DataEleId||n===AgeGrp7DataEleId)&&disableOrEnableAgeGroups(n,!e)}function disableOrEnableAgeGroups(n,t){var i=[47,24,61,90],r=$("#sasdataattributesView_"+n+" input[type=checkbox]:checked").length;t&&r===0?i.forEach(function(t){t!==n&&$("#agegroups_"+t).css({"pointer-events":"",opacity:"1"})}):i.forEach(function(t){t!==n&&$("#agegroups_"+t).css({"pointer-events":"none",opacity:"0.4"})})}function bindNoAttributesSASDataEle(n,t,i){var u="hdndataeledesc_"+t,f="hdndataelename_"+t,r=$("#"+f).val(),e=$("#"+u).val(),o="txtNoAttribute_"+t;if(!n.checked){delete inputData.SasData[r];displaySasDataAttribute();setBackgroundCOlorDataEle(r,t);return}inputData.SasData[r]=[];inputData.SasData[r].push({code:"0",sasdatadesc:e,bindattrType:i,controlId:o,sasdataeleid:t,defintion:"No Attribute"});displaySasDataAttribute();setBackgroundCOlorDataEle(r,t)}function SetCheckboxAttributesData(n,t,i,r){var w=$("#attchkdesc_"+t).prop("checked"),l,a,f,o,v,s,y,h,p;(r===AgeDataEleId||r===AgeGrp1DataEleId||r===AgeGrp6DataEleId||r===AgeGrp7DataEleId)&&disableOrEnableAgeGroups(r,!w);var b="hdndataeledesc_"+r,k=$("#"+b).val(),d="hdndataelename_"+r,u=$("#"+d).val(),g="selattridesc_"+t,c="attchkdesc_"+t,nt=$("#"+g).text(),e=$("#"+c).data(),tt=e.attributeparentid,it=e.isparent==="true"||e.isparent===!0?!0:!1;n.checked?inputData.SasData[u]&&inputData.SasData[u]!=undefined&&(inputData.SasData[u]=$.grep(inputData.SasData[u],function(n){return n.code!==i}),inputData.SasData[u].push({code:i,sasdatadesc:k,bindattrType:1,controlId:c,type:"check",sasdataeleid:r,defintion:nt,attributeparentId:tt,isparent:it})):inputData.SasData[u]&&inputData.SasData[u]!=undefined&&(inputData.SasData[u]=$.grep(inputData.SasData[u],function(n){return n.code!==i}));setBackgroundCOlorDataEle(u,r);displaySasDataAttribute();l=Object.getOwnPropertyNames(jsonObject).length>0;attributes.expandParent(n,l);r===45&&(a=[172,173,174,175],f=[],$.each(a,function(n,t){f.push("#attchkdesc_"+t+":checked")}),o=$(f.join(",")).length,v=$("#attchkdesc_171:checked").length,o===4&&v===1?($("#lighttruck").prop("checked",!1),$("#passengervechile").prop("checked",!0)):o===4?($("#lighttruck").prop("checked",!0),$("#passengervechile").prop("checked",!1)):($("#lighttruck").prop("checked",!1),$("#passengervechile").prop("checked",!1)),$("#sasdataattributesView_45").find("input[type='checkbox']:checked").not(f.join(",")+",#attchkdesc_171:checked").length>0&&($("#lighttruck").prop("checked",!1),$("#passengervechile").prop("checked",!1)),s="orderstatus_"+r,$("#sasdataattributesView_45").find("input[type='checkbox']:checked").length>0?$("#"+s).css("background-color","rgba(80, 175, 228, 0.43)"):$("#"+s).css("background-color","#edeff0"));r===73&&(y=[314,315,316],h=[],$.each(y,function(n,t){h.push("#attchkdesc_"+t+":checked")}),p=$(h.join(",")).length,p===3?$("#injuryGroupCheckbox").prop("checked",!0):$("#injuryGroupCheckbox").prop("checked",!1))}function checkVechileTypeCheckBox(){}function SeTextxttributesData(n,t){var c="hdndataeledesc_"+n,l=$("#"+c).val(),a="hdndataelename_"+n,u=$("#"+a).val(),e="txtAttributesText_"+n,r=$("#"+e).val(),i="ziprangegerrtext_"+n,o,v,s,f,h;if($("#"+i).html(""),inputData.SasData[u]=[],o=/^[A-Za-z0-9]+$/,u.toUpperCase()=="VIN"&&(r!=0&&r.length!=12||!o.test(r))){$("#"+i).html("Enter a 12 Alpha Numeric VIN Number.");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");setBackgroundCOlorDataEle(u,n);displaySasDataAttribute();return}if(u.toUpperCase()=="A_MOD_YR"){if(v=new Date,r.length!=0&&r.length!=4||isNaN(r)){$("#"+i).html("Enter a valid 4-digit Year.");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");setBackgroundCOlorDataEle(u,n);displaySasDataAttribute();return}if(s=parseInt(r),f=parseInt(AppTableConfig.EndYear)+1,s>f){$("#"+i).html("Enter "+f+" or less than "+f+".");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");setBackgroundCOlorDataEle(u,n);displaySasDataAttribute();return}}h='"'+r+'"';r!=""?($("#"+i).html(""),inputData.SasData[u].push({code:h,sasdatadesc:l,bindattrType:t,controlId:e,sasdataeleid:n,defintion:r}),setBackgroundCOlorDataEle(u,n),displaySasDataAttribute()):($("#"+i).html(""),setBackgroundCOlorDataEle(u,n),displaySasDataAttribute())}function SetNumberxttributesData(n,t){var s="hdndataeledesc_"+n,h=$("#"+s).val(),i="ziprangegerr_"+n,l,o,f;$("#"+i).html("");var c="hdndataelename_"+n,r=$("#"+c).val(),e="txtAttributesAtrNum_"+n,u=$("#"+e).val();if(inputData.SasData[r]=[],isNaN(u)){$("#"+i).html("Please enter numbers.");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");$("#"+e).val("");setBackgroundCOlorDataEle(r,n);displaySasDataAttribute();return}if(r.toUpperCase()=="DR_ZIP"&&u.length!=0&&u.length!=5){$("#"+i).html("Enter valid 5 digit Zip Code.");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");setBackgroundCOlorDataEle(r,n);displaySasDataAttribute();return}if(r.toUpperCase()=="A_MOD_YR"){if(l=new Date,u.length!=0&&u.length!=4||isNaN(u)){$("#"+i).html("Enter a valid 4-digit Year.");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");setBackgroundCOlorDataEle(r,n);displaySasDataAttribute();return}if(o=parseInt(u),f=parseInt(AppTableConfig.EndYear)+1,o>f){$("#"+i).html("Enter "+f+" or less than "+f+".");$("#"+i).css({color:"red"});$("#"+i).css("margin-left","2%");setBackgroundCOlorDataEle(r,n);displaySasDataAttribute();return}}u!=""?(inputData.SasData[r].push({code:u,sasdatadesc:h,bindattrType:t,controlId:e,sasdataeleid:n,defintion:u}),setBackgroundCOlorDataEle(r,n),displaySasDataAttribute()):(setBackgroundCOlorDataEle(r,n),displaySasDataAttribute())}function setBackgroundCOlorDataEle(n,t){var i="orderstatus_"+t;inputData.SasData[n]!==undefined&&inputData.SasData[n].length>0?($("#"+i).css("background-color","rgba(80, 175, 228, 0.43)"),(n=="Highest_Bac"||n=="PERSON_BAC")&&selectAttributes(n,"S","F")):($("#"+i).css("background-color","#edeff0"),(n=="Highest_Bac"||n=="PERSON_BAC")&&selectAttributes(n,"D","F"))}function displaySasDataAttribute(){var t,n,i,u,r;if($("#divselctedsasdata").html(""),t="",inputData.SasData!==undefined&&inputData.SasData!==null)for(n in inputData.SasData){if(inputData.SasData[n]!==undefined&&inputData.SasData[n]!==null&&inputData.SasData[n]!==""&&inputData.SasData[n].length>0){for(i=inputData.SasData[n][0].sasdatadesc+" (",u=inputData.SasData[n].length,r=0;r<u-1;r++)i=i+inputData.SasData[n][r].defintion+", ";i=i+inputData.SasData[n][u-1].defintion+");";t=t+i}t=t+" "}$("#divselctedsasdata").html(t);$("#countiesseparator").css("display",t.trim()!=""?"inline":"none");$("#traingledataele").css("display",inputData.SasData.length>0?"inline":"none");isValid=$("[id^='ziprangegerrtext_']").length>0&&checkValidation("ziprangegerrtext_")||$("[id^='ziprangegerr_']").length>0&&checkValidation("ziprangegerr_")||$("[id^='agerangerr_']").length>0&&checkValidation("agerangerr_")||$("[id^='agerangerr_2']").length>0&&checkValidation("agerangerr_2")?!1:!0}function checkValidation(n){return $("[id^="+n+"]").filter(function(){return $(this).html()!==""}).length>0}function displayslider(n,t,i,r,u,f,e,o){var p="hdndataeledesc_"+r,w=$("#"+p).val(),b="hdndataelename_"+r;f=$("#"+b).val();inputData.SasData[f]=[];var l,a,s,h,c=!0,v=parseInt(n),y=parseInt(t);e=e?e:v;o=o?o:y;s=e;h=o;$("#"+f).slider({range:!0,min:v,max:y,values:[e,o],step:i,slide:function(n,t){l=$("#"+f+"_min").val(t.values[0]);a=$("#"+f+"_max").val(t.values[1])},change:function(){if($("#"+f+"_Checkbox").prop("checked")&&c){f==="AGE"&&(parseInt(l.val())!==v||parseInt(a.val())!==y||$("#"+f+"_Checkbox").prop("checked")?disableOrEnableAgeGroups(r):disableOrEnableAgeGroups(r,!0));inputData.SasData[f]&&inputData.SasData[f].length>0&&inputData.SasData[f].pop();for(var u=parseInt(l.val()),i=parseInt(a.val()),t="",n=u;n<=i;n++)t=t+n,n!==i&&(t=t+",");inputData.SasData[f].push({code:l.val()+","+a.val(),sasdatadesc:w,bindattrType:7,controlId:f,sasdataeleid:r,defintion:l.val()+","+a.val()});setBackgroundCOlorDataEle(f,r);displaySasDataAttribute()}}});$("#"+f+"_min").focus(function(){s=$("#"+f+"_min").val()});$("#"+f+"_max").focus(function(){h=$("#"+f+"_max").val()});$("#"+f+"_min").change(function(){if(parseInt($(this).val())<=parseInt($("#"+f+"_max").val())&&parseInt($(this).val())>=n){if(f==="VSPD_LIM"&&parseInt($(this).val())%5!=0){c=!1;$("#"+f).slider("values",0,s);$("#"+f+"_min").val(s);return}c=!0;$("#"+f).slider("values",0,$(this).val());s=$("#"+f+"_min").val()}else c=!1,$("#"+f).slider("values",0,s),$("#"+f+"_min").val(s)});$("#"+f+"_max").change(function(){if(parseInt($(this).val())>=parseInt($("#"+f+"_min").val())&&parseInt($(this).val())<=t){if(c=!0,f==="VSPD_LIM"&&parseInt($(this).val())%5!=0){c=!1;$("#"+f).slider("values",1,h);$("#"+f+"_max").val(h);return}$("#"+f).slider("values",1,$(this).val());h=$("#"+f+"_max").val()}else c=!1,$("#"+f).slider("values",1,h),$("#"+f+"_max").val(h)});$("#"+f+"_min").val($("#"+f).slider("values",0));$("#"+f+"_max").val($("#"+f).slider("values",1))}function bindSasDataFirstList(n){$.ajax({url:relativeUrl("SasData/GetSasFirstDesc"),type:"GET",data:{metricTypeId:n},success:function(n){var t,w,l,v,y,c,g,p;if($("#sortable1").html(""),$("#sortable2").html(""),$("#sortable3").html(""),n!==undefined&&n!==null){t=localStorage.getItem("topicName");w=localStorage.getItem("topicId");$("#divmetrictsdatadivxytabledata").find("#errormsg").css("display","none");t=="Alcohol Impaired"||t=="Rural/Urban"||t=="Occupant Protection"?$("#divmetrictsdatadivxytabledata").find("#defaultMsg").html("If the user does not select any Data Element for Rows, system will select Crash Date (Year) for Rows."):$("#divmetrictsdatadivxytabledata").find("#defaultMsg").html("If the user does not select any Data Element for Rows and Columns, system will pass Crash Date (Year) for Rows and Crash Date (Month) for Columns.");typeDescription();var e="",f="",b=bindTablesArray[selectedBuildValue].RowDefaultValues.split("by"),nt=bindTablesArray[selectedBuildValue].ColumnDefaultValues.split("by"),r="";Object.keys(jsonObject).length>0&&jsonObject.ColPer!=undefined&&jsonObject.ColPer&&($("#ColPer").prop("checked",!0),$("#ColPer").trigger("change"));Object.keys(jsonObject).length>0&&jsonObject.RowPer!=undefined&&jsonObject.RowPer&&($("#RowPer").prop("checked",!0),$("#RowPer").trigger("change"));var o="",u=[],i=[];$.each(n,function(n,s){r=s.DataElementName==="PERSON_BAC"?"sort1_PERSON_BAC":s.DataElementName==="Highest_Bac"?"sort1_Highest_Bac":s.DataElementName==="CITY_UNI"?" stateAndCity_Report hide":"";var h='<li class="ui-state-default '+r+'"  data-itemvalue ="'+s.SasDataFirstDesc+'" value='+s.DataElementName+" >"+s.SasDataFirstDesc+'<button style="margin-right:1%;margin-top:-1%;display:none;opacity:1;outline:none;" class="remove pull-right close" title="Remove Data Element">x<\/button><\/li>';Object.keys(jsonObject).length<=0&&(s.DataElementName==="Highest_Bac"&&t==="Alcohol Impaired"||s.DataElementName=="A_RU"&&t=="Rural/Urban"||s.DataElementName==="A_REST"&&t==="Occupant Protection")?(selectedBuildValue!=="UnivariateGraph"&&$("#sortable3").append(h),defaultRowsandColumns.columnKeys=s.DataElementName,defaultRowsandColumns.columnKeysDesc=s.SasDataFirstDesc,f+=s.SasDataFirstDesc+" by ",(s.DataElementName==="PERSON_BAC"||s.DataElementName=="Highest_Bac")&&(o=s.DataElementName)):Object.keys(jsonObject).length<=0&&b.indexOf(s.DataElementName)!==-1||Object.keys(jsonObject).length>0&&jsonObject.XTableEle.length>0&&jsonObject.XTableEle.indexOf(s.DataElementName)!==-1?(u.push({className:r,DataElementName:s.DataElementName,SasDataFirstDesc:s.SasDataFirstDesc}),e+=s.SasDataFirstDesc+" by ",defaultRowsandColumns.rowsKeys=s.DataElementName,defaultRowsandColumns.rowsKeysDesc=s.SasDataFirstDesc,(s.DataElementName==="PERSON_BAC"||s.DataElementName==="Highest_Bac")&&(o=s.DataElementName),selectAttributes(s.DataElementName,"S","B")):selectedBuildValue!=="UnivariateGraph"&&Object.keys(jsonObject).length<=0&&t!=="Alcohol Impaired"&&t!=="Rural/Urban"&&t!=="Occupant Protection"&&s.DataElementName==="MONTH"||Object.keys(jsonObject).length>0&&jsonObject.YTableEle!==undefined&&jsonObject.YTableEle.length>0&&jsonObject.YTableEle.indexOf(s.DataElementName)!==-1?(i.push({className:r,DataElementName:s.DataElementName,SasDataFirstDesc:s.SasDataFirstDesc}),f+=s.SasDataFirstDesc+" by ",defaultRowsandColumns.columnKeys=s.DataElementName,defaultRowsandColumns.columnKeysDesc=s.SasDataFirstDesc,(s.DataElementName==="PERSON_BAC"||s.DataElementName==="Highest_Bac")&&(o=s.DataElementName),selectAttributes(s.DataElementName,"S","B")):$("#sortable1").append(h);bindBindYourTable(e,f)});var tt=function(n){var t=$.grep(u,function(t){return t.SasDataFirstDesc.trim()===n.trim()});return t[0]},k=function(n){var t=$.grep(u,function(t){return t.DataElementName.trim()===n.trim()});return t[0]},s=[];selectedSortTable2RetriveCodeData=jsonObject.XTableEle?jsonObject.XTableEle:[];selectedSortTable2RetriveCodeData.length!==0&&(e="");$.each(selectedSortTable2RetriveCodeData,function(n,t){var i=k(t);i&&(s.push(i),e+=i.SasDataFirstDesc+" by ")});$.each(s,function(n,t){$("#sortable2").append('<li class="ui-state-default '+t.className+'"  data-itemvalue ="'+t.SasDataFirstDesc+'" value='+t.DataElementName+" >"+t.SasDataFirstDesc+'<button style="margin-right:1%;margin-top:-1%;opacity:1;outline:none;" class="remove pull-right close" title="Remove Data Element">x<\/button><\/li>')});s.length===0&&(l=u[0].SasDataFirstDesc,$("#sortable2").append('<li class="ui-state-default '+u[0].className+'"  data-itemvalue ="'+l+'" value='+u[0].DataElementName+" >"+u[0].SasDataFirstDesc+'<button style="margin-right:1%;margin-top:-1%;opacity:1;outline:none;" class="remove pull-right close" title="Remove Data Element">x<\/button><\/li>'));var it=function(n){var t=$.grep(i,function(t){return t.SasDataFirstDesc.trim()===n.trim()});return t[0]},d=function(n){var t=$.grep(i,function(t){return t.DataElementName.trim()===n.trim()});return t[0]},h=[],a=jsonObject.YTableEle?jsonObject.YTableEle:[];a.length!==0&&(f="");$.each(a,function(n,t){var i=d(t);i&&(h.push(i),f+=i.SasDataFirstDesc+" by ")});$.each(h,function(n,t){$("#sortable3").append('<li class="ui-state-default '+t.className+'" data-itemvalue ="'+t.SasDataFirstDesc+'" value='+t.DataElementName+" >"+t.SasDataFirstDesc+'<button style="margin-right:1%;margin-top:-1%;opacity:1;outline:none;" class="remove pull-right close" title="Remove Data Element">x<\/button><\/li>')});h.length===0&&i&&i.length>0&&(v=i[0].SasDataFirstDesc,$("#sortable3").append('<li class="ui-state-default '+i[0].className+'" data-itemvalue ="'+v+'" value='+i[0].DataElementName+" >"+i[0].SasDataFirstDesc+'<button style="margin-right:1%;margin-top:-1%;opacity:1;outline:none;" class="remove pull-right close" title="Remove Data Element">x<\/button><\/li>'));o!=""&&selectAttributes(o,"S","B");bindBindYourTable(e,f);$("#sortable1").sortable({connectWith:".connectedSortable",receive:function(n,t){t.item.hasClass("pin")&&(t.sender.sortable("cancel"),t.item.children().css("display","none"))},remove:function(n,t){var i=$(this);($(t.item[0]).attr("value")=="Highest_Bac"||$(t.item[0]).attr("value")=="PERSON_BAC")&&($(t.item[0]).attr("value")=="Highest_Bac"?selections.HighestCount=1:$(t.item[0]).attr("value")=="PERSON_BAC"&&(selections.PersonCount=1),selectAttributes($(t.item[0]).attr("value"),"S","B"))},update:function(n,t){var i=$(this);t.item.children().css("display","none");($(t.item[0]).attr("value")=="Highest_Bac"||$(t.item[0]).attr("value")=="PERSON_BAC")&&($(t.item[0]).attr("value")=="Highest_Bac"?selections.HighestCount=0:$(t.item[0]).attr("value")=="PERSON_BAC"&&(selections.PersonCount=0),selectAttributes($(t.item[0]).attr("value"),"D","B"))}});$("#sortable2").sortable({connectWith:".connectedSortable",receive:function(){for(var t=$(this),i="",r,n=0;n<t.children().length;n++)r=t.children()[n],i+=r.childNodes[0].nodeValue.trim()+" by ";bindBindYourTable(i,"empty")},remove:function(){for(var t=[],i=$(this),n=0;n<i.children().length;n++)t+=i.children()[n].childNodes[0].nodeValue.trim()+" by ";bindBindYourTable(t,"empty")},update:function(n,t){for(var r=$(this),u="",f,i=0;i<r.children().length;i++)f=r.children()[i],u+=f.childNodes[0].nodeValue.trim()+" by ";t.item.hasClass("pin")&&(t.sender.sortable("cancel"),$("#divmetrictsdatadivxytabledata").find("#errormsg").css("display","block"));bindBindYourTable(u,"empty")}});$("#sortable3").sortable({connectWith:".connectedSortable",receive:function(){for(var t=$(this),i="",n=0;n<t.children().length;n++)i+=t.children()[n].childNodes[0].nodeValue.trim()+" by ";bindBindYourTable("empty",i)},remove:function(n,t){var r,u,i;if(!t.item.hasClass("pin")){for(r=$(this),u="",i=0;i<r.children().length;i++)u+=r.children()[i].outer+" by ";bindBindYourTable("empty",u)}},update:function(){for(var t=$(this),i="",n=0;n<t.children().length;n++)i+=t.children()[n].childNodes[0].nodeValue.trim()+" by ";bindBindYourTable("empty",i)}});$("#sortable2").trigger("sortreceive");$("#sortable3").trigger("sortreceive")}else $("#divmetrictsdatadivxytabledata").html('<div>  <span style="color:red;">No data to Display.<\/span> <\/div>');y=jsonObject.selectBYTType;$("[data-name='"+y+"']").click();c="";g=!1;c=getErrorMsgForReportForRebind(jsonObject);$("#divmetrictsdatadivxytabledata").find("#errormsg").html(c);p=inputData.State;p.length===1?$(".stateAndCity_Report").removeClass("hide"):$(".stateAndCity_Report").addClass("hide");$("#ascarrow").hide();$("#descarrow").show()},error:function(){}});Object.keys(jsonObject).length>0&&common.showPanel("collapsedivXYtable")}function getErrorMsgForReport(n,t,i){var r=!1;return n&&(r=!0,errorMsg=getErrorMsgByTopic(i)),t&&(r=!0,errorMsg="Dragging Person BAC into Rows or Columns hides Highest BAC for selection.<br/>Currently BAC does not allow the selection of percentages."),r||(errorMsg=""),errorMsg}function getErrorMsgForReportForRebind(n){var i=n.topic_name,t=!1;return n.XTableEle&&(n.XTableEle.indexOf("Highest_Bac")>-1&&(t=!0,errorMsg=getErrorMsgByTopic(i)),n.XTableEle.indexOf("PERSON_BAC")>-1&&(t=!0,errorMsg="Dragging Person BAC into Rows or Columns hides Highest BAC for selection.<br/>Currently BAC does not allow the selection of percentages.")),n.YTableEle&&(n.YTableEle.indexOf("Highest_Bac")>-1&&(t=!0,errorMsg=getErrorMsgByTopic(i)),n.YTableEle.indexOf("PERSON_BAC")>-1&&(t=!0,errorMsg="Dragging Person BAC into Rows or Columns hides Highest BAC for selection.<br/>Currently BAC does not allow the selection of percentages.")),t||(errorMsg=""),errorMsg}function getErrorMsgByTopic(n){var t="";switch(n){case"Drivers":case"Pedalcyclists":case"Pedestrians":t="Dragging Highest BAC into Rows or Columns hides Person BAC for selection.<br /> Currently BAC does not allow the selection of percentages.";break;case"Crashes":case"Occupants":case"People":t="Currently BAC does not allow the selection of percentages."}return t}function getRowDesc(n){var i=$("#sortable2 li"),t=[];return $.each(n.XTableEle,function(n,r){var u=i.filter("[value='"+r+"']").attr("data-itemvalue");t.push(u)}),t.join(" by ")}function getColumnDesc(n){var i=$("#sortable3 li"),t=[];return $.each(n.YTableEle,function(n,r){var u=i.filter("[value='"+r+"']").attr("data-itemvalue");t.push(u)}),t.join(" by ")}function bindBindYourTable(n,t){n=n!=""&&n!="empty"?n.substring(n.length-1,0):n;t=t!=""&&t!="empty"?t.substring(t.length-1,0):t;BuildRows=n=="empty"?BuildRows:n;BuildColumns=t=="empty"?BuildColumns:t;BuildRows.indexOf("by")!=-1&&(BuildRows=BuildRows.replace(/by$/,""),BuildRows=BuildRows.replace(/\s*$/,""));BuildColumns.indexOf("by")!=-1&&(BuildColumns=BuildColumns.replace(new RegExp("by$"),""),BuildColumns=BuildColumns.replace(/\s*$/,""));selectedBuildValue=jsonObject.selectBYTType||selectedBuildValue;switch(selectedBuildValue){case"Table":typePrefix="Report Type: Table > ";rowsPrefix="Rows ";rowString=BuildRows!=""?typePrefix+rowsPrefix+" ("+BuildRows+");":"";columnString=BuildColumns!=""?" Columns ("+BuildColumns+")":"";break;case"UnivariateGraph":typePrefix="Report Type: Univariate Graph > ";rowsPrefix="Univariate Graph Value ";rowString=BuildRows!=""?typePrefix+rowsPrefix+" ("+BuildRows+");":"";columnString=BuildColumns!=""?" Columns ("+BuildColumns+")":"";break;case"PanelGraph":typePrefix="Report Type: Panel Graph > ";rowsPrefix="Classification Value Selection ";rowString=BuildRows!=""?typePrefix+rowsPrefix+" ("+BuildRows+");":"";columnString=BuildColumns!=""?" Analysis Value Selection ("+BuildColumns+")":"";break;case"LineGraph":typePrefix="ReportType: Line Graph >";rowsPrefix="Line Graph Value ";rowString=BuildRows!=""?typePrefix+rowsPrefix+" ("+BuildRows+")":"";columnString=BuildColumns!=""?" Columns Y ("+BuildColumns+")":""}SeletedTypeRowsCount=bindTablesArray[selectedBuildValue].rows;SelectedColumnsCount=bindTablesArray[selectedBuildValue].columns;SeletedTypeRowsCount===0&&(rowString="");SelectedColumnsCount===0&&(columnString="");$("#buildyourtable").html(rowString+columnString);showorhideBYTIcon(rowString==""&&columnString=="")}function showorhideBYTIcon(n){$("#traingleBYT").css("display",n?"none":"inline")}function sortUnorderedList(n,t){var o,s,i,u;if(typeof n=="string"&&(n=document.getElementById(n)),!n){alert("The UL object is null!");return}var r=n.getElementsByTagName("LI"),e=[],f=[];for(i=0,o=r.length;i<o;i++)s={innerhtml:r[i].innerHTML,value:r[i].getAttribute("value"),"class":r[i].getAttribute("class"),style:r[i].getAttribute("style")},f.push(s),e.push(r[i].innerHTML);for(e.sort(),t&&e.reverse(),i=0;i<r.length;i++)for(r[i].innerHTML=e[i],u=0;u<f.length;u++)if(e[i]==f[u].innerhtml){r[i].setAttribute("value",f[u].value);r[i].setAttribute("class",f[u].class);r[i].setAttribute("style",f[u].style);break}}function changeBYTCondition(){selectedBuildValue!="Table"&&($(".pnlfooters").css("display","none"),$("#RowPerstrong").css("display","none"),$("#ColPerstrong").css("display","none"),$("#RowPerspan").css("display","none"),$("#ColPerspan").css("display","none"),$("#spantypeDescription").css("display","none"));selectedBuildValue=="UnivariateGraph"?($("#BYTMainDescription").hide(),$("#sortRowHeader").html("Univariate Graph Value<br /><p style='font-size:11px;'>(Drag & Drop to/from Data Elements)<\/p>"),$(".divSortColumns").hide(),$("#spantypeDescription").css("display","block"),$(".stateAndCity_Report").removeClass("hide")):selectedBuildValue=="LineGraph"?($("#BYTMainDescription").hide(),$("#sortRowHeader").html("Line Graph Value<br /><p style='font-size:11px;'>(Drag & Drop to Data Elements)<\/p>"),$(".divSortColumns").hide(),$("#spantypeDescription").css("display","block")):selectedBuildValue=="PanelGraph"?($("#BYTMainDescription").hide(),$("#sortRowHeader").html("Classification Value Selection<br /><p style='font-size:11px;'>(Drag & Drop to/from Data Elementss)<\/p>"),$("#sortColHeader").html("Analysis Value Selection<br /><p style='font-size:11px;'>(Drag & Drop to/from Data Elements)<\/p>"),$(".divSortColumns").show(),$("#spantypeDescription").css("display","block"),$(".stateAndCity_Report").removeClass("hide")):($("#sortRowHeader").html("Rows<br /><p style='font-size:11px;'>(Drag & Drop to/from Data Elements)<\/p>"),$("#sortColHeader").html("Columns<br /><p style='font-size:11px;'>(Drag & Drop to/from Data Elements)<\/p>"),$(".divSortColumns").show(),$("#BYTMainDescription").show(),$("#RowPerstrong").css("display","inline"),$("#ColPerstrong").css("display","inline"),$("#ColPerstrong").css("display","inline"),$(".pnlfooters").css("display","block"),$("#spantypeDescription").css("display","block"),$(".stateAndCity_Report").removeClass("hide"));SeletedTypeRowsCount=bindTablesArray[selectedBuildValue].rows;SelectedColumnsCount=bindTablesArray[selectedBuildValue].columns;$("#xConfigspan").html(bindTablesArray[selectedBuildValue].rows);$("#yConfigspan").html(bindTablesArray[selectedBuildValue].columns);SelectedColumnsCount==0?$("#BYTInnerDescription").hide():$("#BYTInnerDescription").show();inputData.Type=bindTablesArray[selectedBuildValue].type;AppTableConfig.XTableMax=SeletedTypeRowsCount;AppTableConfig.YTableMax=SelectedColumnsCount}function typeDescription(){var n="",t="(<span id='xConfigspan'>"+SeletedTypeRowsCount+"<\/span>)",i="(<span id='yConfigspan'>"+SelectedColumnsCount+"<\/span>)",r="<span style='display:none;' id='yConfigspan'><\/span>";switch(selectedBuildValue){case"Table":n="To build your table, select and drag the data elements from the table on the left and move to Rows and Columns sections. <span style='color:red;'>You are limited to "+t+" for the Rows and  "+i+" for Columns<\/span>. If the user does not select any Data Element for Rows and Columns, system will pass Crash Date (Year) for Rows and Crash Date (Month) for Columns.";break;case"UnivariateGraph":n="To build your Univariate Graph, select and drag the data element from the Data Elements table on the left and move to Univariate Graph section. <span style='color:red;'> You are limited to "+t+" for the Univariate Graph Value.<\/span>  "+r+" If the user does not select any Data Element for Univariate Graph value, system will pass Crash Date (Year) for Univariate Graph Value.";break;case"PanelGraph":n="To build your Panel Graph, select and drag the data elements from the Data Elements table on the left and move to Classification Value Selection and Analysis Value Selection. <span style='color:red;'> You are limited to "+t+" for the Classification Value Selection and  "+i+" for the Analysis Value Selection<\/span>. If the user does not select any Data Element for Classification Value Selection and Analysis Value Selection, system will pass Crash Date (Year) for Classification Value Selection and Crash Date (Month) for Analysis Value Selection.";break;case"LineGraph":n="To build your line chart, select and drag the data element from the Data Elements table on the left and move to Line graph value sections. <span style='color:red;'>You are limited to "+t+" for the Line graph value<\/span>. "+r+" If the user does not select any Data Element for Line Graph value, system will pass the Crash Date (Year). By default, only selected years from Time Frame panel will be also submitted."}$("#divmetrictsdatadivxytabledata").find("#spantypeDescription").html(n)}function EnableordisableAttributes(){var n=$("#sortable2 li, #sortable3 li").filter("[value = 'Highest_Bac']").length===0?!1:!0,t=$("#sortable2 li, #sortable3 li").filter("[value = 'PERSON_BAC']").length===0?!1:!0;n&&($(".sort1_PERSON_BAC").css("display","none"),$(".sort1_Highest_Bac").css("display","block"));t&&($(".sort1_PERSON_BAC").css("display","block"),$(".sort1_Highest_Bac").css("display","none"));n||t||($(".sort1_PERSON_BAC").css("display","block"),$(".sort1_Highest_Bac").css("display","block"))}function selectAttributes(n,t,i){var u=localStorage.getItem("topicName"),r;selections.HighestBac=n=="Highest_Bac"&&t=="S";selections.HighestBac?($("#RowPer").attr("disabled",!0),$("#RowPer :input").is(":checked")&&$("#RowPer").attr("checked",!1)):$("#RowPer").removeAttr("disabled");selections.PersonBac=n=="PERSON_BAC"&&t=="S";t=="S"&&selections.selectionCount==0&&(selections.selectionCount++,i=="F"&&(selections.HighestBac?alert("Selecting Highest BAC will hide Person BAC."):selections.PersonBac&&alert("Selecting Person BAC will hide Highest BAC.")),i=="B"&&($("#divmetrictsdatadivxytabledata").find("#errormsg").css("display","block"),r=getErrorMsgForReport(selections.HighestBac,selections.PersonBac,u),$("#divmetrictsdatadivxytabledata").find("#errormsg").html(r)));t=="D"&&($("#divmetrictsdatadivxytabledata").find("#errormsg").html(""),selections.selectionCount=0);EnableordisableAttributes()}function disableRoworColPer(){inputData.XTableEle.indexOf("Highest_Bac")!=-1||inputData.YTableEle.indexOf("PERSON_BAC")!=-1||inputData.YTableEle.indexOf("Highest_Bac")!=-1||inputData.XTableEle.indexOf("PERSON_BAC")!=-1?($("#RowPer").attr("disabled",!0),$("#ColPer").attr("disabled",!0),$("#RowPer").is(":checked")?($("#RowPer").prop("checked",!1),$("#RowPerspan").css("display","none"),$("#RowPerstrong").html("")):($("#RowPerspan").css("display","none"),$("#RowPerstrong").html("")),$("#ColPer").is(":checked")?($("#ColPer").prop("checked",!1),$("#ColPerspan").css("display","none"),$("#ColPerstrong").html("")):($("#ColPerspan").css("display","none"),$("#ColPerstrong").html(""))):($("#RowPer").removeAttr("disabled"),$("#ColPer").removeAttr("disabled"))}function getsamplequeries(n){var t=localStorage.getItem("selectedQuery");$("#"+t).css({color:"white","background-color":"#0183c1","font-weight":"600"});$.ajax({url:relativeUrl("Home/GetSampQuery?topicid="+n),data:{topicId:n},cache:!1,type:"GET",success:function(n){var t,i;n.length!=0?(t=[],$("#sampleQuieries").html(""),$(".not-found").css("display","none"),$.each(n,function(n,i){var r=bindsamplequery(i,"local");t.push(i);$("#sampleQuieries").append(r)}),$("#sampleQuieries").data("sampleQuieries",t),i=localStorage.getItem("selectedQuery"),$("#"+i).css({color:"white","background-color":"#0183c1","font-weight":"600"})):$("#sampleQuieries").html("<h5 style = color:red;>There are no sample queries for this Topic at this time.<\/h5>");n.length>samplequeriesScrollLength?$("#sampleQuieries").addClass("scroll"):$("#sampleQuieries").removeClass("scroll");$("#expandQueries").click(function(){$("#expandQueries").hide();$("#collapseQueries").show();$("#sampleQuieries").removeClass("scroll")});$("#collapseQueries").click(function(){$("#expandQueries").show();$("#collapseQueries").hide();n.length>samplequeriesScrollLength?$("#sampleQuieries").addClass("scroll"):$("#sampleQuieries").removeClass("scroll")})},error:function(){}})}function getallqueries(){$.ajax({url:relativeUrl("Home/GetAllSampleQuery"),cache:!1,type:"GET",success:function(n){var t,i,r;n.length!=0?(t=[],$("#allsampleQuieries").html(""),$(".not-found").css("display","none"),$.each(n,function(n,i){var r=bindsamplequery(i,"global");t.push(i);$("#allsampleQuieries").append(r)}),i=n.length,$("#totalnoofqueries").html(i),$("#allsampleQuieries").data("allsampleQuieries",t),r=localStorage.getItem("selectedQuery"),$("#"+r).css({color:"white","background-color":"#0183c1","font-weight":"600"})):$("#allsampleQuieries").html("<h5 style = color:red;>There are no sample queries available at this time.<\/h5>")},error:function(){}})}function bindsamplequery(n,t){var i=t==="global"?"rebindPagebyqueries":"rebindPageCall";return'<div class="colortag '+t+'"><a data-querynumber='+n.QueryNumber+' style="display: block;" id="'+n.Id+'" href="javascript:void(0);" title= "'+n.QueryTitle+'" onclick= "formEvents.'+i+"(this,"+n.Id+')" > '+n.QueryTitle+"  (#"+n.QueryNumber+") <\/a><hr><\/div>"}var message1="A planned maintenance update is scheduled for today, Friday December 4th 9:00 pm EST thru Sunday December 6th 11:00pm EST. During this time the website will not be available.",message2="A planned maintenance is scheduled this Friday July 16 9.00 pm EST thru Sunday July 18  11:00 pm EST. During this time, the website may be unavailable or slow. Sorry for the inconvenience.",message3="At this time, the 2019 Vehicle Make and Model data is not available.This function will be available again shortly.",messages=[message1,message2,message3],startDatesofMessages=[new Date("12/4/2020 15:00:00"),new Date("7/16/2021 15:00:00"),new Date("1/30/2021 09:00:00")],endDatesofMessages=[new Date("12/4/2020 15:10:00"),new Date("7/18/2021 23:00:00"),new Date("1/30/2020 19:00:00")],currentTime=new Date,maintenenaceMsg="",releaseDate,expandDays,common,formEvents,attributes,timeframe,makemodel,metricsClick,samplequeriesScrollLength;$(document).ready(function(){for(var n=0;n<messages.length;n++)startDatesofMessages[n]<currentTime&&endDatesofMessages[n]>currentTime&&(maintenenaceMsg=maintenenaceMsg===""?maintenenaceMsg+messages[n]:maintenenaceMsg+"<br>"+messages[n]);maintenenaceMsg!==""?(document.getElementById("maintenanceMessage").innerHTML=maintenenaceMsg,document.getElementById("maintenanceMessage").style.display="block"):document.getElementById("maintenanceMessage").style.display="none"});releaseDate=new Date("3/9/2021");expandDays=0;var inputData={},regionsdata=[],statesdata=[],AppTableConfig={},BuildRows="",BuildColumns="",defaultRowsandColumns={},selections={HighestBac:!1,PersonBac:!1,selectionCount:0,HighestCount:0,PersonCount:0},selectedBuildValue="Table",typePrefix="";inputData.Type=1;var bindTablesArray={Table:{rows:3,columns:2,RowDefaultValues:"YEAR",ColumnDefaultValues:"MONTH",type:"1"},UnivariateGraph:{rows:1,columns:0,RowDefaultValues:"YEAR",ColumnDefaultValues:"",type:"2"},PanelGraph:{rows:1,columns:1,RowDefaultValues:"YEAR",ColumnDefaultValues:"MONTH",type:"3"},LineGraph:{rows:1,columns:0,RowDefaultValues:"YEAR",ColumnDefaultValues:"",type:"4"}},SeletedTypeRowsCount=bindTablesArray[selectedBuildValue].rows,SelectedColumnsCount=bindTablesArray[selectedBuildValue].columns,retriveflag=!0;$(document).ajaxStart(function(){$("#btnsubmit").prop("disabled",!0)});$(document).ajaxStop(function(){$("#btnsubmit").prop("disabled",!1);jsonObject={};defaultYears.min=0;defaultYears.max=0;defaultYears.timeFrameType="Y";sasDataObj={type1:[],type2:[],type3:[],type4:[],type5:[],type6:[],type7:[],type8:[]};$('a[data-toggle = "collapse"]').mouseover(function(){$(this).parent().children().hasClass("collapsed")?$(this).attr("title","Open panel"):$(this).attr("title","Close panel")})});common=function(){var n={};return n.props={enableLog:!0,retriveflag:!1},n.init=function(){$("#modelyearicon").hide();$("input[type=file]").on("change",formEvents.onfileChange);$("#RowPer").change(function(){var n=$(this).is(":checked");n?($("#RowPerspan").css("display",""),$("#RowPerstrong").html("RowPer=1")):($("#RowPerspan").css("display","none"),$("#RowPerstrong").html(""))});$("#ColPer").change(function(){var n=$(this).is(":checked");n?($("#ColPerspan").css("display",""),$("#ColPerstrong").html("ColPer=1")):($("#ColPerspan").css("display","none"),$("#ColPerstrong").html(""))});$("#btnsave").click(function(n){n.preventDefault();var t=this;formEvents.confirmDialog(formEvents.saveCritieria,null,"confirmModal","confirmYes","confirmNo")});$("#btnsubmit").click(function(){formEvents.onSubmit()});var n=localStorage.getItem("topicId");$(".topicpanel").hide();$(".topicinfo_"+n).show();$(".topicinfo_"+n).find("[href='#Panel_"+n+"']").click()},n.ajaxCall=function(n,t,i,r,u,f){t=t||{};$.ajax({url:n,data:t,cache:!1,type:i,contentType:"application/json; charset=utf-8",headers:f||{},success:function(n){r(n)},error:function(n){u(n)}})},n.ajaxGet=function(n,t,i){common.ajaxCall(n,null,"GET",t,i)},n.ajaxPost=function(n,t,i,r,u){common.ajaxCall(n,t,"POST",r,u,i)},n.toggelPanel=function(n){var i=$("#"+n),r=$("."+n),t;i.toggle();t=r.find("a");t.hasClass("collapsed")?t.removeClass("collapsed"):t.addClass("collapsed");i.css("display")==="block"?t.removeClass("collapsed"):t.addClass("collapsed");i.css("display")==="block"?(t.find("i").removeClass("fa-plus").addClass("fa-minus").attr("title","Close panel"),t.removeClass("collapsed"),n==="SampleQueries"&&($("#expandQueries").show(),$("#collapseQueries").hide(),$(".local").show(),$("#sampleQuieries").show(),$("#allsampleQuieries").hide(),$("#Searchqueries").val(""),$("#Searchallqueries").val(""),$("#sampleQuieries").addClass("scroll"),$(".not-found").css("display","none"),$("#allsampleQuieries").removeClass("scroll1"))):(t.find("i").removeClass("fa-minus").addClass("fa-plus").attr("title","Open panel"),t.addClass("collapsed"),n==="SampleQueries"&&($("#expandQueries").hide(),$("#collapseQueries").hide()))},n.showPanel=function(n){$("#"+n).show();var t=$("."+n);$.each(n.split(","),function(){var n=t.find("a");n.removeClass("collapsed");n.find("i").removeClass("fa-plus").addClass("fa-minus").attr("title","Close panel")})},n.showPanels=function(n){var t=n.split(",").join(",#");$("#"+t).show();$.each(n.split(","),function(){var n=$(this).find("a");n.removeClass("collapsed");n.find("i").removeClass("fa-plus").addClass("fa-minus").attr("title","Close panel")})},n.hidePanel=function(n){$("#"+n).hide()},n.hidePanels=function(n){var i=n.split(",").join(",#"),t;$("#"+i).hide();t=n.split(",");$.each(t,function(n,t){var r=$("."+t),i=r.find("a");i.addClass("collapsed");i.find("i").removeClass("fa-minus").addClass("fa-plus").attr("title","Open panel")})},n.log=function(n,t,i){common.props.enableLog&&(i=i||"Default ",t=t||"unkonwn")},n.getSettings=function(){var t=$.Deferred(),n={},i=localStorage.getItem("settings");return i!==undefined&&i!==null?(n=JSON.parse(i),t.resolve(n)):$.ajax({url:relativeUrl("AppConfig/GetXYTableConfig"),cache:!1,type:"GET",async:!1,success:function(i){i!==undefined&&i!==null&&(localStorage.setItem("settings",JSON.stringify(i)),n=i);t.resolve(n)}}),t.promise()},n.alertMsgShowOnce=function(){var n=localStorage.getItem("invalidMsgCount");n=n?Number(n):0;n<=1&&alert("Your saved queries may not work due to system and data upgrades. Please review the retrieved queries for accuracy before running them. By resaving the corrected query, if needed, this message will disappear.")},n.setinvalidMsgCount=function(n){var t=localStorage.getItem("invalidMsgCount");n?t=n:(t=t?Number(t):0,t=t+1);localStorage.setItem("invalidMsgCount",t)},n}();formEvents=function(){var n={saveTopicDetailsUrl:"Report/SaveTopicDetails",tokeninfo:"",isProduction:"false"};return n.onSubmit=function(){var l,b,i,n,h,a,v,y,p,c,r,f,w,u,s,o,t,d,g,nt,tt;if(!isValid)return alert("Please check your selections. At least one invalid value has been entered (Please Check: Drivers Zip Code, Vehicle Indentification Number VIN, Vehicle Model Year or Age)"),!1;if(l=inputData.selectBYTType!="UnivariateGraph",b=l?"Please select at least one Data Element in Rows and one Data Element in Columns.":"Please select at least one Data Element in Rows.",l?$("ul#sortable2 li").not(".hide").length>=1&&$("ul#sortable3 li").not(".hide").length>=1:$("ul#sortable2 li").not(".hide").length>=1){if(i="&Criteria="+$("#partimeframe").attr("data-years"),$("#RowPerstrong").text()!==""&&(i=i+"&"+$("#RowPerstrong").text()),$("#ColPerstrong").text()!==""&&(i=i+"&"+$("#ColPerstrong").text()),n="&topic_num="+inputData.TopicNum+"&metric_num="+inputData.MetricNum+"&metrictype_num="+inputData.MetricTypeNum,inputData.YearsData=timeframe.geSelectedData(),inputData.YearsData!=undefined&inputData.YearsData!="")n=n+"&CrashYear="+inputData.YearsData;else{var e="",it=parseInt(AppTableConfig.EndYear)-4,k=parseInt(AppTableConfig.EndYear);for(h=it;h<k;h++)e=e+h+",";e=e+k;inputData.YearsData=e;n=n+"&CrashYear="+inputData.YearsData}if(inputData.State!==undefined&&inputData.State!=""&&(n=n+"&State="+inputData.State),inputData.County!==undefined&&inputData.County!=""&&(n=n+"&County="+inputData.County),inputData.City!==undefined&&inputData.City!=""&&(n=n+"&City="+inputData.City),inputData.Region!==undefined&&inputData.Region!=""&&(n=n+"&A_Region="+inputData.Region),a=makemodel.getSelectedMakes(),a!==undefined&&a!==""&&(n=n+"&VPICMAKEID="+makemodel.getSelectedMakes()),v=makemodel.getSelectedModels(),v!==undefined&&v!==""&&(n=n+"&VPICMAKEMODELID="+makemodel.getSelectedModels()),y=makemodel.getSelectedBodyClass(),y!==undefined&&y!==""&&(n=n+"&VPICBODYCLASSID="+makemodel.getSelectedBodyClass()),p=makemodel.getSelectedYears(),p!==undefined&&p!==""&&(n=n+"&A_MOD_YR="+makemodel.getSelectedYears()),$("#releaseInfo").data("releasenotes")!==""&&(n=n+"&ReleaseDate="+$("#releaseInfo").data("releasenotes")),inputData.SasData!==undefined){if($.each(Object.getOwnPropertyNames(inputData.SasData),function(n,t){inputData.SasData[t]=$.grep(inputData.SasData[t],function(n){return n.isparent!==!0})}),c="",inputData.SasData!==undefined&&inputData.SasData!==null)for(r in inputData.SasData)if(inputData.SasData[r]!==undefined&&inputData.SasData[r]!==null&&inputData.SasData[r]!==""&&inputData.SasData[r].length>0){for(f="&"+r+"=",w=inputData.SasData[r].length,t=0;t<w-1;t++)f=f+inputData.SasData[r][t].code+",";f=f+inputData.SasData[r][w-1].code;c=c+f}n=n+c}if(inputData.XTableEle!==undefined&&inputData.XTableEle!==null&&inputData.XTableEle.length>0){for(u=[],o=inputData.State!==null?inputData.State.length:0,t=0;t<inputData.XTableEle.length;t++)inputData.XTableEle[t]==="CITY_UNI"?o===1&&u.push(inputData.XTableEle[t]):u.push(inputData.XTableEle[t]);u=u.join(",");n=n+"&TableRows="+u}else n=n+"&TableRows="+defaultRowsandColumns.rowsKeys,i=i+"Rows: "+defaultRowsandColumns.rowsKeysDesc;if(inputData.YTableEle!==undefined&&inputData.YTableEle!==null&&inputData.YTableEle.length>0){for(s=[],o=inputData.State!==null?inputData.State.length:0,t=0;t<inputData.YTableEle.length;t++)inputData.YTableEle[t]==="CITY_UNI"?o===1&&s.push(inputData.YTableEle[t]):s.push(inputData.YTableEle[t]);u=s.join(",");n=n+"&TableCols="+s}else n=n+"&TableCols=DO_NOT_PROCESS";n=n+"&ReportType="+inputData.Type;$("#SASQueryString").html(n+i);$("#SASQueryString").val(n+i);console.log("crteriastring",n+i);d=n+i;g=formEvents.getCritieriaString();formEvents.saveTopicDetails(g,d);$("div[role=tooltip]").remove();nt=$("#FIRSTForm").attr("isDev");tt=$("#FIRSTForm").attr("isProduction");tt.toLowerCase()==="true"?($("#FIRSTForm").attr("action",window.location.origin+"/SASStoredProcess/guest"),$("#_program").val("/Production/Apps/Query/FIRST")):($("#FIRSTForm").attr("action",nt+"SASStoredProcess/do"),$("#_program").val("/Development/Apps/Query/FIRST"));$("#FIRSTForm").attr("target","_blank");$("#FIRSTForm").attr("method","post");$("#FIRSTForm").submit()}else return alert(b),!1},n.saveTopicDetails=function(n,t){var u=$.parseXML("<xml/>"),i=n,o=u.getElementsByTagName("xml")[0],r,f;for(r in i)i.hasOwnProperty(r)&&(f=u.createElement(r),$(f).text(i[r]));var s={Id:0,TopicName:i.topic_name,TopicId:i.topic_num,CreteriaText:o.outerHTML,CurrentCriteria:JSON.stringify(i),SASQueryString:t},h=JSON.stringify({reportViewModel:s}),e={};e.RequestVerificationToken=formEvents.tokeninfo;common.ajaxPost(formEvents.saveTopicDetailsUrl,h,e,function(){},function(){})},n.saveCritieria=function(){var n=formEvents.getCritieriaString(),t;if(n!=="")t="FIRSTCriteria.txt",formEvents.download(t,JSON.stringify(n));else return!1},n.getCritieriaString=function(){var v=inputData.selectBYTType!="UnivariateGraph",n,l,o,f,r,t,e,u,s,h,c;if(v?$("ul#sortable2 li").not(".hide").length>=1&&$("ul#sortable3 li").not(".hide").length>=1:$("ul#sortable2 li").not(".hide").length>=1){if(n={},n.topic_num=inputData.TopicNum,n.topic_name=inputData.TopicName,l=localStorage.getItem("selectedQuery"),o=$("#"+l).attr("data-querynumber"),o!==""&&(n.QueryNum=o),n.metric_num=inputData.metricidval,n.metrictype_num=inputData.MetricTypeNum,n.metrictype_name=inputData.MetricTypeName,n.metrictype_id=inputData.MetricTypeId,n.datasource=inputData.DataSource,n.isgeogrpahy=inputData.IsGeoGrpahy,inputData.YearsData=timeframe.geSelectedData(),inputData.YearsData!=undefined&inputData.YearsData!="")n.CrashYear=inputData.YearsData,n.TimeFrameType=inputData.TimeFrameType;else{var i="",y=parseInt(AppTableConfig.EndYear)-4,a=parseInt(AppTableConfig.EndYear);for(f=y;f<a;f++)i=i+f+",";i=i+a;inputData.YearsData=i;n.CrashYear=inputData.YearsData;n.TimeFrameType=inputData.TimeFrameType}if(inputData.State!==undefined&&inputData.State!=""&&inputData.State.length!=0&&(n.State=inputData.State,n.SelectType="S"),inputData.Region!==undefined&&inputData.Region!=""&&inputData.Region.length!=0&&(n.Region=inputData.Region,n.SelectType="R"),n.SelectType=="S"?n.StateText=$("#stateorregion").attr("data-stateText"):n.SelectType=="R"&&(n.RegionText=$("#stateorregion").attr("data-regionstext")),inputData.County!=undefined&&inputData.County!=""&&inputData.County.length!=0&&(n.County=inputData.County,n.CoutiesText=$("#strcounties").attr("data-countytext")),inputData.City!=undefined&&inputData.City!=""&&inputData.City.length!=0&&(n.City=inputData.City,n.CitiesText=$("#strcities").attr("data-citytext")),!(JSON.stringify(inputData.SasData)===JSON.stringify({}))&&(r=null,e=!1,inputData.SasData!==undefined&&inputData.SasData!==null)){r={};for(t in inputData.SasData)inputData.SasData[t]!==undefined&&inputData.SasData[t]!==null&&inputData.SasData[t]!==""&&inputData.SasData[t].length>0&&(r[t]=inputData.SasData[t],e=!0);e&&(n.SasData=r)}return u=makemodel.getSelectedYears(),u!==undefined&&u!==""&&u.length>0&&(n.VPICYears=u.split(",")),s=makemodel.getSelectedMakesText(),s!==""&&(n.Make=s.split(",")),h=makemodel.getSelectedModelsText(),h!==""&&(n.Model=h.split(",")),c=makemodel.getSelectedBodyClassText(),c!==""&&(n.VPICBodyClass=c.split(",")),n.selectBYTType=inputData.selectBYTType,inputData.XTableEle!==undefined&&inputData.XTableEle!==null&&inputData.XTableEle.length>0?(n.XTableEle=inputData.XTableEle,n.XTableEleDesc=getRowDesc(inputData)):(n.XTableEle=defaultRowsandColumns.rowsKeys,n.XTableEleDesc=defaultRowsandColumns.rowsKeysDesc),inputData.YTableEle!==undefined&&inputData.YTableEle!==null&&inputData.YTableEle.length>0&&(n.YTableEle=inputData.YTableEle,n.YTableEleDesc=getColumnDesc(inputData)),n.ColPer=$("#ColPer").is(":checked")?!0:!1,n.RowPer=$("#RowPer").is(":checked")?!0:!1,n}return""},n.save=function(){e.preventDefault();var n=this;formEvents.confirmDialog(saveCritieria,null,"confirmModal","confirmYes","confirmNo")},n.download=function(n,t){var i=document.createElement("a"),r,u,f;i.style.display="none";document.body.appendChild(i);r="FIRSTCriteria.txt";window.navigator.msSaveOrOpenBlob?(u=[t],blobObject=new Blob(u),$(i).click(function(){window.navigator.msSaveOrOpenBlob(blobObject,r)})):(f="data:text/plain;charset=utf-8,"+encodeURIComponent(t),$(i).attr("download",r),$(i).attr("href",f));i.click();document.body.removeChild(i)},n.confirmDialog=function(n,t,i,r,u){var e=function(){t&&t();f.modal("hide")},o=function(){n&&n();f.modal("hide")},f=$("#"+i);f.modal({backdrop:"static"});$("#"+r).unbind().one("click",o);$("#"+u).unbind().one("click",e)},n.confirmation=function(){formEvents.confirmDialog(function(){formEvents.saveCritieria()},function(){document.getElementById("SelectedFile").click()},"confirmRetrieveModal","confirmRetriveYes","confirmRetrieveNo")},n.rebindPage=function(n,t){var f,e,s,v,i,r,u,h,c,o,l,a;localStorage.setItem("invalidMsgCount","0");try{jsonObject=JSON.parse(n);makemodel.clearMakeModels();localStorage.setItem("metricId",jsonObject.metric_num)}catch(y){return alert("Retrieving the file failed ("+fileName+"). Improper File format."),!1}if(jsonObject!==null&&jsonObject!==undefined){f=[];$.each(jsonObject.SasData,function(n,t){$.each(t,function(n,t){f.push({SASDataElementId:t.sasdataeleid,AttributeLookupId:t.controlId.split("_")[1],Code:t.code,BindattrType:t.bindattrType,DataElementName:t.sasdatadesc})})});e=[];jsonObject.CrashYear!==undefined&&(e=jsonObject.CrashYear);s={SASDataElementAttributeLookupAssociationList:f,StateList:jsonObject.State,CityList:jsonObject.City,CountyList:jsonObject.County,RegionList:jsonObject.Region,XTableEle:jsonObject.XTableEle,YTableEle:jsonObject.YTableEle,TopicList:jsonObject.topic_num,MetricList:jsonObject.metric_num,MetricTypeList:jsonObject.metrictype_id,MakeList:jsonObject.Make,ModelList:jsonObject.Model,BodyClassList:jsonObject.VPICBodyClass,CrashYear:e};v=formEvents.validateJsonData().validateSasData(s);for(i in jsonObject.SasData)if(jsonObject.SasData[i]!==undefined&&jsonObject.SasData[i]!==null&&jsonObject.SasData[i]!==""&&jsonObject.SasData[i].length>0)for(r in jsonObject.SasData[i])switch(jsonObject.SasData[i][r].bindattrType){case 1:sasDataObj.type1.push(jsonObject.SasData[i][r]);break;case 2:sasDataObj.type2.push(jsonObject.SasData[i][r]);break;case 3:sasDataObj.type3.push(jsonObject.SasData[i][r]);break;case 4:sasDataObj.type4.push(jsonObject.SasData[i][r]);break;case 5:sasDataObj.type5.push(jsonObject.SasData[i][r]);break;case 6:sasDataObj.type6.push(jsonObject.SasData[i][r]);break;case 7:sasDataObj.type7.push(jsonObject.SasData[i][r]);break;case 8:sasDataObj.type8.push(jsonObject.SasData[i][r])}}jsonObject!==null&&jsonObject!==undefined&&jsonObject.CrashYear!==undefined&&jsonObject.CrashYear!==""&&(u=Array.isArray(jsonObject.CrashYear)?jsonObject.CrashYear:jsonObject.CrashYear.split(","),u!==undefined&&u.length>0&&(defaultYears.min=parseInt(u[0]),defaultYears.max=parseInt(u[u.length-1]),defaultYears.timeFrameType=jsonObject.TimeFrameType));h=$("#opstates option:selected");jsonObject.State&&jsonObject.State.length>0&&(h.length===1&&(selectedBuildValue==="Table"||selectedBuildValue==="UnivariateGraph"||selectedBuildValue==="PanelGraph")?$(".stateAndCity_Report").removeClass("hide"):$(".stateAndCity_Report").addClass("hide"));$("input[type=file]").val(null);timeframe.GetXyTableConfig();Object.keys(jsonObject).length>0&&jsonObject.Make!==undefined&&jsonObject.Make!==""&&(o=jsonObject.Make,c=makemodel.getSelectedMakeIdsByText(jsonObject.Make),$("#selectMakes").val(c).trigger("change"),$("#selectMakes_select2 .select2").show());Object.keys(jsonObject).length>0&&jsonObject.VPICBodyClass!==undefined&&jsonObject.VPICBodyClass!==""&&(o=jsonObject.VPICBodyClass,l=makemodel.getSelectedBodyClassIdsByText(jsonObject.VPICBodyClass),$("#selectBodyClass").val(l).trigger("change"),$("#selectBodyClass_select2 .select2").show());Object.keys(jsonObject).length>0&&jsonObject.VPICYears!==undefined&&jsonObject.VPICYears!==""&&(a=jsonObject.VPICYears,$("#selectmodelyears").val(a).trigger("change"),$("#selectmodelyears_select2 .select2").show());$(t).addClass("searchQueriesLinkSelected");localStorage.setItem("selectedQuery",$(t).attr("id"));console.log("samplequeryId",$(t).attr("id"))},n.validateJsonData=function(){var n=function(n){var t=JSON.stringify(n);common.ajaxPost("/SasData/ValidateJSONDataItems",t,null,function(n){if(!n.Item1){var t="",i=n.Item2.length===1?"Reason":"Reasons";n.Item2.forEach(function(n){t=t+"\n"+n});alert("Your saved queries may not work due to system and data upgrades. Please review the retrieved queries for accuracy before running them. By resaving the corrected query, if needed, this message will disappear. -->"+i+":-"+t)}},function(){})};return{validateSasData:n}},n.rebindPageCall=function(n,t){var i=$("#sampleQuieries").data("sampleQuieries"),r=$.grep(i,function(n){return n.Id===parseInt(t)});formEvents.rebindPage(r[0].QueryJson,n)},n.rebindPagebyqueries=function(n,t){var i=$("#allsampleQuieries").data("allsampleQuieries"),r=$.grep(i,function(n){return n.Id===parseInt(t)});formEvents.rebindPage(r[0].QueryJson,n)},n.onfileChange=function(n){var t,i;n.stopImmediatePropagation();try{fileName=$("#SelectedFile").val()}catch(e){return}if(fileName!==""){if(t=fileName.toLowerCase(),i=new RegExp("(.*?).(txt)$"),!i.test(t))return $(this).val(""),alert("Only .txt file can be Retrieved"),!1;if(window.FormData!==undefined){var f=document.getElementById("SelectedFile").files[0],r=new FileReader,u="";r.onload=function(n){u=n.target.result;formEvents.rebindPage(u)};r.readAsText(f,"UTF-8")}}},n.reset=function(){jsonObject={};window.location.reload()},n}();attributes=function(){var n={};return n.Props={attributeUrl:"Attributes/AttributeView",getMetricTypesUrl:"Attributes/DefaultAttMetricType",getDefaultsByMetricIdUrl:"Attributes/DefaultAttributeView"},n.onInjuaryClick=function(){alert("onPassengerVechileClick")},n.getMetricTypeData=function(n,t){var i=attributes.Props.getMetricTypesUrl+"?metrictypeId="+n;common.ajaxGet(i,function(n){common.log(n,"getMetricTypeData","Log");t(n)},function(){common.log("Getting error while fetching data.","Error")})},n.getDefaultByMetricIdData=function(n){var t=0,i;t=jsonObject.metric_num!==undefined?jsonObject.metric_num:localStorage.getItem("metricId");i=attributes.Props.getDefaultsByMetricIdUrl+"?metricId="+t;common.ajaxGet(i,function(t){common.log(t,"getMetricTypeData","Log");n(t)},function(){common.log("Getting error while fetching data.","Error")})},n.selectPanelHeader=function(n){common.log(n,"selectPanelHeader","Log");$.each(n,function(n,t){common.log(t,"selectPanelHeader --loop","Log");var i=t.SasDataEleId;$("[data-target='#SasCollapase_"+i+"']").click()})},n.checkSelectControl=function(n,t){$("#btnsubmit").prop("disabled",!0);common.log(n,"checkSelectControl","Log");$.each(n,function(n,t){common.log(t,"checkSelectControl --loop","Log");var i=t.AttributeIds;$.each(i,function(n,i){var u=$("#orderstatus_"+t.SasDataEleId),r;u.css("background-color","rgba(80, 175, 228, 0.43)");r=$(".chkefaultselect_"+t.SasDataEleId).filter("#attchkdesc_"+i);r.prop("checked")||r.click();r.attr("disabled","disabled");u.parent().find("input").attr("disabled","disabled")})});$("#btnsubmit").prop("disabled",!0);t&&t()},n.getandbindAttributesData=function(){var n="sasdataattributesView_"+id},n.fetchdata=function(n,t,i,r){var u=localStorage.getItem("metrictypeidval");attributes.getMetricTypeData(u,function(f){attributes.getDefaultByMetricIdData(function(e){$.ajax({url:relativeUrl("Attributes/AttributeView"),data:n,cache:!1,type:"GET",success:function(o){var s,h,c;$("#"+t).css("display","block");n.sasdataEleId!==45?attributes.bindData(o,t,u,f,e):$("#"+t).html(o);i===1&&(s=!1,sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type1!=null&&sasDataObj.type1!=undefined&&sasDataObj.type1.length>0&&AssignAttributeDetails(i,null,null,r),$(".radiodefaultselect_"+r).each(function(){$(this).is(":checked")&&($(this).hasClass("chkdefaultselectbyfile_"+r)||(s=!0),$(this).click())}),$(".radiodefaultselect_"+r).attr("disabled",s));i===2&&(h=!1,sasDataObj!=null&&sasDataObj!=undefined&&sasDataObj.type1!=null&&sasDataObj.type1!=undefined&&sasDataObj.type1.length>0&&AssignAttributeDetails(i,null,null,r),$(".chkefaultselect_"+r).each(function(){if($(this).is(":checked")){$(this).hasClass("chkdefaultselectbyfile_"+r)||(h=!0);var n=this.dataset.id,t=parseInt(this.dataset.code);SetCheckboxAttributesData(this,n,t,r)}}),$(".chkefaultselect_"+r).attr("disabled",h),c=localStorage.getItem("topicName"))},error:function(){$("#"+t).css("display","block");alert("System Error Occurred (0710). Please Email NCSARequests@dot.gov")}})})})},n.bindData=function(n,t,i,r,u){var f="";$.each(n,function(n,t){f+=t.SelectionOptionType===2?attributes.bindCheckBox(t,!1,i,r,u):attributes.bindRadioButton(t,!1,i,r)});$("#"+t).html(f);$(".parentItem input").on("click",function(){var t=this,n=$(this).prop("checked");$(this).prop("checked",n);attributes.checkAllChildItems(t,n)});$(".childItem").on("click",function(){var n=$(this).attr("parentId"),t=$("[parentid='"+n+"']"),r=t.find("input").length,i=t.find("input:checked").length;$("[pid='"+n+"']").css("background-color","white");r===i?($("[pid='"+n+"']").find("input").prop("checked",!0),$("[pid='"+n+"']").css("background-color","rgba(194, 222, 238, 0.43)")):($("[pid='"+n+"']").find("input").prop("checked",!1),i===0?$("[pid='"+n+"']").css("background-color","white"):$("[pid='"+n+"']").css("background-color","rgba(194, 222, 238, 0.43)"))});$("#"+t).find(".expandParent").unbind("click").bind("click",function(){$(this).hasClass("fa-minus")?($(this).removeClass("fa-minus"),$(this).addClass("fa-plus"),$(this).attr("title","Expand"),$(this).css({cursor:"pointer"})):($(this).addClass("fa-minus"),$(this).removeClass("fa-plus"),$(this).attr("title","Collapse"));var n=$(this).parent().attr("pid");$("[parentid='"+n+"']").toggle()});$("#"+t).find(".expandParent").click()},n.expandParent=function(n,t,i){var r=[],u=[];$(".childItem").find("input:checked").each(function(){i=$(this).data("attributeparentid");t&&r.push(i)});u=r.filter(function(n,t,i){return i.indexOf(n)===t});$.each(u,function(n,t){var r=$(".parentItem").filter("[pid='"+t+"']"),i=r.find(".expandParent");$(i).addClass("fa-minus");$(i).removeClass("fa-plus");$(i).attr("title","Collapse");$("[parentid='"+t+"']").show();$("[pid='"+t+"']").css("background-color","rgba(194, 222, 238, 0.43)")})},n.checkAllChildItems=function(n,t){var i=$(n).parent().attr("pid");$("[parentid='"+i+"']").find("input").each(function(n,i){var r=$(i).prop("checked");(!r&&t||!t&&r)&&$(i).click()})},n.getDefaultAttributes=function(n,t){var i=$.grep(t,function(t){return t.MetricTypeId===Number(n)});return i!==null&&i!==undefined&&i.length>0?i[0].AttributeIds:null},n.bindCheckBox=function(n,t,i,r,u,f){var h=attributes.getDefaultAttributes(i,r),o=!1,s=[],c,e;return h!==undefined&&h!==null&&(s=$.grep(h,function(t){return t===n.Id})),s!==null&&s!==undefined&&(o=s.length>0),u===null||u===undefined||o||(c=$.grep(u,function(t){return Number(t.AttributeId)===n.Id}),o=c.length>0),e='<div class = "',t?e+=' childItem " parentId="'+f+'" >':n.ChildAtrributeslookupdetails!==null?(e+=' parentItem" pid="'+n.Id+'" style = "border-style: ridge;border:1px solid #50afe4;" >',e+='<i class="fa fa-minus expandParent',e+=o?' parentchecked "':'"',e+='   title="Collapse All" style="float:right;margin-right:5%;margin-top:6px;color:#0183c1" ><\/i > '):e+=' "  style ="padding-left:10px!important;" >',e+='<input id="attchkdesc_'+n.Id+'" class="chkefaultselect_'+n.SasDataEleId,e+=n.IsDefault?' defaultDisable " ':' defaultNotDisable " ',n.ChildAtrributeslookupdetails!==null&&(e+=' data-isparent="true" '),o&&(e+=" checked "),t&&(e+=' data-attributeparentId="'+f+'"'),e+=' type = "checkbox"  data-SasDataEleId="'+n.SasDataEleId+'" data-Id="'+n.Id+'" data-code="'+n.code+'"',e+=' onclick = "SetCheckboxAttributesData(this,'+n.Id+","+n.code+","+n.SasDataEleId+')" />',e+=' <\/span ><label class="expandParentText" style="font-weight:normal;display:inline;" for="attchkdesc_'+n.Id+'" id="selattridesc_'+n.Id+'">'+n.Defintion+"<\/label>   <br /><\/div >",$.each(n.ChildAtrributeslookupdetails,function(t,f){e+=attributes.bindCheckBox(f,!0,i,r,u,n.Id)}),e},n.bindRadioButton=function(n,t,i,r){var u='<div class="col-md - 12 ';return u+=t?' childItem ">':' parentItem">',u+='<input id="radiobuttonid_'+n.Id+'" name="radioButton_'+n.SasDataEleId+'" class="radiodefaultselect_'+n.SasDataEleId,u+=t?"   ":' parentItemCheck " ',u+=n.IsDefault?' defaultDisable " ':' defaultNotDisable " ',u+=' type = "radio"  data-SasDataEleId="'+n.SasDataEleId+'" data-Id="'+n.Id+'" data-code="'+n.code+'"',u+=' onclick = "SetRadioButtonAttributesData(this,'+n.Id+","+n.code+","+n.SasDataEleId+')" onload="SetRadioButtonAttributesData(this,'+n.Id+","+n.code+","+n.SasDataEleId+')"/>',u+=' <\/span ><label style="font-weight:normal;display:inline;" for="radiobuttonid_'+n.Id+'" id="selattridesc_'+n.Id+'">'+n.Defintion+"<\/label> <\/div >",$.each(n.ChildAtrributeslookupdetails,function(n,t){u+=attributes.bindRadioButton(t,!0,r)}),u},n}();timeframe=function(){var n={AppTableConfig:{},timeframeUrl:"AppConfig/GetXYTableConfig",yearCtrl:$("#years-range"),scaleSliderCtrl:$("#scale-slider")},t=4;return n.init=function(){},n.setAppTableConfig=function(n){timeframe.AppTableConfig=n},n.getAppTableConfig=function(){return timeframe.AppTableConfig},n.BeginYear=function(){return timeframe.AppTableConfig.BeginYear&&timeframe.AppTableConfig.BeginYear!==null&&timeframe.AppTableConfig.BeginYear!==""?parseInt(timeframe.AppTableConfig.BeginYear):2e3},n.EndYear=function(){return timeframe.AppTableConfig.EndYear&&timeframe.AppTableConfig.EndYear!==null&&timeframe.AppTableConfig.EndYear!==""?parseInt(timeframe.AppTableConfig.EndYear):2099},n.getData=function(n,t){common.ajaxGet(timeframe.timeframeUrl,function(t){n(t)},t)},n.geSelectedData=function(){var n="",f=$(".timeframetab a.active").html(),t,i,u,r;if(f==="Years"){if(n=[],inputData.TimeFrameType="Y",t=$("#years-range option:selected"),t.length>0){for(i=0;i<t.length-1;i++)n.push(t[i].text);n.push(t[t.length-1].text)}}else for(n="",inputData.TimeFrameType="S",u=$("#scale-slider").slider("values"),r=u[0];r<=u[1];r++)n=n+r+",";return n},n.bindTimeFrameYears=function(){for(var n=timeframe.BeginYear();n<=timeframe.EndYear();n++)timeframe.yearCtrl.append($("<option>",{value:n,text:n}))},n.scaleSliderCtrlOnChange=function(n,t){for(var i="",u,r=t.values[0];r<t.values[1];r++)i=i+r+",";i=i+t.values[1];inputData.YearsData=i;inputData.TimeFrameType="S";u="";u=t.values[0]===t.values[1]?"Years: "+t.values[0]:"Years: "+(t.values[0]+"-"+t.values[1]);criteriaSection.setTimeFrame(u)},n.setTimeFrame=function(){if(timeframe.bindTimeFrameYears(),criteriaSection.setTimeFrame("Years: "+(parseInt(timeframe.EndYear())-4)+"-"+parseInt(timeframe.EndYear())),timeframe.scaleSliderCtrl.slider({range:!0,min:timeframe.BeginYear(),max:timeframe.EndYear(),values:[defaultYears.min>0&&defaultYears.timeFrameType==="S"?defaultYears.min:parseInt(timeframe.EndYear())-t,defaultYears.max>0&&defaultYears.timeFrameType==="S"?defaultYears.max:parseInt(timeframe.EndYear())],change:timeframe.scaleSliderCtrlOnChange}).slider("pips",{rest:"label"}).slider("float",{handle:!0}),defaultYears.min>0&&defaultYears.max>0)for(var n=defaultYears.min;n<=defaultYears.max;n++)$("#years-range option[value='"+n+"']").prop("selected",!0)},n.setSlider=function(n){var o,i,c,r,e,u,s,f,h;for($("#divTimeFrame").show(),o=[],i=AppTableConfig.EndYear;i>=AppTableConfig.BeginYear;i--)$("#years-range").append($("<option>",{value:i,text:i}));if(o.sort(function(n,t){return(n>t)-(n<t)}),c="Years: "+(parseInt(AppTableConfig.EndYear)-t)+"-"+parseInt(AppTableConfig.EndYear),$("#partimeframe").attr("data-years","Years: "+(parseInt(AppTableConfig.EndYear)-t)+"-"+parseInt(AppTableConfig.EndYear)),$("#partimeframe").html("Years: "+(parseInt(AppTableConfig.EndYear)-t)+"-"+parseInt(AppTableConfig.EndYear)),$(".timeFrameClass").show(),r=parseInt(AppTableConfig.EndYear)-t,r=defaultYears.min>0&&defaultYears.timeFrameType=="S"?n||r:parseInt(AppTableConfig.EndYear)-t,e=defaultYears.max>0&&defaultYears.timeFrameType=="S"?defaultYears.max:parseInt(AppTableConfig.EndYear),jsonObject.CrashYear&&jsonObject.CrashYear.length>0&&(u=Array.isArray(jsonObject.CrashYear)?jsonObject.CrashYear:jsonObject.CrashYear.split(","),r=u[0],u.length>0&&(s=u.length,e=u[s-2])),$("#scale-slider").slider({range:!0,min:AppTableConfig.BeginYear,max:AppTableConfig.EndYear,values:[r,e],change:function(n,t){var i="",r;for(t.values[0]<2010?($(".divmetrictypesgeography_PreCrash,.area_PreCrash").hide(),$("#divmetrictypesgeography_PreCrash").hide()):($(".collapse_PreCrash,.area_PreCrash").show(),$("#divmetrictypesgeography_PreCrash").show()),r=t.values[0];r<t.values[1];r++)i=i+r+",";i=i+t.values[1];inputData.YearsData=i;inputData.TimeFrameType="S";t.values[0]==t.values[1]?($("#partimeframe").html("Years: "+t.values[0]),$("#partimeframe").attr("data-years","Years: "+t.values[0])):($("#partimeframe").html("Years: "+(t.values[0]+"-"+t.values[1])),$("#partimeframe").attr("data-years","Years: "+(t.values[0]+"-"+t.values[1])));$(".timeFrameClass").show()}}).slider("pips",{rest:"label"}).slider("float",{handle:!0}),defaultYears.max>0&&defaultYears.min>0)for(f=defaultYears.max;f<=defaultYears.min;f++)$("#years-range option[value='"+f+"']").prop("selected",!0);jsonObject.CrashYear&&jsonObject.CrashYear.length>0&&(h=Array.isArray(jsonObject.CrashYear)?jsonObject.CrashYear:jsonObject.CrashYear.split(","),$("#years-range option").prop("selected",!1),$.each(h,function(n,t){$("#years-range option[value='"+t.trim()+"']").prop("selected",!0)}))},n.GetXyTableConfig=function(){var n=function(n){var i,r;n!==undefined&&n!==null&&(AppTableConfig=n,i=parseInt(AppTableConfig.EndYear),$("#partimeframe").html(i-t+"-"+i),$(".timeFrameClass").show(),$("#xConfigspan").html(n.XTableMax),$("#yConfigspan").html(n.YTableMax),$("#divannouncment").html(n.AnonouncementMessage),Object.keys(jsonObject).length>0?(r=$(".topicInfo_"+jsonObject.topic_num),r.attr("fromClick","retrive"),r.click()):$(".topiclinks:first").click(),jsonObject.TimeFrameType==="Y"?(jsonObject.CrashYear&&$("#partimeframe").html("Years: "+jsonObject.CrashYear.sort().join(", ")),$("#partimeframe").attr("data-years","Years: "+jsonObject.CrashYear.sort().join(", ")),common.showPanel("collapseThree")):jsonObject.TimeFrameType!=="S"&&jsonObject.TimeFrameType!==undefined&&common.setinvalidMsgCount())},i=function(){console.log("error");alert("System Error Occurred (0410). Please Email NCSARequests@dot.gov")};common.ajaxGet("AppConfig/GetXYTableConfig",n,i)},n.bindTableData=function(n){$("#xConfigspan").html(n.XTableMax);$("#yConfigspan").html(n.YTableMax);$("#divannouncment").html(n.AnonouncementMessage)},n.changeYears=function(){for(var i=$("#years-range option:selected"),n=[],t=0;t<i.length;t++)n.push(i[t].text);$("#partimeframe").html("Years: "+n.sort().join(", "));$("#partimeframe").removeAttr("data-years");$("#partimeframe").attr("data-years","Years: "+n.sort().join(", "));$(".timeFrameClass").show();inputData.YearsData=n;inputData.TimeFrameType="Y"},n}();!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),n(i),i}:n(jQuery)}(function(n){var t=function(){function u(n,t){return d.call(n,t)}function l(n,t){var e,o,s,f,h,y,c,p,i,l,b,u=t&&t.split("/"),a=r.map,v=a&&a["*"]||{};if(n){for(h=(n=n.split("/")).length-1,r.nodeIdCompat&&w.test(n[h])&&(n[h]=n[h].replace(w,"")),"."===n[0].charAt(0)&&u&&(n=u.slice(0,u.length-1).concat(n)),i=0;i<n.length;i++)if("."===(b=n[i]))n.splice(i,1),i-=1;else if(".."===b){if(0===i||1===i&&".."===n[2]||".."===n[i-1])continue;0<i&&(n.splice(i-1,2),i-=2)}n=n.join("/")}if((u||v)&&a){for(i=(e=n.split("/")).length;0<i;i-=1){if(o=e.slice(0,i).join("/"),u)for(l=u.length;0<l;l-=1)if(s=(s=a[u.slice(0,l).join("/")])&&s[o]){f=s;y=i;break}if(f)break;!c&&v&&v[o]&&(c=v[o],p=i)}!f&&c&&(f=c,y=p);f&&(e.splice(0,y,f),n=e.join("/"))}return n}function nt(n,t){return function(){var i=g.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),o.apply(f,i.concat([n,t]))}}function it(n){return function(t){i[n]=t}}function a(n){if(u(e,n)){var t=e[n];delete e[n];c[n]=!0;h.apply(f,t)}if(!u(i,n)&&!u(c,n))throw new Error("No "+n);return i[n]}function b(n){var i,t=n?n.indexOf("!"):-1;return-1<t&&(i=n.substring(0,t),n=n.substring(t+1,n.length)),[i,n]}function tt(n){return n?b(n):[]}var t,v,y,k,f,h,o,p,s,i,e,r,c,d,g,w;return n&&n.fn&&n.fn.select2&&n.fn.select2.amd&&(t=n.fn.select2.amd),t&&t.requirejs||(t?y=t:t={},i={},e={},r={},c={},d=Object.prototype.hasOwnProperty,g=[].slice,w=/\.js$/,p=function(n,t){var r,u=b(n),i=u[0],f=t[1];return n=u[1],i&&(r=a(i=l(i,f))),i?n=r&&r.normalize?r.normalize(n,function(n){return function(t){return l(t,n)}}(f)):l(n,f):(i=(u=b(n=l(n,f)))[0],n=u[1],i&&(r=a(i))),{f:i?i+"!"+n:n,n:n,pr:i,p:r}},s={require:function(n){return nt(n)},exports:function(n){var t=i[n];return void 0!==t?t:i[n]={}},module:function(n){return{id:n,uri:"",exports:i[n],config:function(n){return function(){return r&&r.config&&r.config[n]||{}}}(n)}}},h=function(n,t,r,o){var y,h,b,w,l,k,d,v=[],g=typeof r;if(k=tt(o=o||n),"undefined"==g||"function"==g){for(t=!t.length&&r.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(h=(w=p(t[l],k)).f))v[l]=s.require(n);else if("exports"===h)v[l]=s.exports(n),d=!0;else if("module"===h)y=v[l]=s.module(n);else if(u(i,h)||u(e,h)||u(c,h))v[l]=a(h);else{if(!w.p)throw new Error(n+" missing "+h);w.p.load(w.n,nt(o,!0),it(h),{});v[l]=i[h]}b=r?r.apply(i[n],v):void 0;n&&(y&&y.exports!==f&&y.exports!==i[n]?i[n]=y.exports:b===f&&d||(i[n]=b))}else n&&(i[n]=r)},v=y=o=function(n,t,i,u,e){if("string"==typeof n)return s[n]?s[n](t):a(p(n,tt(t)).f);if(!n.splice){if((r=n).deps&&o(r.deps,r.callback),!t)return;t.splice?(n=t,t=i,i=null):n=f}return t=t||function(){},"function"==typeof i&&(i=u,u=e),u?h(f,n,t,i):setTimeout(function(){h(f,n,t,i)},4),o},o.config=function(n){return o(n)},v._defined=i,(k=function(n,t,r){if("string"!=typeof n)throw new Error("See almond README: incorrect module build, no module name");t.splice||(r=t,t=[]);u(i,n)||u(e,n)||(e[n]=[n,t,r])}).amd={jQuery:!0},t.requirejs=v,t.require=y,t.define=k),t.define("almond",function(){}),t.define("jquery",[],function(){var t=n||$;return null==t&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),t}),t.define("select2/utils",["jquery"],function(n){function u(n){var i=n.prototype,r=[],t;for(t in i)"function"==typeof i[t]&&"constructor"!==t&&r.push(t);return r}function i(){this.listeners={}}var t={},r;return t.Extend=function(n,t){function r(){this.constructor=n}var u={}.hasOwnProperty,i;for(i in t)u.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.__super__=t.prototype,n},t.Decorate=function(n,t){function i(){var r=Array.prototype.unshift,u=t.prototype.constructor.length,i=n.prototype.constructor;0<u&&(r.call(arguments,n.prototype.constructor),i=t.prototype.constructor);i.apply(this,arguments)}function c(n){var r=function(){},u;return n in i.prototype&&(r=i.prototype[n]),u=t.prototype[n],function(){return Array.prototype.unshift.call(arguments,r),u.apply(this,arguments)}}var s=u(t),h=u(n),r,e,f,o;for(t.displayName=n.displayName,i.prototype=new function(){this.constructor=i},r=0;r<h.length;r++)e=h[r],i.prototype[e]=n.prototype[e];for(f=0;f<s.length;f++)o=s[f],i.prototype[o]=c(o);return i},i.prototype.on=function(n,t){this.listeners=this.listeners||{};n in this.listeners?this.listeners[n].push(t):this.listeners[n]=[t]},i.prototype.trigger=function(n){var i=Array.prototype.slice,t=i.call(arguments,1);this.listeners=this.listeners||{};null==t&&(t=[]);0===t.length&&t.push({});(t[0]._type=n)in this.listeners&&this.invoke(this.listeners[n],i.call(arguments,1));"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},i.prototype.invoke=function(n,t){for(var i=0,r=n.length;i<r;i++)n[i].apply(this,t)},t.Observable=i,t.generateChars=function(n){for(var t="",i=0;i<n;i++)t+=Math.floor(36*Math.random()).toString(36);return t},t.bind=function(n,t){return function(){n.apply(t,arguments)}},t._convertData=function(n){var f,r,i,u,t;for(f in n)if(r=f.split("-"),i=n,1!==r.length){for(u=0;u<r.length;u++)t=r[u],(t=t.substring(0,1).toLowerCase()+t.substring(1))in i||(i[t]={}),u==r.length-1&&(i[t]=n[f]),i=i[t];delete n[f]}return n},t.hasScroll=function(t,i){var u=n(i),f=i.style.overflowX,r=i.style.overflowY;return(f!==r||"hidden"!==r&&"visible"!==r)&&("scroll"===f||"scroll"===r||u.innerHeight()<i.scrollHeight||u.innerWidth()<i.scrollWidth)},t.escapeMarkup=function(n){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof n?n:String(n).replace(/[&<>"'\/\\]/g,function(n){return t[n]})},t.appendMany=function(t,i){if("1.7"===n.fn.jquery.substr(0,3)){var r=n();n.map(i,function(n){r=r.add(n)});i=r}t.append(i)},t.__cache={},r=0,t.GetUniqueElementId=function(n){var t=n.getAttribute("data-select2-id");return null==t&&(n.id?(t=n.id,n.setAttribute("data-select2-id",t)):(n.setAttribute("data-select2-id",++r),t=r.toString())),t},t.StoreData=function(n,i,r){var u=t.GetUniqueElementId(n);t.__cache[u]||(t.__cache[u]={});t.__cache[u][i]=r},t.GetData=function(i,r){var u=t.GetUniqueElementId(i);return r?t.__cache[u]&&null!=t.__cache[u][r]?t.__cache[u][r]:n(i).data(r):t.__cache[u]},t.RemoveData=function(n){var i=t.GetUniqueElementId(n);null!=t.__cache[i]&&delete t.__cache[i];n.removeAttribute("data-select2-id")},t}),t.define("select2/results",["jquery","./utils"],function(n,t){function i(n,t,r){this.$element=n;this.data=r;this.options=t;i.__super__.constructor.call(this)}return t.Extend(i,t.Observable),i.prototype.render=function(){var t=n('<ul class="select2-results__options" role="listbox"><\/ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(t){var u=this.options.get("escapeMarkup"),i,r;this.clear();this.hideLoading();i=n('<li role="alert" aria-live="assertive" class="select2-results__option"><\/li>');r=this.options.get("translations").get(t.message);i.append(u(r(t.args)));i[0].className+=" select2-results__message";this.$results.append(i)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(n){var i,t,r,u;if(this.hideLoading(),i=[],null!=n.results&&0!==n.results.length){for(n.results=this.sort(n.results),t=0;t<n.results.length;t++)r=n.results[t],u=this.option(r),i.push(u);this.$results.append(i)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},i.prototype.position=function(n,t){t.find(".select2-results").append(n)},i.prototype.sort=function(n){return this.options.get("sorter")(n)},i.prototype.highlightFirstItem=function(){var n=this.$results.find(".select2-results__option[aria-selected]"),t=n.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):n.first().trigger("mouseenter");this.ensureHighlightVisible()},i.prototype.setClasses=function(){var i=this;this.data.current(function(r){var u=n.map(r,function(n){return n.id.toString()});i.$results.find(".select2-results__option[aria-selected]").each(function(){var r=n(this),i=t.GetData(this,"data"),f=""+i.id;null!=i.element&&i.element.selected||null==i.element&&-1<n.inArray(f,u)?r.attr("aria-selected","true"):r.attr("aria-selected","false")})})},i.prototype.showLoading=function(n){this.hideLoading();var i={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(n)},t=this.option(i);t.className+=" loading-results";this.$results.prepend(t)},i.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},i.prototype.option=function(i){var u=document.createElement("li"),r,l,o,a,s,f,h,e,v,y,c;u.className="select2-results__option";r={role:"option","aria-selected":"false"};l=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(o in(null!=i.element&&l.call(i.element,":disabled")||null==i.element&&i.disabled)&&(delete r["aria-selected"],r["aria-disabled"]="true"),null==i.id&&delete r["aria-selected"],null!=i._resultId&&(u.id=i._resultId),i.title&&(u.title=i.title),i.children&&(r.role="group",r["aria-label"]=i.text,delete r["aria-selected"]),r)a=r[o],u.setAttribute(o,a);if(i.children){for(s=n(u),f=document.createElement("strong"),f.className="select2-results__group",n(f),this.template(i,f),h=[],e=0;e<i.children.length;e++)v=i.children[e],y=this.option(v),h.push(y);c=n("<ul><\/ul>",{"class":"select2-results__options select2-results__options--nested"});c.append(h);s.append(f);s.append(c)}else this.template(i,u);return t.StoreData(u,"data",i),u},i.prototype.bind=function(i){var r=this,u=i.id+"-results";this.$results.attr("id",u);i.on("results:all",function(n){r.clear();r.append(n.data);i.isOpen()&&(r.setClasses(),r.highlightFirstItem())});i.on("results:append",function(n){r.append(n.data);i.isOpen()&&r.setClasses()});i.on("query",function(n){r.hideMessages();r.showLoading(n)});i.on("select",function(){i.isOpen()&&(r.setClasses(),r.options.get("scrollAfterSelect")&&r.highlightFirstItem())});i.on("unselect",function(){i.isOpen()&&(r.setClasses(),r.options.get("scrollAfterSelect")&&r.highlightFirstItem())});i.on("open",function(){r.$results.attr("aria-expanded","true");r.$results.attr("aria-hidden","false");r.setClasses();r.ensureHighlightVisible()});i.on("close",function(){r.$results.attr("aria-expanded","false");r.$results.attr("aria-hidden","true");r.$results.removeAttr("aria-activedescendant")});i.on("results:toggle",function(){var n=r.getHighlightedResults();0!==n.length&&n.trigger("mouseup")});i.on("results:select",function(){var n=r.getHighlightedResults(),i;0!==n.length&&(i=t.GetData(n[0],"data"),"true"==n.attr("aria-selected")?r.trigger("close",{}):r.trigger("select",{data:i}))});i.on("results:previous",function(){var i=r.getHighlightedResults(),u=r.$results.find("[aria-selected]"),f=u.index(i),n,t;if(!(f<=0)){n=f-1;0===i.length&&(n=0);t=u.eq(n);t.trigger("mouseenter");var e=r.$results.offset().top,o=t.offset().top,s=r.$results.scrollTop()+(o-e);0===n?r.$results.scrollTop(0):o-e<0&&r.$results.scrollTop(s)}});i.on("results:next",function(){var e=r.getHighlightedResults(),t=r.$results.find("[aria-selected]"),i=t.index(e)+1,n;if(!(i>=t.length)){n=t.eq(i);n.trigger("mouseenter");var u=r.$results.offset().top+r.$results.outerHeight(!1),f=n.offset().top+n.outerHeight(!1),o=r.$results.scrollTop()+f-u;0===i?r.$results.scrollTop(0):u<f&&r.$results.scrollTop(o)}});i.on("results:focus",function(n){n.element.addClass("select2-results__option--highlighted")});i.on("results:message",function(n){r.displayMessage(n)});n.fn.mousewheel&&this.$results.on("mousewheel",function(n){var t=r.$results.scrollTop(),i=r.$results.get(0).scrollHeight-t+n.deltaY,u=0<n.deltaY&&t-n.deltaY<=0,f=n.deltaY<0&&i<=r.$results.height();u?(r.$results.scrollTop(0),n.preventDefault(),n.stopPropagation()):f&&(r.$results.scrollTop(r.$results.get(0).scrollHeight-r.$results.height()),n.preventDefault(),n.stopPropagation())});this.$results.on("mouseup",".select2-results__option[aria-selected]",function(i){var f=n(this),u=t.GetData(this,"data");"true"!==f.attr("aria-selected")?r.trigger("select",{originalEvent:i,data:u}):r.options.get("multiple")?r.trigger("unselect",{originalEvent:i,data:u}):r.trigger("close",{})});this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(){var i=t.GetData(this,"data");r.getHighlightedResults().removeClass("select2-results__option--highlighted");r.trigger("results:focus",{data:i,element:n(this)})})},i.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},i.prototype.destroy=function(){this.$results.remove()},i.prototype.ensureHighlightVisible=function(){var n=this.getHighlightedResults();if(0!==n.length){var f=this.$results.find("[aria-selected]").index(n),t=this.$results.offset().top,i=n.offset().top,r=this.$results.scrollTop()+(i-t),u=i-t;r-=2*n.outerHeight(!1);f<=2?this.$results.scrollTop(0):(u>this.$results.outerHeight()||u<0)&&this.$results.scrollTop(r)}},i.prototype.template=function(t,i){var u=this.options.get("templateResult"),f=this.options.get("escapeMarkup"),r=u(t,i);null==r?i.style.display="none":"string"==typeof r?i.innerHTML=f(r):n(i).append(r)},i}),t.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),t.define("select2/selection/base",["jquery","../utils","../keys"],function(n,t,i){function r(n,t){this.$element=n;this.options=t;r.__super__.constructor.call(this)}return t.Extend(r,t.Observable),r.prototype.render=function(){var i=n('<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"><\/span>');return this._tabindex=0,null!=t.GetData(this.$element[0],"old-tabindex")?this._tabindex=t.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),i.attr("title",this.$element.attr("title")),i.attr("tabindex",this._tabindex),i.attr("aria-disabled","false"),this.$selection=i},r.prototype.bind=function(n){var t=this,r=n.id+"-results";this.container=n;this.$selection.on("focus",function(n){t.trigger("focus",n)});this.$selection.on("blur",function(n){t._handleBlur(n)});this.$selection.on("keydown",function(n){t.trigger("keypress",n);n.which===i.SPACE&&n.preventDefault()});n.on("results:focus",function(n){t.$selection.attr("aria-activedescendant",n.data._resultId)});n.on("selection:update",function(n){t.update(n.data)});n.on("open",function(){t.$selection.attr("aria-expanded","true");t.$selection.attr("aria-owns",r);t._attachCloseHandler(n)});n.on("close",function(){t.$selection.attr("aria-expanded","false");t.$selection.removeAttr("aria-activedescendant");t.$selection.removeAttr("aria-owns");t.$selection.trigger("focus");t._detachCloseHandler(n)});n.on("enable",function(){t.$selection.attr("tabindex",t._tabindex);t.$selection.attr("aria-disabled","false")});n.on("disable",function(){t.$selection.attr("tabindex","-1");t.$selection.attr("aria-disabled","true")})},r.prototype._handleBlur=function(t){var i=this;window.setTimeout(function(){document.activeElement==i.$selection[0]||n.contains(i.$selection[0],document.activeElement)||i.trigger("blur",t)},1)},r.prototype._attachCloseHandler=function(i){n(document.body).on("mousedown.select2."+i.id,function(i){var r=n(i.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=r[0]&&t.GetData(this,"element").select2("close")})})},r.prototype._detachCloseHandler=function(t){n(document.body).off("mousedown.select2."+t.id)},r.prototype.position=function(n,t){t.find(".selection").append(n)},r.prototype.destroy=function(){this._detachCloseHandler(this.container)},r.prototype.update=function(){throw new Error("The `update` method must be defined in child classes.");},r}),t.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(n,t,i){function r(){r.__super__.constructor.apply(this,arguments)}return i.Extend(r,t),r.prototype.render=function(){var n=r.__super__.render.call(this);return n.addClass("select2-selection--single"),n.html('<span class="select2-selection__rendered"><\/span><span class="select2-selection__arrow" role="presentation"><b role="presentation"><\/b><\/span>'),n},r.prototype.bind=function(n){var i=this,t;r.__super__.bind.apply(this,arguments);t=n.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",t).attr("role","textbox").attr("aria-readonly","true");this.$selection.attr("aria-labelledby",t);this.$selection.on("mousedown",function(n){1===n.which&&i.trigger("toggle",{originalEvent:n})});this.$selection.on("focus",function(){});this.$selection.on("blur",function(){});n.on("focus",function(){n.isOpen()||i.$selection.trigger("focus")})},r.prototype.clear=function(){var n=this.$selection.find(".select2-selection__rendered");n.empty();n.removeAttr("title")},r.prototype.display=function(n,t){var i=this.options.get("templateSelection");return this.options.get("escapeMarkup")(i(n,t))},r.prototype.selectionContainer=function(){return n("<span><\/span>")},r.prototype.update=function(n){var r;if(0!==n.length){var i=n[0],t=this.$selection.find(".select2-selection__rendered"),u=this.display(i,t);t.empty().append(u);r=i.title||i.text;r?t.attr("title",r):t.removeAttr("title")}else this.clear()},r}),t.define("select2/selection/multiple",["jquery","./base","../utils"],function(n,t,i){function r(){r.__super__.constructor.apply(this,arguments)}return i.Extend(r,t),r.prototype.render=function(){var n=r.__super__.render.call(this);return n.addClass("select2-selection--multiple"),n.html('<ul class="select2-selection__rendered"><\/ul>'),n},r.prototype.bind=function(){var t=this;r.__super__.bind.apply(this,arguments);this.$selection.on("click",function(n){t.trigger("toggle",{originalEvent:n})});this.$selection.on("click",".select2-selection__choice__remove",function(r){if(!t.options.get("disabled")){var u=n(this).parent(),f=i.GetData(u[0],"data");t.trigger("unselect",{originalEvent:r,data:f})}})},r.prototype.clear=function(){var n=this.$selection.find(".select2-selection__rendered");n.empty();n.removeAttr("title")},r.prototype.display=function(n,t){var i=this.options.get("templateSelection");return this.options.get("escapeMarkup")(i(n,t))},r.prototype.selectionContainer=function(){return n('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;<\/span><\/li>')},r.prototype.update=function(n){var f,r,e,o;if(this.clear(),0!==n.length){for(f=[],r=0;r<n.length;r++){var u=n[r],t=this.selectionContainer(),s=this.display(u,t);t.append(s);e=u.title||u.text;e&&t.attr("title",e);i.StoreData(t[0],"data",u);f.push(t)}o=this.$selection.find(".select2-selection__rendered");i.appendMany(o,f)}},r}),t.define("select2/selection/placeholder",["../utils"],function(){function n(n,t,i){this.placeholder=this.normalizePlaceholder(i.get("placeholder"));n.call(this,t,i)}return n.prototype.normalizePlaceholder=function(n,t){return"string"==typeof t&&(t={id:"",text:t}),t},n.prototype.createPlaceholder=function(n,t){var i=this.selectionContainer();return i.html(this.display(t)),i.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),i},n.prototype.update=function(n,t){var r=1==t.length&&t[0].id!=this.placeholder.id,i;if(1<t.length||r)return n.call(this,t);this.clear();i=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(i)},n}),t.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(n,t,i){function r(){}return r.prototype.bind=function(n,t,i){var r=this;n.call(this,t,i);null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option.");this.$selection.on("mousedown",".select2-selection__clear",function(n){r._handleClear(n)});t.on("keypress",function(n){r._handleKeyboardClear(n,t)})},r.prototype._handleClear=function(n,t){var e,u,o,r,f;if(!this.options.get("disabled")&&(e=this.$selection.find(".select2-selection__clear"),0!==e.length))if(t.stopPropagation(),u=i.GetData(e[0],"data"),o=this.$element.val(),this.$element.val(this.placeholder.id),r={data:u},this.trigger("clear",r),r.prevented)this.$element.val(o);else{for(f=0;f<u.length;f++)if(r={data:u[f]},this.trigger("unselect",r),r.prevented)return void this.$element.val(o);this.$element.trigger("change");this.trigger("toggle",{})}},r.prototype._handleKeyboardClear=function(n,i,r){r.isOpen()||i.which!=t.DELETE&&i.which!=t.BACKSPACE||this._handleClear(i)},r.prototype.update=function(t,r){if(t.call(this,r),!(0<this.$selection.find(".select2-selection__placeholder").length||0===r.length)){var f=this.options.get("translations").get("removeAllItems"),u=n('<span class="select2-selection__clear" title="'+f()+'">&times;<\/span>');i.StoreData(u[0],"data",r);this.$selection.find(".select2-selection__rendered").prepend(u)}},r}),t.define("select2/selection/search",["jquery","../utils","../keys"],function(n,t,i){function r(n,t,i){n.call(this,t,i)}return r.prototype.render=function(t){var i=n('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /><\/li>'),r;return this.$searchContainer=i,this.$search=i.find("input"),r=t.call(this),this._transferTabIndex(),r},r.prototype.bind=function(n,r,u){var f=this,s=r.id+"-results",e,o;n.call(this,r,u);r.on("open",function(){f.$search.attr("aria-controls",s);f.$search.trigger("focus")});r.on("close",function(){f.$search.val("");f.$search.removeAttr("aria-controls");f.$search.removeAttr("aria-activedescendant");f.$search.trigger("focus")});r.on("enable",function(){f.$search.prop("disabled",!1);f._transferTabIndex()});r.on("disable",function(){f.$search.prop("disabled",!0)});r.on("focus",function(){f.$search.trigger("focus")});r.on("results:focus",function(n){n.data._resultId?f.$search.attr("aria-activedescendant",n.data._resultId):f.$search.removeAttr("aria-activedescendant")});this.$selection.on("focusin",".select2-search--inline",function(n){f.trigger("focus",n)});this.$selection.on("focusout",".select2-search--inline",function(n){f._handleBlur(n)});this.$selection.on("keydown",".select2-search--inline",function(n){var r,u;(n.stopPropagation(),f.trigger("keypress",n),f._keyUpPrevented=n.isDefaultPrevented(),n.which===i.BACKSPACE&&""===f.$search.val())&&(r=f.$searchContainer.prev(".select2-selection__choice"),0<r.length&&(u=t.GetData(r[0],"data"),f.searchRemoveChoice(u),n.preventDefault()))});this.$selection.on("click",".select2-search--inline",function(n){f.$search.val()&&n.stopPropagation()});e=document.documentMode;o=e&&e<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(){o?f.$selection.off("input.search input.searchcheck"):f.$selection.off("keyup.search")});this.$selection.on("keyup.search input.search",".select2-search--inline",function(n){if(o&&"input"===n.type)f.$selection.off("input.search input.searchcheck");else{var t=n.which;t!=i.SHIFT&&t!=i.CTRL&&t!=i.ALT&&t!=i.TAB&&f.handleSearch(n)}})},r.prototype._transferTabIndex=function(){this.$search.attr("tabindex",this.$selection.attr("tabindex"));this.$selection.attr("tabindex","-1")},r.prototype.createPlaceholder=function(n,t){this.$search.attr("placeholder",t.text)},r.prototype.update=function(n,t){var i=this.$search[0]==document.activeElement;this.$search.attr("placeholder","");n.call(this,t);this.$selection.find(".select2-selection__rendered").append(this.$searchContainer);this.resizeSearch();i&&this.$search.trigger("focus")},r.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var n=this.$search.val();this.trigger("query",{term:n})}this._keyUpPrevented=!1},r.prototype.searchRemoveChoice=function(n,t){this.trigger("unselect",{data:t});this.$search.val(t.text);this.handleSearch()},r.prototype.resizeSearch=function(){this.$search.css("width","25px");var n="";n=""!==this.$search.attr("placeholder")?this.$selection.find(".select2-selection__rendered").width():.75*(this.$search.val().length+1)+"em";this.$search.css("width",n)},r}),t.define("select2/selection/eventRelay",["jquery"],function(n){function t(){}return t.prototype.bind=function(t,i,r){var u=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],e=["opening","closing","selecting","unselecting","clearing"];t.call(this,i,r);i.on("*",function(t,i){if(-1!==n.inArray(t,f)){i=i||{};var r=n.Event("select2:"+t,{params:i});u.$element.trigger(r);-1!==n.inArray(t,e)&&(i.prevented=r.isDefaultPrevented())}})},t}),t.define("select2/translation",["jquery","require"],function(n,t){function i(n){this.dict=n||{}}return i.prototype.all=function(){return this.dict},i.prototype.get=function(n){return this.dict[n]},i.prototype.extend=function(t){this.dict=n.extend({},t.all(),this.dict)},i._cache={},i.loadPath=function(n){if(!(n in i._cache)){var r=t(n);i._cache[n]=r}return new i(i._cache[n])},i}),t.define("select2/diacritics",[],function(){return{"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),t.define("select2/data/base",["../utils"],function(n){function t(){t.__super__.constructor.call(this)}return n.Extend(t,n.Observable),t.prototype.current=function(){throw new Error("The `current` method must be defined in child classes.");},t.prototype.query=function(){throw new Error("The `query` method must be defined in child classes.");},t.prototype.bind=function(){},t.prototype.destroy=function(){},t.prototype.generateResultId=function(t,i){var r=t.id+"-result-";return r+=n.generateChars(4),r+=null!=i.id?"-"+i.id.toString():"-"+n.generateChars(4),r},t}),t.define("select2/data/select",["./base","../utils","jquery"],function(n,t,i){function r(n,t){this.$element=n;this.options=t;r.__super__.constructor.call(this)}return t.Extend(r,n),r.prototype.current=function(n){var t=[],r=this;this.$element.find(":selected").each(function(){var n=i(this),u=r.item(n);t.push(u)});n(t)},r.prototype.select=function(n){var t=this,r;if(n.selected=!0,i(n.element).is("option"))return n.element.selected=!0,void this.$element.trigger("change");this.$element.prop("multiple")?this.current(function(r){var f=[],u,e;for((n=[n]).push.apply(n,r),u=0;u<n.length;u++)e=n[u].id,-1===i.inArray(e,f)&&f.push(e);t.$element.val(f);t.$element.trigger("change")}):(r=n.id,this.$element.val(r),this.$element.trigger("change"))},r.prototype.unselect=function(n){var t=this;if(this.$element.prop("multiple")){if(n.selected=!1,i(n.element).is("option"))return n.element.selected=!1,void this.$element.trigger("change");this.current(function(r){for(var e,u=[],f=0;f<r.length;f++)e=r[f].id,e!==n.id&&-1===i.inArray(e,u)&&u.push(e);t.$element.val(u);t.$element.trigger("change")})}},r.prototype.bind=function(n){var t=this;(this.container=n).on("select",function(n){t.select(n.data)});n.on("unselect",function(n){t.unselect(n.data)})},r.prototype.destroy=function(){this.$element.find("*").each(function(){t.RemoveData(this)})},r.prototype.query=function(n,t){var r=[],u=this;this.$element.children().each(function(){var t=i(this),e,f;(t.is("option")||t.is("optgroup"))&&(e=u.item(t),f=u.matches(n,e),null!==f&&r.push(f))});t({results:r})},r.prototype.addOptions=function(n){t.appendMany(this.$element,n)},r.prototype.option=function(n){var r,f,u;return n.children?(r=document.createElement("optgroup")).label=n.text:void 0!==(r=document.createElement("option")).textContent?r.textContent=n.text:r.innerText=n.text,void 0!==n.id&&(r.value=n.id),n.disabled&&(r.disabled=!0),n.selected&&(r.selected=!0),n.title&&(r.title=n.title),f=i(r),u=this._normalizeItem(n),u.element=r,t.StoreData(r,"data",u),f},r.prototype.item=function(n){var r={},o,s;if(null!=(r=t.GetData(n[0],"data")))return r;if(n.is("option"))r={id:n.val(),text:n.text(),disabled:n.prop("disabled"),selected:n.prop("selected"),title:n.prop("title")};else if(n.is("optgroup")){r={text:n.prop("label"),children:[],title:n.prop("title")};for(var f=n.children("option"),e=[],u=0;u<f.length;u++)o=i(f[u]),s=this.item(o),e.push(s);r.children=e}return(r=this._normalizeItem(r)).element=n[0],t.StoreData(n[0],"data",r),r},r.prototype._normalizeItem=function(n){return n!==Object(n)&&(n={id:n,text:n}),null!=(n=i.extend({},{text:""},n)).id&&(n.id=n.id.toString()),null!=n.text&&(n.text=n.text.toString()),null==n._resultId&&n.id&&null!=this.container&&(n._resultId=this.generateResultId(this.container,n)),i.extend({},{selected:!1,disabled:!1},n)},r.prototype.matches=function(n,t){return this.options.get("matcher")(n,t)},r}),t.define("select2/data/array",["./select","../utils","jquery"],function(n,t,i){function r(n,t){this._dataToConvert=t.get("data")||[];r.__super__.constructor.call(this,n,t)}return t.Extend(r,n),r.prototype.bind=function(n,t){r.__super__.bind.call(this,n,t);this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(n){var t=this.$element.find("option").filter(function(t,i){return i.value==n.id.toString()});0===t.length&&(t=this.option(n),this.addOptions(t));r.__super__.select.call(this,n)},r.prototype.convertToOptions=function(n){function a(n){return function(){return i(this).val()==n.id}}for(var c=this,e=this.$element.find("option"),l=e.map(function(){return c.item(i(this)).id}).get(),o=[],r,f,h,u=0;u<n.length;u++)if(r=this._normalizeItem(n[u]),0<=i.inArray(r.id,l)){var s=e.filter(a(r)),v=this.item(s),y=i.extend(!0,{},r,v),p=this.option(y);s.replaceWith(p)}else f=this.option(r),r.children&&(h=this.convertToOptions(r.children),t.appendMany(f,h)),o.push(f);return o},r}),t.define("select2/data/ajax",["./array","../utils","jquery"],function(n,t,i){function r(n,t){this.ajaxOptions=this._applyDefaults(t.get("ajax"));null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults);r.__super__.constructor.call(this,n,t)}return t.Extend(r,n),r.prototype._applyDefaults=function(n){var t={data:function(n){return i.extend({},n,{q:n.term})},transport:function(n,t,r){var u=i.ajax(n);return u.then(t),u.fail(r),u}};return i.extend({},t,n,!0)},r.prototype.processResults=function(n){return n},r.prototype.query=function(n,t){function f(){var f=r.transport(r,function(r){var f=u.processResults(r,n);u.options.get("debug")&&window.console&&console.error&&(f&&f.results&&i.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response."));t(f)},function(){"status"in f&&(0===f.status||"0"===f.status)||u.trigger("results:message",{message:"errorLoading"})});u._request=f}var u=this,r;null!=this._request&&(i.isFunction(this._request.abort)&&this._request.abort(),this._request=null);r=i.extend({type:"GET"},this.ajaxOptions);"function"==typeof r.url&&(r.url=r.url.call(this.$element,n));"function"==typeof r.data&&(r.data=r.data.call(this.$element,n));this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(f,this.ajaxOptions.delay)):f()},r}),t.define("select2/data/tags",["jquery"],function(n){function t(t,i,r){var f=r.get("tags"),o=r.get("createTag"),e,u;if(void 0!==o&&(this.createTag=o),e=r.get("insertTag"),void 0!==e&&(this.insertTag=e),t.call(this,i,r),n.isArray(f))for(u=0;u<f.length;u++){var s=f[u],h=this._normalizeItem(s),c=this.option(h);this.$element.append(c)}}return t.prototype.query=function(n,t,i){var r=this;this._removeOldTags();null!=t.term&&null==t.page?n.call(this,t,function n(u,f){for(var s,l,h,c,e=u.results,o=0;o<e.length;o++)if(s=e[o],l=null!=s.children&&!n({results:s.children},!0),(s.text||"").toUpperCase()===(t.term||"").toUpperCase()||l)return!f&&(u.data=e,void i(u));if(f)return!0;h=r.createTag(t);null!=h&&(c=r.option(h),c.attr("data-select2-tag",!0),r.addOptions([c]),r.insertTag(e,h));u.results=e;i(u)}):n.call(this,t,i)},t.prototype.createTag=function(t,i){var r=n.trim(i.term);return""===r?null:{id:r,text:r}},t.prototype.insertTag=function(n,t,i){t.unshift(i)},t.prototype._removeOldTags=function(){this.$element.find("option[data-select2-tag]").each(function(){this.selected||n(this).remove()})},t}),t.define("select2/data/tokenizer",["jquery"],function(n){function t(n,t,i){var r=i.get("tokenizer");void 0!==r&&(this.tokenizer=r);n.call(this,t,i)}return t.prototype.bind=function(n,t,i){n.call(this,t,i);this.$search=t.dropdown.$search||t.selection.$search||i.find(".select2-search__field")},t.prototype.query=function(t,i,r){var u=this,f;i.term=i.term||"";f=this.tokenizer(i,this.options,function(t){var i=u._normalizeItem(t),r;u.$element.find("option").filter(function(){return n(this).val()===i.id}).length||(r=u.option(i),r.attr("data-select2-tag",!0),u._removeOldTags(),u.addOptions([r]));!function(n){u.trigger("select",{data:n})}(i)});f.term!==i.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.trigger("focus")),i.term=f.term);t.call(this,i,r)},t.prototype.tokenizer=function(t,i,r,u){for(var s,h,o,c=r.get("tokenSeparators")||[],e=i.term,f=0,l=this.createTag||function(n){return{id:n.term,text:n.term}};f<e.length;)s=e[f],-1!==n.inArray(s,c)?(h=e.substr(0,f),o=l(n.extend({},i,{term:h})),null!=o?(u(o),e=e.substr(f+1)||"",f=0):f++):f++;return{term:e}},t}),t.define("select2/data/minimumInputLength",[],function(){function n(n,t,i){this.minimumInputLength=i.get("minimumInputLength");n.call(this,t,i)}return n.prototype.query=function(n,t,i){t.term=t.term||"";t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):n.call(this,t,i)},n}),t.define("select2/data/maximumInputLength",[],function(){function n(n,t,i){this.maximumInputLength=i.get("maximumInputLength");n.call(this,t,i)}return n.prototype.query=function(n,t,i){t.term=t.term||"";0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):n.call(this,t,i)},n}),t.define("select2/data/maximumSelectionLength",[],function(){function n(n,t,i){this.maximumSelectionLength=i.get("maximumSelectionLength");n.call(this,t,i)}return n.prototype.bind=function(n,t,i){var r=this;n.call(this,t,i);t.on("select",function(){r._checkIfMaximumSelected()})},n.prototype.query=function(n,t,i){var r=this;this._checkIfMaximumSelected(function(){n.call(r,t,i)})},n.prototype._checkIfMaximumSelected=function(n,t){var i=this;this.current(function(n){var r=null!=n?n.length:0;0<i.maximumSelectionLength&&r>=i.maximumSelectionLength?i.trigger("results:message",{message:"maximumSelected",args:{maximum:i.maximumSelectionLength}}):t&&t()})},n}),t.define("select2/dropdown",["jquery","./utils"],function(n,t){function i(n,t){this.$element=n;this.options=t;i.__super__.constructor.call(this)}return t.Extend(i,t.Observable),i.prototype.render=function(){var t=n('<span class="select2-dropdown"><span class="select2-results"><\/span><\/span>');return t.attr("dir",this.options.get("dir")),this.$dropdown=t},i.prototype.bind=function(){},i.prototype.position=function(){},i.prototype.destroy=function(){this.$dropdown.remove()},i}),t.define("select2/dropdown/search",["jquery","../utils"],function(n){function t(){}return t.prototype.render=function(t){var r=t.call(this),i=n('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /><\/span>');return this.$searchContainer=i,this.$search=i.find("input"),r.prepend(i),r},t.prototype.bind=function(t,i,r){var u=this,f=i.id+"-results";t.call(this,i,r);this.$search.on("keydown",function(n){u.trigger("keypress",n);u._keyUpPrevented=n.isDefaultPrevented()});this.$search.on("input",function(){n(this).off("keyup")});this.$search.on("keyup input",function(n){u.handleSearch(n)});i.on("open",function(){u.$search.attr("tabindex",0);u.$search.attr("aria-controls",f);u.$search.trigger("focus");window.setTimeout(function(){u.$search.trigger("focus")},0)});i.on("close",function(){u.$search.attr("tabindex",-1);u.$search.removeAttr("aria-controls");u.$search.removeAttr("aria-activedescendant");u.$search.val("");u.$search.trigger("blur")});i.on("focus",function(){i.isOpen()||u.$search.trigger("focus")});i.on("results:all",function(n){null!=n.query.term&&""!==n.query.term||(u.showSearch(n)?u.$searchContainer.removeClass("select2-search--hide"):u.$searchContainer.addClass("select2-search--hide"))});i.on("results:focus",function(n){n.data._resultId?u.$search.attr("aria-activedescendant",n.data._resultId):u.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(){if(!this._keyUpPrevented){var n=this.$search.val();this.trigger("query",{term:n})}this._keyUpPrevented=!1},t.prototype.showSearch=function(){return!0},t}),t.define("select2/dropdown/hidePlaceholder",[],function(){function n(n,t,i,r){this.placeholder=this.normalizePlaceholder(i.get("placeholder"));n.call(this,t,i,r)}return n.prototype.append=function(n,t){t.results=this.removePlaceholder(t.results);n.call(this,t)},n.prototype.normalizePlaceholder=function(n,t){return"string"==typeof t&&(t={id:"",text:t}),t},n.prototype.removePlaceholder=function(n,t){for(var u,r=t.slice(0),i=t.length-1;0<=i;i--)u=t[i],this.placeholder.id===u.id&&r.splice(i,1);return r},n}),t.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function t(n,t,i,r){this.lastParams={};n.call(this,t,i,r);this.$loadingMore=this.createLoadingMore();this.loading=!1}return t.prototype.append=function(n,t){this.$loadingMore.remove();this.loading=!1;n.call(this,t);this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},t.prototype.bind=function(n,t,i){var r=this;n.call(this,t,i);t.on("query",function(n){r.lastParams=n;r.loading=!0});t.on("query:append",function(n){r.lastParams=n;r.loading=!0});this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},t.prototype.loadMoreIfNeeded=function(){var i=n.contains(document.documentElement,this.$loadingMore[0]),t;!this.loading&&i&&(t=this.$results.offset().top+this.$results.outerHeight(!1),this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore())},t.prototype.loadMore=function(){this.loading=!0;var t=n.extend({},{page:1},this.lastParams);t.page++;this.trigger("query:append",t)},t.prototype.showLoadingMore=function(n,t){return t.pagination&&t.pagination.more},t.prototype.createLoadingMore=function(){var t=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"><\/li>'),i=this.options.get("translations").get("loadingMore");return t.html(i(this.lastParams)),t},t}),t.define("select2/dropdown/attachBody",["jquery","../utils"],function(n,t){function i(t,i,r){this.$dropdownParent=n(r.get("dropdownParent")||document.body);t.call(this,i,r)}return i.prototype.bind=function(n,t,i){var r=this;n.call(this,t,i);t.on("open",function(){r._showDropdown();r._attachPositioningHandler(t);r._bindContainerResultHandlers(t)});t.on("close",function(){r._hideDropdown();r._detachPositioningHandler(t)});this.$dropdownContainer.on("mousedown",function(n){n.stopPropagation()})},i.prototype.destroy=function(n){n.call(this);this.$dropdownContainer.remove()},i.prototype.position=function(n,t,i){t.attr("class",i.attr("class"));t.removeClass("select2");t.addClass("select2-container--open");t.css({position:"absolute",top:-999999});this.$container=i},i.prototype.render=function(t){var i=n("<span><\/span>"),r=t.call(this);return i.append(r),this.$dropdownContainer=i},i.prototype._hideDropdown=function(){this.$dropdownContainer.detach()},i.prototype._bindContainerResultHandlers=function(n,t){if(!this._containerResultsHandlersBound){var i=this;t.on("results:all",function(){i._positionDropdown();i._resizeDropdown()});t.on("results:append",function(){i._positionDropdown();i._resizeDropdown()});t.on("results:message",function(){i._positionDropdown();i._resizeDropdown()});t.on("select",function(){i._positionDropdown();i._resizeDropdown()});t.on("unselect",function(){i._positionDropdown();i._resizeDropdown()});this._containerResultsHandlersBound=!0}},i.prototype._attachPositioningHandler=function(i,r){var u=this,f="scroll.select2."+r.id,o="resize.select2."+r.id,s="orientationchange.select2."+r.id,e=this.$container.parents().filter(t.hasScroll);e.each(function(){t.StoreData(this,"select2-scroll-position",{x:n(this).scrollLeft(),y:n(this).scrollTop()})});e.on(f,function(){var i=t.GetData(this,"select2-scroll-position");n(this).scrollTop(i.y)});n(window).on(f+" "+o+" "+s,function(){u._positionDropdown();u._resizeDropdown()})},i.prototype._detachPositioningHandler=function(i,r){var u="scroll.select2."+r.id,f="resize.select2."+r.id,e="orientationchange.select2."+r.id;this.$container.parents().filter(t.hasScroll).off(u);n(window).off(u+" "+f+" "+e)},i.prototype._positionDropdown=function(){var s=n(window),e=this.$dropdown.hasClass("select2-dropdown--above"),a=this.$dropdown.hasClass("select2-dropdown--below"),t=null,i=this.$container.offset(),r,f;i.bottom=i.top+this.$container.outerHeight(!1);r={height:this.$container.outerHeight(!1)};r.top=i.top;r.bottom=i.top+r.height;var h=this.$dropdown.outerHeight(!1),v=s.scrollTop(),y=s.scrollTop()+s.height(),c=v<i.top-h,l=y>i.bottom+h,o={left:i.left,top:r.bottom},u=this.$dropdownParent;"static"===u.css("position")&&(u=u.offsetParent());f={top:0,left:0};n.contains(document.body,u[0])&&(f=u.offset());o.top-=f.top;o.left-=f.left;e||a||(t="below");l||!c||e?!c&&l&&e&&(t="below"):t="above";("above"==t||e&&"below"!==t)&&(o.top=r.top-f.top-h);null!=t&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+t),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+t));this.$dropdownContainer.css(o)},i.prototype._resizeDropdown=function(){var n={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(n.minWidth=n.width,n.position="relative",n.width="auto");this.$dropdown.css(n)},i.prototype._showDropdown=function(){this.$dropdownContainer.appendTo(this.$dropdownParent);this._positionDropdown();this._resizeDropdown()},i}),t.define("select2/dropdown/minimumResultsForSearch",[],function(){function n(n,t,i,r){this.minimumResultsForSearch=i.get("minimumResultsForSearch");this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0);n.call(this,t,i,r)}return n.prototype.showSearch=function(n,t){return!(function n(t){for(var u,i=0,r=0;r<t.length;r++)u=t[r],u.children?i+=n(u.children):i++;return i}(t.data.results)<this.minimumResultsForSearch)&&n.call(this,t)},n}),t.define("select2/dropdown/selectOnClose",["../utils"],function(n){function t(){}return t.prototype.bind=function(n,t,i){var r=this;n.call(this,t,i);t.on("close",function(n){r._handleSelectOnClose(n)})},t.prototype._handleSelectOnClose=function(t,i){var u,f,r;i&&null!=i.originalSelect2Event&&(u=i.originalSelect2Event,"select"===u._type||"unselect"===u._type)||(f=this.getHighlightedResults(),f.length<1||(r=n.GetData(f[0],"data"),null!=r.element&&r.element.selected||null==r.element&&r.selected||this.trigger("select",{data:r})))},t}),t.define("select2/dropdown/closeOnSelect",[],function(){function n(){}return n.prototype.bind=function(n,t,i){var r=this;n.call(this,t,i);t.on("select",function(n){r._selectTriggered(n)});t.on("unselect",function(n){r._selectTriggered(n)})},n.prototype._selectTriggered=function(n,t){var i=t.originalEvent;i&&(i.ctrlKey||i.metaKey)||this.trigger("close",{originalEvent:i,originalSelect2Event:t})},n}),t.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(n){var t=n.input.length-n.maximum,i="Please delete "+t+" character";return 1!=t&&(i+="s"),i},inputTooShort:function(n){return"Please enter "+(n.minimum-n.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(n){var t="You can only select "+n.maximum+" item";return 1!=n.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),t.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et){function ot(){this.reset()}return ot.prototype.apply=function(c){var ht,ct,lt,at,vt,l,ot,st;for(null==(c=n.extend(!0,{},this.defaults,c)).dataAdapter&&((c.dataAdapter=null!=c.ajax?y:null!=c.data?v:a,0<c.minimumInputLength&&(c.dataAdapter=h.Decorate(c.dataAdapter,b)),0<c.maximumInputLength&&(c.dataAdapter=h.Decorate(c.dataAdapter,k)),0<c.maximumSelectionLength&&(c.dataAdapter=h.Decorate(c.dataAdapter,d)),c.tags&&(c.dataAdapter=h.Decorate(c.dataAdapter,p)),null==c.tokenSeparators&&null==c.tokenizer||(c.dataAdapter=h.Decorate(c.dataAdapter,w)),null!=c.query)&&(ht=t(c.amdBase+"compat/query"),c.dataAdapter=h.Decorate(c.dataAdapter,ht)),null!=c.initSelection&&(ct=t(c.amdBase+"compat/initSelection"),c.dataAdapter=h.Decorate(c.dataAdapter,ct))),(null==c.resultsAdapter&&(c.resultsAdapter=i,null!=c.ajax&&(c.resultsAdapter=h.Decorate(c.resultsAdapter,it)),null!=c.placeholder&&(c.resultsAdapter=h.Decorate(c.resultsAdapter,tt)),c.selectOnClose&&(c.resultsAdapter=h.Decorate(c.resultsAdapter,ft))),null==c.dropdownAdapter)&&(c.multiple?c.dropdownAdapter=g:(lt=h.Decorate(g,nt),c.dropdownAdapter=lt),(0!==c.minimumResultsForSearch&&(c.dropdownAdapter=h.Decorate(c.dropdownAdapter,ut)),c.closeOnSelect&&(c.dropdownAdapter=h.Decorate(c.dropdownAdapter,et)),null!=c.dropdownCssClass||null!=c.dropdownCss||null!=c.adaptDropdownCssClass)&&(at=t(c.amdBase+"compat/dropdownCss"),c.dropdownAdapter=h.Decorate(c.dropdownAdapter,at)),c.dropdownAdapter=h.Decorate(c.dropdownAdapter,rt)),null==c.selectionAdapter&&((c.selectionAdapter=c.multiple?u:r,null!=c.placeholder&&(c.selectionAdapter=h.Decorate(c.selectionAdapter,f)),c.allowClear&&(c.selectionAdapter=h.Decorate(c.selectionAdapter,e)),c.multiple&&(c.selectionAdapter=h.Decorate(c.selectionAdapter,o)),null!=c.containerCssClass||null!=c.containerCss||null!=c.adaptContainerCssClass)&&(vt=t(c.amdBase+"compat/containerCss"),c.selectionAdapter=h.Decorate(c.selectionAdapter,vt)),c.selectionAdapter=h.Decorate(c.selectionAdapter,s)),c.language=this._resolveLanguage(c.language),c.language.push("en"),l=[],ot=0;ot<c.language.length;ot++)st=c.language[ot],-1===l.indexOf(st)&&l.push(st);return c.language=l,c.translations=this._processTranslations(c.language,c.debug),c},ot.prototype.reset=function(){function t(n){return n.replace(/[^\u0000-\u007E]/g,function(n){return l[n]||n})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:h.escapeMarkup,language:{},matcher:function i(r,u){var f,e,o,s;if(""===n.trim(r.term))return u;if(u.children&&0<u.children.length){for(f=n.extend(!0,{},u),e=u.children.length-1;0<=e;e--)null==i(r,u.children[e])&&f.children.splice(e,1);return 0<f.children.length?f:i(r,f)}return o=t(u.text).toUpperCase(),s=t(r.term).toUpperCase(),-1<o.indexOf(s)?u:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(n){return n},templateResult:function(n){return n.text},templateSelection:function(n){return n.text},theme:"default",width:"resolve"}},ot.prototype.applyFromElement=function(n,t){var i=n.language,r=this.defaults.language,u=t.prop("lang"),f=t.closest("[lang]").prop("lang"),e=Array.prototype.concat.call(this._resolveLanguage(u),this._resolveLanguage(i),this._resolveLanguage(r),this._resolveLanguage(f));return n.language=e,n},ot.prototype._resolveLanguage=function(t){var r,u,i,f;if(!t)return[];if(n.isEmptyObject(t))return[];if(n.isPlainObject(t))return[t];for(r=n.isArray(t)?t:[t],u=[],i=0;i<r.length;i++)(u.push(r[i]),"string"==typeof r[i]&&0<r[i].indexOf("-"))&&(f=r[i].split("-")[0],u.push(f));return u},ot.prototype._processTranslations=function(t,i){for(var u,r,e=new c,f=0;f<t.length;f++){if(u=new c,r=t[f],"string"==typeof r)try{u=c.loadPath(r)}catch(t){try{r=this.defaults.amdLanguageBase+r;u=c.loadPath(r)}catch(t){i&&window.console&&console.warn&&console.warn('Select2: The language file for "'+r+'" could not be automatically loaded. A fallback will be used instead.')}}else u=n.isPlainObject(r)?new c(r):r;e.extend(u)}return e},ot.prototype.set=function(t,i){var r={},u;r[n.camelCase(t)]=i;u=h._convertData(r);n.extend(!0,this.defaults,u)},new ot}),t.define("select2/options",["require","jquery","./defaults","./utils"],function(n,t,i,r){function u(t,u){if(this.options=t,null!=u&&this.fromElement(u),null!=u&&(this.options=i.applyFromElement(this.options,u)),this.options=i.apply(this.options),u&&u.is("input")){var f=n(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=r.Decorate(this.options.dataAdapter,f)}}return u.prototype.fromElement=function(n){function a(n,t){return t.toUpperCase()}var l=["select2"],u,e,s,o,h,c,f,i;for(null==this.options.multiple&&(this.options.multiple=n.prop("multiple")),null==this.options.disabled&&(this.options.disabled=n.prop("disabled")),null==this.options.dir&&(this.options.dir=n.prop("dir")?n.prop("dir"):n.closest("[dir]").prop("dir")?n.closest("[dir]").prop("dir"):"ltr"),n.prop("disabled",this.options.disabled),n.prop("multiple",this.options.multiple),r.GetData(n[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),r.StoreData(n[0],"data",r.GetData(n[0],"select2Tags")),r.StoreData(n[0],"tags",!0)),r.GetData(n[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),n.attr("ajax--url",r.GetData(n[0],"ajaxUrl")),r.StoreData(n[0],"ajax-Url",r.GetData(n[0],"ajaxUrl"))),u={},e=0;e<n[0].attributes.length;e++)s=n[0].attributes[e].name,o="data-",s.substr(0,o.length)==o&&(h=s.substring(o.length),c=r.GetData(n[0],h),u[h.replace(/-([a-z])/g,a)]=c);t.fn.jquery&&"1."==t.fn.jquery.substr(0,2)&&n[0].dataset&&(u=t.extend(!0,{},n[0].dataset,u));f=t.extend(!0,{},r.GetData(n[0]),u);for(i in f=r._convertData(f))-1<t.inArray(i,l)||(t.isPlainObject(this.options[i])?t.extend(this.options[i],f[i]):this.options[i]=f[i]);return this},u.prototype.get=function(n){return this.options[n]},u.prototype.set=function(n,t){this.options[n]=t},u}),t.define("select2/core",["jquery","./options","./utils","./keys"],function(n,t,i,r){var u=function(n,r){var e,o,f,s,h,c,l;null!=i.GetData(n[0],"select2")&&i.GetData(n[0],"select2").destroy();this.$element=n;this.id=this._generateId(n);r=r||{};this.options=new t(r,n);u.__super__.constructor.call(this);e=n.attr("tabindex")||0;i.StoreData(n[0],"old-tabindex",e);n.attr("tabindex","-1");o=this.options.get("dataAdapter");this.dataAdapter=new o(n,this.options);f=this.render();this._placeContainer(f);s=this.options.get("selectionAdapter");this.selection=new s(n,this.options);this.$selection=this.selection.render();this.selection.position(this.$selection,f);h=this.options.get("dropdownAdapter");this.dropdown=new h(n,this.options);this.$dropdown=this.dropdown.render();this.dropdown.position(this.$dropdown,f);c=this.options.get("resultsAdapter");this.results=new c(n,this.options,this.dataAdapter);this.$results=this.results.render();this.results.position(this.$results,this.$dropdown);l=this;this._bindAdapters();this._registerDomEvents();this._registerDataEvents();this._registerSelectionEvents();this._registerDropdownEvents();this._registerResultsEvents();this._registerEvents();this.dataAdapter.current(function(n){l.trigger("selection:update",{data:n})});n.addClass("select2-hidden-accessible");n.attr("aria-hidden","true");this._syncAttributes();i.StoreData(n[0],"select2",this);n.data("select2",this)};return i.Extend(u,i.Observable),u.prototype._generateId=function(n){return"select2-"+(null!=n.attr("id")?n.attr("id"):null!=n.attr("name")?n.attr("name")+"-"+i.generateChars(2):i.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},u.prototype._placeContainer=function(n){n.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&n.css("width",t)},u.prototype._resolveWidth=function(n,t){var r,u,f,i;if("resolve"==t)return r=this._resolveWidth(n,"style"),null!=r?r:this._resolveWidth(n,"element");if("element"==t)return u=n.outerWidth(!1),u<=0?"auto":u+"px";if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(n[0]).width;if(f=n.attr("style"),"string"!=typeof f)return null;for(var o=f.split(";"),e=0,s=o.length;e<s;e+=1)if(i=o[e].replace(/\s/g,"").match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==i&&1<=i.length)return i[1];return null},u.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container);this.selection.bind(this,this.$container);this.dropdown.bind(this,this.$container);this.results.bind(this,this.$container)},u.prototype._registerDomEvents=function(){var t=this,r;this.$element.on("change.select2",function(){t.dataAdapter.current(function(n){t.trigger("selection:update",{data:n})})});this.$element.on("focus.select2",function(n){t.trigger("focus",n)});this._syncA=i.bind(this._syncAttributes,this);this._syncS=i.bind(this._syncSubtree,this);this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=r?(this._observer=new r(function(i){n.each(i,t._syncA);n.each(i,t._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},u.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(t,i){n.trigger(t,i)})},u.prototype._registerSelectionEvents=function(){var t=this,i=["toggle","focus"];this.selection.on("toggle",function(){t.toggleDropdown()});this.selection.on("focus",function(n){t.focus(n)});this.selection.on("*",function(r,u){-1===n.inArray(r,i)&&t.trigger(r,u)})},u.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(t,i){n.trigger(t,i)})},u.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(t,i){n.trigger(t,i)})},u.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")});this.on("close",function(){n.$container.removeClass("select2-container--open")});this.on("enable",function(){n.$container.removeClass("select2-container--disabled")});this.on("disable",function(){n.$container.addClass("select2-container--disabled")});this.on("blur",function(){n.$container.removeClass("select2-container--focus")});this.on("query",function(t){n.isOpen()||n.trigger("open",{});this.dataAdapter.query(t,function(i){n.trigger("results:all",{data:i,query:t})})});this.on("query:append",function(t){this.dataAdapter.query(t,function(i){n.trigger("results:append",{data:i,query:t})})});this.on("keypress",function(t){var i=t.which;n.isOpen()?i===r.ESC||i===r.TAB||i===r.UP&&t.altKey?(n.close(),t.preventDefault()):i===r.ENTER?(n.trigger("results:select",{}),t.preventDefault()):i===r.SPACE&&t.ctrlKey?(n.trigger("results:toggle",{}),t.preventDefault()):i===r.UP?(n.trigger("results:previous",{}),t.preventDefault()):i===r.DOWN&&(n.trigger("results:next",{}),t.preventDefault()):(i===r.ENTER||i===r.SPACE||i===r.DOWN&&t.altKey)&&(n.open(),t.preventDefault())})},u.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled"));this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},u.prototype._syncSubtree=function(n,t){var i=!1,u=this,r;if(!n||!n.target||"OPTION"===n.target.nodeName||"OPTGROUP"===n.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(r=0;r<t.addedNodes.length;r++)t.addedNodes[r].selected&&(i=!0);else t.removedNodes&&0<t.removedNodes.length&&(i=!0);else i=!0;i&&this.dataAdapter.current(function(n){u.trigger("selection:update",{data:n})})}},u.prototype.trigger=function(n,t){var r=u.__super__.trigger,f={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"},e,i;if((void 0===t&&(t={}),n in f)&&(e=f[n],i={prevented:!1,name:n,args:t},r.call(this,e,i),i.prevented))return void(t.prevented=!0);r.call(this,n,t)},u.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},u.prototype.open=function(){this.isOpen()||this.trigger("query",{})},u.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},u.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},u.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},u.prototype.focus=function(){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},u.prototype.enable=function(n){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.');null!=n&&0!==n.length||(n=[!0]);var t=!n[0];this.$element.prop("disabled",t)},u.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var n=[];return this.dataAdapter.current(function(t){n=t}),n},u.prototype.val=function(t){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==t||0===t.length)return this.$element.val();var i=t[0];n.isArray(i)&&(i=n.map(i,function(n){return n.toString()}));this.$element.val(i).trigger("change")},u.prototype.destroy=function(){this.$container.remove();this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA);null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1));this._syncA=null;this._syncS=null;this.$element.off(".select2");this.$element.attr("tabindex",i.GetData(this.$element[0],"old-tabindex"));this.$element.removeClass("select2-hidden-accessible");this.$element.attr("aria-hidden","false");i.RemoveData(this.$element[0]);this.$element.removeData("select2");this.dataAdapter.destroy();this.selection.destroy();this.dropdown.destroy();this.results.destroy();this.dataAdapter=null;this.selection=null;this.dropdown=null;this.results=null},u.prototype.render=function(){var t=n('<span class="select2 select2-container"><span class="selection"><\/span><span class="dropdown-wrapper" aria-hidden="true"><\/span><\/span>');return t.attr("dir",this.options.get("dir")),this.$container=t,this.$container.addClass("select2-container--"+this.options.get("theme")),i.StoreData(t[0],"element",this.$element),t},u}),t.define("jquery-mousewheel",["jquery"],function(n){return n}),t.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(n,t,i,r,u){if(null==n.fn.select2){var f=["open","close","destroy"];n.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var r=n.extend(!0,{},t);new i(n(this),r)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var r,e=Array.prototype.slice.call(arguments,1);return this.each(function(){var n=u.GetData(this,"select2");null==n&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2.");r=n[t].apply(n,e)}),-1<n.inArray(t,f)?this:r}}return null==n.fn.select2.defaults&&(n.fn.select2.defaults=r),i}),{define:t.define,require:t.require}}(),i=t.require("jquery.select2");return n.fn.select2.amd=t,i});$(function(){$("#radiostate").unbind("click").bind("click",function(){getandbindstates()});$("#radioregion").unbind("click").bind("click",function(){getandbindregions(this.value)})});var inputData={},makedata=[],modeldata=[],modelsDataCache=[],yeardata=[],bodyclassdata=[];$(document).ready(function(){inputData.Make=[];inputData.Model=[];$("#divMake").css("display","block");$("#divModel").css("display","block");$("#selectMakes option").remove();$("#selectModels option").remove();$("#trainglemodle").css("display","none");var n=function(n){if(n!==undefined&&n!==null&&(makedata=n,$("#selectMakes").css("display","block"),$("#divMake").css("display","block"),$.each(n,function(n,t){$("#selectMakes").append($("<option>",{value:t.MakeCode,text:t.Make,datamakes:t.Make}))}),$("#selectMakes").select2({dropdownParent:$("#divMake")}).change(function(){}),$(".select2[multiple]").siblings(".select2-container").append('<span class="select-all"><\/span>'),$("#selectModels").select2(),$(".select2#selectModels").attr("disabled",!0).trigger("select2:updated"),Object.keys(jsonObject).length>0&&jsonObject.Make!==undefined&&jsonObject.Make!=="")){var t=jsonObject.Make;$("#selectMakes").val("").trigger("change");$("#selectMakes").val(t).trigger("change");$("#selectMakes_select2 .select2").show();common.showPanel("collapseFour")}},t=function(){alert("System Error Occurred (0810). Please Email NCSARequests@dot.gov")};common.ajaxGet("MakeModel/GetMakes",n,t)});$(document).ready(function(){$.ajax({type:"GET",url:"AppConfig/GetXYTableConfig",contentType:"application/json; charset=utf-8",datatype:"json",success:function(n){var i,r,t;for(setting=n,i=1920,r=setting.EndYear+1,t=r;t>=i;t--)$("#selectmodelyears").append($("<option>",{value:t,text:t,datamodelyears:t}));$("#selectmodelyears").select2({dropdownParent:$("#vehicleyears")}).change(function(){})},error:function(){alert("error!")}});$("#selectmodelyears").on("select2:select",function(n){modelyearsselection(n.params.data)});$("#selectmodelyears").on("select2:unselect",function(n){modelyearsselection(n.params.data)})});makemodel=function(){var n={};return n.getSelectedBodyClass=function(){var t=$("#selectBodyClass").select2("data"),n=[];return $.each(t,function(t,i){n.push(i.id)}),n.length>0?n.join(","):""},n.getSelectedBodyClassText=function(){for(var i=$("#selectBodyClass").select2().find(":selected"),t=[],r,n=0;n<i.length;n++)r=i[n].getAttribute("databodyclass"),t.push(r);return t.length>0?t.join(","):""},n.getSelectedBodyClassIdsByText=function(n){var t=[];return $.each(n,function(n,i){t.push(makemodel.getSelectedBodyClassIdByText(i))}),t},n.getSelectedBodyClassIdByText=function(n){var i=$("#selectBodyClass").find("option"),t=null;return $.each(i,function(i,r){var u=$(r).text();if(u.trim()===n.trim())return t=$(r).val()}),t},n.getSelectedMakes=function(){var t=$("#selectMakes").select2("data"),n=[];return $.each(t,function(t,i){n.push(i.id)}),n.length>0?n.join(","):""},n.getSelectedMakesText=function(){for(var i=$("#selectMakes").select2().find(":selected"),t=[],r,n=0;n<i.length;n++)r=i[n].getAttribute("datamakes"),t.push(r);return t.length>0?t.join(","):""},n.getSelectedMakeIdsByText=function(n){var t=[];return $.each(n,function(n,i){t.push(makemodel.getSelectedMakeIdByText(i))}),t},n.getSelectedMakeIdByText=function(n){var i=$("#selectMakes").find("option"),t=null;return $.each(i,function(i,r){var u=$(r).text();if(u.trim()===n.trim())return t=$(r).val()}),t},n.getSelectedModels=function(){var t=$("#selectModels").select2("data"),n=[];return $.each(t,function(t,i){n.push(i.id)}),n.length>0?n.join(","):""},n.getSelectedModelIdsByText=function(n){var t=[];return $.each(n,function(n,i){t.push(makemodel.getSelectedModelIdByText(i))}),t},n.getSelectedModelIdByText=function(n){var i=$("#selectModels").find("option"),t=null;return $.each(i,function(i,r){var u=$(r).text();if(u.trim()===n.trim())return t=$(r).val()}),t},n.getSelectedModelsText=function(){for(var i=$("#selectModels").select2().find(":selected"),t=[],r,n=0;n<i.length;n++)r=i[n].getAttribute("datamodels"),t.push(r);return t.length>0?t.join(","):""},n.getSelectedYears=function(){for(var i=$("#selectmodelyears").select2().find(":selected"),t=[],r,n=0;n<i.length;n++)r=i[n].getAttribute("datamodelyears"),t.push(r);return t.length>0?t.join(","):""},n.clearSelectedYear=function(){$("#selectmodelyears").val(null).trigger("change");$("#modelyears").html("")},n.clearSelectedMakes=function(){$("#selectMakes").val(null).trigger("change")},n.clearSelectedModels=function(){$("#selectModels").val(null).trigger("change")},n.clearSelectedBodyClass=function(){$("#selectBodyClass").val(null).trigger("change");$("#strbodyclass").html("")},n.clearMakeModels=function(){makemodel.clearSelectedModels();makemodel.clearSelectedMakes();makemodel.clearSelectedYear();makemodel.clearSelectedBodyClass()},n}();$(".select2").select2({placeholder:"Press CTRL+A for select or unselect all options"});$(document).on("click",".select-all",function(){selectAllSelect2($(this).siblings(".selection").find(".select2-search__field"))});$(document).on("keyup",".select2-search__field",function(n){var t=window.event?event:n;t.keyCode===65&&t.ctrlKey&&selectAllSelect2($(this))});metricsClick=1;var ageData={},messageDiv="Selecting an Age range from the scale will disable the other Age data elements.",NoRangeselection=0,RadioButtonSelectionOptionType=1,CheckBoxSelectionOptionType=2,TextTextboxSelectionOptionType=3,NumTextboxSelectionOptionType=4,TextRangeSelectionOptionType=5,NumRangeSelectionOptionTypeType=6,SliderSelectionOptionType=7,AgeDataEleId=47,AgeGrp1DataEleId=24,AgeGrp6DataEleId=61,AgeGrp7DataEleId=90;typeDescription();$(document).ready(function(){$(".btnSortable").click(function(){var t;metricsClick=0;selections.selectionCount=0;selectedBuildValue=BYTSelection=this.dataset.name;$(".btnSortable").removeClass("activebtn");$(this).addClass("activebtn");var n=localStorage.getItem("metrictypeidval"),i=localStorage.getItem("metrictype_num"),r=localStorage.getItem("isgeogrpahy"),u=localStorage.getItem("datasource");inputData.selectBYTType=selectedBuildValue;changeBYTCondition();t=localStorage.getItem("firstTimeDataTableBindonRetrive");Object.keys(jsonObject).length<=0?bindSasDataFirstList(n):localStorage.setItem("firstTimeDataTableBindonRetrive",!0);jsonObject.TimeFrameType==="Y"&&($("#listTimeFrameYear a").click(),common.showPanel("collapseThree"));jsonObject.TimeFrameType==="S"&&($("#liTimeFrameSilder a").click(),common.showPanel("collapseThree"))})});$(function(){$("#ascarrow").hide();$(".panelblock").click(function(){$(this).prop("display")});$(".link-sort-list").click(function(n){var t=this;$(t).hasClass("asc")?($("#ascarrow").hide(),$("#descarrow").show(),sortUnorderedList("sortable1",!1)):($("#ascarrow").show(),$("#descarrow").hide(),sortUnorderedList("sortable1",!0));n.preventDefault()});$("#sortable1, #sortable2").sortable({connectWith:".connectedSortable",scroll:!0}).disableSelection();$("#sortable1, #sortable3").sortable({connectWith:".connectedSortable",scroll:!0}).disableSelection()});$(document).ready(function(){$(".activetab").click(function(){$("#partimeframe").html("");$(".timeFrameClass").hide();$("#years-range[multiple]").empty();timeframe.setSlider()});timeframe.GetXyTableConfig();$(document).ready(function(){if(!window.matchMedia||window.matchMedia("(max-width: 767px)").matches)$(document).on("shown.bs.tooltip",function(n){setTimeout(function(){$(n.target).tooltip("destroy")},3e3)})});$("#txtAttributesnumbrangeFrom").change(function(){var n=$(this).val(),i=$("#txtAttributesnumbrangeTo").val(),t;if(i){$("#"+ziptxterrangemsgtxtId).css("color","red");$("#"+ziptxterrangemsgtxtId).html("Please enter age to value");return}$("#"+ziptxterrangemsgtxtId).html("");n!=undefined&&n!==""&&(t=parseInt(n),(AppTableConfig.MinRange<t||t>AppTableConfig.MaxRange)&&alert("The Age range must be . "+AppTableConfig.MinRange+"to"+AppTableConfig.MaxRange))});$("#txtAttributesnumbrangeTo").change(function(){var t=$("#txtAttributesnumbrangeFrom").val(),n;$("#"+ziptxterrangemsgtxtId).html("");thisvalue!=undefined&&thisvalue!==""&&(n=parseInt(thisvalue),(AppTableConfig.MinRange<n||n>AppTableConfig.MaxRange)&&alert("The Age range must be . "+AppTableConfig.MinRange+"to"+AppTableConfig.MaxRange))});$("#sortable1").on("sortreceive",function(n,t){var i,r,u,f;if(!t.item.hasClass("pin")&&(i=$(this),i.children().length>0)){for(r=0;r<i.children().length-1;r++)u=i.children()[r],inputData.XTableEle=$.grep(inputData.XTableEle,function(n){return n!==u.attributes.value.nodeValue}),inputData.YTableEle=$.grep(inputData.YTableEle,function(n){return n!==u.attributes.value.nodeValue});f=i.children()[i.children().length-1].attributes.value.nodeValue;inputData.XTableEle=$.grep(inputData.XTableEle,function(n){return n!==f});inputData.YTableEle=$.grep(inputData.YTableEle,function(n){return n!==f})}});$("#sortable2").on("sortreceive",function(n,t){var i=$(this),e,r,u,f;if(inputData.XTableEle=[],i.children().length>AppTableConfig.XTableMax?(console.log("lengthhh"),t!=undefined&&$(t.sender).sortable("cancel")):t&&t.item.children().css("display","block"),i.children().length>0){for(e={},r=0;r<i.children().length-1;r++)u=i.children()[r],inputData.XTableEle.push(u.attributes.value.nodeValue),disableRoworColPer(),inputData.YTableEle=$.grep(inputData.YTableEle,function(n){return n!==u.attributes.value.nodeValue});inputData.XTableEle.push(i.children()[i.children().length-1].attributes.value.nodeValue);f=i.children()[i.children().length-1].attributes.value.nodeValue;inputData.YTableEle=$.grep(inputData.YTableEle,function(n){return n!==f})}});$("#sortable2").on("sortupdate",function(n,t){var i=$(this),e,r,u,f;if(inputData.XTableEle=[],i.children().length>AppTableConfig.XTableMax&&t!=undefined&&$(t.sender).sortable("cancel"),i.children().length>0){for(e={},r=0;r<i.children().length-1;r++)u=i.children()[r],inputData.XTableEle.push(u.attributes.value.nodeValue),inputData.YTableEle=$.grep(inputData.YTableEle,function(n){return n!==u.attributes.value.nodeValue});inputData.XTableEle.push(i.children()[i.children().length-1].attributes.value.nodeValue);f=i.children()[i.children().length-1].attributes.value.nodeValue;disableRoworColPer();inputData.YTableEle=$.grep(inputData.YTableEle,function(n){return n!==f})}});$("#sortable3").on("sortreceive",function(n,t){var i=$(this),r,u,f;if(i.children().length>AppTableConfig.YTableMax?t!==undefined&&$(t.sender).sortable("cancel"):t&&t.item.children().css("display","block"),inputData.YTableEle=[],i.children().length>0){for(r=0;r<i.children().length-1;r++)u=i.children()[r],inputData.YTableEle.push(u.attributes.value.nodeValue),inputData.XTableEle=$.grep(inputData.XTableEle,function(n){return n!==u.attributes.value.nodeValue});inputData.YTableEle.push(i.children()[i.children().length-1].attributes.value.nodeValue);f=i.children()[i.children().length-1].attributes.value.nodeValue;disableRoworColPer();inputData.XTableEle=$.grep(inputData.XTableEle,function(n){return n!==f})}});$("#sortable3").on("sortupdate",function(n,t){var i=$(this),r,u,f;if(i.children().length>AppTableConfig.YTableMax&&t!=undefined&&$(t.sender).sortable("cancel"),inputData.YTableEle=[],i.children().length>0){for(r=0;r<i.children().length-1;r++)u=i.children()[r],inputData.YTableEle.push(u.attributes.value.nodeValue),inputData.XTableEle=$.grep(inputData.XTableEle,function(n){return n!==u.attributes.value.nodeValue});inputData.YTableEle.push(i.children()[i.children().length-1].attributes.value.nodeValue);f=i.children()[i.children().length-1].attributes.value.nodeValue;disableRoworColPer();inputData.XTableEle=$.grep(inputData.XTableEle,function(n){return n!==f})}})});$(document).ready(function(){$(".btnPieChart").click(function(){var n=inputData.State;n.length===1&&$(".stateAndCity_Report").removeClass("hide")});$("#sortable2").on("click",".remove",function(){var r="",n,i;inputData.XTableEle=[];var u=$(this).parent()[0],t=u.parentNode,f=$("#sortable1")[0];for($(this).parent().children().css("display","none"),f.insertBefore(u,null),$("#errormsg").css("display","none"),EnableordisableAttributes(),n=0;n<t.children.length;n++)i=t.children[n],r+=i.childNodes[0].nodeValue.trim()+" by ";if(bindBindYourTable(r,"empty"),t.children.length>0){for(n=0;n<t.children.length-1;n++)i=t.children[n],inputData.XTableEle.push(i.attributes.value.nodeValue);inputData.XTableEle.push(t.children[t.children.length-1].attributes.value.nodeValue);console.log("updated X",inputData.XTableEle)}});$("#sortable3").on("click",".remove",function(){var r="",n,i;inputData.YTableEle=[];var u=$(this).parent()[0],t=u.parentNode,f=$("#sortable1")[0];for($(this).parent().children().css("display","none"),f.insertBefore(u,null),$("#errormsg").css("display","none"),EnableordisableAttributes(),n=0;n<t.children.length;n++)i=t.children[n],r+=i.childNodes[0].nodeValue.trim()+" by ";if(bindBindYourTable("empty",r),t.children.length>0){for(n=0;n<t.children.length-1;n++)i=t.children[n],inputData.YTableEle.push(i.attributes.value.nodeValue);inputData.YTableEle.push(t.children[t.children.length-1].attributes.value.nodeValue);console.log("updated y",inputData.YTableEle)}})});samplequeriesScrollLength=10;$(document).ready(function(){$("#Searchqueries").keyup(function(){$("#Searchallqueries").val("");var t=$("#Searchqueries").val().toLowerCase().split(" "),i=$("#sampleQuieries").data("sampleQuieries"),n=[];$.each(i,function(i,r){var f=t.length,u=0;$.each(t,function(n,t){(r.QueryTitle.toLowerCase().indexOf(t)!==-1||("(#"+r.QueryNumber+")").toString().indexOf(t)!==-1)&&(u=u+1)});u===f&&n.push(r)});$(".searchbyid").show();$(".local,.global,.globalSearch").html("");$.each(n,function(n,t){var i=bindsamplequery(t,"local");[].push(t);$("#sampleQuieries").append(i)});n.length===0?$(".not-found").css("display","block"):$(".not-found").css("display","none");n.length>samplequeriesScrollLength?$("#sampleQuieries").addClass("scroll"):$("#sampleQuieries").removeClass("scroll");$("#expandQueries").click(function(){$("#expandQueries").hide();$("#collapseQueries").show();n.length>samplequeriesScrollLength&&($("#allsampleQuieries").removeClass("scroll1"),$("#sampleQuieries").removeClass("scroll"))});$("#collapseQueries").click(function(){$("#expandQueries").show();$("#collapseQueries").hide();n.length>samplequeriesScrollLength&&($("#allsampleQuieries").removeClass("scroll1"),$("#sampleQuieries").removeClass("scroll"))})});$("#Searchallqueries").keyup(function(){var t;$("#Searchqueries").val("");$("#expandQueries").show();$("#collapseQueries").hide();var i=$("#Searchallqueries").val().toLowerCase().split(" "),r=$("#allsampleQuieries").data("allsampleQuieries"),n=[];$.each(r,function(t,r){var f=i.length,u=0;$.each(i,function(n,t){r.QueryTitle!==null&&(r.QueryTitle.toLowerCase().indexOf(t)>-1||("(#"+r.QueryNumber+")").toString().indexOf(t)>-1)&&(u=u+1)});u===f&&n.push(r)});$(".globalSearch").show();$(".local,.global").hide();$.each(n,function(n,t){var i=bindsamplequery(t,"global");[].push(t);$("#allsampleQuieries").append(i)});t=$("#Searchallqueries").val().trim();t===""&&$(".local,.global").hide();$("#sampleQuieries").removeClass("scroll");$("#allsampleQuieries").removeClass("scroll1");n.length===0?$(".not-found").css("display","block"):$(".not-found").css("display","none");n.length>samplequeriesScrollLength&&t!==""&&($("#sampleQuieries").removeClass("scroll"),$("#allsampleQuieries").addClass("scroll1"));$("#expandQueries").click(function(){$("#expandQueries").hide();$("#collapseQueries").show();n.length>samplequeriesScrollLength&&t!==""&&($("#allsampleQuieries").removeClass("scroll1"),$("#sampleQuieries").removeClass("scroll"))});$("#collapseQueries").click(function(){$("#expandQueries").show();$("#collapseQueries").hide();n.length>samplequeriesScrollLength&&t!==""&&($("#allsampleQuieries").removeClass("scroll1"),$("#sampleQuieries").removeClass("scroll"))})});$("#Searchallqueries").focusin(function(){$(".local,.global").hide();$("#sampleQuieries").removeClass("scroll");$("#allsampleQuieries").removeClass("scroll1");$("#expandQueries").hide();$("#collapseQueries").hide()});$("#Searchqueries").focusin(function(){$(".global").hide();$(".local").show();$(".not-found").css("display","none");$("#allsampleQuieries").hide();$("#Searchqueries").val("");$("#expandQueries").show();$("#collapseQueries").hide();var n=$("#sampleQuieries").data("sampleQuieries");$("#sampleQuieries").html("");n.length>=samplequeriesScrollLength&&($("#sampleQuieries").addClass("scroll"),$("#allsampleQuieries").addClass("scroll1"));$.each(n,function(n,t){var i=bindsamplequery(t,"local");[].push(t);$("#sampleQuieries").append(i)})})})