function formatCurrency(n){n=n.toString().replace(/\$|\,/g,"");isNaN(n)&&(n="0");sign=n==(n=Math.abs(n));n=Math.floor(n*100+.50000000001);cents=n%100;n=Math.floor(n/100).toString();cents<10&&(cents="0"+cents);for(var t=0;t<Math.floor((n.length-(1+t))/3);t++)n=n.substring(0,n.length-(4*t+3))+","+n.substring(n.length-(4*t+3));return(sign?"":"-")+"$"+n+"."+cents}function formatDecimal(n,t){if(n=="")return"";n=removeNonNumericCharacters(n);var i=new Number(n);return isNaN(i)?"":i.toFixed(t)}function padLeft(n,t,i){var u,r;if(!n||!t||n.length>=i)return n;for(u=(i-n.length)/t.length,r=0;r<u;r++)n=t+n;return n}function padRight(n,t,i){var u,r;if(!n||!t||n.length>=i)return n;for(u=(i-n.length)/t.length,r=0;r<u;r++)n+=t;return n}function GetCurrentDate(){var n=new Date,t=n.getMonth()+1,i=n.getDate(),r=n.getFullYear();return t+"/"+i+"/"+r}function isValidDate(n){var t="",l="",f,i,u,a=0,r=0,e,o,s,c,h;if((r=0,t=n,h=t.split("/"),h.length!=3)||(o=h[0],s=h[1],c=h[2],o.length==1&&(o="0"+o),s.length==1&&(s="0"+s),c.length!=2&&c.length!=4))return!1;for(t=o+s+c,e=0;e<t.length;e++)"0123456789".indexOf(t.substr(e,1))>=0&&(l=l+t.substr(e,1));return t=l,t.length==6&&(t=t.substr(4,2)<50?t.substr(0,4)+"20"+t.substr(4,2):t.substr(0,4)+"19"+t.substr(4,2)),t.length!=8&&(r=19),u=t.substr(4,4),(u==0||u<1900||u>2100)&&(r=20),i=t.substr(0,2),(i<1||i>12)&&(r=21),f=t.substr(2,2),f<1&&(r=22),(u%4==0||u%100==0||u%400==0)&&(a=1),i==2&&a==1&&f>29&&(r=23),i==2&&a!=1&&f>28&&(r=24),f>31&&(i=="01"||i=="03"||i=="05"||i=="07"||i=="08"||i=="10"||i=="12")&&(r=25),f>30&&(i=="04"||i=="06"||i=="09"||i=="11")&&(r=26),r==0?!0:!1}function CheckNumeric(n){n.value=Number(n.value)||Number(n.value)==0?n.value:""}function CheckDecimalPlaces(n){n.value=Number(n.value)||Number(n.value)==0?Number(n.value)<=100&&/^\d{0,3}\.{0,1}\d{0,3}$/g.test(n.value)?n.value:"":""}function imposeMaxLength(n,t){return n.value.length<t}function removeNonNumericCharacters(n){return n.toString().replace(/\$|\,/g,"")}function removeSpecialCharacters(n){n.value!=""&&n.value.match(/^[\w ]+$/)==null&&(n.value=n.value.replace(/[\W]/g,""))}function isDollarAmountOnly(n){var t=event.which?event.which:window.event.keyCode?window.event.keyCode:-1;return t>=48&&t<=57?!0:t==43?n.value&&n.value.indexOf("+")>=0?!1:!0:t==45?n.value&&n.value.indexOf("-")>=0?!1:!0:t==46?n.value&&n.value.indexOf(".")>=0?!1:!0:!1}function isOneDecimalNumberOnlyKeyPress(n){var t=event.which?event.which:window.event.keyCode?window.event.keyCode:-1;return t>=48&&t<=57?!0:t==46?n.value&&n.value.indexOf(".")>=0?n.selectionStart==0&&n.selectionEnd==n.value.length?!0:!1:!0:!1}function isOneDecimalNumberOnlyKeyPressIncludeNegatives(n){var t=event.which?event.which:window.event.keyCode?window.event.keyCode:-1;return t>=48&&t<=57?!0:t==45?n.value&&n.value.indexOf("-")>=0?n.selectionStart==0&&n.selectionEnd==n.value.length?!0:!1:!0:t==46?n.value&&n.value.indexOf(".")>=0?n.selectionStart==0&&n.selectionEnd==n.value.length?!0:!1:!0:!1}function isNumberOnlyKeyPress(n){var t=n.which?n.which:event.keyCode;return t>31&&(t<48||t>57)?!1:!0}function isNumberOnlyKeyPressNeg(n){var t=n.which?n.which:event.keyCode;return t==45?!0:t>31&&(t<48||t>57)?!1:!0}function convertToMMYY(n){var t,i;isValidDate(n.value)?(t=new Date(n.value),t!="Invalid Date"&&(i=t.getMonth()+1,n.value=i.toString()+"/"+t.getFullYear().toString())):n.value=""}function isPhoneNumberOnly(n){var t=event.which?event.which:window.event.keyCode?window.event.keyCode:-1;return t>=48&&t<=57?!0:t==45?n.value&&n.value.split("-").length>2?!1:!0:!1}function numberWithCommas(n){var t=n.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")}function PopulateDropDown(n,t,i,r){gCodeLists[t]?FillDropDown(n,gCodeLists[t],i,r):$.ajax({url:"./Home/GetCodeList?codeList="+t,success:function(u){u.Message==undefined&&(u.Err.length>0?alert(u.Err):(gCodeLists[t]=u,FillDropDown(n,u,i,r)))},error:function(n,t,i){alert(i)}})}function PopulateDropDownWithoutBlanks(n,t,i,r){gCodeLists[t]?FillDropDownWithoutBlanks(n,gCodeLists[t],i,r):$.ajax({url:"./Home/GetCodeList?codeList="+t,success:function(u){u.Message==undefined&&(u.Err.length>0?alert(u.Err):(gCodeLists[t]=u,FillDropDownWithoutBlanks(n,u,i,r)))},error:function(n,t,i){alert(i)}})}function FillDropDown(n,t,i,r){obj=document.getElementById(n);obj.options.length=0;obj[0]=new Option("","");var u=1;for(j=0;j<t.codeListEntries.length;j++)obj[u]=i==1?new Option(t.codeListEntries[j].codeName,t.codeListEntries[j].codeID):new Option(t.codeListEntries[j].codeDescription,t.codeListEntries[j].codeID),obj[u].title=r==1?t.codeListEntries[j].codeName:t.codeListEntries[j].codeDescription,obj[u].disabled=t.codeListEntries[j].isObsolete=="True"||t.codeListEntries[j].isObsolete=="true"||t.codeListEntries[j].isObsolete=="1",u=u+1;document.getElementById(n).selectedIndex=0}function FillDropDownWithoutBlanks(n,t,i,r){obj=document.getElementById(n);obj.options.length=0;var u=0;for(j=0;j<t.codeListEntries.length;j++)obj[u]=i==1?new Option(t.codeListEntries[j].codeName,t.codeListEntries[j].codeID):new Option(t.codeListEntries[j].codeDescription,t.codeListEntries[j].codeID),obj[u].title=r==1?t.codeListEntries[j].codeName:t.codeListEntries[j].codeDescription,obj[u].disabled=t.codeListEntries[j].isObsolete=="True"||t.codeListEntries[j].isObsolete=="true"||t.codeListEntries[j].isObsolete=="1",u=u+1;document.getElementById(n).selectedIndex=-1}function GetCodeListEntryCode(n,t,i){var f=0,r,e,u;if(gCodeLists[n])for(u=gCodeLists[n],r=0;r<u.codeListEntries.length;r++)if(e=i==1?u.codeListEntries[r].codeName:u.codeListEntries[r].codeDescription,t==e){f=u.codeListEntries[r].codeID;break}return parseInt(f,10)}function GetCodeListEntryText(n,t,i){var r,f="",u;if(gCodeLists[n])for(u=gCodeLists[n],r=0;r<u.codeListEntries.length;r++)if(parseInt(t,10)==u.codeListEntries[r].codeID){f=i==1?u.codeListEntries[r].codeName:u.codeListEntries[r].codeDescription;break}return f}function IsNumberOnly(){var n=event.which?event.which:window.event.keyCode?window.event.keyCode:-1;return n>=48&&n<=57?!0:!1}function DecimalNumberOnly(n){var t=event.which?event.which:window.event.keyCode?window.event.keyCode:-1;return t>=48&&t<=57?!0:t==46?n.value&&n.value.indexOf(".")>=0?!1:!0:!1}function logStatistics(n){try{$.ajax({url:"./admin/LogStatistics",data:n})}catch(t){}}function SelectionListDoubleClick(n,t){var i,u,r,f;i=document.getElementById(n);u=document.getElementById(t);r=document.getElementById(n).selectedIndex;f=u.options.length;i.options[r].value!="-1"&&(u[f]=new Option(i.options[r].text,i.options[r].value),SelectionListSortList(t));i.options[r]=null}function SelectionListAddRemove(n,t){var f,u,i,r,e,o;for(r=SelectionListGetSelectedItems(n),e=r.length,f=document.getElementById(n),u=document.getElementById(t),i=0;i<e;i++)r[i].value!="-1"&&(o=u.options.length,u[o]=new Option(r[i].text,r[i].value)),f.options[r[i].index-i]=null;SelectionListSortList(t)}function SelectionListAddRemoveAll(n,t){var f,u,i,r,e,o;for(r=SelectionListGetAllItems(n),e=r.length,f=document.getElementById(n),u=document.getElementById(t),i=0;i<e;i++)r[i].value!="-1"&&(o=u.options.length,u[o]=new Option(r[i].text,r[i].value)),f.options[r[i].index-i]=null;SelectionListSortList(t)}function SelectionListGetSelectedItems(n){for(var t=[],r=0,u=document.getElementById(n),f=u.options.length,i=0;i<f;i++)u[i].selected&&(r=t.length,t[r]={},t[r].value=u[i].value,t[r].text=u[i].text,t[r].index=i);return t}function SelectionListGetAllItems(n){for(var t=[],i=0,u=document.getElementById(n),f=u.options.length,r=0;r<f;r++)i=t.length,t[i]={},t[i].value=u[r].value,t[i].text=u[r].text,t[i].index=r;return t}function SelectionListCopyList(n,t){var i,r=document.getElementById(n),f=r.options.length,u=document.getElementById(t);for(u.options.length=0,i=0;i<f;i++)u[i]=new Option(r[i].text,r[i].value)}function SelectionListInitializeList(n,t,i,r){var f,u,l,s,e,o=document.getElementById(n),h,c,a;if(o==null){setTimeout("SelectionListInitializeList('"+n+"','"+t+"','"+i+"','"+r+"')",50);return}if(h=o.options.length,h<1){setTimeout("SelectionListInitializeList('"+n+"','"+t+"','"+i+"','"+r+"')",50);return}for(SelectionListCopyList(i,t),c=document.getElementById(t),a=c.options.length,s=0,f=0;f<a;f++)for(l=h-s,e=0,u=0;u<l;u++)if(o.options[u-e].text==c.options[f].text){o.options[u-e]=null;s++;e++;break}}function compareNumbers(n,t){return n-t}function SelectionListSortList(n){if(n=="SpecialEventAvailableCCS"||n=="SpecialEventCurrentCCS"||n=="wavetronixCCSAvail"||n=="wavetronixCCSSel"){SelectionListSortListNumber(n);return}var t=document.getElementById(n);for(arrTexts=[],i=0;i<t.options.length;i++)arrTexts[i]=n=="SpecialEventAvailableLanes"||n=="SpecialEventCurrentLanes"?t.options[i].value+":"+t.options[i].text:t.options[i].text+":"+t.options[i].value;for(arrTexts.sort(),i=0;i<t.options.length;i++)el=arrTexts[i].split(":"),n=="SpecialEventAvailableLanes"||n=="SpecialEventCurrentLanes"?(t.options[i].text=el[1],t.options[i].value=el[0]):(t.options[i].text=el[0],t.options[i].value=el[1]);document.getElementById(n).selectedIndex=-1}function SelectionListSortListNumber(n){var t=document.getElementById(n);for(arrTexts=[],i=0;i<t.options.length;i++)arrTexts[i]=t.options[i].text;for(arrTexts.sort(compareNumbers),i=0;i<t.options.length;i++)el=arrTexts[i].split(":"),t.options[i].text=el[0],t.options[i].value=el[1]}function parseRouteID(n){var t;return t=n.split("")[8]=="0"?" (Inventory)":" (Non-Inventory)",n.substring(0,2)+" "+parseInt(n.substring(2,8)).toString()+t}function getCookie(n){for(var t,r=n+"=",f=decodeURIComponent(document.cookie),u=f.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(r)==0)return t.substring(r,t.length)}return""}function setCookie(n,t,i){var r=new Date,u;r.setTime(r.getTime()+i*864e5);u="expires="+r.toUTCString();document.cookie=n+"="+t+";"+u+";path=/"}function checkCookie(n){var t=getCookie(n);return t!=""?!0:!1}function onlyShowSignificantDigits(n){if(isNaN(n)||n=="")return"";var t=Number(n);return parseFloat(t.toFixed(3))}function GetFindTrafficYearsForUsers(n){$.ajax({url:"./Misc/GetFindTrafficYearsForUsers",data:{userID:userID},success:function(t){if(document.getElementById("tdmaMapATR").options.length=0,t.substring(0,5)=="ERROR")closeWait(),alert(t);else{closeWait();obj=document.getElementById(n);obj.innerHTML=t;var i=document.getElementById("tdmaMapYear").value;i!=""&&GetFindTrafficATRsBasedOnYear(i,"tdmaMapATR")}},error:function(n,t,i){document.getElementById("tdmaMapATR").options.length=0;alert(i)}})}function initializeMap(){require(["esri/map","esri/toolbars/navigation","esri/layers/FeatureLayer","esri/layers/ArcGISDynamicMapServiceLayer","dojo/dom-class","esri/symbols/SimpleFillSymbol","esri/symbols/SimpleMarkerSymbol","esri/symbols/SimpleLineSymbol","esri/dijit/Popup","dojo/_base/array","esri/Color","dojo/dom-construct","dijit/popup","esri/lang","esri/graphic","dojo/dom-style","esri/renderers/UniqueValueRenderer","esri/dijit/InfoWindow","esri/dijit/BasemapGallery","esri/SnappingManager","esri/toolbars/draw","esri/symbols/TextSymbol","esri/layers/LabelClass","esri/InfoTemplate","esri/tasks/IdentifyTask","esri/tasks/IdentifyParameters","esri/config","esri/renderers/SimpleRenderer","dojo/domReady!"],function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt){function rt(){var n,l,r,a,u,v;try{window.console&&console.info("mapReady");app.map.on("mouse-up",mapResetNavigationRightClick);app.map.setExtent(new esri.geometry.Extent({xmin:-10873023.954135397,ymin:3256254.6955210692,xmax:-8524878.4452154059,ymax:4295798.2801991906,spatialReference:{wkid:102100}}));app.navToolbar=new t(app.map);dojo.connect(app.navToolbar,"onExtentHistoryChange",mapResetNavigation);app.map.infoWindow.resize(220,60);app.map.infoWindow.wintype="";app.map.graphics.enableMouseEvents();app.doHover=!0;app.mapZoomLayer=new esri.layers.GraphicsLayer;app.mapZoomLayer.id="MapZoom";app.map.addLayer(app.mapZoomLayer);var f=new e(e.STYLE_SQUARE,tdmaConstants.TDMPublicSymbolSize,new o(o.STYLE_SOLID,new c([0,0,175,.9]),1),new c([0,0,200,.75])),s=new e(e.STYLE_CIRCLE,tdmaConstants.TDMPublicSymbolSize,new o(o.STYLE_SOLID,new c([200,0,0,.9]),1),new c([225,0,0,.75])),h=new e(e.STYLE_CIRCLE,tdmaConstants.TDMPublicSymbolSize,new o(o.STYLE_SOLID,new c([0,125,0,.9]),1),new c([0,150,0,.75]));app.trafficCounterPerm=new i(tdmaConstants.TDMPublicTrafficCounterPointFeatureLayerURL,{id:"Perm",mode:i.MODE_ONDEMAND,outFields:["TrafficCounterDetailID","LUCounterTypeID","ATRNumber","LUCountyID","Station","AADT","YearAADT","KFactor","DFactor","TADT"]});app.trafficCounterPerm.setDefinitionExpression("YearAADT="+app.countYearPublished+" and LUCounterTypeID in (2) and IsActive = 1");n=(new nt).setColor(new c([200,0,0]));n.font.setSize("8pt");n.font.setFamily("arial");l={labelExpressionInfo:{expression:countyLabelDecode},labelPlacement:"above-right"};app.trafficCounterPermLabelClass=new tt(l);app.trafficCounterPermLabelClass.symbol=n;app.trafficCounterPerm.setLabelingInfo([app.trafficCounterPermLabelClass]);app.trafficCounterPerm.on("load",function(){app.trafficCounterPerm.minScale=tdmaConstants.TDMPublicPermMinScale;app.trafficCounterPerm.maxScale=0});app.trafficCounterPermRenderer=new w(s,"LUCounterTypeID");app.trafficCounterPermRenderer.addValue({value:"2",symbol:s,label:"Permanent",description:"Permanent Traffic Counter"});app.trafficCounterPerm.setRenderer(app.trafficCounterPermRenderer);app.map.addLayer(app.trafficCounterPerm);app.trafficCounterPort=new i(tdmaConstants.TDMPublicTrafficCounterPointFeatureLayerURL,{id:"Port",mode:i.MODE_ONDEMAND,outFields:["TrafficCounterDetailID","LUCounterTypeID","ATRNumber","LUCountyID","Station","AADT","YearAADT","KFactor","DFactor","TADT"]});app.trafficCounterPort.setDefinitionExpression("YearAADT="+app.countYearPublished+" and LUCounterTypeID in (1) and IsActive = 1");r=(new nt).setColor(new c([0,0,175]));r.font.setSize("8pt");r.font.setFamily("arial");a={labelExpressionInfo:{expression:countyLabelDecode},labelPlacement:"above-right"};app.trafficCounterPortLabelClass=new tt(a);app.trafficCounterPortLabelClass.symbol=r;app.trafficCounterPort.setLabelingInfo([app.trafficCounterPortLabelClass]);app.trafficCounterPort.on("load",function(){app.trafficCounterPort.minScale=tdmaConstants.TDMPublicPortMinScale;app.trafficCounterPort.maxScale=0});app.trafficCounterPortRenderer=new w(f,"LUCounterTypeID");app.trafficCounterPortRenderer.addValue({value:"1",symbol:f,label:"Portable",description:"Portable Traffic Counter"});app.trafficCounterPort.setRenderer(app.trafficCounterPortRenderer);app.map.addLayer(app.trafficCounterPort);app.trafficCounterVirtual=new i(tdmaConstants.TDMPublicTrafficCounterPointFeatureLayerURL,{id:"Virtual",mode:i.MODE_ONDEMAND,outFields:["TrafficCounterDetailID","LUCounterTypeID","ATRNumber","LUCountyID","Station","AADT","YearAADT","KFactor","DFactor","TADT"]});app.trafficCounterVirtual.setDefinitionExpression("YearAADT="+app.countYearPublished+" and LUCounterTypeID in (4) and IsActive = 1");u=(new nt).setColor(new c([0,125,0]));u.font.setSize("8pt");u.font.setFamily("arial");v={labelExpressionInfo:{expression:countyLabelDecode},labelPlacement:"above-right"};app.trafficCounterVirtualLabelClass=new tt(v);app.trafficCounterVirtualLabelClass.symbol=u;app.trafficCounterVirtual.setLabelingInfo([app.trafficCounterVirtualLabelClass]);app.trafficCounterVirtual.on("load",function(){app.trafficCounterVirtual.minScale=tdmaConstants.TDMPublicVirtualMinScale;app.trafficCounterVirtual.maxScale=0});app.trafficCounterVirtualRenderer=new w(h,"LUCounterTypeID");app.trafficCounterVirtualRenderer.addValue({value:"4",symbol:h,label:"Virtual",description:"Virtual Traffic Counter"});app.trafficCounterVirtual.setRenderer(app.trafficCounterVirtualRenderer);app.map.addLayer(app.trafficCounterVirtual);app.trafficCounterPerm.on("mouse-over",trafficCounterMouseOver);app.trafficCounterPort.on("mouse-over",trafficCounterMouseOver);app.trafficCounterVirtual.on("mouse-over",trafficCounterMouseOver);app.trafficCounterPerm.on("mouse-out",closeMapDialog);app.trafficCounterPort.on("mouse-out",closeMapDialog);app.trafficCounterVirtual.on("mouse-out",closeMapDialog);app.trafficCounterPerm.on("click",trafficCounterMouseClick);app.trafficCounterPort.on("click",trafficCounterMouseClick);app.trafficCounterVirtual.on("click",trafficCounterMouseClick);loadZoomCityDropDown("indexZoomToCity")}catch(y){window.console&&console.error("mapReady: "+y.toString())}}var it=new s({fillSymbol:new f(f.STYLE_SOLID,new o(o.STYLE_SOLID,new c([255,0,0]),2),new c([255,255,0,.25]))},l.create("div"));app.map=new n("map",{basemap:"osm",zoom:18,center:[-83.275,42.573],showLabels:!0,infoWindow:it});app.map.on("load",rt);app.rceLayer=app.map.addLayer(new r(tdmaConstants.TDMPublicMapServiceURL,{opacity:.75}))})}function closeMapDialog(){app.map.infoWindow.wintype!="counterClick"&&(app.map.graphics.clear(),app.map.infoWindow.hide())}function mapResetNavigationRightClick(n){n.which==3&&(app.navToolbar.deactivate(),$("#indexZoomAreaImage").removeClass("indexImageSelected"),app.doHover=!0,app.map.graphics.clear(),n.currentTarget.oncontextmenu="return false;")}function mapResetNavigation(){app.navToolbar.deactivate();$("#indexZoomAreaImage").removeClass("indexImageSelected");app.doHover=!0;app.map.graphics.clear()}function trafficCounterMouseOver(n){var t,i,r,u,f;(app.map.infoWindow.isShowing!=!0||app.map.infoWindow.wintype!="counterClick")&&(app.map.infoWindow.clearFeatures(),app.map.infoWindow.resize(300,150),t=n.graphic.attributes,lastCounterTypeIDHoveredOrClicked=t.LUCounterTypeID.toString(),i=gCodeLists.County.codeListEntries[t.LUCountyID-1].codeName,r="N/A",t.AADT!=null&&(r=numberWithCommas(t.AADT.toString())),u="Counter ID: "+i+" "+t.Station,f="<div><b>County:<\/b> "+i+"<\/div><div><b>"+t.YearAADT+" AADT:<\/b> "+r+"<\/div>",app.map.infoWindow.setTitle(u),app.map.infoWindow.setContent(f),app.map.infoWindow.wintype="counterHover",app.map.infoWindow.show(n.mapPoint))}function trafficCounterMouseClick(n){var i,f,e,t;if(n.graphic.attributes!=undefined){mapDisableAllMouseEvents();i=n.graphic.attributes;lastCounterTypeIDHoveredOrClicked=i.LUCounterTypeID.toString();var a=gCodeLists.County.codeListEntries[i.LUCountyID-1].codeName,o="N/A",s="N/A",h="N/A",c="N/A";i.AADT!=null&&(o=numberWithCommas(i.AADT.toString()));i.KFactor!=null&&(s=i.KFactor);i.DFactor!=null&&(h=i.DFactor);i.TADT!=null&&(c=i.TADT);f="";e="";i.LUCounterTypeID==2&&(f="(CCS# "+i.ATRNumber.toString()+")",e=i.ATRNumber.toString());var r=i.YearAADT.toString(),v=i.LUCountyID,y=i.Station.toString(),u=i.LUCounterTypeID.toString(),p="<select class='formField' onchange='trafficCounterClickYearChange()' id='trafficCounterClickYear'><option value='"+r+"'>"+r+"<\/option><\/select>";if(selectedCounterIDString=a+" "+i.Station+" "+f,t="<div style='margin-bottom:10px;' class='disable-dbl-tap-zoom' id='infoWindowDiv' data-CounterTypeID='"+u+"' data-CountyID='"+i.LUCountyID+"' data-Station='"+i.Station+"' data-CCS='"+i.ATRNumber+"'><b>Counter ID: "+selectedCounterIDString+"<\/b><\/div>",t+="<table style='width:100%; height:100%'>",t+="<colgroup >",t+="<col style='width:52%;'/>",t+="<col style='width:48%;'/>",t+="<tbody>",t+="<tr style='height:20px'><td style='text-align:left;overflow:hidden'><b>AADT Year: <\/b>"+p+"<\/td><td style='text-align:left;overflow:hidden;'><b>AADT: <\/b><label id='trafficCounterAADT'>"+o+"<\/label><\/td><\/tr>",t+="<tr style='height:20px'><td style='text-align:left;overflow:hidden'><b>K Factor: <\/b><label id='trafficCounterKFactor'>"+s+"<\/label><\/td><td style='text-align:left;overflow:hidden;'><b>TADT %: <\/b><label id='trafficCounterTADT'>"+c+"<\/label><\/td><\/tr>",t+="<tr style='height:20px'><td style='text-align:left;overflow:hidden'><b>D Factor: <\/b><label id='trafficCounterDFactor'>"+h+"<\/label><\/td><td style='text-align:left;overflow:hidden;'><a href='javascript:indexRequestInformation();' id='requestInformationLink' style='float:left'>Request Information<\/a><\/td><\/tr>",t+="<\/tbody><\/table>",i.LUCounterTypeID==2){var w="<select style='width:80px;text-align:center;margin-left:13px;' disabled='disabled' type='text' class='formFieldDisabled' id='LDTAnnualYear'><option value=''><\/option><option value='"+r+"'>"+r+"<\/option><\/select>",l="<input id='LDTOpenPDFButton' style='width:100px;' type='button' class='button' value='Open as PDF' onclick='LDTOpenPDF()' />";t+="<div id='infoWindowReportArrowDiv' style='height:24px;border-top:1px solid black;border-bottom:1px solid black;width:300px;margin-left:-10px;font-weight:bold;'><img id='infoWindowDownArrow' onclick='infoWindowArrowChange()' style='display:none;height:16px;margin-right:3px;margin-top:3px;cursor:pointer;' src='./Content/Images/down-arrow.png' /><img id='infoWindowRightArrow' onclick='infoWindowArrowChange(this)' style='display:inline;height:16px;margin-right:3px;margin-top:3px;cursor:pointer;' src='./Content/Images/right-arrow.png' /><label style='position:relative;top:-4px;cursor:pointer;' onclick='infoWindowArrowChange()'>Traffic Volume Reports<\/label><\/div>";t+="<div id='infoWindowReportDiv' style='display:none;'>";t+="<table style='width:100%; height:100%'>";t+="<colgroup >";t+="<col style='width:58%;'/>";t+="<col style='width:42%;'/>";t+="<tbody>";t+="<tr style='height:40px'><td style='text-align:left;overflow:hidden'><input type='radio' style='margin:0px;position:relative;top:3px;' checked='checked' name='LDTDateRadio' id='LDTDailyRadio' value='daily' onchange='LDTDateRadioChanged()' /><label> Daily<\/label><input style='width:80px;text-align:center;margin-left:25px;' maxlength='10' type='text' readonly='true' autocomplete='off' placeholder='MM/DD/YYYY' class='formField' id='LDTDailyDate' /><\/td><td style='text-align:left;overflow:hidden;'><input type='radio' style='margin:0px;position:relative;top:3px;' checked='checked' name='LDTTypeRadio' value='direction' id='LDTTypeDirection' /><label> Direction<\/label><\/td><\/tr>";t+="<tr style='height:20px'><td style='text-align:left;overflow:hidden'><input type='radio' style='margin:0px;position:relative;top:3px;' name='LDTDateRadio' value='monthly' id='LDTMonthlyRadio' onchange='LDTDateRadioChanged()' /><label> Monthly<\/label><input style='width:80px;text-align:center;margin-left:7px;' maxlength='7' disabled='disabled' type='text' readonly='true' autocomplete='off' class='formField' id='LDTMonthlyDate' /><\/td><td style='text-align:left;overflow:hidden;'><input type='radio' style='margin:0px;position:relative;top:3px;' name='LDTTypeRadio' value='lane' id='LDTTypeLane' /><label> Lane<\/label><\/td><\/tr>";t+="<tr style='height:40px'><td style='text-align:left;overflow:hidden'><input type='radio' style='margin:0px;position:relative;top:3px;' name='LDTDateRadio' value='annual' id='LDTAnnualRadio' onchange='LDTDateRadioChanged()' /><label> Annual<\/label>"+w+"<\/td><td style='text-align:left;overflow:hidden;'><input type='radio' disabled='disabled' style='margin:0px;position:relative;top:3px;' name='LDTTypeRadio' value='total' id='LDTTypeTotal' /><label> Total<\/label><\/td><\/tr>";t+="<\/tbody><\/table>";t+="<div style='text-align:center;margin-top:3px;'>"+l+"<\/div>";t+="<\/div >";app.map.infoWindow.resize(300,600)}else if(i.LUCounterTypeID==1){var l="<input id='LDTOpenPDFButton' style='width:100px;' type='button' class='button' value='Open as PDF' onclick='LDTOpenPDF()' />";t+="<div id='infoWindowReportArrowDiv' style='height:24px;border-top:1px solid black;border-bottom:1px solid black;width:300px;margin-left:-10px;font-weight:bold;'><img id='infoWindowDownArrow' onclick='infoWindowArrowChange()' style='display:none;height:16px;margin-right:3px;margin-top:3px;cursor:pointer;' src='./Content/Images/down-arrow.png' /><img id='infoWindowRightArrow' onclick='infoWindowArrowChange(this)' style='display:inline;height:16px;margin-right:3px;margin-top:3px;cursor:pointer;' src='./Content/Images/right-arrow.png' /><label style='position:relative;top:-4px;cursor:pointer;' onclick='infoWindowArrowChange()'>Portable Direction Reports<\/label><\/div>";t+="<div id='infoWindowReportDiv' style='display:none;'>";t+="<table style='width:100%; height:100%'>";t+="<colgroup >";t+="<col style='width:100%;'/>";t+="<tbody>";t+="<tr style='height:40px'><td style='text-align:left;overflow:hidden;'><input type='radio' style='margin:0px;position:relative;top:3px;' checked='checked' name='LDTReportTypeRadio' onchange='LDTReportTypeRadioChanged()' id='LDTVolumeRadio' value='volume' /><label> Volume<\/label><select style='width:90px;text-align:center;margin-left:7px;' type='text' class='formField' id='LDTVolumeDailyDate'><option value=''><\/option><\/select><\/td><\/tr>";t+="<tr style='height:20px'><td style='text-align:left;overflow:hidden;'><input type='radio' style='margin:0px;position:relative;top:3px;' name='LDTReportTypeRadio' id='LDTClassRadio' onchange='LDTReportTypeRadioChanged()' value='class' /><label> Class<\/label><select style='width:90px;text-align:center;margin-left:19px;' type='text' disabled='disabled' class='formFieldDisabled' id='LDTClassDailyDate'><option value=''><\/option><\/select><\/td><\/tr>";t+="<\/tbody><\/table>";t+="<div style='text-align:center;margin-top:13px;'>"+l+"<\/div>";t+="<\/div >";app.map.infoWindow.resize(300,600)}else app.map.infoWindow.resize(300,600);app.map.infoWindow.setTitle("Counter Location");app.map.infoWindow.setContent(t);app.map.infoWindow.wintype="counterClick";app.map.infoWindow.show(n.mapPoint);document.getElementById("LDTDailyDate")!=null&&$("#LDTDailyDate").datepicker({changeMonth:!0,changeYear:!0});document.getElementById("LDTMonthlyDate")!=null&&($("#LDTMonthlyDate").datepicker({changeMonth:!0,changeYear:!0,showButtonPanel:!0,dateFormat:"mm/yy",onClose:function(){var n=$("#ui-datepicker-div .ui-datepicker-month :selected").val(),t=$("#ui-datepicker-div .ui-datepicker-year :selected").val();$(this).val($.datepicker.formatDate("mm/yy",new Date(t,n,1)))}}),$("#LDTMonthlyDate").focus(function(){$(".ui-datepicker-calendar").hide();$("#ui-datepicker-div").position({my:"center top",at:"center bottom",of:$(this)})}));$.ajax({url:"./Misc/trafficCounterClick?year="+r+"&countyID="+v+"&station="+y+"&counterTypeID="+u+"&ccs="+e,success:function(n){n.err!=null?(closeWait(),alert(n.err)):(document.getElementById("trafficCounterClickYear")!=null&&n.aadtYearHTML!=""&&(document.getElementById("trafficCounterClickYear").innerHTML=n.aadtYearHTML),u=="2"&&document.getElementById("LDTAnnualYear")!=null&&n.annualReportYearHTML!=""&&(document.getElementById("LDTAnnualYear").innerHTML=n.annualReportYearHTML),u=="1"&&document.getElementById("LDTVolumeDailyDate")!=null&&document.getElementById("LDTClassDailyDate")!=null&&n.dailyReportDatesHTML!=""&&n.dailyClassReportDatesHTML!=""&&(document.getElementById("LDTVolumeDailyDate").innerHTML=n.dailyReportDatesHTML,document.getElementById("LDTClassDailyDate").innerHTML=n.dailyClassReportDatesHTML,document.getElementById("LDTVolumeDailyDate").options.length<=1&&document.getElementById("LDTClassDailyDate").options.length<=1?(document.getElementById("LDTVolumeRadio").disabled=!0,document.getElementById("LDTClassRadio").disabled=!0,document.getElementById("LDTVolumeDailyDate").disabled=!0,document.getElementById("LDTVolumeDailyDate").className="formFieldDisabled",document.getElementById("LDTOpenPDFButton").disabled=!0):document.getElementById("LDTVolumeDailyDate").options.length<=1?(document.getElementById("LDTVolumeRadio").disabled=!0,document.getElementById("LDTClassRadio").checked=!0,document.getElementById("LDTClassDailyDate").disabled=!1,document.getElementById("LDTClassDailyDate").className="formField",document.getElementById("LDTVolumeDailyDate").value="",document.getElementById("LDTVolumeDailyDate").disabled=!0,document.getElementById("LDTVolumeDailyDate").className="formFieldDisabled"):document.getElementById("LDTClassDailyDate").options.length<=1&&(document.getElementById("LDTClassRadio").disabled=!0)));mapEnableAllMouseEvents()},error:function(n,t,i){alert(i);mapEnableAllMouseEvents()}})}}function loadModal(n,t,i){loadModal(n,t,i,null,null)}function loadModal(n,t,i,r,u){var f;f="modal";$("#"+f+"Dialog").is(":visible")&&(f="modal2",$("#"+f+"Dialog").is(":visible")&&(f="modal3"));$.ajax({type:"POST",url:"./Home/GetPane?pane="+n,cache:!1,success:function(n){var e,o,s,h;$("#"+f+"Dialog").html(n);$("#"+f+"Dialog").css("height",i);$("#"+f+"Dialog").css("width",t);e=$(document).height();o=$(window).width();$("#"+f+"Mask").css({width:o,height:e});s=$(window).height();h=$(window).width();r==null||u==null?($("#"+f+"Dialog").css("top",s/2-$("#"+f+"Dialog").height()/2),$("#"+f+"Dialog").css("left",h/2-$("#"+f+"Dialog").width()/2-15)):($("#"+f+"Dialog").css("top",r),$("#"+f+"Dialog").css("left",u));$("#"+f+"Mask").fadeIn("fast",function(){$("#"+f+"Dialog").fadeIn("fast")})},error:function(t,i,r){alert("Request failed.  Failed to retrieve "+n+". \n"+r)}})}function displayModal(){var n,t,i,r,u;n="modal";$("#"+n+"Dialog").is(":visible")&&(n="modal2",$("#"+n+"Dialog").is(":visible")&&(n="modal3"));t=$(document).height();i=$(window).width();$("#"+n+"Mask").css({width:i,height:t});r=$(window).height();u=$(window).width();$("#"+n+"Dialog").css("top",r/2-$("#"+n+"Dialog").height()/2);$("#"+n+"Dialog").css("left",u/2-$("#"+n+"Dialog").width()/2-15);$("#"+n+"Mask").fadeIn("slow",function(){$("#"+n+"Dialog").fadeIn("slow")})}function closeModal(){var n;n="modal3";$("#"+n+"Dialog").is(":visible")||(n="modal2",$("#"+n+"Dialog").is(":visible")||(n="modal"));$("#"+n+"Dialog").hide();$("#"+n+"Mask").hide()}function closeModalSlow(){var n;n="modal3";$("#"+n+"Dialog").is(":visible")||(n="modal2",$("#"+n+"Dialog").is(":visible")||(n="modal"));$("#"+n+"Dialog").fadeOut("slow");$("#"+n+"Mask").fadeOut("slow")}function kd(n){var t=n||window.event,i=t.which||t.keyCode;i==8&&(t.srcElement.nodeName!="INPUT"&&t.srcElement.nodeName!="TEXTAREA"&&t.preventDefault(),t.srcElement.getAttribute("readonly")=="readonly"&&t.preventDefault(),t.srcElement.nodeName=="SELECT"&&t.preventDefault())}function loadAllCodeLists(){if(app.codeLists.Message==undefined)if(app.codeLists[0].Name=="GetAllCodeListsERROR")alert(app.codeLists[0].Value);else for(gCodeLists=[],i=0;i<app.codeLists.length;i++)gCodeLists[app.codeLists[i].codeListName]=app.codeLists[i]}function getTDMAConstants(n){if(app.constants.Message==undefined){if(app.constants[0].Name=="GetTDMAConstantsERROR")alert(app.constants[0].Value);else if(app.constants[0].Name=="GetTDMAConstantsNOROWS")tdmaConstants=[];else for(tdmaConstants=[],i=0;i<app.constants.length;i++)tdmaConstants[app.constants[i].Name]=app.constants[i].Value;n&&n()}}function closeWait(){$("#waitImage").css("display","");$("#Wait").css("display","none")}function showWait(){$("#Wait").css("display","");arguments.length>0?$("#WaitMessage").html(arguments[0]):$("#WaitMessage").html("Working...")}function setWaitMsg(n){$("#WaitMessage").html(n)}function loadIndex(){loadCountyLabelDecode();PopulateDropDown("indexZoomToCounty","County",1,1);loadTrafficYearDropDown("indexTrafficYear");loadDisclaimer();try{initializeMap()}catch(n){mapComplete();alert("Error while initializing map: "+n.message)}}function loadDisclaimer(){document.getElementById("middleDivDisclaimer").innerHTML=tdmaConstants.TDMPublicDisclaimer;window.innerWidth<=767&&$.ajax({url:"./Home/GetPane",cache:!1,data:{pane:"DisclaimerPopUp"},success:function(n){$("#modalDialog").html(n);$("#modalDialog").css("height",140);$("#modalDialog").css("width",310);displayModal();closeWait()},error:function(n,t,i){alert("Request failed. Failed to open Disclaimer interface. \n"+i);closeWait()}})}function DisclaimerPopUpLoad(){document.getElementById("DisclaimerPopUpDiv").innerHTML=tdmaConstants.TDMPublicDisclaimer}function mapComplete(){closeWait()}function loadZoomCityDropDown(n){var i=new esri.tasks.QueryTask(tdmaConstants.TDMPublicMapServiceURL+"/"+tdmaConstants.Map_TDMPublicCityBoundary),t=new esri.tasks.Query;t.returnGeometry=!1;t.outFields=["OBJECTID","BoundaryName"];t.orderByFields=["BoundaryName"];t.returnDistinctValues=!0;t.where="1=1";t.outSpatialReference=app.map.spatialReference;t.spatialReference=esri.tasks.Query.SPATIAL_REL_INTERSECTS;i.execute(t,function(t){var r,i;for(obj=document.getElementById(n),obj.options.length=0,obj[0]=new Option("",""),r=1,i=0;i<t.features.length;i++)obj[r]=new Option(t.features[i].attributes.BoundaryName,t.features[i].attributes.OBJECTID),obj[r].title=t.features[i].attributes.BoundaryName,r=r+1;document.getElementById(n).selectedIndex=0})}function loadTrafficYearDropDown(n){$.ajax({url:"./Misc/GetTrafficYears",success:function(t){t.substring(0,5)=="ERROR"?(closeWait(),alert(t)):(closeWait(),obj=document.getElementById(n),obj.innerHTML=t,trafficYearDropdownHTML==""&&(trafficYearDropdownHTML=t))},error:function(n,t,i){alert(i)}})}function loadCountyLabelDecode(){countyLabelDecode="var countyID = $feature.LUCountyID; var station = $feature.Station;  if (countyID == 0) { return 'On-System (' + station + ')'; }";countyLabelDecode+=" if (countyID == 1) { return 'Autauga (' + station + ')'; }";countyLabelDecode+=" if (countyID == 2) { return 'Baldwin (' + station + ')'; }";countyLabelDecode+=" if (countyID == 3) { return 'Barbour (' + station + ')'; }";countyLabelDecode+=" if (countyID == 4) { return 'Bibb (' + station + ')'; }";countyLabelDecode+=" if (countyID == 5) { return 'Blount (' + station + ')'; }";countyLabelDecode+=" if (countyID == 6) { return 'Bullock (' + station + ')'; }";countyLabelDecode+=" if (countyID == 7) { return 'Butler (' + station + ')'; }";countyLabelDecode+=" if (countyID == 8) { return 'Calhoun (' + station + ')'; }";countyLabelDecode+=" if (countyID == 9) { return 'Chambers (' + station + ')'; }";countyLabelDecode+=" if (countyID == 10) { return 'Cherokee (' + station + ')'; }";countyLabelDecode+=" if (countyID == 11) { return 'Chilton (' + station + ')'; }";countyLabelDecode+=" if (countyID == 12) { return 'Choctaw (' + station + ')'; }";countyLabelDecode+=" if (countyID == 13) { return 'Clarke (' + station + ')'; }";countyLabelDecode+=" if (countyID == 14) { return 'Clay (' + station + ')'; }";countyLabelDecode+=" if (countyID == 15) { return 'Cleburne (' + station + ')'; }";countyLabelDecode+=" if (countyID == 16) { return 'Coffee (' + station + ')'; }";countyLabelDecode+=" if (countyID == 17) { return 'Colbert (' + station + ')'; }";countyLabelDecode+=" if (countyID == 18) { return 'Conecuh (' + station + ')'; }";countyLabelDecode+=" if (countyID == 19) { return 'Coosa (' + station + ')'; }";countyLabelDecode+=" if (countyID == 20) { return 'Covington (' + station + ')'; }";countyLabelDecode+=" if (countyID == 21) { return 'Crenshaw (' + station + ')'; }";countyLabelDecode+=" if (countyID == 22) { return 'Cullman (' + station + ')'; }";countyLabelDecode+=" if (countyID == 23) { return 'Dale (' + station + ')'; }";countyLabelDecode+=" if (countyID == 24) { return 'Dallas (' + station + ')'; }";countyLabelDecode+=" if (countyID == 25) { return 'DeKalb (' + station + ')'; }";countyLabelDecode+=" if (countyID == 26) { return 'Elmore (' + station + ')'; }";countyLabelDecode+=" if (countyID == 27) { return 'Escambia (' + station + ')'; }";countyLabelDecode+=" if (countyID == 28) { return 'Etowah (' + station + ')'; }";countyLabelDecode+=" if (countyID == 29) { return 'Fayette (' + station + ')'; }";countyLabelDecode+=" if (countyID == 30) { return 'Franklin (' + station + ')'; }";countyLabelDecode+=" if (countyID == 31) { return 'Geneva (' + station + ')'; }";countyLabelDecode+=" if (countyID == 32) { return 'Greene (' + station + ')'; }";countyLabelDecode+=" if (countyID == 33) { return 'Hale (' + station + ')'; }";countyLabelDecode+=" if (countyID == 34) { return 'Henry (' + station + ')'; }";countyLabelDecode+=" if (countyID == 35) { return 'Houston (' + station + ')'; }";countyLabelDecode+=" if (countyID == 36) { return 'Jackson (' + station + ')'; }";countyLabelDecode+=" if (countyID == 37) { return 'Jefferson (' + station + ')'; }";countyLabelDecode+=" if (countyID == 38) { return 'Lamar (' + station + ')'; }";countyLabelDecode+=" if (countyID == 39) { return 'Lauderdale (' + station + ')'; }";countyLabelDecode+=" if (countyID == 40) { return 'Lawrence (' + station + ')'; }";countyLabelDecode+=" if (countyID == 41) { return 'Lee (' + station + ')'; }";countyLabelDecode+=" if (countyID == 42) { return 'Limestone (' + station + ')'; }";countyLabelDecode+=" if (countyID == 43) { return 'Lowndes (' + station + ')'; }";countyLabelDecode+=" if (countyID == 44) { return 'Macon (' + station + ')'; }";countyLabelDecode+=" if (countyID == 45) { return 'Madison (' + station + ')'; }";countyLabelDecode+=" if (countyID == 46) { return 'Marengo (' + station + ')'; }";countyLabelDecode+=" if (countyID == 47) { return 'Marion (' + station + ')'; }";countyLabelDecode+=" if (countyID == 48) { return 'Marshall (' + station + ')'; }";countyLabelDecode+=" if (countyID == 49) { return 'Mobile (' + station + ')'; }";countyLabelDecode+=" if (countyID == 50) { return 'Monroe (' + station + ')'; }";countyLabelDecode+=" if (countyID == 51) { return 'Montgomery (' + station + ')'; }";countyLabelDecode+=" if (countyID == 52) { return 'Morgan (' + station + ')'; }";countyLabelDecode+=" if (countyID == 53) { return 'Perry (' + station + ')'; }";countyLabelDecode+=" if (countyID == 54) { return 'Pickens (' + station + ')'; }";countyLabelDecode+=" if (countyID == 55) { return 'Pike (' + station + ')'; }";countyLabelDecode+=" if (countyID == 56) { return 'Randolph (' + station + ')'; }";countyLabelDecode+=" if (countyID == 57) { return 'Russell (' + station + ')'; }";countyLabelDecode+=" if (countyID == 58) { return 'Saint Clair (' + station + ')'; }";countyLabelDecode+=" if (countyID == 59) { return 'Shelby (' + station + ')'; }";countyLabelDecode+=" if (countyID == 60) { return 'Sumter (' + station + ')'; }";countyLabelDecode+=" if (countyID == 61) { return 'Talladega (' + station + ')'; }";countyLabelDecode+=" if (countyID == 62) { return 'Tallapoosa (' + station + ')'; }";countyLabelDecode+=" if (countyID == 63) { return 'Tuscaloosa (' + station + ')'; }";countyLabelDecode+=" if (countyID == 64) { return 'Walker (' + station + ')'; }";countyLabelDecode+=" if (countyID == 65) { return 'Washington (' + station + ')'; }";countyLabelDecode+=" if (countyID == 66) { return 'Wilcox (' + station + ')'; }";countyLabelDecode+=" if (countyID == 67) { return 'Winston (' + station + ')'; }"}function indexMenuToggle(){var n=document.getElementById("middleDiv").classList.contains("showMiddleDiv");n==!0?$("#middleDiv").removeClass("showMiddleDiv"):$("#middleDiv").addClass("showMiddleDiv")}function indexMapFullExtent(){app.map.setExtent(new esri.geometry.Extent({xmin:-10873023.954135397,ymin:3256254.6955210692,xmax:-8524878.4452154059,ymax:4295798.2801991906,spatialReference:{wkid:102100}}));document.getElementById("indexZoomToCounty").value="";document.getElementById("indexZoomToCity").value="";app.mapZoomLayer.clear()}function indexZoomArea(){document.getElementById("indexZoomAreaImage").className.indexOf("indexImageSelected")>-1?(app.navToolbar.deactivate(),document.getElementById("indexZoomAreaImage").classList.remove("indexImageSelected")):(document.getElementById("indexZoomAreaImage").classList.add("indexImageSelected"),app.navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN))}function indexTrafficYearChange(){showWait();app.map.infoWindow.hide();var n=document.getElementById("indexTrafficYear").value;app.trafficCounterPerm.setDefinitionExpression("YearAADT="+n+" and LUCounterTypeID in (2) and IsActive = 1");app.trafficCounterPort.setDefinitionExpression("YearAADT="+n+" and LUCounterTypeID in (1) and IsActive = 1");app.trafficCounterVirtual.setDefinitionExpression("YearAADT="+n+" and LUCounterTypeID in (4) and IsActive = 1");closeWait()}function indexZoomToCountyChange(){var t=document.getElementById("indexZoomToCounty").value;if(t!=""){document.getElementById("indexZoomToCity").value="";showWait();app.mapZoomLayer.clear();var i=parseInt(t)*2-1,r=new esri.tasks.QueryTask(tdmaConstants.TDMPublicMapServiceURL+"/"+tdmaConstants.Map_TDMPublicCountyBoundary),n=new esri.tasks.Query;n.returnGeometry=!0;n.where="CountyFP10 = "+i;n.outSpatialReference=app.map.spatialReference;n.spatialReference=esri.tasks.Query.SPATIAL_REL_INTERSECTS;r.execute(n,function(n){for(var r,i,u,f,t=0;t<n.features.length;t++)r=new esri.geometry.Polygon(n.features[t].geometry),r.setSpatialReference(app.map.spatialReference),i=esri.symbol.SimpleFillSymbol(),i.setOutline(new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new esri.Color.fromRgb(tdmaConstants.TDMPublicZoomCityCountyColor),tdmaConstants.TDMPublicZoomCityCountyLineWidth)),i.setStyle(esri.symbol.SimpleFillSymbol.STYLE_NULL),u=new esri.Graphic(r,i),u.setAttributes({SearchType:"Zoom to County",Name:"Zoom to County",Type:"Zoom to County"}),app.mapZoomLayer.add(u);f=esri.graphicsExtent(app.mapZoomLayer.graphics);app.map.setExtent(f,!0);closeWait()})}}function indexZoomToCityChange(){var t=document.getElementById("indexZoomToCity").value,i,n;t!=""&&(document.getElementById("indexZoomToCounty").value="",showWait(),app.mapZoomLayer.clear(),i=new esri.tasks.QueryTask(tdmaConstants.TDMPublicMapServiceURL+"/"+tdmaConstants.Map_TDMPublicCityBoundary),n=new esri.tasks.Query,n.returnGeometry=!0,n.where="OBJECTID = "+t,n.outSpatialReference=app.map.spatialReference,n.spatialReference=esri.tasks.Query.SPATIAL_REL_INTERSECTS,i.execute(n,function(n){for(var r,i,u,f,t=0;t<n.features.length;t++)r=new esri.geometry.Polygon(n.features[t].geometry),r.setSpatialReference(app.map.spatialReference),i=esri.symbol.SimpleFillSymbol(),i.setOutline(new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new esri.Color.fromRgb(tdmaConstants.TDMPublicZoomCityCountyColor),tdmaConstants.TDMPublicZoomCityCountyLineWidth)),i.setStyle(esri.symbol.SimpleFillSymbol.STYLE_NULL),u=new esri.Graphic(r,i),u.setAttributes({SearchType:"Zoom to City",Name:"Zoom to City",Type:"Zoom to City"}),app.mapZoomLayer.add(u);f=esri.graphicsExtent(app.mapZoomLayer.graphics);app.map.setExtent(f,!0);closeWait()}))}function indexPrint(){window.print()}function indexHelp(){var n=window.open("./Content/TDMHelp.pdf","_self")}function indexMobileHelp(){var n=window.open("./Content/MobileTDMHelp.pdf","_self")}function indexRequestInformation(){showWait();document.getElementById("requestInformationLink").disabled=!0;mapDisableAllMouseEvents();$.ajax({url:"./Home/GetPane",cache:!1,data:{pane:"RequestInformationPopUp"},success:function(n){$("#modalDialog").html(n);$("#modalDialog").css("height",260);$("#modalDialog").css("width",315);displayModal();closeWait();document.getElementById("requestInformationLink").disabled=!1;mapEnableAllMouseEvents()},error:function(n,t,i){alert("Request failed. Failed to open Requestion Information interface. \n"+i);closeWait();document.getElementById("requestInformationLink").disabled=!1;mapEnableAllMouseEvents()}})}function indexRequestInformationLoad(){document.getElementById("RequestInformationCounterIDSpan").innerHTML=selectedCounterIDString}function indexRequestInformationClose(){closeModal()}function indexRequestInformationSendEmail(){var u,n;showWait();disableRequestInformationButtonsAndLinks();var i=document.getElementById("RequestInformationPopUpEmailName").value.trim(),t=document.getElementById("RequestInformationPopUpEmailAddress").value.trim(),r=document.getElementById("RequestInformationPopUpEmailComments").value.trim();if(i==""){alert("Must enter a valid Full Name before continuing.  Please correct and submit again.");enableRequestInformationButtonsAndLinks();closeWait();return}if(t==""){alert("Must enter a valid Email Address before continuing.  Please correct and submit again.");enableRequestInformationButtonsAndLinks();closeWait();return}if(r==""){alert("Must enter valid Request before continuing.  Please correct and submit again.");enableRequestInformationButtonsAndLinks();closeWait();return}if(u=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,!u.test(t)){alert("Email Address ("+t+") is not valid.  Please correct and submit again.");enableRequestInformationButtonsAndLinks();closeWait();return}n={counterIDString:selectedCounterIDString,name:i,emailAddress:t,comments:r};n=JSON.stringify(n);n=n.replace(/&/g,"%26");n=n.replace(/#/g,"%23");$.ajax({url:"./Misc/RequestInformation",data:"emailData="+n,cache:!1,type:"POST",success:function(n){closeWait();n.substring(0,5)=="ERROR"?(alert(n),enableRequestInformationButtonsAndLinks()):(alert("Email Successful"),indexRequestInformationClose())},error:function(n,t,i){closeWait();alert(i);enableReportButtonsAndMap()}})}function disableRequestInformationButtonsAndLinks(){document.getElementById("RequestInformationPopUpCloseLink").disabled=!0;document.getElementById("RequestInformationPopUpSendEmailButton").disabled=!0}function enableRequestInformationButtonsAndLinks(){document.getElementById("RequestInformationPopUpCloseLink").disabled=!1;document.getElementById("RequestInformationPopUpSendEmailButton").disabled=!1}function trafficCounterClickYearChange(){mapDisableAllMouseEvents();var n="N/A",t="N/A",i="N/A",r="N/A";document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-AADT")!=""&&(n=numberWithCommas(document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-AADT")));document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-KFactor")!=""&&(t=numberWithCommas(document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-KFactor")));document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-DFactor")!=""&&(i=numberWithCommas(document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-DFactor")));document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-TADT")!=""&&(r=numberWithCommas(document.getElementById("trafficCounterClickYear").options[document.getElementById("trafficCounterClickYear").selectedIndex].getAttribute("data-TADT")));document.getElementById("trafficCounterAADT").innerHTML=n;document.getElementById("trafficCounterKFactor").innerHTML=t;document.getElementById("trafficCounterDFactor").innerHTML=i;document.getElementById("trafficCounterTADT").innerHTML=r;mapEnableAllMouseEvents()}function mapDisableAllMouseEvents(){app.trafficCounterPerm.disableMouseEvents();app.trafficCounterPort.disableMouseEvents();app.trafficCounterVirtual.disableMouseEvents()}function mapEnableAllMouseEvents(){app.trafficCounterPerm.enableMouseEvents();app.trafficCounterPort.enableMouseEvents();app.trafficCounterVirtual.enableMouseEvents()}function infoWindowArrowChange(){document.getElementById("infoWindowDownArrow").style.display=="inline"?(document.getElementById("infoWindowDownArrow").style.display="none",document.getElementById("infoWindowRightArrow").style.display="inline",document.getElementById("infoWindowReportDiv").style.display="none"):(document.getElementById("infoWindowDownArrow").style.display="inline",document.getElementById("infoWindowRightArrow").style.display="none",document.getElementById("infoWindowReportDiv").style.display="")}function LDTReportTypeRadioChanged(){document.getElementById("LDTVolumeRadio").checked==!0?(document.getElementById("LDTVolumeDailyDate").disabled=!1,document.getElementById("LDTVolumeDailyDate").className="formField",document.getElementById("LDTClassDailyDate").value="",document.getElementById("LDTClassDailyDate").disabled=!0,document.getElementById("LDTClassDailyDate").className="formFieldDisabled"):(document.getElementById("LDTClassDailyDate").disabled=!1,document.getElementById("LDTClassDailyDate").className="formField",document.getElementById("LDTVolumeDailyDate").value="",document.getElementById("LDTVolumeDailyDate").disabled=!0,document.getElementById("LDTVolumeDailyDate").className="formFieldDisabled")}function LDTDateRadioChanged(){document.getElementById("LDTDailyRadio").checked==!0?(document.getElementById("LDTMonthlyDate").value="",document.getElementById("LDTAnnualYear").value="",document.getElementById("LDTDailyDate").disabled=!1,document.getElementById("LDTMonthlyDate").disabled=!0,document.getElementById("LDTAnnualYear").disabled=!0,document.getElementById("LDTAnnualYear").className="formFieldDisabled",document.getElementById("LDTTypeTotal").checked==!0&&(document.getElementById("LDTTypeDirection").checked=!0),document.getElementById("LDTTypeTotal").disabled=!0,document.getElementById("LDTDailyDate").placeholder="MM/DD/YYYY",document.getElementById("LDTMonthlyDate").placeholder=""):document.getElementById("LDTMonthlyRadio").checked==!0?(document.getElementById("LDTDailyDate").value="",document.getElementById("LDTAnnualYear").value="",document.getElementById("LDTDailyDate").disabled=!0,document.getElementById("LDTMonthlyDate").disabled=!1,document.getElementById("LDTAnnualYear").disabled=!0,document.getElementById("LDTAnnualYear").className="formFieldDisabled",document.getElementById("LDTTypeTotal").disabled=!1,document.getElementById("LDTDailyDate").placeholder="",document.getElementById("LDTMonthlyDate").placeholder="MM/YYYY"):(document.getElementById("LDTDailyDate").value="",document.getElementById("LDTMonthlyDate").value="",document.getElementById("LDTDailyDate").disabled=!0,document.getElementById("LDTMonthlyDate").disabled=!0,document.getElementById("LDTAnnualYear").disabled=!1,document.getElementById("LDTAnnualYear").className="formField",document.getElementById("LDTTypeTotal").disabled=!1,document.getElementById("LDTDailyDate").placeholder="",document.getElementById("LDTMonthlyDate").placeholder="")}function LDTOpenPDF(){var t,w,n,rt,ut,e;showWait();disableReportButtonsAndMap();t=new Date;t.setHours(0,0,0,0);t.setMonth(t.getMonth()-2);var a=t.getDate(),o=t.getMonth()+1,p=t.getFullYear();a<10&&(a="0"+a);o<10&&(o="0"+o);w=o+"/"+a+"/"+p;n=new Date;n.setHours(0,0,0,0);n.setMonth(n.getMonth()-74);n.setDate(n.getDate()+1);var v=n.getDate(),s=n.getMonth()+1,b=n.getFullYear();v<10&&(v="0"+v);s<10&&(s="0"+s);var g=s+"/"+v+"/"+b,nt=document.getElementById("infoWindowDiv").getAttribute("data-CounterTypeID"),tt=document.getElementById("infoWindowDiv").getAttribute("data-CountyID"),ft=gCodeLists.County.codeListEntries[parseInt(tt)-1].codeName,et=document.getElementById("infoWindowDiv").getAttribute("data-Station"),it="",r="",u="",k="",l="",d="",y="";if(nt=="2"){if(it=document.getElementById("infoWindowDiv").getAttribute("data-CCS"),r=document.getElementById("LDTDailyDate").value,u=document.getElementById("LDTMonthlyDate").value,k=document.getElementById("LDTAnnualYear").value,l=$("input[name='LDTDateRadio']:checked").val(),d=$("input[name='LDTTypeRadio']:checked").val(),y="volume",rt=/^\d{2}\/\d{2}\/\d{4}$/,ut=/^\d{2}\/\d{4}$/,l=="daily"){if(r==""){alert("Must enter a valid date.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}if(!rt.test(r)){alert("Invalid Date: "+r+".\nMust be of format MM/DD/YYYY.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}var f=r.split("/")[0],h=r.split("/")[1],i=r.split("/")[2],c=new Date(i,f-1,h);if(c.getMonth()+1!=f||c.getDate()!=h||c.getFullYear()!=i){alert("Invalid Date: "+r+".\nMust be of format MM/DD/YYYY.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}if(parseInt(i)>t.getFullYear()||parseInt(i)==t.getFullYear()&&parseInt(f)>t.getMonth()+1||parseInt(i)==t.getFullYear()&&parseInt(f)==t.getMonth()+1&&parseInt(h)>t.getDate()){alert("Invalid Date: "+r+".\nDate must be between "+w+" and "+g+".\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}if(parseInt(i)<n.getFullYear()||parseInt(i)==n.getFullYear()&&parseInt(f)<n.getMonth()+1||parseInt(i)==n.getFullYear()&&parseInt(f)==n.getMonth()+1&&parseInt(h)<n.getDate()){alert("Invalid Date: "+r+".\nDate must be between "+w+" and "+g+".\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}}else if(l=="monthly"){if(u==""){alert("Must enter a valid date.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}if(!ut.test(u)){alert("Invalid Date: "+u+".\nMust be of format MM/YYYY.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}var f=u.split("/")[0],h="01",i=u.split("/")[1],c=new Date(i,f-1,h);if(c.getMonth()+1!=f||c.getDate()!=h||c.getFullYear()!=i){alert("Invalid Date: "+u+".\nMust be of format MM/YYYY.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}if(parseInt(i)>t.getFullYear()||parseInt(i)==t.getFullYear()&&parseInt(f)>t.getMonth()+1){alert("Invalid Date: "+u+".\nDate must be between "+o+"/"+p+" and "+s+"/"+b+".\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}if(parseInt(i)<n.getFullYear()||parseInt(i)==n.getFullYear()&&parseInt(f)<n.getMonth()+1){alert("Invalid Date: "+u+".\nDate must be between "+o+"/"+p+" and "+s+"/"+b+".\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}}else if(k==""){alert("Must select a valid year.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}}else if(l="daily",d="direction",y=$("input[name='LDTReportTypeRadio']:checked").val(),r=y=="volume"?document.getElementById("LDTVolumeDailyDate").value:document.getElementById("LDTClassDailyDate").value,r==""){alert("Must select a valid date.\nPlease correct and submit again.");closeWait();enableReportButtonsAndMap();return}e={dateValue:l,typeValue:d,reportType:y,counterTypeID:nt,countyID:tt,countyName:ft,station:et,ccs:it,dailyDate:r,monthlyDate:u,annualYear:k,fileType:"pdf"};e=JSON.stringify(e);e=e.replace(/&/g,"%26");e=e.replace(/#/g,"%23");document.getElementById("ReportForm").action="./StandardReports/LDTReports?data="+e;document.getElementById("ReportForm").target="_blank";document.getElementById("ReportForm").submit();reportEndTimeOut=setTimeout(reportEnd,1e3)}function reportReturn(n){reportEndTimeOut!=null&&(clearTimeout(reportEndTimeOut),closeWait(),enableReportButtonsAndMap());alert(n)}function reportEnd(){closeWait();enableReportButtonsAndMap();reportEndTimeOut=null}function disableReportButtonsAndMap(){document.getElementById("togglePermCheckbox").disabled=!0;document.getElementById("togglePortCheckbox").disabled=!0;document.getElementById("toggleVirtualCheckbox").disabled=!0;document.getElementById("LDTOpenPDFButton").disabled=!0;mapDisableAllMouseEvents()}function enableReportButtonsAndMap(){document.getElementById("togglePermCheckbox").disabled=!1;document.getElementById("togglePortCheckbox").disabled=!1;document.getElementById("toggleVirtualCheckbox").disabled=!1;document.getElementById("LDTOpenPDFButton").disabled=!1;mapEnableAllMouseEvents()}function toggleCounterCheckboxChange(n){var i=n.id,t=n.checked;i=="togglePermCheckbox"?t==!0?app.trafficCounterPerm.show():(app.trafficCounterPerm.hide(),lastCounterTypeIDHoveredOrClicked=="2"&&app.map.infoWindow.hide()):i=="togglePortCheckbox"?t==!0?app.trafficCounterPort.show():(app.trafficCounterPort.hide(),lastCounterTypeIDHoveredOrClicked=="1"&&app.map.infoWindow.hide()):t==!0?app.trafficCounterVirtual.show():(app.trafficCounterVirtual.hide(),lastCounterTypeIDHoveredOrClicked=="4"&&app.map.infoWindow.hide())}var app={},countyLabelDecode="",trafficYearDropdownHTML="",selectedCounterIDString="",lastCounterTypeIDHoveredOrClicked="",reportEndTimeOut=""