function LoadPropertyMap(n){require(["esri/map","esri/layers/ArcGISTiledMapServiceLayer","esri/tasks/QueryTask","esri/tasks/query","esri/symbols/SimpleFillSymbol","esri/symbols/SimpleLineSymbol","esri/symbols/Font","esri/symbols/TextSymbol","esri/graphicsUtils","esri/layers/GraphicsLayer","esri/graphic","esri/geometry/Point","esri/SpatialReference","dojo/_base/Color","dojo/parser","dojo/dom-class","dojo/query","dijit/form/FilteringSelect","dojo/dom-construct","dojo/ready","dojo/dom","dojo/on","esri/layers/FeatureLayer","esri/dijit/BasemapToggle","esri/IdentityManager"],function(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut){g(function(){function d(n){return n?"$"+n.toFixed().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"):""}function tt(n){var t="",i;return n.ADDRESS!=null&&(t=n.ADDRESS,i=n.JUR+"-"+n.ROLL+")",n.ADDRESS.length>i.length&&n.ADDRESS.indexOf(i,n.ADDRESS.length-i.length)!=-1&&(t=t.substr(0,t.length-i.length-1))),t}function ot(n){emap.resize();ePoint=n.mapPoint;b.spatialRelationship=u.esriSpatialRelWithin;b.geometry=n.mapPoint;queryTask.execute(b,ft)}function st(n){b.spatialRelationship=u.esriSpatialRelWithin;b.geometry=new a(n,new v({wkid:4326}));queryTask.execute(b,ct)}function ht(){for(var t=document.getElementsByClassName("dijitPopup dijitComboBoxMenuPopup"),i,n=0;n<t.length;n++)i=t[n].parentNode,i.removeChild(t[n])}function ct(t){var u=t.features,e=u[0],r,f,c,i,p,w;e.setSymbol(nt);emap.getLayer("subjectProperty").clear();emap.getLayer("subjectProperty").add(e);subjectPropertyExtent=h.graphicsExtent(t.features);emap.setExtent(subjectPropertyExtent,!0);r=new o;r.setFamily("Montserrat, sans-serif");r.setSize("8pt");r.setWeight(o.WEIGHT_NORMAL);f=u[0].attributes.STREET_NUMBER;u.length>0&&(c=$("#Map").data("property-id"),$.each(u,function(n,t){if(c==t.attributes.OID_EVBC){f=t.attributes.STREET_NUMBER;return}}));i=new s(f);i.setColor(new y([45,72,115]));i.setAlign(s.ALIGN_MIDDLE);i.setFont(r);i.setVerticalAlignment("middle");p=new a(n,new v({wkid:4326}));w=new l(p,i);emap.getLayer("subjectProperty").add(w)}function it(n){var t="",i="",r="",u="";return n.FARM_FLAG=="Y"&&(t+="<p>Farm land – value set by <a target ='blank' href='http://www.bclaws.ca/civix/document/id/complete/statreg/411_95'>BC Regulation 411/95<\/a><\/p>"),n.UTILITY_FLAG=="Y"&&(u+="<p>Land and/or building values set by legislated cost manual or regulation<\/p>"),n.MAJ_INDUSTRY_FLAG=="Y"&&(i+="<p>Assessment Act, Section 20 – Major industry building – value set by legislated Major Industrial <a target ='blank' href='http://www.bclaws.ca/civix/document/id/complete/statreg/96020_01#section20'> Properties Manual<\/a> and <a target ='blank' href='http://www.bclaws.ca/civix/document/id/lc/bcgaz2/v59n03_053-2016'>BC Regulation 53/2016<\/a><\/p>"),n.MANAGED_FOREST_FLAG=="Y"&&(r+="<p>Managed forest land and cut timber – values set by <a target ='blank' href='http://www.bclaws.ca/civix/document/id/complete/statreg/90_2000'> BC Regulation 90/2000 <\/a>  <\/p>"),"<div class='infoClass'>"+t+i+r+u+"<\/div>"}function rt(n){var t="",i="";return n.IS_STRATA=="N"&&(t="<div class='popupContentRow'>     <span class='popupDataLabel propertyLabelsText'>Land<\/span>     <span class='popupDataValue propertyValuesText'>"+d(n.TOTAL_LAND)+"<\/span>  <\/div>  <div class='popupContentRow'>     <span class='popupDataLabel propertyLabelsText'>Buildings<\/span>     <span class='popupDataValue propertyValuesText'>"+d(n.TOTAL_BUILDING)+"<\/span>  <\/div>"),(n.FARM_FLAG=="Y"||n.UTILITY_FLAG=="Y"||n.MAJ_INDUSTRY_FLAG=="Y"||n.MANAGED_FOREST_FLAG=="Y")&&(i="<sup class='propinfo' style='margin-left:5px;' id='supiconmap'><img src='/Content/Images/info_marigold.png' onclick=\"javascript: togglebaloon('iconmap');\" /><label hidden id='stateiconmap'>off<\/label>                                <\/sup>"),"<div class='popupAJR'>Area-Jurisdiction-Roll: <b>"+n.AREA_EVBC+"-"+n.JUR+"-"+n.ROLL+"<\/b><\/div><div id='popupContent'>  <div class='popupContentRow'>     <span class='popupDataLabel propertyLabelsText bolder standout'>Total Value<\/span>     <span class='popupDataValue propertyValuesText standout'>"+d(n.TOTAL_ASSESSED)+i+"<\/span>  <\/div>"+t+"  <\/div>"}function ft(n){var c,e,o,s,h,r;notAuthorized==!1?(favHTML="<div class='favOne left'>                    <input type='checkbox' value='None'  name='check' @replacestring>                    <label for='@favcheckID' id='@lblfavcheck'><\/label>                <\/div>",comHTML="<div class='compareOne'>                    <input type='checkbox' value='None'  name='check' @replacestring>                    <label for='@comcheckID' id='@lblcomcheck'><\/label>                <\/div>"):_hasportalaccess==!1&&_hasvalidLogin==!0?(favHTML="<div class='favOne left'><label class='disabledfavicon' onclick='showdialog(\"UnauthorizedPopUp\");'><\/label> <\/div>",comHTML="<div class='compareOne' style='margin-left:50px;'><label class='disabledcomicon' onclick='showdialog(\"UnauthorizedPopUp\");'><\/label> <\/div>"):_hasportalaccess==!0&&_hasTCpending==!0&&_hasvalidLogin==!0?(favHTML="<div class='favOne left'><label class='disabledfavicon' onclick='showdialog(\"TC-pending-popup\");'><\/label> <\/div>",comHTML="<div class='compareOne' style='margin-left:50px;'><label class='disabledcomicon' onclick='showdialog(\"TC-pending-popup\");'><\/label> <\/div>"):(favHTML="<div class='favOne left'><label class='disabledfavicon' onclick='showdialog(\"login-popup\");'><\/label> <\/div>",comHTML="<div class='compareOne' style='margin-left:50px;'><label class='disabledcomicon' onclick='showdialog(\"login-popup\");'><\/label> <\/div>");n.features.length==0?emap.infoWindow.isShowing&&(lastPointWithFeature&&(ePoint=lastPointWithFeature),lastFeatureSet&&(n=lastFeatureSet)):(oa000_oid!=""&&lastPointWithFeature!=ePoint&&(oa000_oid=""),lastPointWithFeature=ePoint,lastFeatureSet=n);var i=null,l=null,a=null,t=null,f=null,v="",y="",u=n.features;if(u.length>0){if(a=u[0],a.setSymbol(g),u.length==1)t=a.attributes,i=tt(t),y=it(t),notAuthorized==!1?(favpropertyIds.indexOf(t.OID_EVBC)>-1?(e='checked="true" id="fav'+t.OID_EVBC+'" data-isdelete="true" onclick="bcaPortalUser.postChanges(\'RemoveFavourite\' ,\''+t.OID_EVBC+"',function(){ toggleMapCardSection('fav-switch"+t.OID_EVBC+"', 'addFavourite', 'deleteFavourite'); });\"",favHTML=favHTML.replace("@replacestring",e).replace("@favcheckID","fav"+t.OID_EVBC).replace("@lblfavcheck","lblfav"+t.OID_EVBC)):(o='data-isdelete="false" id="fav'+t.OID_EVBC+"\" onclick=\"bcaPortalUser.postChanges('AddFavourite' ,'"+t.OID_EVBC+"',function(){ toggleMapCardSection('fav-switch"+t.OID_EVBC+"', 'deleteFavourite', 'addFavourite');  });\"",favHTML=favHTML.replace("@replacestring",o).replace("@favcheckID","fav"+t.OID_EVBC).replace("@lblfavcheck","lblfav"+t.OID_EVBC)),comparisonpropertyIds.indexOf(t.OID_EVBC)>-1?(s='checked="true" id="comp'+t.OID_EVBC+'" data-isdelete="true" onclick="bcaPortalUser.postChanges(\'RemoveComparable\' ,\''+t.OID_EVBC+"',function(){ toggleMapCardSection('com-switch"+t.OID_EVBC+"', 'addComparsion', 'deleteComparsion');  });\"",comHTML=comHTML.replace("@replacestring",s).replace("@comcheckID","comp"+t.OID_EVBC).replace("@lblcomcheck","lblcom"+t.OID_EVBC)):(h='data-isdelete="false" id="comp'+t.OID_EVBC+"\" onclick=\"bcaPortalUser.postChanges('AddComparable' ,'"+t.OID_EVBC+"',function(){ toggleMapCardSection('com-switch"+t.OID_EVBC+"', 'deleteComparsion', 'addComparsion');    });\"",comHTML=comHTML.replace("@replacestring",h).replace("@comcheckID","comp"+t.OID_EVBC).replace("@lblcomcheck","lblcom"+t.OID_EVBC))):_hasportalaccess==!1&&_hasvalidLogin==!0?(favHTML="<div class='favOne left'><label class='disabledfavicon' onclick='showdialog(\"UnauthorizedPopUp\");'><\/label> <\/div>",comHTML="<div class='compareOne' style='margin-left:50px;'><label class='disabledcomicon' onclick='showdialog(\"UnauthorizedPopUp\");'><\/label> <\/div>"):_hasportalaccess==!0&&_hasTCpending==!0&&_hasvalidLogin==!0?(favHTML="<div class='favOne left'><label class='disabledfavicon' onclick='showdialog(\"TC-pending-popup\");'><\/label> <\/div>",comHTML="<div class='compareOne' style='margin-left:50px;'><label class='disabledcomicon' onclick='showdialog(\"TC-pending-popup\");'><\/label> <\/div>"):(favHTML="<div class='favOne left'><label class='disabledfavicon' onclick='showdialog(\"login-popup\");'><\/label> <\/div>",comHTML="<div class='compareOne' style='margin-left:50px;'><label class='disabledcomicon' onclick='showdialog(\"login-popup\");'><\/label> <\/div>"),l=rt(t)+"<div id='addressSelectorRow'>"+favHTML+"<div><a class='btn1sm right' href='/Property/Info/"+btoa(t.OID_EVBC)+"'>View details<\/a> "+comHTML+" <\/div><\/div>",emap.infoWindow.resize(400,270);else{for(c=0;c<u.length;c=c+1)t=u[c].attributes,v+="<option value='"+t.OID_EVBC+"'>"+t.SHORT_ADDRESS+"<\/option>",t.OID_EVBC==oa000_oid&&(f=t);oa000_oid!=""?(notAuthorized==!1&&(favpropertyIds.indexOf(oa000_oid)>-1?(e='checked="true" id="fav'+oa000_oid+'" data-isdelete="true" onclick="bcaPortalUser.postChanges(\'RemoveFavourite\' ,\''+oa000_oid+"',function(){ toggleMapCardSection('fav-switch"+oa000_oid+"', 'addFavourite', 'deleteFavourite'); });\"",favHTML=favHTML.replace("@replacestring",e).replace("@favcheckID","fav"+oa000_oid).replace("@lblfavcheck","lblfav"+oa000_oid)):(o='data-isdelete="false" id="fav'+oa000_oid+"\" onclick=\"bcaPortalUser.postChanges('AddFavourite' ,'"+oa000_oid+"',function(){ toggleMapCardSection('fav-switch"+oa000_oid+"', 'deleteFavourite', 'addFavourite');  });\"",favHTML=favHTML.replace("@replacestring",o).replace("@favcheckID","fav"+oa000_oid).replace("@lblfavcheck","lblfav"+oa000_oid)),comparisonpropertyIds.indexOf(oa000_oid)>-1?(s='checked="true" data-isdelete="true" id="comp'+oa000_oid+"\" onclick=\"bcaPortalUser.postChanges('RemoveComparable' ,'"+oa000_oid+"',function(){ toggleMapCardSection('com-switch"+oa000_oid+"', 'addComparsion', 'deleteComparsion');  });\"",comHTML=comHTML.replace("@replacestring",s).replace("@comcheckID","comp"+oa000_oid).replace("@lblcomcheck","lblcom"+oa000_oid)):(h='data-isdelete="false" id="comp'+oa000_oid+"\" onclick=\"bcaPortalUser.postChanges('AddComparable' ,'"+oa000_oid+"',function(){ toggleMapCardSection('com-switch"+oa000_oid+"', 'deleteComparsion', 'addComparsion');    });\"",comHTML=comHTML.replace("@replacestring",h).replace("@comcheckID","comp"+oa000_oid).replace("@lblcomcheck","lblcom"+oa000_oid))),i=tt(f),y=it(f),l=rt(f)+"<div id='addressSelectorRow'>  <select class='addressSelector' tabindex='0' onchange='selectChanged(this.value)' "+(isIEBrowser?" onclick='setPlaceholderText(\"\")' onblur='setPlaceholderText(\"Select another unit\")' ":"")+"    data-dojo-type=\"dijit/form/FilteringSelect\"     data-dojo-attach-point=\"name\"     data-dojo-props=\"       name: 'dts', value: '', placeholder: 'Select another unit', maxHeight: 200,        required: false, autoComplete: false, invalidMessage: 'No records found.'     \"     name='addresses'  style='width: 220px'>"+v+"  <\/select><div style='padding:5px!important;' id='multiunitsection1'><a id='multiUnitButton' class='btn1sm right' style='margin-bottom:10px'  href='/Property/Info/"+btoa(f.OID_EVBC)+"'>View details<\/a> "+favHTML+comHTML+"<\/div><\/div>",emap.infoWindow.resize(400,270)):(i="Multiple units found - ("+u.length+")",l="<div id='addressSelectorRow'><select class='addressSelector' tabindex='0' onchange='selectChanged(this.value)' "+(isIEBrowser?" onclick='setPlaceholderText(\"\")' onblur='setPlaceholderText(\"Select unit\")' ":"")+"data-dojo-type=\"dijit/form/FilteringSelect\" data-dojo-attach-point=\"name\" data-dojo-props=\"name: 'dts', value: '', placeholder: 'Select unit', maxHeight: 200, required: false, autoComplete: false, invalidMessage: 'No records found.' \" name='addresses'  style='width: 373px'>"+v+"<\/select><\/div>",emap.infoWindow.resize(400,270))}ht();emap.graphics.clear();emap.graphics.add(a);r="";r=i!=undefined&&i!=""&&i.length>40?i.substr(0,38):i;r.indexOf("Multiple units found")==-1&&(r=r.toUpperCase(),i=i.toUpperCase());r="<span title='"+i+"'>"+r+"<\/span>";emap.infoWindow.setTitle(r);emap.infoWindow.setContent(l);emap.infoWindow.show(ePoint);p.parse();$(".propinfo > img").balloon({html:!0,css:{border:"solid 2px #2a6496",padding:"5px",margin:"0px",fontSize:"95%",opacity:"1",backgroundColor:"white",fontWeight:"normal"},hideDuration:300,position:"left",tipSize:20,contents:y})}}var k,g,nt,et;ut.on("dialog-create",function(){$.ajax({url:"/Property/Auth/RefreshGISToken",type:"GET",cache:!1,async:!1,dataType:"json",contentType:"application/json",success:function(n){n==!0&&window.location.reload()},error:function(){window.location.href="/"}})});k=window.navigator.userAgent;isIEBrowser=k.indexOf("MSIE ")>0||k.indexOf("Trident/")>0||k.indexOf("Edge/")>0;emap=new t("emap",{basemap:"streets-vector",center:n,maxZoom:17,minZoom:3,maxScale:5e4,zoom:defaultzoom,logo:!1});queryTask=new r(mapserverUrl+"/0?token="+gistoken);b=new u;b.returnGeometry=!0;b.returnGeometry=!0;b.outFields=["AFP_OID","UNIT_NUMBER","TOTAL_ASSESSED","ROLL","AREA_EVBC","JUR","TOTAL_LAND","TOTAL_BUILDING","ADDRESS","DESCRIPTION","STREET_NUMBER","STREET_NAME","OID_EVBC","SHORT_ADDRESS","IS_STRATA","FARM_FLAG","UTILITY_FLAG","MAJ_INDUSTRY_FLAG","MANAGED_FOREST_FLAG"];b.orderByFields=["STREET_NAME","STREET_NUMBER","UNIT_NUMBER","SHORT_ADDRESS"];g=new f(f.STYLE_SOLID,new e(e.STYLE_SOLID,new y([43,142,131]),2),new y([43,142,131,.4]));nt=new f(f.STYLE_SOLID,new e(e.STYLE_SOLID,new y([45,72,115]),3),new y([45,72,115,.3]));tileLayer=new i(mapserverUrl+"?token="+gistoken);subjectPropertyLayer=new c({id:"subjectProperty"});emap.addLayers([tileLayer,subjectPropertyLayer]);w.add(emap.infoWindow.domNode,"mapPopup");et=emap.on("click",ot);st(n);selectChanged=function(n){oa000_oid=n;ft(lastFeatureSet)}})})}function setPlaceholderText(n){for(var i=document.getElementsByClassName("dijitReset dijitInputInner"),t=0;t<i.length;t++)i[t].placeholder=n;return!1}var popup=null,emap=null,ePoint=null,queryTask=null,query=null,tileLayer=null,transitlayer=null,subjectPropertyLayer=null,subjectPropertyExtent=null,oa000_oid="",_isarrowkey=!1,isvalidationmodalShown=!1,jursCode=null,defaultzoom=7,isIEBrowser=!1,lastPointWithFeature,lastFeatureSet,favHTML="",comHTML="",_showDetails=function(){alert("showing some details")};Array.prototype.remove=function(n){var t=this.indexOf(n);return t!=-1?this.splice(t,1):!1};$(document).ready(function(){$("#mapLoadingMessage").text("Attempting to load map...");gistoken!=""&&(LoadPropertyMap(mapInitialCenter),typeof require!="undefined"&&$("#mapLoadingMessage").hide())})