var VPAjax=function(n){"use strict";var i=function(i,r,u,f){var e=n("#vp_vld_hid").val();r=JSON.stringify(r);n.ajax({headers:{valkey:e},type:"POST",url:i,data:r,dataType:u,contentType:"application/json; charset=utf-8",success:function(n){t(f,n)},error:function(n){console.log(n.responseText)}})},r=function(i,r,u){r===null&&(r="{}");var f=n("#vp_vld_hid").val();n.ajax({headers:{valkey:f},type:"POST",url:i,data:r,processData:!1,cache:!1,contentType:!1,success:function(n){t(u,n)},error:function(n){console.log(n.responseText)}})},t=function(n,t){switch(n){case"prtSearchRunReceive":vp_participant.prtSearchRunReceive(t);break;case"vpPrtSubmitReceive":vp_participant.vpPrtSubmitReceive(t);break;case"vpdSubmitReceive":vp_details.vpdSubmitReceive(t);break;case"reportEmpReceive":VPReports.reportEmpReceive(t)}},e=function(){var t=n("form:first");return n('input[name="__RequestVerificationToken"]',t).val()},u=function(t){var i=new FormData,r=n("#cpVldHid").val();i.append("id",r);GRHAjax.ajaxUpload("/TDM/GRHShared/SetSecurity",i,t)},f=function(){};return{init:f,ajaxSend:i,ajaxUpload:r,setSecurity:u}}(jQuery,window,document),vanpools=function(n,t){"use strict";var i=function(){var t=n("#vp_mode_desktop").val();t==="1"&&n("#wrapfooter").addClass("vp_desktop")},r=function(n,i){var f=t.location.protocol,r=".aspx",u;i&&(r="."+i);u=f+n+r;t.location=u},u=function(){var i=new Date,n=i.getDate(),t=i.getMonth()+1,r=i.getFullYear();return n<10&&(n="0"+n),t<10&&(t="0"+t),t+"/"+n+"/"+r},f=function(n,t,i){var u="<"+n;for(var r in t)if(t[r]===!1)continue;else u+=" "+r+'="'+t[r]+'"';return u+(i?">"+i+"<\/"+n+">":"/>")},e=function(t,i){var f=vanpools.build_html("select",{"class":t}),u="";for(var r in i)if(i[r]===!1)continue;else u+=vanpools.build_html("option",{value:i[r].val},i[r].name);return n(f).append(u)},o=function(){var t={};n(".vp_lnk").each(function(){var i=n(this).attr("id"),r=n(this).text();t[i]=r});n("#vp_addchange_ids").val(JSON.stringify(t))},s=function(){o();i()};return{init:s,get_date_today:u,go_to:r,build_html:f,build_ddl:e,set_mode_desktop:i}}(jQuery,window,document),vp_home=function(n){"use strict";var t=function(){var t=n("#hMyVanpoolsAdm").val(),i,r;t&&(i=n.parseJSON(t),n.each(i,function(t,i){r=n(['<div class="row vp_my_pool_list_row">','<div class="col-sm-12 vp_my_pool_list_box">','<div class="row vp_my_pools_lnks_vp">','<div class="col-sm-12">','<a href="/Commuter/VPL/VanpoolDetails.aspx?vp='+i.VpId+'">Manage '+i.VpName+"<\/a>","<\/div>","<\/div>",'<div class="row vp_my_pools_lnks">','<div class="col-xs-6 vp_hm_lnk_trip">','<a href="/Commuter/VPL/VanpoolTrip.aspx?vp='+i.VpId+'">Enter Trip<\/a>',"<\/div>",'<div class="col-xs-6 vp_hm_lnk_prch">','<a href="/Commuter/VPL/VanpoolPurchase.aspx?vp='+i.VpId+'">Enter Purchase<\/a>',"<\/div>","<\/div>",'<div class="row vp_my_pools_lnks">','<div class="col-xs-6 vp_hm_lnk_trip">','<a href="/Commuter/VPL/VPRecentTrips.aspx?vp='+i.VpId+'">Recent Trips<\/a>',"<\/div>",'<div class="col-xs-6 vp_hm_lnk_prch">','<a href="/Commuter/VPL/VPRecentPurchases.aspx?vp='+i.VpId+'">Recent Purchases<\/a>',"<\/div>","<\/div>","<\/div>","<\/div>"].join("\n"));n("#pnlMyPoolsAdm").append(r)}))},i=function(){var t=n("#hMyVanpoolsPrt").val(),i,r;t&&(i=n.parseJSON(t),n.each(i,function(t,i){r=n(['<div class="row vp_my_pool_list_row">','<div class="col-sm-12">','<div class="row vp_my_pools_lnks_vp">','<div class="col-sm-12">'+i.VpName+"<\/div>","<\/div>",'<div class="row vp_my_pools_lnks">','<div class="col-xs-6 vp_hm_lnk_trip">',"Member since: ","<\/div>",'<div class="col-xs-6 vp_hm_lnk_prch">'+i.VpStart+"<\/div>","<\/div>","<\/div>","<\/div>"].join("\n"));n("#pnlMyPoolsPrt").append(r)}))},r=function(){t();i()};return{init:r}}(jQuery,window,document),vp_forms=function(n,t,i){"use strict";function u(t,i){var r,u;t?(r=n(t).length,r>1?(u=n(t).closest("ul"),u.addClass("vp-invalid"),t=n(t).first()):t.addClass("vp-invalid"),t.attr("aria-invalid","true"),n("#vp-error-list").append("<li>"+i+"<\/li>"),t.attr("aria-labelledby","error-"+t.attr("id"))):n("#vp-error-list").append("<li>"+i+"<\/li>")}var e=function(t){var i=new FormData,r=n("."+t);return n.each(r,function(){var t,f,e;if(n(this).is("ul")){var u=n(this).attr("data-fld"),r=n(this).find("input[id]"),o=n(r).first().attr("type")==="radio";o?n.each(r,function(){var r=n(this).prop("checked"),t;if(r)return t=n(this).val(),i.append(u,t),!1}):(t=[],n.each(r,function(){var r=n(this).prop("checked"),i;r&&(i=n(this).val(),t.push(i))}),t=JSON.stringify(t),i.append(u,t))}else f=n(this).attr("data-fld"),e=n(this).val(),i.append(f,e)}),i},o=function(){var t=n(".mt-form");n(t).find(".mt-field input[type=text], textarea").val("");n(t).find(".mt-field input[type=checkbox]").prop("checked",!1);n(t).find(".mt-field select").prop("selectedIndex",0)},s=function(){var t=n(".vp_move_up");n(t).off("click");n(t).click(function(){var t=n(this).closest("tr"),i=t.prev();n(i).hasClass("vp_table_header")||(n(i).prev().hasClass("vp_table_header")&&t.find(".vp_move_up").hide(),n(i).find(".vp_move_up").show(),t.prev().before(t));vp_details.vp_vpd_stops_sort_send(t)})},h=function(t,i){return n.each(i,function(i,r){t.append(n("<option><\/option>").val(i).html(r))}),t},c=function(n,t){var u=i.getElementById(n),f,e,r;if(u!==null)for(f=t.toLowerCase(),e=u.options.length,r=0;r<e;r++)if(u.options[r].value.toLowerCase()===f){u.options[r].selected=!0;break}},l=function(){n(".vp_lnk").click(function(){r(this)});n(".vp_lnk").each(function(){var i=n(this).attr("id"),t=i.replace("_lnk","_frm"),r=n("#"+t).children("button");n(r).click(function(){a(t)})})},r=function(t){var r=n(t).attr("id"),u="Change",f=n("#vp_addchange_ids").val(),e;typeof f!="undefined"&&(e=JSON.parse(f),u=e[r]);var s=r.replace("_lnk","_frm"),i=n("#"+s),o=n(i).children("input");n(i).is(":visible")?(n(i).hide(),n(t).text(u),n(o).val("")):(n(i).show(),n(t).text("Cancel"),n(o).focus())},a=function(t){switch(t){case"vp_vpd_stp_add_frm":vp_details.addchange_stop(t);break;case"vp_vpd_emp_chg_frm":vp_details.vp_emp_change();break;case"vp_prt_emp_chg_frm":vp_participant.vp_emp_change()}var i=t.replace("_frm","_lnk"),u=n("#"+i);r(u)},v=function(t,i,r,u,f){f||(f=2);n("#"+t).devbridgeAutocomplete({minChars:f,width:550,lookup:function(t,i){var f=y(t,u),e=n("#vp_vld_hid").val();n.ajax({headers:{valkey:e},type:"POST",url:"/vanpool/"+r,data:f,dataType:"json",success:function(n){i(n)},error:function(n){console.log(n.responseText)}})},onSelect:function(t){return n("#"+i).val(t.data),!1}})},y=function(t,i){var u={},r;return i&&(r=n("#"+i).val(),r===""&&(r=n("#"+i).text()),u.term=t,u.param=r),JSON.stringify(u)},p=function(){var t=navigator.userAgent.toLowerCase().indexOf("chrome"),i=navigator.vendor.toLowerCase().indexOf("google");t>=0&&i>=0&&n("input[autocomplete=off]").attr("autocomplete","new-password")},w=function(t){t||(t="auto");const i=n("#vpIsAdminPg").val()=="True";if(i){n(".vp-datepicker").datetimepicker({pickTime:!1});n(".vp-timepicker").datetimepicker({pickDate:!1,pick12HourFormat:!0,pickSeconds:!1});n(".close-time").click(function(){var t=n(this).closest(".bootstrap-datetimepicker-widget");return n(t).hide(),!1});n(".add-on").on("click",function(t){n(".datepicker").parent().hide();n(".timepicker").parent().hide();var i=n(this).parent().data("datetimepicker");n(this).attr("class").indexOf("date")>=0?(i.height=i.component?i.component.outerHeight():i.$element.outerHeight(),i.place(),i.set(),n(".datepicker-days").show(),i.widget.show()):n(this).attr("class").indexOf("time")>=0&&(i.height=i.component?i.component.outerHeight():i.$element.outerHeight(),i.place(),i.set(),i.widget.show());t.stopPropagation()})}else n(".vp-datepicker").datetimepicker({format:"L",vertical:t,icons:{previous:"icon chevron-left-blue",next:"icon chevron-right-blue"},widgetPositioning:{horizontal:"right",vertical:"top"}}),n(".vp-timepicker").datetimepicker({format:"LT",icons:{up:"icon chevron-up-blue",down:"icon chevron-down-blue"},widgetPositioning:{horizontal:"left",vertical:"top"}})},b=function(n){return/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(n)},k=function(n){return/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(n)},d=function(n){return!!n.match(/(?=.)^\$?(([1-9][0-9]{0,2}(,[0-9]{3})*)|0)?(\.[0-9]{1,2})?$/)},g=function(t){var i=!1,r=n(t).val();return r&&r.length>0&&(i=!0),i},nt=function(t){var i=!1,u=n(t).attr("id"),r=n("#"+u+" option:selected").val();return r&&r.length>0&&(i=!0),i},tt=function(t){var r=!1,u=n("input[name="+t+"]").first().attr("type"),i;return i=u==="checkbox"?n("input:checkbox[name="+t+"]:checked").val():n("input:radio[name="+t+"]:checked").val(),i&&i.length>0&&(r=!0),r},it=function(t){var i=!1,r=n(t).val();return r&&(i=/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(r)),i},rt=function(t){var r=n(t).data("maxlength"),i=n(t).val();i&&i.length>r&&n(t).val(i.substr(0,r))},ft=function(t){n.each(t,function(t,i){var r=i.FldId,f=null,e;r&&(f=n("#"+r));e=i.Message;u(f,e)});f()},f=function(){n("#vp-validation-summary").show();n("#vp-validation-summary").focus()},ut=function(){l();n("textarea").on("keyup",function(){rt(this)})};return{init:ut,collectFormValues:e,clear_form:o,move_up_init:s,set_ddl_options:h,set_ddl_value:c,addchange_toggle:r,vp_autocomplete:v,initDateTimePickers:w,acBrowserFix:p,showErrors:f,addValidationIssue:u,isPhoneNumber:b,isEmailAddress:k,isCurrency:d,validateTbxReq:g,validateDdlReq:nt,validateListReq:tt,validateZip:it}}(jQuery,window,document),vp_participant=function(n,t){"use strict";var i=function(t){let i=0;i=t?n("#vp_part_search_hid").val():n("#vp_prsn_id").val();const u=n("#vp_part_search").val(),f=n("#vp_part_vpid").val();let r={};r.vp_id=f;r.pn_id=i;i>0?VPAjax.ajaxSend("/vanpool/VPPGetPrsn",r,"json","prtSearchRunReceive"):u.length>0&&(n("#vpResetAddrBox").hide(),n("#vp_part_phone_home").val(u));n("#boxPrtSearch").hide();n("#boxPrtAddForm").show();n("#pnlEmployer").show();n("#vpPrtSave").show()},f=function(t){var u=t.PnId,f=t.FirstName,e=t.LastName,i=t.Email,r=t.MtId,s=t.Addr.AddressId,h=t.Addr.Street1,c=t.Addr.Street2,l=t.Addr.City,a=t.Addr.State,v=t.Addr.Zip,y=t.Phone,p=t.PhoneExtension;n("#vp_prsn_id").val(u);n("#vp_part_name_first").val(f);n("#vp_part_name_last").val(e);n("#vp_part_mtid").val(r);n("#vp_part_addr_hid").val(s);n("#vp_part_address1").val(h);n("#vp_part_address2").val(c);n("#vp_part_city").val(l);n("#vp_part_state").val(a);n("#vp_part_zip").val(v);n("#vp_part_phone_home").val(y);n("#vp_part_phone_home_ext").val(p);i.length>0?(n("#vp_part_email").val(i),n("#vp_part_email_lit").text(i),r===0?(n("#pnlAddPrtEmail").show(),n("#vp_part_email_lit").hide()):(n("#pnlAddPrtEmail").hide(),n("#vp_part_email_lit").show())):n(".vp_part_email_lit").hide();o()},r=function(){var t=n("#vp_prt_emp_hid").val();t>0&&e(t)},e=function(t){var i="",r=n("#vp_vld_hid").val();t>0&&(i="{'emp_id':'"+t+"'}",n.ajax({headers:{valkey:r},type:"POST",url:"/vanpool/VPPGetEmpById",data:i,dataType:"json",success:function(n){var t=n.emp;u(t)},error:function(n){console.log(n.responseText)}}))},u=function(t){var i=t.EmpId,r=t.EmpName,u=t.Street1,f=t.Street2,e=t.City,o=t.State,s=t.Zip;n("#vp_prt_emp_hid").val(i);n(".vp_prt_emp_name").text(r);n(".vp_prt_emp_add1").text(u);n(".vp_prt_emp_add2").text(f);n(".vp_prt_emp_city").text(e);n(".vp_prt_emp_ste").text(o);n(".vp_prt_emp_zip").text(s)},o=function(){var i=n("#vp_part_vpid").val(),t=n("#vp_prsn_id").val(),r="{'pn_id':'"+t+"', 'vp_id':'"+i+"'}",u=n("#vp_vld_hid").val();t>0&&n.ajax({headers:{valkey:u},type:"POST",url:"/vanpool/VPPGetEmp",data:r,dataType:"json",success:function(n){s(n)},error:function(n){console.log(n.responseText)}})},s=function(n){u(n.emp)},h=function(){const n=c();if(n){var t=vp_forms.collectFormValues("vpPrtForm");VPAjax.ajaxUpload("/TDM/VPForms/PrtSubmit",t,"vpPrtSubmitReceive")}},c=function(){var r=n("#vp_part_name_first"),u=n("#vp_part_name_last"),f=n("#vp_part_address1"),e=n("#vp_part_city"),o=n("#vp_part_state"),s=n("#vp_part_zip"),t=n("#vp_part_phone_home"),h=n("#vp_part_email"),v=n("#vp_prt_emp_hid"),c,i,l,a;return n("#vp-validation-summary").hide(),n("#vp-error-list").children().remove(),n("input, select").removeClass("vp-invalid"),n("input, select").removeAttr("aria-invalid"),n("#vpRegCMList").removeClass("vp-invalid"),vp_forms.validateTbxReq(r)===!1&&vp_forms.addValidationIssue(r,"The First Name field is required."),vp_forms.validateTbxReq(u)===!1&&vp_forms.addValidationIssue(u,"The Last Name field is required."),vp_forms.validateTbxReq(f)===!1&&vp_forms.addValidationIssue(f,"The Address 1 field is required."),vp_forms.validateTbxReq(e)===!1&&vp_forms.addValidationIssue(e,"The City field is required."),vp_forms.validateDdlReq(o)===!1&&vp_forms.addValidationIssue(o,"The State field is required."),vp_forms.validateZip(s)===!1&&vp_forms.addValidationIssue(s,"Please enter a valid Zip code."),vp_forms.validateTbxReq(t)===!1?vp_forms.addValidationIssue(t,"The Phone field is required."):(c=n(t).val(),vp_forms.isPhoneNumber(c)===!1&&vp_forms.addValidationIssue(t,"Please enter a valid, ten-digit phone number.")),i=n(h).val(),i.length>0&&vp_forms.isEmailAddress(i)===!1&&vp_forms.addValidationIssue(h,"Please enter a valid email address."),l=n(v).val(),n.isNumeric(l)||n("#vp_prt_emp_hid").val(0),a=n("#vp-error-list").children(),n(a).length>0?(vp_forms.showErrors(),!1):!0},l=function(i){var r=i.success===!0;if(r){const i=n("#vp_part_addrecord").val();if(i==="true"){let n=location.pathname.replace("Participant","Details");n=n+location.search+"#vpdp";t.location=n}else vp_modal.show_modal("Close",!1,"Participant updated successfully.")}else i.errors&&i.errors.length>0&&n.each(i.errors,function(t,i){var r=i.FldId,u=i.Message,f=n("#"+r);vp_forms.addValidationIssue(f,u);vp_forms.showErrors()})},a=function(){var t=n("#vp_prsn_id").val();t>0?(n("#boxPrtSearch").hide(),n("#boxPrtAddForm").show(),i()):(n("#pnlEmployer").hide(),n("#vpPrtSave").hide(),n("#vp_part_search").focus());n("#vpPrtSave").click(function(){h()});n("#boxPrtSearch").keypress(function(n){v(n)});n("#boxPrtAddForm").keypress(function(n){y(n)});n("#vp_prt_emp_chg_btn").click(function(){r()})},v=function(t){if(t&&t.keyCode===13)return t.preventDefault(),n("#btnPrtSearch").click(),!1},y=function(t){if(t&&t.keyCode===13)return t.preventDefault(),n("#vpPrtSave").click(),!1},p=function(){const i=location.search.indexOf("pn=");i===-1&&n("#vp_part_addrecord").val(!0);let t=location.search.substring(1).split("&");for(let i=0;i<t.length;i++){let r=t[i].split("=");const u=r[0],f=r[1];u==="vp"?n("#vp_part_vpid").val(f):u==="pn"&&n("#vp_prsn_id").val(f)}},w=function(){p();vp_forms.vp_autocomplete("vp_part_search","vp_part_search_hid","AutoVPPParticipants","vp_part_vpid",7);vp_forms.vp_autocomplete("vp_prt_emp_txt","vp_prt_emp_hid","AutoVPEmps","vp_prsn_id");n("#btnPrtSearch").click(function(){i(!0)});a();vp_forms.initDateTimePickers();vp_forms.acBrowserFix()};return{init:w,prtSearchRunReceive:f,vpPrtSubmitReceive:l,vp_emp_change:r}}(jQuery,window,document),vpPurchase=function(n){"use strict";var i=function(){n("#vp_prch_plate").removeAttr("disabled");n(".vpBtnVanChange").hide()},t=function(t){var u=n("#vp_prch_category option:selected").text().toLowerCase(),i=n("#vp_prch_qty_box"),r=n("#vp_prch_quantity");u.indexOf("wash")>=0?(n(i).hide(),n(r).val("1")):t||(n(r).val(""),n(i).show())},r=function(){n("#vp_purchase_form_box span[data-val-errormessage]").hide();let i=!1,r=!1,u=!1,f=!1,e=!1;const o=n("#vp_prch_date").val(),t=n("#vp_prch_category").val(),a=n("#vp_prch_plate").val(),s=n("#vp_prch_quantity").val();let h=0;const c=n("#vp_prch_amt").val();let l=0;if(o){const t=new Date(o);t?i=!0:n("#vp_prch_date_req").show()}else n("#vp_prch_date_req").show();return t&&(t==="69"||t==="139")&&(r=!0),a&&(u=!0),s?(h=Number(s),h>0?f=!0:n("#vp_prch_quantity_nbr").show()):n("#vp_prch_quantity_req").show(),c?(l=Number(c),l>0?e=!0:n("#vp_prch_amt_nbr").show()):n("#vp_prch_amt_req").show(),i&&r&&u&&f&&e?!0:!1},u=function(){const r=n("#IsAdminPg").val()=="True";r?n(".vp-datepicker").datetimepicker({pickTime:!1}):vp_forms.initDateTimePickers("bottom");t(!0);n("#vp_prch_category").change(function(){t(!1)});n(".vpBtnVanChange").click(function(){i()})};return{init:u,validatePurchaseForm:r}}(jQuery,window,document),vpTrip=function(n,t,i){"use strict";var e=function(){var t=r();t&&n("#vp_trip_pgr_all").prop("checked",!0)},o=function(){n("#vp_trip_plate").removeAttr("disabled");n(".vpBtnVanChange").hide();n("#vp_trip_start_odo").val("")},s=function(){var i=n("#vp_trip_pgr_all"),r=n(i).prop("checked"),t=n("#vp_trip_passengers");r?n(t).find("input[type=checkbox]").prop("checked",!0):n(t).find("input[type=checkbox]").prop("checked",!1)},r=function(){var t=n("#vp_trip_passengers input").length,i=n("#vp_trip_passengers input:checked").length;return t===i?!0:!1},h=function(t){var i=n("#vp_trip_pgr_all"),e=n(t).prop("checked"),u,f;e?(u=r(),u&&n(i).prop("checked",!0),n("#vp_trip_passengers_vld").hide()):(n(i).prop("checked",!1),f=n(".vp_cbx_list ul li input:checked").length,f===0&&n("#vp_trip_passengers_vld").show())},u=function(){var t=!1,i=n(".vp_cbx_list ul li input:checked").length;return i>0&&(t=!0),t},c=function(){n("div.col-md-12 vp_trip_form_box span[data-val-errormessage]").hide();n("#vpAvgDistanceError").hide();let a=i.getElementsByClassName("vp-trip-error");for(let n of a)n.style.display="none";let r=!1,f=!1,e=!1,o=!1;const s=n("#vp_trip_date").val(),v=n("#vp_trip_plate").val(),t=n("#vp_trip_direction").val(),h=n("#vp_trip_driver").val();if(s){const t=new Date(s);t?r=!0:n("#vp_trip_date_req").show()}else n("#vp_trip_date_req").show();if(v&&(f=!0),t&&(t==="0"||t==="1")&&(e=!0),h){const t=n("#vp_trip_passengers").find("input[value="+h+"]");t.length>0&&(o=!0)}const y=l(),c=u();return c||n("#vp_trip_passengers_vld").show(),r&&f&&e&&o&&y&&c?!0:(i.getElementById("vpTripErrorSummary").style.display="block",!1)},f;const l=function(){let i=!1,r=!1;const u=n("#vp_trip_start_odo").val();let t=0;const f=n("#vp_trip_end_odo").val();let e=0;return u?(t=parseInt(u),t>0?i=!0:n("#vp_trip_start_odo_nbr").show()):n("#vp_trip_start_odo_req").show(),f?(e=parseInt(f),e>t?r=!0:n("#vp_trip_end_odo_vld").show()):n("#vp_trip_end_odo_req").show(),i&&r?!0:!1};return f=function(){const t=n("#IsAdminPg").val()=="True";t?n(".vp-datepicker").datetimepicker({pickTime:!1}):vp_forms.initDateTimePickers("bottom");n(".vpBtnVanChange").click(function(){o()});n("#vp_trip_pgr_all").click(function(){s()});var i=n("#vp_trip_passengers").find("input[type=checkbox]");n(i).click(function(){h(this)});e()},{init:f,validatePgrList:u,validateTripForm:c}}(jQuery,window,document),vp_details=function(n,t){"use strict";var p=function(){const t=i();if(t){const t=n("#vpIsAdminPg").val()==="True";if(t){const t=n("#vp_vpd_active").prop("checked");if(t)r();else vp_modal.show_modal("Save",!0,"The 'Active' field is unchecked.  Continuing will automatically deactivate all participants and roles.  Is this ok?")}else r()}else vp_modal.show_modal("Close",!1,"The form data is not valid.  Please make sure the form is filled out correctly.")},r=function(t){t&&n("#hdToPartPg").val(1);let i={};i.vp_id=n("#vp_vpd_id").val();i.Name=n("#vp_vpd_name").val();i.Active=n("#vp_vpd_active").prop("checked");i.EmployerReports=n("#cbxEmpReports").prop("checked");i.RentalMiles=n("#vp_vpd_rental_miles").val();i.MonthlyRentalValue=n("#vp_vpd_rental_value").val();i.SubsidyPercentage=n("#vp_vpd_subsidy_prct").val();i.Notes=n("#vp_vpd_notes").val();VPAjax.ajaxSend("/vanpool/VPDSubmit",i,"json","vpdSubmitReceive")},w=function(i){const u=i.success===!0,f=n("#hdToPartPg").val();let r="";if(f==="1"){n("#hdToPartPg").val(0);let i=t.location.href;i=i.replace("VanpoolDetails","VanpoolParticipant");t.location=i}else if(u){r="Vanpool updated successfully.";vp_modal.show_modal("Close",!1,r);const i=n("#vpIsAdminPg").val()==="True";if(i){const i=n("#vp_vpd_active").prop("checked");i||t.location.reload(!1)}}else r=i.error,r||(r="An error occurred while trying to update the vanpool.  Please try again later."),vp_modal.show_modal("Close",!1,r)},b=function(t,i){n.each(t,function(n,t){k(t,i)})},k=function(t,i){var v=n("#vp_vpd_id").val(),o=t.PnId,y=t.PtId,p=t.FullName,w=t.AppDrv,b=t.EmpName,k=t.PckId,nt=t.Pickup,d=t.DrpId,tt=t.Dropoff,g=t.Vld,s=n("<a/>").attr("href","VanpoolParticipant.aspx?vp="+v+"&pn="+o),e,r,u,f,h,c,l,a;n(s).text(p);e=n("<input/>").attr({type:"checkbox",value:"backup_driver","class":"vp_vpd_app_drv"});n(e).prop("checked",w);r=n("#vp_vpd_tmp_prt").html();r=n.parseHTML(r);n(r).attr("data-pn-id",o);n(r).attr("data-pt-id",y);g&&n(r).find(".vp_frm_connected").text("Connected");n(r).find(".vp_vpd_prt_name").append(s);n(r).find(".vp_vpd_prt_app").append(e);n(r).find(".vp_vpd_prt_emp").text(b);u=n(r).find(".vp_vpd_prt_stp[type=pck] .vp_stp_ddl");f=n(r).find(".vp_vpd_prt_stp[type=drp] .vp_stp_ddl");i?(h=n("<option/>",{value:0}).text("None"),n(u).append(h),n.each(i,function(t,i){if(i.VPStopType===0){var r=n("<option/>",{value:i.StId});n(r).text(i.Street1);n(u).append(r)}}),n(u).val(k),c=n("<option/>",{value:0}).text("None"),n(f).append(c),n.each(i,function(t,i){if(i.VPStopType===1){var r=n("<option/>",{value:i.StId});n(r).text(i.Street1);n(f).append(r)}}),n(f).val(d)):(l=n(".vp_vpd_prt_stp[type=pck] select").first().clone(),n(u).replaceWith(l),n(u).val("0"),a=n(".vp_vpd_prt_stp[type=drp] select").first().clone(),n(f).replaceWith(a),n(f).val("0"));n("table[vp-type=participant] tbody").append(r);ai(t)},d=function(){r(!0)},g=function(t){n.each(t,function(n,t){e(t)});a()},e=function(t){var r=t.StId,h=t.Street1,c=t.City,l=t.State,a=t.Zip,v=t.ToWork,y=t.ToHome,p=t.VPStopType,s=n("<input/>").attr({type:"checkbox",value:"dropoff","class":"vp_stp_cbx_drp",disabled:"true"}),i;n(s).prop("checked",p);i=n("#vp_vpd_tmp_stp").html();i=n.parseHTML(i);n(i).attr("data-stp-id",r);n(i).find(".vp_stp_td_add1").text(h);n(i).find(".vp_stp_td_city").text(c);n(i).find(".vp_stp_td_ste").text(l);n(i).find(".vp_stp_td_zip").text(a);n(i).find(".vp_stp_td_towork input").val(v);n(i).find(".vp_stp_td_tohome input").val(y);n(i).find(".vp_stp_td_drp").append(s);const u="pkp"+r,f="drp"+r,e=n(i).find(".vp_stp_td_towork");n(e).attr("id",u);n(e).find("input").attr("data-target","#"+u);n(e).find(".input-group-append").attr("data-target","#"+u);const o=n(i).find(".vp_stp_td_tohome");n(o).attr("id",f);n(o).find("input").attr("data-target","#"+f);n(o).find(".input-group-append").attr("data-target","#"+f);n("tr[data-stp-id=0]").before(i)},nt=function(t){var r=n("#vp_vpd_id").val(),i=[],e=n(t).closest("tbody").children("tr"),u,f;n.each(e,function(t,r){var u=n(r).data("stp-id");u>=0&&i.push(u)});u="{'vp_id':'"+r+"', 'stops':'"+i+"'}";f=n("#vp_vld_hid").val();r>0&&i.length>0&&n.ajax({headers:{valkey:f},type:"POST",url:"/vanpool/VPDStopsSort",data:u,dataType:"json",success:function(n){tt(n)},error:function(n){console.log(n.responseText)}})},tt=function(n){var t=n.success},it=function(){n(".vp_stp_ddl").change(function(){rt(this)})},rt=function(t){var i=n("#vp_vpd_id").val(),r=n(t).closest("tr").data("pn-id"),u=n(t).closest("tr").data("pt-id"),f=n(t).parent().attr("type"),e=n(t).val(),o="{'vp_id':'"+i+"', 'pn_id':'"+r+"', 'stp_typ':'"+f+"', 'stp_id':'"+e+"'}",s=n("#vp_vld_hid").val();i>0&&r>0&&n.ajax({headers:{valkey:s},type:"POST",url:"/vanpool/VPDPartSetStop",data:o,dataType:"json",success:function(n){ut(n,u)},error:function(n){console.log(n.responseText)}})},ut=function(n,t){var i=n.success;i&&bt(t)},ft=function(){var t=n(".vp_frm_remove");n(t).off("click");n(t).click(function(){var t=n(this),r=n(t).closest("table"),u=n(r).attr("vp-type"),f=n(t).closest("tr"),e=n(f).children("td").first().text(),o="Are you sure you want to remove "+e+" from this vanpool?",i=0;i=u==="participant"?"prt"+n(t).closest("tr").data("pn-id"):"stp"+n(t).closest("tr").data("stp-id");vp_modal.show_modal("Remove",!0,o,i)})},et=function(n){var r=n.substring(0,3),t=n.replace(/\D/g,""),i;if(r==="prt")if(i=ot(t),i)vp_modal.show_modal("OK",!1,"This participant is assigned to a role.  Please reassign the role before removing this participant.");else st(t);else ct(t)},ot=function(t){var r=!1,i=n("table[vp-type=participant] tr[data-pn-id="+t+"]").data("pt-id");if(i>0){var u=n("#vp_vpd_role_driver").val(),f=n("#vp_vpd_role_driver_bck").val(),e=n("#vp_vpd_role_coord").val(),o=n("#vp_vpd_role_renter").val();(Number(u)===i||Number(f)===i||Number(e)===i||Number(o)===i)&&(r=!0)}return r},st=function(t){var i=n("#vp_vpd_id").val(),r="{'vp_id':'"+i+"', 'pn_id':'"+t+"'}",u=n("#vp_vld_hid").val();i>0&&t>0&&n.ajax({headers:{valkey:u},type:"POST",url:"/vanpool/VPDPartRemove",data:r,dataType:"json",success:function(n){ht(n)},error:function(n){console.log(n.responseText)}})},ht=function(t){var u=t.success,f=t.PnId,e=t.PtId,r,i;u&&(r=n("table[vp-type=participant]"),i=n(r).find("tr[data-pn-id="+f+"]"),i.length>0&&n(i).remove(),vi(t))},ct=function(t){var i=n("#vp_vpd_id").val(),r="{'vp_id':'"+i+"', 'stp_id':'"+t+"'}",u=n("#vp_vld_hid").val();i>0&&t>0&&n.ajax({headers:{valkey:u},type:"POST",url:"/vanpool/VPDStopRemove",data:r,dataType:"json",success:function(){lt(t)},error:function(n){console.log(n.responseText)}})},lt=function(t){n("tr[data-stp-id="+t+"]").remove();n(".vp_vpd_prt_stp select option[value="+t+"]").remove()},o=function(){var t=n("#vp_vpd_van_ddl").val(),i;t>=0&&at(t);i=n("#vp_vpd_van_chg_lnk");vp_forms.addchange_toggle(i)},at=function(t){var i=n("#vp_vpd_id").val(),r="",u;r=t>=0?"{'vp_id':'"+i+"', 'vid':'"+t+"'}":"{'vp_id':'"+i+"'}";u=n("#vp_vld_hid").val();i>0&&n.ajax({headers:{valkey:u},type:"POST",url:"/vanpool/VPDVanSet",data:r,dataType:"json",success:function(n){s(n)},error:function(n){console.log(n.responseText)}})},s=function(t){var i;if(t.error==="duplicate")n("#vp_van_msg_dup").show(),i=n("#vp_vpd_van_chg_lnk"),vp_forms.addchange_toggle(i);else{n("#vp_van_msg_dup").hide();var c=t.VanId,r=t.VIN,u=t.Plate,f=t.Make,e=t.Model,o=t.Year,s=t.Capacity,h=vt();n(".vp_vpd_vin").text(r);n(".vp_vpd_plate").text(u);n(".vp_vpd_make").text(f);n(".vp_vpd_model").text(e);n(".vp_vpd_year").text(o);n(".vp_vpd_capacity").text(h+" of "+s)}},vt=function(){var t=0,i=n("table[vp-type=participant] tr td[type=pck] select");return n(i).length>0&&n.each(i,function(){var i=n(this).val();i>0&&(t+=1)}),t},yt=function(t){var i=n("#vp_vpd_van_ddl");n.each(t,function(t,r){var u=n("<option/>",{value:r.VanId}).text(r.Plate);n(i).append(u)})},pt=function(){var t=n("#vp_vpd_emp_hid").val();t>0&&wt(t)},wt=function(t){var i=n("#vp_vpd_id").val(),r="",u;r=t>0?"{'vp_id':'"+i+"', 'emp_id':'"+t+"'}":"{'vp_id':'"+i+"'}";u=n("#vp_vld_hid").val();i>0&&t>0&&n.ajax({headers:{valkey:u},type:"POST",url:"/vanpool/VPDGetEmp",data:r,dataType:"json",success:function(n){h(n)},error:function(n){console.log(n.responseText)}})},h=function(t){var i=t.EmpName,r=t.Street1,u=t.Street2,f=t.City,e=t.State,o=t.Zip;n(".vp_vpd_emp_name").text(i);n(".vp_vpd_emp_add1").text(r);n(".vp_vpd_emp_add2").text(u);n(".vp_vpd_emp_city").text(f);n(".vp_vpd_emp_ste").text(e);n(".vp_vpd_emp_zip").text(o)},bt=function(t){var i=n("table[vp-type=participant] tr[data-pt-id="+t+"]"),r=n(i).find("input.vp_vpd_app_drv");c(r)},kt=function(){var t=n(".vp_vpd_app_drv");n(t).off("click");n.each(t,function(){c(this)})},c=function(t){var r=n(t).is(":checked"),i=n(t).closest("tr"),u=n(i).find("td[type=pck] select"),f=n(i).find("td[type=drp] select"),e=n(u).val(),o=n(f).val();e>0&&o>0?(n(t).prop("disabled",!1),n(t).click(function(){l(this)})):(n(t).prop("disabled",!0),r&&(n(t).prop("checked",!1),l(t)))},l=function(t){var i=n("#vp_vpd_id").val(),r=n(t).closest("tr").data("pn-id"),u=n(t).is(":checked"),f="{'vp_id':'"+i+"', 'pn_id':'"+r+"', 'chk':'"+u+"'}",e=n("#vp_vld_hid").val();i>0&&r>0&&n.ajax({headers:{valkey:e},type:"POST",url:"/vanpool/VPDPartAppDrvCheck",data:f,dataType:"json",success:function(n){dt(n)},error:function(n){console.log(n.responseText)}})},dt=function(t){var r=t.PtId,a=t.FullName,v=t.AppDrv,o=n("#vp_vpd_role_driver"),y=n("#vp_vpd_role_driver_bck"),u,s,h,c,f,l,e;v?(u=n("<option/>").attr("value",r).text(a),s=n("#vp_vpd_role_driver option[value="+r+"]"),n(s).length===0&&n(o).append(n(u).clone()),n("#vp_vpd_role_driver option").length===1&&n(o).trigger("change"),h=n("#vp_vpd_role_driver_bck option[value="+r+"]"),n(h).length===0&&n(y).append(n(u).clone())):(c=n("#vp_vpd_role_driver").val(),c===r?(f=n("#vpRoleDateDriver"),n(f).val(""),n("#vp_vpd_role_driver option[value="+r+"]").remove(),n(f).change()):n("#vp_vpd_role_driver option[value="+r+"]").remove(),l=n("#vp_vpd_role_driver_bck").val(),l===r?(e=n("#vpRoleDateDriverBck"),n(e).val(""),n("#vp_vpd_role_driver_bck option[value="+r+"]").remove(),n(e).change()):n("#vp_vpd_role_driver_bck option[value="+r+"]").remove());i()},gt=function(){kt();it()},a=function(){vp_forms.move_up_init();ft();ei()},v=function(){n("#vp_stp_tbx_name").val("");n("#vp_stp_tbx_add1").val("").removeAttr("disabled");n("#vp_stp_tbx_add2").val("").removeAttr("disabled");n("#vp_stp_tbx_city").val("").removeAttr("disabled");n("#vp_stp_ddl_state").removeAttr("disabled");n("#vp_stp_tbx_zip").val("").removeAttr("disabled");n("#vp_stp_tbx_towork").val("").removeAttr("disabled");n("#vp_stp_tbx_tohome").val("").removeAttr("disabled");n("#vp_stp_cbx_drp").removeAttr("checked");n("#vp_stp_tbx_add1_hid").val("")},ni=function(){n("#vp_stp_add").click(function(){ti()});n("#vp_stp_reset").click(function(){v()})},ti=function(){var t={},i,r,u;t.vp_id=n("#vp_vpd_id").val();t.Street1=n("#vp_stp_tbx_add1").val();t.City=n("#vp_stp_tbx_city").val();t.State=n("#vp_stp_ddl_state").val();t.Zip=n("#vp_stp_tbx_zip").val();t.ToWork=n("#vp_stp_tbx_towork").val();t.ToHome=n("#vp_stp_tbx_tohome").val();t.VPStopType=n("#vp_stp_cbx_drp").prop("checked");i=0;n.each(t,function(n,t){t===""&&n!=="VPStopType"&&(i+=1)});i===0&&(r=JSON.stringify(t),u=n("#vp_vld_hid").val(),t.vp_id>0&&n.ajax({headers:{valkey:u},type:"POST",url:"/vanpool/VPDStopAdd",data:r,dataType:"json",success:function(n){ii(t,n)},error:function(n){console.log(n.responseText)}}))},ii=function(t,i){var u=i.success,r;u&&(t.StId=i.StId,t.VPStopType===!0&&(t.VPStopType=1),e(t),r=n("tr[data-stp-id=0] input"),n.each(r,function(){var t=n(this);n(t).attr("type")==="checkbox"?n(t).prop("checked",!1):n(t).val("")}),a(),v(),fi(t),ri(t,i))},ri=function(t,i){const f=n("#vp_vpd_id").val(),e=n.grep([t.Street1,t.City,t.State,t.Zip],Boolean).join(", ");let r=0,u=0;const o=new google.maps.Geocoder;o.geocode({address:e},function(t,e){if(e===google.maps.GeocoderStatus.OK){if(r=t[0].geometry.location.lat(),u=t[0].geometry.location.lng(),r>0){const t={vpId:f,stpId:i.StId,lat:r,lng:u},e=JSON.stringify(t),o=n("#vp_vld_hid").val();n.ajax({headers:{valkey:o},type:"POST",url:"/vanpool/VPDSetLatLong",data:e,dataType:"json",success:function(n){ui(n)},error:function(n){console.log(n.responseText)}})}}else console.log("Geocode was not successful for the following reason: "+e)})},ui=function(n){let t=n},fi=function(t){var r=t.VPStopType,u=t.StId,f=t.Street1,i=n("<option/>").attr("value",u).text(f);r===1?n(".vp_vpd_prt_stp[type=drp] select").append(i):n(".vp_vpd_prt_stp[type=pck] select").append(i)},ei=function(){const t=n("#vpIsAdminPg").val()=="True";if(vp_forms.initDateTimePickers(),t){n(".vp-timepicker").on("changeDate",function(){y(this)});n(".vp-datepicker").on("changeDate",function(){u(this)})}else{n("#vp_details_form_box .vp-timepicker").on("change.datetimepicker",function(){y(this)});n("#vp_details_form_box .vp-datepicker").on("change.datetimepicker",function(){u(this)})}},y=function(t){var r=n(t).parent().data("stp-id"),u=n(t).children("input").first().val(),i="work";if(n(t).hasClass("vp_stp_td_tohome")&&(i="home"),r>0){var o="vp_stp_td_to"+i,f="{'stpId':'"+r+"', 'field':'"+i+"', 'time':'"+u+"'}",e=n("#vp_vld_hid").val();n.ajax({headers:{valkey:e},type:"POST",url:"/vanpool/VPDStpTimeChg",data:f,dataType:"json",success:function(n){oi(n)},error:function(n){console.log(n.responseText)}})}},oi=function(){},u=function(t){var r=n("#vp_vpd_id").val(),u=n(t).siblings("select").val(),i=n(t).siblings("select").attr("id"),f,e,o;i=i.replace("vp_vpd_role_","");f=n(t).children("input").val();Number(r)>0&&Number(u)>-1&&(e="{'vpid':'"+r+"', 'pid':'"+u+"', 'role':'"+i+"', 'dt':'"+f+"'}",o=n("#vp_vld_hid").val(),n.ajax({headers:{valkey:o},type:"POST",url:"/vanpool/VPDRoleStartChg",data:e,dataType:"json",success:function(n){si(n)},error:function(n){console.log(n.responseText)}}))},si=function(t){var f=t,i=new Date,r,u;i=i.toLocaleDateString();r=n("#vpRoleDateDriver").val();r===""&&n("#vpRoleDateDriver").val(i);u=n("#vp_vpd_role_driver_bck").val();Number(u)>0&&r===""&&n("#vpRoleDateDriverBck").val(i)},hi=function(){var t=n("#vp_vpd_id").val(),i="{'vp_id':'"+t+"'}",r=n("#vp_vld_hid").val();t>0?n.ajax({headers:{valkey:r},type:"POST",url:"/vanpool/VPDPageLoad",data:i,dataType:"json",success:function(n){ci(n)},error:function(n){console.log(n.responseText)}}):n("#map").hide()},ci=function(n){b(n.parts,n.stops);g(n.stops);h(n.emp);s(n.van);yt(n.vans);gt();ni();yi();i()},li=function(){var t=n("#vp_vpd_id").val();t===""&&n(".vp_vpd_add_hide").hide()},ai=function(t){var i=t.PtId,u=t.FullName,f=t.AppDrv,e=t.Drv,o=t.DrvBck,s=t.Coord,h=t.Renter,c=t.StartDrv,l=t.StartDrvBck,a=t.StartCoord,v=t.StartRenter,r=n("<option/>").attr("value",i).text(u);n("#vp_vpd_role_coord").append(n(r).clone());s&&(n("#vp_vpd_role_coord").val(i),n("#vpRoleDateCoord").val(a));n("#vp_vpd_role_renter").append(n(r).clone());h&&(n("#vp_vpd_role_renter").val(i),n("#vpRoleDateRenter").val(v));f&&(n("#vp_vpd_role_driver").append(n(r).clone()),n("#vp_vpd_role_driver_bck").append(n(r).clone()),e&&(n("#vp_vpd_role_driver").val(i),n("#vpRoleDateDriver").val(c)),o&&(n("#vp_vpd_role_driver_bck").val(i),n("#vpRoleDateDriverBck").val(l)))},vi=function(t){var i=t.PtId;n("#vp_vpd_role_coord option[value="+i+"]").remove();n("#vp_vpd_role_renter option[value="+i+"]").remove();n("#vp_vpd_role_driver option[value="+i+"]").remove();n("#vp_vpd_role_driver_bck option[value="+i+"]").remove()},yi=function(){n(".vp_vpd_role_ddl").change(function(){pi(this)})},pi=function(t){var r=n(t).attr("id"),f=r.replace("vp_vpd_role_",""),i=n(t).val();i||(i=0);var u=n("#vp_vpd_id").val(),e="{'vp_id':'"+u+"', 'role':'"+f+"', 'prt':'"+i+"'}",o=n("#vp_vld_hid").val();u>0&&n.ajax({headers:{valkey:o},type:"POST",url:"/vanpool/VPDRoleDDLChange",data:e,dataType:"json",success:function(n){wi(r,n)},error:function(n){console.log(n.responseText)}})},wi=function(t,r){var o=r,f=new Date,e;f=f.toLocaleDateString();e=n("#"+t).siblings(".vp-role-date-box");n(e).children("input").val(f);u(e);i()},i=function(){var i=!1,r=!1,t=!1,f=n(".vp_vpd_role_box").is(":visible"),u;if(n("#vp_vpd_name_req").hide(),n("#vp_vpd_role_error").hide(),u=n("#vp_vpd_name").val(),u?r=!0:n("#vp_vpd_name_req").show(),f){var e=n("table[vp-type=participant] tr"),o=n("#vp_vpd_role_driver").val(),s=n("#vp_vpd_role_driver_bck").val(),h=n("#vp_vpd_role_coord").val(),c=n("#vp_vpd_role_renter").val();e.length>0&&o>0&&s>=0&&h>0&&c>0?t=!0:n("#vp_vpd_role_error").show()}else t=!0;return r&&t&&(i=!0),i},f,bi=function(){n("#mapLoading").is(":visible")&&(ki(),clearInterval(f),f=0)},ki=function(){goog.route!==null&&n.each(goog.route.via_waypoints,function(n,t){var i={lat:t[0],lng:t[1]},r=new google.maps.Marker({position:i,map:goog.map,title:"stop "+(n+1),icon:"/Images/Icons/TripWaypoint.png"})})},di=function(){var t=n("section.buttons div.button i.fa-bars").is(":visible");t&&n("div.vp-role-date-box input.datepickertext").css("vertical-align","top")},gi=function(){hi();vp_forms.vp_autocomplete("vp_vpd_emp_txt","vp_vpd_emp_hid","AutoVPEmps","vp_vpd_id");n("#vp_vpd_van_chg_btn").click(function(){o()});li();n("#VPDetailsSave").click(function(){p(!0)});n("#VPDAddNewPrt").click(function(){d()});f=setInterval(bi,400);vp_forms.acBrowserFix();di()};return{init:gi,vpdSubmitSend:r,vpdSubmitReceive:w,vp_vpd_stops_sort_send:nt,remove_item_redirect:et,vp_emp_change:pt,vp_van_change:o,validateVPDetails:i}}(jQuery,window,document),vp_modal=function(n){"use strict";var t=function(){n("#vp_modal_run").click(function(){vp_modal.run_process()});n("#vp_modal_cancel").click(function(){vp_modal.hide_modal()})},i=function(){this.hide_modal();var t=n("#vp_modal_run").text().toLowerCase();switch(t){case"remove":f();break;case"add new stops":vanpools.go_to("vanpool_stop");break;case"lock":e();break;case"unlock":o();break;case"save":vp_details.vpdSubmitSend()}},r=function(t,i,r,u){n("#vp_modal_run").text(t);i?n("#vp_modal_cancel").show():n("#vp_modal_cancel").hide();n("#vp_modal_copy").text(r);u&&n("#vp_modal_param").val(u);n(".vp_modal_bg").show();n(".vp_modal").show()},u=function(){n(".vp_modal_bg").hide();n(".vp_modal").hide();n("#vp_modal_cancel").show()},f=function(){var t=n("#vp_modal_param").val();vp_details.remove_item_redirect(t);n("#vp_modal_param").val("")},e=function(){var t=n("#vp_modal_param").val();t==="trips"?vp_trips.finalize_send():t==="purchases"&&vp_purchases.finalize_send()},o=function(){var t=n("#vp_modal_param").val();t==="trips"?vp_trips.unlock_send():t==="purchases"&&vp_purchases.unlock_send()},s=function(){vp_modal.init_modal()};return{init:s,init_modal:t,run_process:i,show_modal:r,hide_modal:u}}(jQuery,window,document),VPReports=function(n,t){"use strict";var u=function(){let i={},r=n("#mtrcEmpReportDate").val();i.dt=r;const u=new URLSearchParams(t.location.search);i.empid=u.get("em");n("#VPPrts").data("sort","name|asc");VPAjax.ajaxSend("/TDM/VPReport/VPReportEmpPrts",i,"xml","reportEmpReceive")},f=function(){const i=new URLSearchParams(t.location.search),r=i.get("em");let u=n("#mtrcEmpReportDate").val(),f=n("#VPPrts").data("sort");e(r,u,f)},e=function(t,i,r){var u=n("#vp_vld_hid").val(),f="/TDM/VPReport/VPReportEmpPrtsExport?vk="+u+"&empid="+t+"&dt="+i+"&sort="+r;n("#ifDownload").attr("src",f)},o=function(t){if(t.documentElement.tagName==="VPParticipants"){let n=s(t);r(n)}else n("#vpReportEmpHdr").siblings().remove()},s=function(t){let u=n(t).find("Participant"),r=[],i={};return n.each(u,function(t,u){let f=n(u).children();i={};n.each(f,function(t,r){let u=n(r).prop("tagName"),f=n(r).text();i[u]=f});r.push(i)}),r},h=function(){let i=n("#vpReportEmpHdr").siblings(),t=[];return n.each(i,function(i,r){let u={},f=n(r).children();n.each(f,function(t,i){let r=n(i).text();switch(t){case 0:u.VPNAME=r;break;case 1:u.NAME=r;break;case 2:u.STARTDATE=r;break;case 3:u.ROLES=r;break;case 4:u.TRIPCT=r;break;case 5:u.TRIPMILES=r}});t.push(u)}),t},r=function(t){n("#vpReportEmpHdr").siblings().remove();n.each(t,function(t,i){let r=n("<tr>");n.each(i,function(t,i){let u=n("<td>");n(u).text(i);n(r).append(u)});n("#VPPrts").append(r)})},c=function(n){let t=h();t=l(t,n);r(t)},l=function(t,i){let u=n("#VPPrts"),e=n(u).data("sort"),f=e.split("|"),o=f[0],r=f[1];r=o===i?r==="asc"?"desc":"asc":"asc";let s=i+"|"+r;n(u).data("sort",s);switch(i){case"vpname":t.sort(a);break;case"name":t.sort(v);break;case"start":t.sort(y);break;case"roles":t.sort(p);break;case"trips":t.sort(w);break;case"miles":t.sort(b)}return r==="desc"?t.reverse():t},a=function(n,t){let i=n.VPNAME.toLowerCase(),r=t.VPNAME.toLowerCase();return i<r?-1:i>r?1:0},v=function(n,t){let i=n.NAME.toLowerCase(),r=t.NAME.toLowerCase();return i<r?-1:i>r?1:0},y=function(n,t){let i=new Date(n.STARTDATE),r=new Date(t.STARTDATE);return i<r?-1:i>r?1:0},p=function(n,t){let i=n.ROLES.toLowerCase(),r=t.ROLES.toLowerCase();return i<r?-1:i>r?1:0},w=function(n,t){let i=parseInt(n.TRIPCT),r=parseInt(t.TRIPCT);return i<r?-1:i>r?1:0},b=function(n,t){let i=parseInt(n.TRIPMILES),r=parseInt(t.TRIPMILES);return i<r?-1:i>r?1:0},nt=function(){var t=n("form:first");return n('input[name="__RequestVerificationToken"]',t).val()},k=function(){d();n("#mtrcEmpReportDate").change(function(){VPReports.reportEmpSend()});VPReports.reportEmpSend()},d=function(){let f=new Date,r=i(f.getMonth(),-1),u=f.getFullYear();r===11&&(u-=1);let t=new Date(u,r);const e=new Date(2018,0);while(t>=e){let f=t.getFullYear()+"-"+(t.getMonth()+1),e=g[t.getMonth()]+" "+t.getFullYear();n("#mtrcEmpReportDate").append(n("<option>").val(f).html(e));r=i(t.getMonth(),-1);t.getMonth()===0&&(u-=1);t=new Date(u,r)}},i;const g=["January","February","March","April","May","June","July","August","September","October","November","December"];return i=function(n,t){return n=n+t,n<0&&(n=12+n),n},{init:k,reportEmpSend:u,reportEmpExport:f,reportEmpReceive:o,sortPrts:c}}(jQuery,window,document),GRHAjax=function(n){"use strict";var i=function(i,r,u){let f=n("#cpVldHid").val();n.ajax({headers:{valkey:f},type:"POST",url:i,data:r,dataType:"json",contentType:"application/json; charset=utf-8",success:function(n){t(u,n)},error:function(n){console.log(n.responseText)}})},r=function(i,r,u){r===null&&(r="{}");var f=n("#cpVldHid").val();n.ajax({headers:{valkey:f},type:"POST",url:i,data:r,processData:!1,cache:!1,contentType:!1,success:function(n){t(u,n)},error:function(n){console.log(n.responseText)}})},t=function(n,t){switch(n){case"grhRegSecurityReceive":GRHRegister.initFormRegister();break;case"grhRegUserDataReceive":GRHRegister.grhRegUserDataReceive(t);break;case"grhRegPersonReceive":GRHRegister.grhRegPersonReceive(t);break;case"grhRegisterReceive":GRHRegister.grhRegisterFormReceive(t);break;case"grhRegAddressSelectReceive":GRHRegister.grhRegAddressSelectReceive(t);break;case"grhRegEmpSelectReceive":GRHRegister.grhRegEmpSelectReceive(t);break;case"grhRegGetLatLongReceive":GRHRegister.grhRegGetLatLongReceive(t);break;case"grhRegCommuteModesReceive":GRHRegister.grhRegCommuteModesReceive(t);break;case"grhReqSecurityReceive":GRHRequest.initFormRequest();break;case"grhRequestAddrTypeReceive|org":GRHRequest.grhRequestAddrTypeReceive(t,"org");break;case"grhRequestAddrTypeReceive|dest":GRHRequest.grhRequestAddrTypeReceive(t,"dest");break;case"grhRequestReceive":GRHRequest.grhRequestReceive(t);break;case"grhReceiptUploadReceive":GRHRequest.grhReceiptUploadReceive(t);break;case"grhRequestAddrTypeReceive":GRHRequest.grhRequestAddrTypeReceive(t);break;case"grhRequestGetLatLongReceive":GRHRequest.grhRequestGetLatLongReceive(t);break;case"initRequestHistoryReceive":GRHRequest.initRequestHistoryReceive(t);break;case"ShowPrintForm":GRHRequest.ShowPrintForm(t);break;case"grhSendLatLngRPReceive":GRHRequest.grhSendLatLngRPReceive(t)}},u=function(t){var i=new FormData,r=n("#cpVldHid").val();i.append("id",r);GRHAjax.ajaxUpload("/TDM/GRHShared/SetSecurity",i,t)},f=function(){};return{init:f,ajaxSend:i,ajaxUpload:r,setSecurity:u}}(jQuery,window,document),GRHForms=function(n,t,i){"use strict";function r(t,i){var r,u;t?(r=n(t).length,r>1?(u=n(t).closest("ul"),u.addClass("grh-invalid"),t=n(t).first()):t.addClass("grh-invalid"),t.attr("aria-invalid","true"),n("#grh-error-list").append("<li>"+i+"<\/li>"),t.attr("aria-labelledby","error-"+t.attr("id"))):n("#grh-error-list").append("<li>"+i+"<\/li>")}function k(t){return n("<div/>").text(t).html()}var nt=function(){tt();it();n("textarea").on("keyup",function(){wt(this)});SsnTimer.init()},tt=function(){const t=n("#grhRequestProcess").val()=="1";if(!t){const t=new Date,r=(new Date).setDate(t.getDate()-10),i=new Date(r);i.setHours(0,0,0,0);n(".grh-datepicker").datetimepicker({format:"L",useCurrent:!1,minDate:i,maxDate:t,icons:{previous:"icon chevron-left-blue",next:"icon chevron-right-blue"},widgetPositioning:{horizontal:"right",vertical:"top"}});n(".grh-timepicker").datetimepicker({format:"LT",icons:{up:"icon chevron-up-blue",down:"icon chevron-down-blue"},widgetPositioning:{horizontal:"left",vertical:"top"}})}},it=function(){var i=n("#GrhUrlReferrer").val(),r=t.location.href;i&&i!=r?n("#grhBtnBack").click(function(n){y(n)}):n("#grhBtnBack").hide()},rt=function(){var t=navigator.userAgent.toLowerCase().indexOf("chrome"),i=navigator.vendor.toLowerCase().indexOf("google");t>=0&&i>=0&&n("input[autocomplete=off]").attr("autocomplete","new-password")},y=function(i){i.preventDefault();var r=n("#GrhUrlReferrer").val(),u=t.location.href;return r&&r!=u&&(t.location=r),!1},ut=function(t,i,r,u){n("#"+t).autocomplete({minChars:2,width:550,lookup:function(t,i){var f=ft(t,u),e=n("#cpVldHid").val();n.ajax({headers:{valkey:e},type:"POST",url:"/TDM/"+r,data:f,dataType:"json",contentType:"application/json; charset=utf-8",success:function(n){i(n)},error:function(n){console.log(n.responseText)}})},onSelect:function(r){return n("#"+i).val(r.data),t=="grhRegEmpAC"?GRHRegister.grhEmpSelectConfirm():u==="grhRegAddrType"?GRHRegister.grhRegAddressSelectSend():t==="grhReqTripOriginAddress1"?GRHRequest.grhReqACAddressSend("org"):t==="grhReqTripDestAddress1"&&GRHRequest.grhReqACAddressSend("dest"),!1}})},ft=function(t,i){var u={Term:t},r;return i!==null&&(r=n("#"+i).val(),r===""&&(r=n("#"+i).text()),u.Params=r),JSON.stringify(u)},p=function(n){var t,r,f,u,i;return n!=null&&n.length>0&&(r=n.split(" "),f=r[1].toLowerCase(),f=="pm"?(u=r[0].split(":"),i=parseInt(u[0]),i<12&&(i=i+12),t=i+":"+u[1]):t=r[0],t=t+":00"),t},et=function(t){var i=new FormData,r=n("."+t);return n.each(r,function(){var t,u,e,o;if(n(this).is("ul")){var f=n(this).attr("data-fld"),r=n(this).find("input[id]"),s=n(r).first().attr("type")=="radio";s?n.each(r,function(){var r=n(this).prop("checked"),t;if(r)return t=n(this).val(),i.append(f,t),!1}):(t=[],n.each(r,function(){var r=n(this).prop("checked"),i;r&&(i=n(this).val(),t.push(i))}),t=JSON.stringify(t),i.append(f,t))}else n(this).attr("type")=="file"?(u=n(this).get(0).files,u.length>0&&i.append("GRHReceipt",u[0])):(e=n(this).attr("data-fld"),o=n(this).val(),i.append(e,o))}),i},ot=function(t,r){var f;if(t&&t.keyCode==13){var u=i.activeElement,e=n(u).get(0).tagName.toLowerCase(),o=n(u).attr("contenteditable");return e!="textarea"&&o!="true"&&(t.preventDefault(),f=n("#"+r),n(f).click()),!1}},st=function(){var y=n("#grhRegNameFirst"),p=n("#grhRegNameLast"),f=n("#grhRegAddress1"),s=n("#grhRegCity"),h=n("#grhRegState"),l=n("#grhRegZip"),i=n("#grhRegPhone"),t=n("#grhRegEmail"),a=n("#grhRegEmpHidChosen"),w,b,v,k,d,g;if(n("#grh-validation-summary").hide(),n("#grh-error-list").children().remove(),n("input, select").removeClass("grh-invalid"),n("input, select").removeAttr("aria-invalid"),n(a).parent().removeClass("grh-invalid"),n("#grhRegCMList").removeClass("grh-invalid"),u(y)===!1&&r(y,"The First Name field is required."),u(p)===!1&&r(p,"The Last Name field is required."),u(f)===!1&&r(f,"The Address 1 field is required."),u(s)===!1&&r(s,"The City field is required."),pt(h)===!1&&r(h,"The State field is required."),e(l)===!1&&r(l,"Please enter a valid Zip code."),u(i)===!1?r(i,"The Phone field is required."):(w=n(i).val(),vt(w)===!1&&r(i,"Please enter a valid, ten-digit phone number.")),n(t).length>0&&(u(t)===!1?r(t,"The Email field is required."):(b=n(t).val(),yt(b)===!1&&r(t,"Please enter a valid email address."))),v=n(a).val(),n.isNumeric(v)&&v!=="0"||(k=n(a).parent(),n(k).addClass("grh-invalid"),n("#grh-error-list").append("<li>Please select an employer.<\/li>")),d=n("#grhRegCMList input:checked").length,d===0&&(n("#grhRegCMList").addClass("grh-invalid"),n("#grh-error-list").append("<li>Please select at least one commute mode.<\/li>")),g=n("#grh-error-list").children(),n(g).length>0)o();else{var nt=n(f).val(),tt=n("#grhRegAddress2").val(),it=n(s).val(),rt=n(h).val(),ut=n(l).val(),ft=n.grep([nt,tt,it,rt,ut],Boolean).join(", ");c(ft,"grhReg","register")}},ht=function(){var n=GRHForms.collectFormValues("cpFrmFld");GRHAjax.ajaxUpload("/TDM/GRHForms/RegisterSubmit",n,"grhRegisterReceive")},ct=function(){var a=n("#grhReqRideDateInput"),c=n("#grhReqRideTimeInput"),ht=n("input[name=tripReason]"),y=n("#grhReqExplanation"),ct=n("input[name=tripOrigin]"),w=n("#grhReqTripOriginAddress1"),k=n("#grhReqTripOriginCity"),d=n("#grhReqTripOriginZip"),lt=n("input[name=tripDest]"),g=n("#grhReqTripDestAddress1"),nt=n("#grhReqTripDestCity"),tt=n("#grhReqTripDestZip"),at=n("input[name=tripTransType]"),l=n("#grhReqGoto"),it=n("#grhReqAgency"),i=n("#grhReqCost"),vt=n("input[name=tripReceiptType]"),yt=n("#grhReqReceiptFile"),pt=n("#grhReqConfirm"),wt=v(),rt,ut,bt,ft,et,t,ot,st;n("#grh-validation-summary").hide();n("#grh-error-list").children().remove();n("input, select, ul, label, textarea").removeClass("grh-invalid");n("input, select").removeAttr("aria-invalid");u(a)===!1&&r(a,"Please enter a Ride Date.");u(c)===!1?r(c,"Please enter a Ride Time."):(rt=n(c).val(),ut=p(rt),n("#grhReqRideTimeHd").val(ut));f("tripReason")===!1&&r(ht,"Please select a reason for the trip.");u(y)===!1&&r(y,"Please enter an explanation for the trip.");f("tripOrigin")===!1&&r(ct,"Please select an origin for the trip.");u(w)===!1&&r(w,"Please enter an address for the location the trip began.");u(k)===!1&&r(k,"Please enter a city for the location the trip began.");e(d)===!1&&r(d,"Please enter a valid zip code for the location the trip began.");f("tripDest")===!1&&r(lt,"Please select a destination for the trip.");u(g)===!1&&r(g,"Please enter an address for the location the trip ended.");u(nt)===!1&&r(nt,"Please enter a city for the location the trip ended.");e(tt)===!1&&r(tt,"Please enter a valid zip code for the location the trip ended.");f("tripTransType")===!1&&r(at,"Please select a transportation type for the trip.");wt=="Taxi"?u(it)===!1&&r(it,"Please enter the name of the agency hired for the trip."):u(l)===!1?r(l,"Please enter the ID number of the Go-To card used to pay for the trip."):bt=n(l).val();u(i)?(ft=n(i).val(),b(ft)===!1&&r(i,"Please enter a valid currency value in the Trip Cost field.")):r(i,"Please enter the amount paid for the trip.");f("tripReceiptType")===!1&&r(vt,"Please select a receipt type.");et=n("#grhReqReceiptTypeList input:checked").siblings("label").text();et==="Digital"&&(t=n("#grhReqRptFilename").text(),t.length>0&&(t=n.trim(t)),t.length===0&&u(yt)===!1&&(ot=n("#grhReqReceiptBtn"),r(ot,"Please attach an image file of your receipt.")));f("Confirmed")===!1&&(n("label[for=grhReqConfirm]").addClass("grh-invalid"),r(pt,"Please approve the confirmation statement."));st=n("#grh-error-list").children();n(st).length>0?o():(h(),s())},s=function(t){const r=n("#grhReqTripOriginAddress1").val(),u=n("#grhReqTripOriginAddress2").val(),f=n("#grhReqTripOriginCity").val(),e=n("#grhReqTripOriginState").val(),o=n("#grhReqTripOriginZip").val(),i=n.grep([r,u,f,e,o],Boolean).join(", ");t?l(i,"cpStart"):c(i,"cpStart","dest")},w=function(t){const r=n("#grhReqTripDestAddress1").val(),u=n("#grhReqTripDestAddress2").val(),f=n("#grhReqTripDestCity").val(),e=n("#grhReqTripDestState").val(),o=n("#grhReqTripDestZip").val(),i=n.grep([r,u,f,e,o],Boolean).join(", ");t?l(i,"cpStop"):c(i,"cpStop","request")},lt=function(){var i=GRHForms.collectFormValues("cpFrmFld"),f=n("#grhRequestProcess").val(),u;if(f==="1"){var r=n("#grhExpForCustomerCE"),e=n(r).attr("data-fld"),t=n(r).html();t=n.trim(t);t.indexOf("<ul>")==0&&(t="<br/>"+t);t.lastIndexOf("ul>")+3==t.length&&(t=t+"<br/>");t=k(t);i.append(e,t);GRHAjax.ajaxUpload("/TDM/GRHForms/RequestProcessSubmit",i,"grhRequestReceive")}else u=n("#grhReqId").val(),u>0?GRHAjax.ajaxUpload("/TDM/GRHForms/RequestUpdate",i,"grhRequestReceive"):GRHAjax.ajaxUpload("/TDM/GRHForms/RequestAdd",i,"grhRequestReceive")},at=function(){var ot,st,ht,ct,t,lt,at,l,vt;n(".grh-form-confirm").hide();var a=n("#grhReqDateSubmit"),y=n("#grhReqRideDate"),c=n("#grhReqRideTime"),yt=n("input[name=tripReason]"),w=n("#grhReqExplanation"),pt=n("input[name=tripOrigin]"),d=n("#grhReqTripOriginAddress1"),g=n("#grhReqTripOriginCity"),nt=n("#grhReqTripOriginZip"),wt=n("input[name=tripDest]"),tt=n("#grhReqTripDestAddress1"),it=n("#grhReqTripDestCity"),rt=n("#grhReqTripDestZip"),bt=n("input[name=tripTransType]"),ut=n("#grhReqGoto"),ft=n("#grhReqAgency"),i=n("#grhReqCost"),kt=n("input[name=tripReceiptType]"),dt=n("#grhReqReceiptFile"),gt=n("#grhReqConfirm"),ni=v(),et=n("#grhExpForCustomerCE");n("#grh-validation-summary").hide();n("#grh-error-list").children().remove();n("input, select, ul, label, textarea").removeClass("grh-invalid");n("input, select").removeAttr("aria-invalid");u(a)===!1&&r(a,"Please enter a Submit Date.");u(y)===!1&&r(y,"Please enter a Ride Date.");u(c)===!1?r(c,"Please enter a Ride Time."):(ot=n(c).val(),st=p(ot),n("#grhReqRideTimeHd").val(st));f("tripReason")===!1&&r(yt,"Please select a reason for the trip.");u(w)===!1&&r(w,"Please enter an explanation for the trip.");f("tripOrigin")===!1&&r(pt,"Please select an origin for the trip.");u(d)===!1&&r(d,"Please enter an address for the location the trip began.");u(g)===!1&&r(g,"Please enter a city for the location the trip began.");e(nt)===!1&&r(nt,"Please enter a valid zip code for the location the trip began.");f("tripDest")===!1&&r(wt,"Please select a destination for the trip.");u(tt)===!1&&r(tt,"Please enter an address for the location the trip ended.");u(it)===!1&&r(it,"Please enter a city for the location the trip ended.");e(rt)===!1&&r(rt,"Please enter a valid zip code for the location the trip ended.");f("tripTransType")===!1&&r(bt,"Please select a transportation type for the trip.");ni=="Taxi"?u(ft)===!1&&r(ft,"Please enter the name of the agency hired for the trip."):u(ut)===!1&&r(ut,"Please enter the ID number of the GoTo card used to pay for the trip.");u(i)?(ht=n(i).val(),b(ht)===!1&&r(i,"Please enter a valid currency value in the Trip Cost field.")):r(i,"Please enter the amount paid for the trip.");f("tripReceiptType")===!1&&r(kt,"Please select a receipt type.");ct=n("#grhReqReceiptTypeList input:checked").siblings("label").text();ct==="Digital"&&(t=n("#grhReqRptFilename").text(),t.length>0&&(t=n.trim(t)),t.length===0&&u(dt)===!1&&(lt=n("#grhReqReceiptBtn"),r(lt,"Please attach an image file of your receipt.")));f("Confirmed")===!1&&(n("label[for=grhReqConfirm]").addClass("grh-invalid"),r(gt,"Please approve the confirmation statement."));at=n(et).html().trim();l=k(at).length;l>1e3&&r(et,"The 'Explanation for Customer' field allows 1000 characters (includes HTML tags).  The current value has "+l+" characters.  Please reduce the number of characters to 1000 or less.");vt=n("#grh-error-list").children();n(vt).length>0?o():(h(),s())},vt=function(n){return/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(n)},yt=function(n){return/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(n)},b=function(n){return!!n.match(/(?=.)^\$?(([1-9][0-9]{0,2}(,[0-9]{3})*)|0)?(\.[0-9]{1,2})?$/)},u=function(t){var i=!1,r=n(t).val();return r&&r.length>0&&(i=!0),i},pt=function(t){var i=!1,u=n(t).attr("id"),r=n("#"+u+" option:selected").val();return r&&r.length>0&&(i=!0),i},f=function(t){var r=!1,u=n("input[name="+t+"]").first().attr("type"),i;return i=u==="checkbox"?n("input:checkbox[name="+t+"]:checked").val():n("input:radio[name="+t+"]:checked").val(),i&&i.length>0&&(r=!0),r},e=function(t){var i=!1,r=n(t).val();return r&&(i=/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(r)),i},wt=function(t){var r=n(t).data("maxlength"),i=n(t).val();i&&i.length>r&&n(t).val(i.substr(0,r))},bt=function(t){n.each(t,function(t,i){var u=i.FldId,f=null,e;u&&(f=n("#"+u));e=i.Message;r(f,e)});o()},o=function(){n("#grh-validation-summary").show();n("#grh-validation-summary").focus()},h=function(){n("#wrapnav").css("z-index",0);n("#grhOverlay").show()},kt=function(){n("#wrapnav").css("z-index",99);n("#grhOverlay").hide()},c=function(t,i,r){var f=n("#"+i+"Lat").val(),u;f>10?a(r):(u=new google.maps.Geocoder,u.geocode({address:t},function(t,u){u===google.maps.GeocoderStatus.OK?(n("#"+i+"Lat").val(t[0].geometry.location.lat()),n("#"+i+"Lng").val(t[0].geometry.location.lng()),a(r)):console.log("Geocode was not successful for the following reason: "+u)}))},l=function(n,t){var i=new google.maps.Geocoder;i.geocode({address:n},function(n,i){if(i===google.maps.GeocoderStatus.OK){const i=n[0].geometry.location.lat(),r=n[0].geometry.location.lng();dt(t,i,r);d(t,i,r)}else console.log("Geocode was not successful for the following reason: "+i)})},d,a,v;let dt=function(t,i,r){switch(t){case"cpHome":n("#cpHomeLat").val(i);n("#cpHomeLng").val(r);break;case"cpEmp":n("#cpWorkLat").val(i);n("#cpWorkLng").val(r);break;case"cpStart":n("#cpStartLat").val(i);n("#cpStartLng").val(r);break;case"cpStop":n("#cpStopLat").val(i);n("#cpStopLng").val(r)}};d=function(t,i,r){let u=new FormData;const f=n("#grhReqPrtId").val(),e=n("#grhReqId").val();u.append("prtId",f);u.append("reqId",e);u.append("fldId",t);u.append("lat",i);u.append("lng",r);GRHAjax.ajaxUpload("/TDM/GRHForms/LatLngUpdate",u,"grhSendLatLngRPReceive")};a=function(n){switch(n){case"register":ht();break;case"dest":w();break;case"request":lt()}};let gt=function(){let t=n("#cpStartLat").val(),i=n("#cpStartLng").val(),r=n("#cpStopLat").val(),u=n("#cpStopLng").val(),f=n("#cpHomeLat").val(),e=n("#cpHomeLng").val(),o=n("#cpWorkLat").val(),h=n("#cpWorkLng").val();(t<10||i>-10)&&s(!0);(r<10||u>-10)&&w(!0);(f<10||e>-10)&&g("Home");(o<10||h>-10)&&g("Emp")};const g=function(t){let i=n("#grhRP"+t+"Addr");const r="cp"+t,u=n(i).find(".str1").text(),f=n(i).find(".str2").text(),e=n(i).find(".city").text(),o=n(i).find(".state").text(),s=n(i).find(".zip").text(),h=n.grep([u,f,e,o,s],Boolean).join(", ");l(h,r)};return v=function(){var t=n("#grhReqTransTypeList").find("input:checked"),i=n(t).parent().text().trim();return i.match("^Taxi")?"Taxi":"Transit"},{init:nt,acBrowserFix:rt,goBack:y,collectFormValues:et,addValidationIssue:r,showErrors:o,processErrors:bt,showSpinner:h,hideSpinner:kt,pressEnterToSubmit:ot,grhAutocomplete:ut,grhFormValidateRegister:st,grhFormValidateRequest:ct,grhFormValidateRequestProcess:at,checkRPLatLngValues:gt}}(jQuery,window,document),GRHRegister=function(n){"use strict";var o=function(){GRHAjax.setSecurity("grhRegSecurityReceive")},s=function(){h();c();l();a();v();n("#grhRegFormBox").keypress(function(n){GRHForms.pressEnterToSubmit(n,"grhRegSubmit")})},h=function(){n(".grh-lnk").click(function(n){n.preventDefault();e(this)})},c=function(){n("#grhRegSubmit").click(function(n){n.preventDefault();GRHForms.grhFormValidateRegister()})},l=function(){GRHForms.grhAutocomplete("grhRegEmpAC","grhRegEmpHid","GRHAC/AutoGRHEmps");GRHForms.acBrowserFix()},a=function(){var t=n("section.buttons div.button i.fa-bars").is(":visible");t&&n("#grhRegEmpDetailsBox").addClass("grh-reg-emp-box-mob")},v=function(){GRHAjax.ajaxSend("/TDM/GRHShared/GRHGetUserData",null,"grhRegUserDataReceive")},y=function(i){var e=i.success,r,u,f;e?(r=i.Person,u=i.PrtId,n("#grhRegPrtIdHid").val(u),t(r)):(f=i.message,GRHForms.addValidationIssue(null,f),GRHForms.showErrors())},p=function(t){var i=t.success;i?(n("#grhRegFormBox").hide(),n(".grh-form-confirm").show(),n("html, body").animate({scrollTop:n("#GrhHdrRegister").offset().top},500)):t.errors&&t.errors.length>0&&n.each(t.errors,function(t,i){var r=i.FldId,u=i.Message,f=n("#"+r);GRHForms.addValidationIssue(f,u);GRHForms.showErrors()})},w=function(n){var t=n.success},t=function(t){var e=t.PnId,o=t.FirstName,s=t.LastName,r=t.Email,h=t.Phone,c=t.PhoneExt,l=t.Addr,a=t.Emp,v=t.Modes;n("#grhRegPsnIdHid").val(e);n("#grhRegNameFirst").val(o);n("#grhRegNameLast").val(s);n("#grhRegEmail").val(r);n("#grhRegEmailLit").text(r);n("#grhRegPhone").val(h);n("#grhRegPhoneExt").val(c);i(l);u(a);f(v)},b=function(){var t=n("#grhRegAddressHid").val();GRHAjax.ajaxSend("/TDM/GRHShared/GRHGetAddressById/"+t,null,"grhRegAddressSelectReceive")},i=function(t){if(t){n("#grhRegAddressHid").val(t.AdId);n("#grhRegAddress1").val(t.Street1);n("#grhRegAddress2").val(t.Street2);n("#grhRegCity").val(t.City);var i="MN";t.State==="WI"&&(i="WI");n("#grhRegState").val(i);n("#grhRegZip").val(t.Zip)}},k=function(){n("#grhRegEmpAC").val("");r();var t=n("#grhRegEmpChgLnk");e(t)},r=function(){var t=n("#grhRegEmpHid").val();GRHAjax.ajaxSend("/TDM/GRHShared/GRHGetEmployerById/"+t,null,"grhRegEmpSelectReceive")},u=function(t){if(t){var i=t.EmpId,r=t.EmpName,u=t.Street1,f=t.Street2,e=t.City,o=t.State,s=t.Zip;n("#grhRegEmpHidChosen").val(i);n(".grhRegEmpName").text(r);n(".grhRegEmpAdd1").text(u);n(".grhRegEmpAdd2").text(f);n(".grhRegEmpCity").text(e);n(".grhRegEmpState").text(o);n(".grhRegEmpZip").text(s)}},f=function(t){var f,i,u,r;if(t)for(f=n("#grhRegCMList"),i=0;i<t.length;i++)u=t[i].Value,r=n("#grhRegCMList input[value="+u+"]"),r&&n(r).prop("checked",!0)},e=function(t){var r=n(t).attr("id"),u="Select",f=n("#grhAddChangeIds").val(),e;typeof f!="undefined"&&(e=JSON.parse(f),u=e[r]);var s=r.replace("Lnk","Frm"),i=n("#"+s),o=n(i).children("input"),h=n(i).children("select");n(i).is(":visible")?(n(i).hide(),n(t).text(u),n(t).attr("aria-label","Select Employer"),n(o).val("")):(n(i).show(),n(t).text("Cancel"),n(t).attr("aria-label","Cancel Select Employer"),n(o).focus(),n(h).focus())};return{init:o,initFormRegister:s,grhRegUserDataReceive:y,grhRegisterFormReceive:p,grhRegPersonReceive:t,grhRegAddressSelectSend:b,grhRegAddressSelectReceive:i,grhEmpSelectConfirm:k,grhRegEmpSelectSend:r,grhRegEmpSelectReceive:u,grhRegCommuteModesReceive:f,grhRegGetLatLongReceive:w}}(jQuery,window,document),GRHRequest=function(n,t,i){"use strict";var c=function(){GRHAjax.setSecurity("grhReqSecurityReceive")},l=function(){a();v();p();w();e();b();nt();it();n("#grhReqFormBox").keypress(function(n){GRHForms.pressEnterToSubmit(n,"grhReqSubmit")});n("input[name=tripTransType]").change(function(){e()})},a=function(){var t=n("#dataInc").val();t==1&&(n("#grh-prereq-issue-box").show(),n("#grh-request-box").hide())},v=function(){u();n("#grhReqReceiptTypeList").change(function(){u()});y();rt()},y=function(){n("#grhReqReceiptBtn").click(function(){n("#grhReqReceiptFile").click()});n("#grhReqReceiptFile").change(function(){var t,i,r;n("#grhReqRptIdHid").val(0);t=n(this).val();i=t.lastIndexOf("\\")+1;t=t.substring(i);n("#grhReqRptFilename").text(t);n("#grhUploadFileHd").val(!0);r=n("#grhRequestProcess").val();r==1&&(n("#grh-receipt-lnk-box").hide(),n("#grh-receipt-lnk").attr("href","/TDM/GRHShared/GetAxImage/0"))})},p=function(){n("#grhReqTripOriginList input").change(function(){o("org",this)});n("#grhReqTripDestList input").change(function(){o("dest",this)})},w=function(){n("#grhReqSubmit").click(function(n){n.preventDefault();r()?GRHForms.grhFormValidateRequestProcess():GRHForms.grhFormValidateRequest()});r()&&n("#grhBtnBackReqPro").click(function(n){return n.preventDefault(),t.location="/Admin/Commuter/GRH/GRHManageRequests.aspx",!1});n("#grh-request-confirm-print-btn").click(function(n){return n.preventDefault(),et(),!1})},b=function(){var r=n("section.buttons div.button i.fa-bars").is(":visible"),t;r&&(n("#grh-validation-summary").addClass("grh-vld-sum-mob"),n("#grhReqNameBox").addClass("grh-proreq-name-mob"),n(".grh-datepicker").addClass("grh-datepicker-mob"),n(".grh-timepicker").addClass("grh-timepicker-mob"),n("#grh-proreq-map-box").addClass("grh-proreq-map-box-mobile"),n(".grh-proreq-map").addClass("grh-proreq-map-mobile"),n("#grhReqCost").addClass("grh-proreq-cost-mobile"),t=i.createElement("script"),t.setAttribute("type","text/javascript"),t.setAttribute("src","/ClientScript/TransitValidation.js"),i.getElementsByTagName("head")[0].appendChild(t))},r=function(){var t=n("#grhRequestProcess").val();return t==="1"?!0:!1},u=function(){var t=n("#grhReqReceiptTypeList input:checked").siblings("span").text(),i=n("#grhReqRptFilename").text().trim(),r=n("#grhRequestProcess").val();r==1?i!="Default Receipt"&&n("#grh-receipt-lnk-box").show():(t==="Digital"?n(".grh-upload-box, .grh-req-file-types").show():n(".grh-upload-box, .grh-req-file-types").hide(),t==="Email"?n(".grh-req-rpt-email").show():n(".grh-req-rpt-email").hide())},k=function(i){var r;GRHForms.hideSpinner();var f=i.success,u=i.ReqId,e=n("#grhRequestProcess").val();if(f===!0){if(n(".grh-form-confirm").show(),e==1)t.location="/Admin/Commuter/GRH/GRHManageRequests.aspx";else{n("#grhReqFormBox").hide();var o=n("#grhReqTransTypeList").find("input").eq(0),s=n(o).prop("checked"),h=n("#grhReqReceiptTypeList").find("input").eq(1),c=n(h).prop("checked");s&&c&&n("#grh-request-confirm-print").show();n("html, body").animate({scrollTop:n("#GrhHdrRequest").offset().top},500)}u>0&&n("#grhReqId").val(u)}else r=i.errors,n.each(r,function(t,i){if(i.FldId=="grhReqCost"&&i.Value>0){var r=i.Value,u=i.FldId;n("#"+u).val(r)}}),GRHForms.processErrors(r)},d=function(n){var t=n.success},o=function(t,i){var e=n(i).next().text(),o=n(i).val(),r,u,f;e==="Other"?(r={},r.Params={},r.Params.orgDest=t,s(r)):(u=n("#grhReqPrtId").val(),f="at="+o+"&pt="+u+"&od="+t,GRHAjax.ajaxSend("/TDM/GRHShared/RequestAddrType?"+f,null,"grhRequestAddrTypeReceive"))},g=function(t){var i=0;t==="org"?(i=n("#grhReqOriginACId").val(),GRHAjax.ajaxSend("/TDM/GRHShared/GRHGetAddressById/"+i,null,"grhRequestAddrTypeReceive|"+t)):(i=n("#grhReqDestACId").val(),GRHAjax.ajaxSend("/TDM/GRHShared/GRHGetAddressById/"+i,null,"grhRequestAddrTypeReceive|"+t))},s=function(t,i){var u;i==null&&(i=t.Params.orgDest);var f=t.Street1,e=t.Street2,o=t.City,r="MN";t.State=="WI"&&(r="WI");u=t.Zip;i==="org"?(n("#grhReqTripOriginAddress1").val(f),n("#grhReqTripOriginAddress2").val(e),n("#grhReqTripOriginCity").val(o),n("#grhReqTripOriginState").val(r),n("#grhReqTripOriginZip").val(u)):(n("#grhReqTripDestAddress1").val(f),n("#grhReqTripDestAddress2").val(e),n("#grhReqTripDestCity").val(o),n("#grhReqTripDestState").val(r),n("#grhReqTripDestZip").val(u))},nt=function(){if(r()){var t=n("#grhReqPrtId").val();GRHAjax.ajaxSend("/TDM/GRHShared/RequestHistoryByPtId/"+t,null,"initRequestHistoryReceive")}},tt=function(t){n.each(t,function(){var t=n("#grh-tmp-reqhist").html();t=n.parseHTML(t);var i=this.ReqId,r=n("<a>",{href:"/Admin/Commuter/GRH/GRHRequestProcess.aspx?r="+i}).text(this.RideDate),u=this.SubmitDate,f=this.Status,e=this.Cost,o=this.AdminNotes;n(t).find(".grh-reqhst-ride").append(r);n(t).find(".grh-reqhst-sbmdt").append(u);n(t).find(".grh-reqhst-stat").text(f);n(t).find(".grh-reqhst-amt").text(e);n(t).find(".grh-reqhst-admnotes").text(o);n("#grhRequestFormHistoryTbl tbody").append(t)});ut()},it=function(){var t=n("#grhRequestProcess").val();t==="1"&&(lt(),GRHForms.checkRPLatLngValues())},rt=function(){var t=n("#grhReqRptIdHid").val();t>0&&n("#grh-receipt-lnk-box").show()},ut=function(){const i=new Date(n("#grh-regdate").text());let t=new Date(i.getFullYear()+1,i.getMonth(),i.getDate()),r=n("#grhRequestFormHistoryTbl tbody tr");while(r.length>0)r=ft(r,t),t=new Date(t.getFullYear()+1,t.getMonth(),t.getDate())},ft=function(t,i){let u=0,f=0;t=n.grep(t,function(t){let r=n(t).children(":first").text(),e=new Date(r);if(e<i){let i=n(t).children(":eq(2)").text().toLowerCase(),r=parseFloat(n(t).children(":eq(3)").text().replace("$",""));return i!=="denied"&&(u+=1,f+=r),!1}return!0});let r=n("<tr>");return n(r).append(n("<td>").text(i.toLocaleDateString())),n(r).append(n("<td>").text(u)),n(r).append(n("<td>").text("$"+parseFloat(f).toFixed(2))),n("#grhRequestYTDTbl tbody").prepend(r),t},et=function(){var n=GRHForms.collectFormValues("cpFrmFld");GRHForms.showSpinner();GRHAjax.ajaxUpload("/TDM/GRHForms/RequestPrint",n,"ShowPrintForm")},ot=function(t){GRHForms.hideSpinner();n("body").append(t);n("form").hide();st();n("#grh-request-print-box").show()},st=function(){var t=n("#grhReqTripReasonListPrint").find("input"),i=n("#grhReqTripOriginListPrint").find("input"),r=n("#grhReqTripDestListPrint").find("input"),u=n("#grhReqTransTypeListPrint").find("input"),e=n("#grhReqReceiptTypeListPrint").find("input");f(t);h(i);h(r);f(u);f(e)},f=function(t){n.each(t,function(){var i=n(this).prop("checked"),t;i||(t=n(this).closest("li"),n(t).hide())})},h=function(t){n.each(t,function(){var t=n(this).prop("checked");t||n(this).prop("disabled",!0)})},ht=function(){return print(),!1},ct=function(){return n("#grh-request-print-box").remove(),n("form").show(),!1},e=function(){var r=n("#grhReqTransTypeList").find("input:checked"),f=n(r).parent().text().trim(),t,i;f.match("^Taxi")?(t=n("#grh-fld-goto"),n(t).hide(),n(t).val(""),n("#grh-fld-prov").show(),n("#grhReqReceiptTypeFS").show()):(i=n("#grh-fld-prov"),n(i).hide(),n(i).val(""),n("#grh-fld-goto").show(),n("#grhReqReceiptTypeFS").hide(),n("#grhReqReceiptTypeFS").find("li:nth-child(2) input").prop("checked","checked"),u())},lt=function(){n("#grhReqDenialList label:gt(0)").after('<i class="grh-rp-icon glyphicon glyphicon-edit"><\/i>');n("#grhReqDenialList li i").click(function(){at(this)})},at=function(t){var u=i.createElement("ul"),s=n(t).siblings("label").children("span").text(),h="<li>"+s+"<\/li>",r=n("#grhExpForCustomerCE").html(),e,o,f,c;r.indexOf(s)<0&&(e=r.lastIndexOf("<ul><li>"),e>=0?(o=r.lastIndexOf("<\/ul>"),o>0&&(f=r.substring(e,o+5),c=f.substring(4,f.length-5),r=r.replace(f,""),u.innerHTML=c,n(u).append(h))):u.innerHTML=h,r=r+n(u).prop("outerHTML"),n("#grhExpForCustomerCE").html(r))};let vt=function(n){var t=n.success;t===!0&&initGRHMap()};return{init:c,grhReqACAddressSend:g,grhRequestReceive:k,grhRequestAddrTypeReceive:s,grhRequestGetLatLongReceive:d,initFormRequest:l,transportTypeShow:e,initRequestHistoryReceive:tt,ShowPrintForm:ot,Print:ht,PrintCancel:ct,grhSendLatLngRPReceive:vt}}(jQuery,window,document),common=function(n,t){var i=function(){n(".date-picker")!==null&&n(".date-picker").datetimepicker({pickTime:!1});n("input[id$='txtPhone']")!==null&&n("input[id$='txtPhone']").mask("999-9999")},r=function(t,i,r){n(t).devbridgeAutocomplete({minChars:2,width:550,lookup:function(t,i){var u=JSON.stringify({Term:t});n.ajax({type:"POST",url:r,data:u,dataType:"json",contentType:"application/json; charset=utf-8",success:function(n){i(n)},error:function(n){console.log(n.responseText)}})},onSelect:function(r){return n(t).val(r.value),n(i).val(r.data),!1}})},u=function(n){n=n?n:t.event;var i=n.which?n.which:n.keyCode;return i>31&&(i<48||i>57)?!1:!0},f=function(){return confirm("Are you sure you want to remove this person from your carpool?")};return{init:i,isNumber:u,deleteConfirm:f,devbautosearch:r}}(jQuery,window,document),permit=function(){var n=function(){common.devbautosearch("#txtEmployerSearch","#hidEmployerID","/TDM/Parkingpermit/GetEmployers");var n=Sys.WebForms.PageRequestManager.getInstance();n!==null&&n.add_endRequest(function(n){n._postBackSettings.panelsToUpdate!==null&&common.devbautosearch("#txtEmployerSearch","#hidEmployerID","/TDM/Parkingpermit/GetEmployers")})},t=function(){pcEmployer.Show()};return{init:n,ShowEmployerWindow:t}}(jQuery,window,document),spinner=function(n){"use strict";var t=function(){n("#dvLoading").fadeOut()};return{init:t}}(jQuery,window,document),rdmajaxmvc=function(n,t){"use strict";var f=function(){e()},e=function(){var t=n("#filename").val();switch(t){case"UserProfile":i("#submitButton","/TDM/Ridematch/UserProfile",{filename:t},"");break;case"NewEmployer":i("#submitButton","/TDM/Ridematch/NewEmployer",{filename:t},"");break;case"CommuteProfile":i("#submitButton","/TDM/Ridematch/CommuteProfile",{filename:t},"")}},i=function(t,i,u,f){n(t).on("click",function(t){t.preventDefault();var e="";e=f===""?n(this).closest("form").serializeFormJSON():f;n("#dvLoading").show();r(i,e,u);n("#dvLoading").hide()})},r=function(t,i,r){n.ajax({method:"POST",url:t,data:i,dataType:"json"}).done(function(n){n.success?o(r,n):s(n.Errors)}).fail(function(n,t){console.log(r+" Failed: "+t+" - "+n.status+" - "+n.statusText)})},o=function(i,r){switch(i.filename){case"UserProfile":n("#submittedModal").off("hidden.bs.modal").on("hidden.bs.modal",function(){location="/Commuter/Ridematch/RDMDashboard.aspx"}).modal({show:!0});break;case"NewEmployer":n("#submittedModal").off("hidden.bs.modal").on("hidden.bs.modal",function(){location="RDMUserProfile.aspx?newemployerId="+r.employerId}).modal({show:!0});break;case"CommuteProfile":t.location.href="/Commuter/Ridematch/RDMSearchResults.aspx?profileId="+r.profileId;break;case"SearchResultsCard":n(i.divmsg).hide();n(i.divconfirm).show();break;case"MessageAdd":n(i.divmsg).hide();n(i.divconfirm).show();break;case"CommuteProfileDelete":case"MessageDelete":t.location.href="/Commuter/Ridematch/RDMDashboard.aspx"}},u=function(){var i=n("[data-valmsg-replace=true]"),t,r;i.removeClass("field-validation-error").addClass("field-validation-valid");i.empty();n("#dvRmEmployerAdd").length&&n("#dvRmEmployerAdd").hide();t=n("[data-valmsg-summary=true]");r=t.find("ul");r.empty();t.removeClass("validation-summary-errors").removeClass("alert").removeClass("alert-danger").addClass("validation-summary-valid")},s=function(t){u();var i=n("[data-valmsg-summary=true]"),r=i.find("ul");n.each(t,function(t,i){if(i.Value.length>0){n("[data-valmsg-for='"+i.Key+"'").text(i.Value[0]).removeClass("field-validation-valid").addClass("field-validation-error");var u="<span class='field-validation-error text-danger'>"+i.Value[0]+"<\/span>";n("<li />").html(u).appendTo(r);n("#dvRmEmployerAdd").length&&i.Key==="EmployerNameAddr"&&n("#dvRmEmployerAdd").show()}});t.length>0&&i.removeClass("validation-summary-valid").addClass("validation-summary-errors").addClass("alert").addClass("alert-danger")};return n.fn.serializeFormJSON=function(){var t={},i=this.serializeArray();return n.each(i,function(){t[this.name]?(t[this.name].push||(t[this.name]=[t[this.name]]),this.name.indexOf("__")!==0&&this.name.indexOf("_")!==0&&this.name.indexOf("ctl00")!==0&&this.name.indexOf("DXScript")!==0&&this.name.indexOf("DXCss")!==0&&(t[this.name]=this.value||"-1")):this.name.indexOf("__")!==0&&this.name.indexOf("_")!==0&&this.name.indexOf("ctl00")!==0&&this.name.indexOf("DXScript")!==0&&this.name.indexOf("DXCss")!==0&&(t[this.name]=this.value||"-1")}),t},{init:f,request:r,cleanError:u,FormSubmit:i}}(jQuery,window,document);(function(n){"use strict";function r(r,u){this.element=r;this.settings=n.extend({},i,u);this.currentPage=1;this._defaults=i;this._name=t;this._results;this._page=0;this._itemsPerPage=this.settings.itemsPerPage;this.init()}var t="pager",i={nextButton:"#nextbutton",prevButton:"#prevbutton",itemsPerPage:3,childElementName:"div"};n.extend(r.prototype,{init:function(){var t=this._itemsPerPage,i=1;this._results=n(this.element).children(this.settings.childElementName);this._results.each(function(r){r>t-1?n(this).hide():n(this).addClass("pagerItem-"+i++)});n(this.settings.prevButton).on("click",{plugin:this},this.pagePrevious);n(this.settings.nextButton).on("click",{plugin:this},this.pageNext);n(this.settings.prevButton).addClass("btn-disable");this._results.length<=t&&n(this.settings.nextButton).addClass("btn-disable")},pagePrevious:function(t){t.preventDefault();var i=t.data.plugin,r=1;n('[class*="pagerItem-"]').removeClass(function(n,t){return t.match(/pagerItem-\d+/)[0]});--i._page==0?n(this).addClass("btn-disable"):n(this).removeClass("btn-disable");n(i.settings.nextButton).removeClass("btn-disable");i._results.each(function(t){t>i._page*i._itemsPerPage-1&&t<(i._page+1)*i._itemsPerPage?n(this).show().addClass("pagerItem-"+r++):n(this).hide()});i.currentPage=i._page+1;n(i.settings.prevButton).trigger("page:previous")},pageNext:function(t){t.preventDefault();var i=t.data.plugin,r=1,u=Math.ceil(i._results.length/i._itemsPerPage)-1;n('[class*="pagerItem-"]').removeClass(function(n,t){return t.match(/pagerItem-\d+/)[0]});++i._page==u?n(this).addClass("btn-disable"):n(this).removeClass("btn-disable");n(i.settings.prevButton).removeClass("btn-disable");i._results.each(function(t){t>i._page*i._itemsPerPage-1&&t<(i._page+1)*i._itemsPerPage?n(this).show().addClass("pagerItem-"+r++):n(this).hide()});i.currentPage=i._page+1;n(i.settings.nextButton).trigger("page:next")}});n.fn[t]=function(i){return this.each(function(){n.data(this,"plugin_"+t)||n.data(this,"plugin_"+t,new r(this,i))})}})(jQuery,window,document);var rdmsearchresults=function(n,t,i,r){"use strict";var u=function(){var t=n("#profileCards").pager({childElementName:"div.card"}).data("plugin_pager");f(t);e(t);t!==r&&showMarkers(null,t.currentPage-1)},f=function(t){n("#prevbutton").on("page:previous",function(){showMarkers(null,t.currentPage-1)});n("#nextbutton").on("page:next",function(){showMarkers(null,t.currentPage-1)})},e=function(n){init_Google("map_canvas","searchCards");createGoogleGeocoder("FromAddress",null);createGoogleGeocoder("ToAddress",null);o(n)},o=function(){if(n("#ToAddress").val().length>0&&n("#FromAddress").val().length>0)return getRouteFromLocation("FromAddress","FromAddress"),getRouteToLocation("ToAddress","ToAddress"),createGoogleRoute(),!1};return{init:u}}(jQuery,window,document),rdmsearchresultscard=function(n){"use strict";var t=function(n,t,f,o,s,h,c,l,a){i(n,t);r(f,n,t);u(t,a);e(o,h,s,c)},i=function(t,i){n(t).show();n(i).hide()},r=function(t,i,r){n(t).on("click",function(t){t.preventDefault();var u=n(this).closest("form").serializeFormJSON();rdmajaxmvc.request("/TDM/Ridematch/MessageAdd",u,{filename:"MessageAdd",divmsg:i,divconfirm:r})})},u=function(t,i){n('[data-toggle="modal"]').on("click",function(){f(t,i)})},f=function(t,i){rdmajaxmvc.cleanError();n(".modal-body input[type=text]").val("Metro Transit - Ridematch");n("replyModal .modal-body textarea").val(n(i).val());n(t).hide()},e=function(t,i,r,u){n("#"+t).val().length>0&&n("#"+i).val().length>0&&(getRouteFromLocation(i,u),goog.routeFromLocation&&setGoogleMarker(goog.routeFromLocation),getRouteToLocation(t,r),goog.routeToLocation&&setGoogleMarker(goog.routeToLocation))};return{init:t}}(jQuery,window,document),rdmcommuteprofile=function(n){"use strict";function i(t){var i=n(t).prop("checked");n(t).prop("checked")?n(t).attr("value","true"):n(t).attr("value","false");n(t).on("change",function(){n(this).is(":checked")?n(this).attr("value","true"):n(this).attr("value","false")})}var u=function(t,r){f(t);e(r);n("#FromAddress").trigger("change");n("#ToAddress").trigger("change");o();s();h();i("#IsSmoker");i("#IsNotDriver");i("#MatchCoworker");i("#MatchGender");i("#MatchNonSmoker");c();l()},f=function(t){n("#homeAddress").change(function(){return this.checked?(n("#FromAddress").val(t),codeAddress("FromAddress",r),!1):(n("#FromAddress").val(""),clearGoogleMapMarkers(),clearGoogleMapRoute(),!1)})},e=function(t){n("#workAddress").change(function(){return this.checked?(n("#ToAddress").val(t),codeAddress("ToAddress",r),!1):(n("#ToAddress").val(""),clearGoogleMapMarkers(),clearGoogleMapRoute(),!1)})},o=function(){n("#FromAddress").change(function(){return n("#homeAddress").prop("checked",!1),clearGoogleMapMarkers(),clearGoogleMapRoute(),!1})},s=function(){n("#ToAddress").change(function(){return n("#workAddress").prop("checked",!1),clearGoogleMapMarkers(),clearGoogleMapRoute(),!1})},h=function(){n("#IsSmoker").change(function(){this.checked?(n("#MatchNonSmoker").prop("checked",!1),n("#MatchNonSmoker").prop("disabled",!0)):(n("#MatchNonSmoker").prop("checked"),n("#MatchNonSmoker").prop("disabled",!1))})},c=function(){n("#SchedSunStyle").click(function(){t(this,"#SchedSun")});n("#SchedMonStyle").click(function(){t(this,"#SchedMon")});n("#SchedTueStyle").on("click",function(){t(this,"#SchedTue")});n("#SchedWedStyle").click(function(){t(this,"#SchedWed")});n("#SchedThuStyle").click(function(){t(this,"#SchedThu")});n("#SchedFriStyle").click(function(){t(this,"#SchedFri")});n("#SchedSatStyle").click(function(){t(this,"#SchedSat")})},t=function(t,i){return n(t).hasClass("active")?(n(t).removeClass("active"),n(i).val("0")):(n(t).addClass("active"),n(i).val("1")),!1},l=function(){init_Google("map_canvas","card");createGoogleGeocoder("FromAddress",r);createGoogleGeocoder("ToAddress",r);r()},r=function(){n("#ToAddress").val().length>0&&n("#FromAddress").val().length>0&&(getRouteFromLocation("FromAddress","FromAddress"),getRouteToLocation("ToAddress","ToAddress"),createGoogleRoute(),zoomGoogleMapToVisibleFeatures(-1,-1))};return{init:u}}(jQuery,window,document),rdmcommuteprofilecard=function(n){"use strict";function i(t,i){n(t).on("click",function(t){t.preventDefault();var r=n(i).val(),u={profileId:r};rdmajaxmvc.request("/TDM/Ridematch/CommuteProfileDelete",u,{filename:"CommuteProfileDelete"})})}function r(t,i){n(t).on("change",function(t){t.preventDefault();var r=this.checked,u=n(i).val(),f={profileId:u,isActive:r};rdmajaxmvc.request("/TDM/Ridematch/ActiveChange",f,{filename:"ActiveChange"})})}var t=function(t,u,f,e){i(t,u);r(f,u);n(e).popover()};return{init:t}}(jQuery,window,document),rdmemployer=function(n){"use strict";var t=function(){n("#dvRmEmployerAdd").length&&n("#dvRmEmployerAdd").hide();i()},i=function(){n("#EmployerNameAddr").devbridgeAutocomplete({minChars:2,width:550,lookup:function(t,i){var r=JSON.stringify({Term:t});n.ajax({type:"POST",url:"/TDM/Parkingpermit/GetEmployers",data:r,dataType:"json",contentType:"application/json; charset=utf-8",success:function(n){i(n)},error:function(n){console.log(n.responseText)}})},onSelect:function(t){return n("#EmployerNameAddr").val(t.value),n("#EmployerId").val(t.data),!1}})};return{init:t}}(jQuery,window,document),rdmmessagegrid=function(n){"use strict";function u(t,i,r){n(t).show();n(i).hide();n(r).on("click",function(r){r.preventDefault();var u=n(this).closest("form").serializeFormJSON();rdmajaxmvc.request("/TDM/Ridematch/MessageAdd",u,{filename:"MessageAdd",divmsg:t,divconfirm:i})})}function f(t,i){n(t).on("click",function(t){t.preventDefault();var r=n(i).val(),u={ParentMessageId:r};rdmajaxmvc.request("/TDM/Ridematch/MessageDelete",u,{filename:"MessageDelete"})})}function e(t,i,r,u){n(t).on("shown.bs.collapse",function(){n(i).text().indexOf("(")>=0&&(o(u,r),n(i).replaceWith("Metro Transit Ridematch"))})}function o(t,i){var r=n(t).val(),u={ParentMessageId:r};rdmajaxmvc.request("/TDM/Ridematch/MessageUpdateRead",u,{filename:"MessageReadUpdate",accordionHeadId:i})}var t=function(t,r,o,s,h,c,l,a){n(".panel-heading.new").click(function(){n(this).closest(".panel-heading").removeClass("new")});u(t,r,o);f(s,h);e(c,l,a,h);i(t,r)},i=function(t,i){n('[data-toggle="modal"]').on("click",function(){r(t,i)})},r=function(t,i){rdmajaxmvc.cleanError();n(".modal-body input[type=text]").val("");n(".modal-body textarea").val("");n(i).hide()};return{init:t}}(jQuery,window,document)