function IfxNwkMapCommon(){}function IfxNwkMap(){}function IfxNwkMapStructures(){}function NWK_loadMap(n,t,i,r){objIfxNwkMap=new IfxNwkMap,objIfxNwkMapStructures=new IfxNwkMapStructures,objIfxNwkMap.registerEvent("UPDATEUI",NWK_updateUI),objIfxNwkMap.registerEvent("PANCHANGED",NWK_panChanged),objIfxNwkMap.registerEvent("MODECHANGED",NWK_panChanged),objIfxNwkMap.registerEvent("ONDRAGCOMPLETE",NWK_onDragCompleteFn),objIfxNwkMap.registerEvent("FEATUREOVER",NWK_featureOver),objIfxNwkMap.registerEvent("FEATUREOUT",NWK_featureOut),objIfxNwkMap.registerEvent("STRUCTUREMODIFIED",NWK_updateStructure);var u=IfxNwkMapCommon.getRoutePlanUnit($("#HdnRoutePlanUnit").val());objIfxNwkMap.loadMap(n,t,u,i,r)}function NWK_updateUI(){}function NWK_panChanged(){var n=setInterval(function(){(objifxStpMap.pageType=="NWK_STRUCTURES"||objifxStpMap.pageType=="MIG_STRUCTURES")&&(objifxStpMap.pageType=="NWK_STRUCTURES"&&disableControls(),objIfxNwkMapStructures.showStructuresByMode(function(){objifxStpMap.pageType=="NWK_STRUCTURES"&&enableControls(),stopAnimation()})),clearTimeout(n)},1e3)}function NWK_onDragCompleteFn(){}function NWK_showContextMenu(){var r=$("#PortalType").val(),e,f,t,i,n,s;if(objifxStpMap.getProject()=="NWK"&&($("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide()),i=getCurrentMouseOverFeature(),objifxStpMap.getPageState()!="mouseover"||i==0)nwk_mapcontextMenuOn=!1,currentMouseOverFeature=null;else if(n=i[0],n=="ANNOTATION"||n=="STRUCTURE"||n=="CONSTRAINT"||n=="FVPANNOTATION")nwk_mapcontextMenuOn=!0;else if(n!="WAYPOINT"&&n!="VIAPOINT"||objIfxNwkMap.pageType=="DISPLAYONLY"||objIfxNwkMap.pageType=="DISPLAYONLY_EDITANNOTATION"){for(t=0;t<12;t++)$("#ctxtable").find("tr:eq("+t+")").hide();$("#ctxtable").find("tr:eq(18)").hide(),r=="696009"&&($("#ctxtable").find("tr:eq(12)").hide(),$("#ctxtable").find("tr:eq(14)").hide()),(n=="STARTPOINT"||n=="ENDPOINT")&&$("#ctxtable").find("tr:eq(12)").hide();return}r=="696009"&&($("#ctxtable").find("tr:eq(14)").hide(),$("#ctxtable").find("tr:eq(18)").hide(),i[0]=="CONSTRAINT"&&$("#ctxtable").find("tr:eq(9)").hide());switch(objifxStpMap.pageType){case"A2BPLANNING":case"ROUTELIBRARY":case"SIMPNOTIF":case"CONSULTRESTRICTION":e=objifxStpMap.getCurrentPathState();switch(e){case"idle":objifxStpMap.getcurrentSelectedRouteType()==0?($("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide()):objifxStpMap.getcurrentSelectedRouteType()==1?$("#ctxtable").find("tr:eq(5)").hide():objifxStpMap.getcurrentSelectedRouteType()==3&&$("#ctxtable").find("tr:eq(6)").hide(),$("#ctxtable").find("tr:eq(2)").hide(),$("#ctxtable").find("tr:eq(3)").hide(),$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(7)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide(),$("#ctxtable").find("tr:eq(18)").hide();break;case"firstpointselected":objifxStpMap.getcurrentSelectedRouteType()==0?($("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide()):objifxStpMap.getcurrentSelectedRouteType()==1?(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0||$("#ctxtable").find("tr:eq(6)").hide(),$("#ctxtable").find("tr:eq(5)").hide()):objifxStpMap.getcurrentSelectedRouteType()==2?objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0?$("#ctxtable").find("tr:eq(5)").hide():$("#ctxtable").find("tr:eq(6)").hide():objifxStpMap.getcurrentSelectedRouteType()==3&&(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0&&$("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide()),$("#ctxtable").find("tr:eq(2)").hide(),$("#ctxtable").find("tr:eq(3)").hide(),$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(7)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide(),$("#ctxtable").find("tr:eq(18)").hide();break;case"secondpointselected":case"routeplanned":case"routedisplayed":$("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide(),e=="secondpointselected"&&$("#ctxtable").find("tr:eq(7)").hide(),r=="696009"&&(objifxStpMap.pageType=="CONSULTRESTRICTION"&&$("#ctxtable").find("tr:eq(7)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide()),r=="696009"&&$("#ctxtable").find("tr:eq(18)").hide();break;default:for(t=0;t<11;t++)$("#ctxtable").find("tr:eq("+t+")").hide()}f=objifxStpMap.getPageState();switch(f){case"mouseover":i=getCurrentMouseOverFeature(),i!=0&&i[0]!="CONSTRAINT"&&$("#ctxtable").find("tr:eq(2)").hide(),$("#ctxtable").find("tr:eq(3)").hide(),$("#ctxtable").find("tr:eq(7)").hide();var n=i[0],o=0,u=0,h;if(r=="696009"&&$("#ctxtable").find("tr:eq(18)").hide(),n=="ANNOTATION"||n=="FVPANNOTATION")$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide(),$("#ctxtable").find("tr:eq(11)").hide();else if(n=="WAYPOINT"||n=="VIAPOINT")$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide();else if(n=="STRUCTURE"||n=="CONSTRAINT"){for(n!="STRUCTURE"?($("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide(),$("#ctxtable").find("tr:eq(9)").hide()):$("#ctxtable").find("tr:eq(10)").hide(),u=0;u<i.length;u++)i[u]=="SUITABILITY"&&(o=i[parseInt(u)+1],o!="Unsuitable"&&$("#ctxtable").find("tr:eq(18)").hide());fvpXGeometry==0&&fvpYGeometry==0&&$("#ctxtable").find("tr:eq(18)").hide(),$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(8)").hide()}else $("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide();break;default:$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide(),$("#ctxtable").find("tr:eq(18)").hide()}$("#ctxtable").find("tr:eq(12)").hide(),r!="696008"&&$("#ctxtable").find("tr:eq(14)").hide();break;case"DISPLAYONLY":case"STRUCTURES":case"NWK_STRUCTURES":case"MIG_STRUCTURES":case"DISPLAYONLY_EDITANNOTATION":for($("#ctxtable").find("tr:eq(18)").hide(),t=0;t<9;t++)$("#ctxtable").find("tr:eq("+t+")").hide();if(objifxStpMap.pageType=="DISPLAYONLY_EDITANNOTATION"){f=objifxStpMap.getPageState();switch(f){case"mouseover":$("#ctxtable").find("tr:eq(8)").show(),$("#ctxtable").find("tr:eq(9)").show();break;default:$("#ctxtable").find("tr:eq(7)").show()}}objifxStpMap.getPageState()!="mouseover"&&($("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),r=="696009"&&$("#ctxtable").find("tr:eq(14)").hide()),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide(),$("#ctxtable").find("tr:eq(12)").hide(),objifxStpMap.getPageState()=="mouseover"&&(n=="STRUCTURE"||n=="CONSTRAINT")&&r=="696009"&&$("#ctxtable").find("tr:eq(14)").hide(),objifxStpMap.getPageState()=="mouseover"&&n!="STRUCTURE"&&$("#ctxtable").find("tr:eq(9)").hide();break;case"DELEGATION_VIEWONLY":case"DELEGATION_VIEWANDEDIT":for($("#ctxtable").find("tr:eq(18)").hide(),t=0;t<11;t++)$("#ctxtable").find("tr:eq("+t+")").hide();$("#ctxtable").find("tr:eq(12)").hide();break;case"ROADOWNERSHIP_VIEWANDEDIT":case"ROADOWNERSHIP_VIEWONLY":case"MAINTAIN_CORRIDOR":case"MAINTAIN_CORRIDOR_EDITMODE":case"LZV":case"AGRICULTURE":case"LBOV":case"ITS":case"MIG_ITS":case"ViewITSDetails":case"CONVOY":case"DS_ANALYSIS":case"CR_VIEWANDEDIT":for($("#ctxtable").find("tr:eq(18)").hide(),t=0;t<13;t++)$("#ctxtable").find("tr:eq("+t+")").hide()}$("#ctxtable").find("tr:eq(3)").hide(),i=getCurrentMouseOverFeature(),n=i[0],n=="FVPANNOTATION"&&(r=="696008"&&($("#ctxtable").find("tr:eq(8)").show(),$("#ctxtable").find("tr:eq(9)").show()),s=objifxStpMap.pageType,(r=="696009"||s=="DISPLAYONLY")&&$("#ctxtable").find("tr:eq(8)").hide())}function NWK_featureOver(n,t){if(objIfxNwkMap.setPageState("mouseover"),currentMouseOverFeature=n.feature,t=="STRUCTURE"||t=="CONSTRAINT")if(n.feature.geometry.components)if(n.feature.geometry.components[0].components)NWK_createPopup(t,n.feature,n.feature.geometry.components[0].components[0]);else{var i=NWK_calculateRelativePosition(n.feature.geometry.components[0],n.feature.geometry.components[n.feature.geometry.components.length-1]);NWK_createPopup(t,n.feature,n.feature.geometry.components[0],i)}else NWK_createPopup(t,n.feature,n.feature.geometry)}function NWK_featureOut(n,t){objifxStpMap.setPageState("readyidle"),(t=="STRUCTURE"||t=="CONSTRAINT")&&NWK_removePopups(),nwk_mapcontextMenuOn==!1&&objifxStpMap.getPageState()=="readyidle"&&(currentMouseOverFeature=null)}function NWK_createPopup(n,t){var f,e;if(n=="STRUCTURE"){var o=t.data.name.match("NAME (.*) CODE"),s=t.data.name.match("CODE (.*) SUITABILITY"),u=t.data.name.match("SUITABILITY (.*) OTHERORG"),l=t.data.name.match("OTHERORG (.*) TYPE"),h=t.data.name.split("TYPE ").pop();u[1]=="Default"?u[1]="   ":u[1]=="Unsuitable"?u[1]="Unsuitable for selected vehicle(s)":u[1]=="Marginally suitable"&&(u[1]="Marginally suitable for selected vehicle(s)"),f="<div style='font-size:1.0em'><table><tr><td><b>"+o[1]+"<\/b><\/td><\/tr><\/table><br>"+u[1]+"<br>Code: "+s[1]+"<br>Class: "+IfxNwkMapCommon.capitaliseString(h)+"<\/div>"}else if(n=="CONSTRAINT"){var o=t.data.name.match("NAME (.*) CODE"),s=t.data.name.match("CODE (.*) SUITABILITY"),u=t.data.name.match("SUITABILITY (.*) OTHERORG"),l=t.data.name.match("OTHERORG (.*) TYPE"),h=t.data.name.match("TYPE (.*) DESCRIPTION"),c=t.data.name.split("DESCRIPTION ").pop();u[1]!=null&&u[1]!=undefined&&(u[1]=u[1].toLowerCase()),u[1]=u[1]=="unsuitable"?"Unsuitable for selected vehicle(s)":"   ",f="<div style='font-size:1.0em'><table><tr><td><b>"+o[1]+"<\/b><\/td><\/tr><\/table><br>"+u[1]+"<br>"+c}e=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel(objifxStpMap.olMap.getControlsByClass("OpenLayers.Control.MousePosition")[0].lastXy),null,f,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!1),t.popup=e,objifxStpMap.olMap.addPopup(e)}function NWK_calculateRelativePosition(n,t){var i;return i=n.y<t.y?"b":"t",i=n.x<t.x?i.concat("l"):i.concat("r")}function NWK_removePopup(n){objIfxNwkMap.olMap.NWK_removePopup(n.popup),n.popup.destroy(),n.popup=null}function NWK_removePopups(){while(objifxStpMap.olMap.popups.length)objifxStpMap.olMap.removePopup(objifxStpMap.olMap.popups[0])}function showStructureDetails(n,t){var i=$("#OrgId").val(),r=0;i!=0?$.ajax({type:"POST",url:"../Structures/GetStructureOwner",data:{StructureId:t,OrganisationId:i},beforeSend:function(){},success:function(n){r=n.result,r==0?viewStructureDetails(t):window.location.href="../Structures/ReviewSummary?structureId="+t},error:function(){alert("error")},complete:function(){}}):n=="true"?viewStructureDetails(t):window.location.href="../Structures/ReviewSummary?structureId="+t}function viewStructureDetails(n){resetdialogue(),$("#dialogue").load("../Structures/ReviewSummaryPopup?structureId="+n,function(){CheckSessionTimeOut(),removescroll(),$("#dialogue").show(),$("#overlay").show()})}function setStructureDetails(n,t,i,r){objIfxNwkMapStructures.setStructureDetails(n,t,i,r)}function NWK_updateStructure(n,t,i){updateStructureModel(n,t,i)}function NWK_setRoutePointDesc(n,t,i,r){var u="";switch(n){case 0:u="#From_location",objifxStpMap.setRoutePointDescription(0,i,null,r);break;case 1:u="#To_location",objifxStpMap.setRoutePointDescription(1,i,null,r);break;case 2:u="#Waypoint"+t;case 3:u="#Viapoint"+t,objifxStpMap.setRoutePointDescription(t+1,i);case 7:u="#Viapoint"+t,objifxStpMap.setRoutePointDescription(t+1,i)}$(u).val(i)}function verifyCheck(){return objIfxNwkMap.getVerifyCheck()}function ClickIntellizenzLinkData(n,t,i){console.log(optn),optn.columnType[n].func({xcord:t,ycord:i})}function insertwaypoint(n){var f,t,s,e,i,h,r,u;if($("#sortable").show(),f=$("#sortable li").length,s="",pointType=n,f<=99){if(t=f==0?0:$("#sortable li:last").attr("id"),f==99&&($("#spn_WayPoint").hide(),$("#spn_ViaPoint").hide()),e=document.getElementsByName("lblwaypoint"),t=e.length+1,n==3)var i="Viapoint"+t,o="Viapunt"+t,h="Viapoint #"+t;else if(n==7)i="ForcedViapoint"+t,h="ForcedViapoint #"+t;else var i="Viapoint"+t,h="Viapoint #"+t,o="Viapunt"+t;r=parseInt(t)+1,n==null||n==1?u="<li id="+t+" name='trwaypoint' class='ui-state-default'><div style='display:none;'><span name='lblwaypoint'>"+i+"<\/span><\/div> <div class='searchtableleft editor-field'><span class='waypointicon waypointclass' name='waypointicon' style='line-height: 12px;'>"+t+"<\/span><input class='serchlefttxt1one AutocompleteElement'  url='../QAS/Search?isReverseLookup=1' origin='a2bLeft' pointType ='2' pointNo = '"+r+"' placeholder='"+i+"' type='search' id='"+i+"' name='txtwaypoint' /> <div class='canwaypoint' onclick='removewaypoint(this);'><\/div>  <\/li>":n==2?u="<li id="+t+" name='trwaypoint' class='ui-state-default'><div style='display:none;'><span name='lblwaypoint'>"+i+"<\/span><\/div> <div class='searchtableleft editor-field'><span class='waypointicon waypointclass' name='waypointicon' style='line-height: 12px;'>"+t+"<\/span><input class='serchlefttxt1one AutocompleteElement'   url='../QAS/Search?isReverseLookup=1' origin='a2bLeft' pointType ='2' pointNo = '"+r+"' placeholder='"+o+"' type='search' id='"+i+"' name='txtwaypoint' /> <div class='canwaypoint' onclick='removewaypoint(this);'><\/div>  <\/li>":n==3?u="<li id="+t+" name='trwaypoint' class='ui-state-default'><div style='display:none;'><span name='lblwaypoint'>"+i+"<\/span><\/div> <div class='searchtableleft editor-field'><span class='waypointicon_green waypointclass' name='waypointicon' style='line-height: 12px;'>"+t+"<\/span><input class='serchlefttxt1one AutocompleteElement'  url='../QAS/Search?isReverseLookup=1' origin='a2bLeft' pointType ='3' pointNo = '"+r+"'  placeholder='"+o+"' type='search' id='"+i+"' name='txtwaypoint' /> <div class='canwaypoint' onclick='removewaypoint(this);'><\/div>  <\/li>":n==7&&(u="<li id="+t+" name='trwaypoint' class='ui-state-default'><div style='display:none;'><span name='lblwaypoint'>"+i+"<\/span><\/div> <div class='searchtableleft editor-field'><span class='forcedviapointicon waypointclass' name='waypointicon' style='line-height: 12px;'>"+t+"<\/span><input class='serchlefttxt1one AutocompleteElement'  url='../QAS/Search?isReverseLookup=1' origin='a2bLeft' pointType ='7' pointNo = '"+r+"'  placeholder='"+i+"' type='search' id='"+i+"' name='txtwaypoint' /> <div class='canwaypoint' onclick='removewaypoint(this);'><\/div>  <\/li>"),$("#sortable").append(u),$("#spn_WayPoint").hide(),$("#spn_ViaPoint").hide()}}function insertfvpoint(n){var r=$("#sortablefvp li").length,t,s="",u,i,o,f,e;r<=99&&(t=r==0?0:$("#sortablefvp li:last").attr("id"),u=document.getElementsByName("lblfvpoint"),t=u.length+1,n==7&&(i="ForcedViapoint"+t,o="ForcedViapoint #"+t),f=parseInt(t)+1,n==7&&(e="<li id="+t+" name='trfvpoint' class='ui-state-default_f'><div style='display:none;'><span name='lblfvpoint'>"+i+"<\/span><\/div> <div class='searchtableleft editor-field'><span class='forcedviapointicon waypointclass' name='forcedviapointicon' style='line-height: 15px; color:darkblue;font-weight: bold'>"+t+"<\/span><input class='serchlefttxt1one AutocompleteElement'  url='../QAS/Search?isReverseLookup=1' origin='a2bLeft' pointType ='7' pointNo = '"+f+"'  placeholder='"+i+"' type='text' id='"+i+"' name='txtfvpoint' readonly/> <div class='canwaypoint' onclick='removefvpoint(this);'><\/div>  <\/li>"),$("#sortablefvp").append(e),$("#sortablefvp").sortable("disable"))}function removefvpoint(n){var i=$(n).closest("li");i.remove();for(var r=document.getElementsByName("lblfvpoint"),f=document.getElementsByName("trfvpoint"),u=document.getElementsByName("txtfvpoint"),e=document.getElementsByName("forcedviapointicon"),t=0,t=0;t<r.length;t++)r[t].innerHTML="ForcedViapoint"+(t+1),f[t].id=t+1,e[t].innerHTML=t+1,u[t].id="ForcedViapoint"+(t+1),u[t].placeholder="ForcedViapoint"+(t+1);DeleteFVP($(i).attr("id"),getCurrentActiveRoutePathIndex()),$(".swapicon").last().hide()}function removewaypoint(n){var i=$(n).closest("li"),r,e;i.remove(),$("#spn_WayPoint").show(),$("#spn_ViaPoint").hide();for(var u=document.getElementsByName("lblwaypoint"),o=document.getElementsByName("trwaypoint"),f=document.getElementsByName("txtwaypoint"),s=document.getElementsByName("waypointicon"),t=0,t=0;t<u.length;t++)u[t].innerHTML="Viapoint"+(t+1),o[t].id=t+1,s[t].innerHTML=t+1,f[t].id="Viapoint"+(t+1),f[t].placeholder="Viapoint"+(t+1);deleteWayPoint($(i).attr("id")-1,getCurrentActiveRoutePathIndex()),$(".swapicon").last().hide(),pointType==7&&(r=$(i).attr("id"),r++,e=objifxStpMap.vectorLayerMarkers.getFeaturesByAttribute("name","FVPANNOTATION "+r),objifxStpMap.vectorLayerMarkers.removeFeatures(e))}function WaypointReady(){var n=0,t=0;$("#sortable").sortable({start:function(t,i){i.item.css("opacity",.5),n=i.item.attr("id")},stop:function(i,r){r.item.css("opacity",1),waypoint_ordering(),t=r.item.attr("id"),moveWayPointPosition(n,t)}}),$("li > input").disableSelection()}function FvpointReady(){var n=0,t=0;$("#sortablefvp").sortable({start:function(t,i){i.item.css("opacity",.5),n=i.item.attr("id")},stop:function(i,r){r.item.css("opacity",1),Fvpoint_ordering(),t=r.item.attr("id"),moveWayPointPosition(n,t)}}),$("li > input").disableSelection()}function waypoint_ordering(){var t=2,n=1;objifxStpMap!=null&&objifxStpMap.pageType=="CONSULTRESTRICTION"&&(swapflag=1),$(".ui-state-default").each(function(){$(this).find(".waypointclass").text(n),$(this).find("input").attr({id:"Viapoint"+n,placeholder:"Viapoint"+n,pointNo:t}),$(this).attr({id:n}),n=n+1,t=t+1})}function Fvpoint_ordering(){var t=2,n=1;$(".ui-state-default_f").each(function(){$(this).find(".waypointclass").text(n),$(this).find("input").attr({id:"ForcedViapoint"+n,placeholder:"ForcedViapoint"+n,pointNo:t}),$(this).attr({id:n}),n=n+1,t=t+1})}function removewaypoint_map(n){$("#sortable").find("li").eq(n).remove(),waypoint_ordering()}function RouteDetailsReady(n){origin=$("#origin").val(),PageFlag=$("#Pageflag").val(),AppRouteType="planned";var t=$("#RouteID").val();(PageFlag==1||PageFlag==3||PageFlag==2)&&(t==0||String(t)=="Undefined")&&(t=$("#RouteIDApp").val()),t==!0||t>0?((PageFlag==1||PageFlag==3||PageFlag==2)&&(AppRouteType=$("#HfRouteType").val()),setRouteID(t),ShowForUpdate(t,n)):(setRouteID(0),PageFlag==2?loadmap("A2BPLANNING",null):PageFlag==3?loadmap("A2BPLANNING",null):PageFlag==1||PageFlag==3?loadmap("A2BPLANNING",null):loadmap("A2BPLANNING",null,n))}function ShowForUpdate(n,t){var i=null,r="RouteID";(PageFlag==2||PageFlag==1||PageFlag==3)&&(r="plannedRouteId"),$.ajax({type:"POST",dataType:"json",url:"../Routes/GetPlannedRoute",data:{RouteID:n,routeType:AppRouteType},beforeSend:function(){},success:function(n){i=n.result}}).done(function(n){var f,e,u,o,s,r,h;if(i!=null&&(i.routePathList.length>0||i.routePathList.Count>0)){if(i.routePathList[0].routePointList.length>0){for(f=-1,e=-1,r=0;r<i.routePathList[0].routePointList.length;r++)f==-1&&i.routePathList[0].routePointList[r].pointType==0&&($("#From_location").val(i.routePathList[0].routePointList[r].pointDescr),f=r),e==-1&&i.routePathList[0].routePointList[r].pointType==1&&($("#To_location").val(i.routePathList[0].routePointList[r].pointDescr),e=r);f!=-1&&e!=-1&&(i.routePathList[0].routePointList[f].pointDescr!=""||i.routePathList[0].routePointList[e].pointDescr!="")&&(u=i.routePartDetails.routeName+" "+i.routePathList[0].routePointList[f].pointDescr+" to "+i.routePathList[0].routePointList[e].pointDescr,u.length>130&&(u=u.substring(0,129),u=u+"..."),$("#pageheader").find("h3").text(u))}o=null;try{o=i.routePathList.length>0?i.routePathList[0].routeSegmentList[0].routeLinkList:null}catch(c){}if(o==null||o=="null"||o=="[]"?(s=0,s=i.routePathList[0].routeSegmentList.length,i.routePathList[0].routePointList.length>0&&i.routePathList[0].routePointList[0].pointGeom!=null?PageFlag==2||PageFlag==0?AppRouteType=="outline"||s==0?(loadmap("A2BPLANNING",n.result),addWaypoint(0,i),$("#btn_clear").show()):(loadmap("A2BPLANNING",i),addWaypoint(0,i),$("#btn_saveRoute").show()):i.routePartDetails.routeType=="outline"?(loadmap("A2BPLANNING"),showSketchedRoute(n.result),addWaypoint(0,i),$("#btn_clear").show()):(loadmap("A2BPLANNING",i),addWaypoint(0,i)):loadmap("A2BPLANNING",null)):PageFlag=="U"&&origin=="Lib"?(loadmap("ROUTELIBRARY",i),addWaypoint(0,i)):PageFlag=="U"&&origin=="App"?(loadmap("A2BPLANNING",i,t),addWaypoint(0,i)):(PageFlag==2||PageFlag==4)&&AppRouteType=="planned"?(loadmap("A2BPLANNING",i,null,!0),addWaypoint(0,i)):(loadmap("A2BPLANNING",i),addWaypoint(0,i)),i.routePathList.length>1){for(r=2;r<=i.routePathList.length;r++)h="Path"+r,$(".root").append("<li ><a class='active'>"+h+"<\/a><\/li>");clear_selection(),$(".account").html("Path1"),$(".root > li:first > a").addClass("active"),$(".dropdown11").show()}}else loadmap("A2BPLANNING",null),showNotification(Lang_Key.Notif_Incomplete_Route)}).fail(function(){}).always(function(){})}function close_alert(){return $("#dialogue").hide(),$("#pop-warning").hide(),$("#overlay").hide(),!1}function RouteLibReady(){removeHLinks(),PaginateGrid(),RemoveDelete(),RemoveLinks_Map(),ViewRoute(),$("#btn_back").click(function(){alter("Go Back")})}function removeHLinks(){$("#Config-body").find(".pagination").find("li a").removeAttr("href").css("cursor","pointer")}function PaginateGrid(){$("#Config-body").find(".pagination").find("li").not(".active, .PagedList-skipToLast, .PagedList-skipToNext, .PagedList-skipToFirst, .PagedList-skipToPrevious").find("a").click(function(){var n=$(this).html();AjaxPagination(n)}),PaginateToLastPage(),PaginateToFirstPage(),PaginateToNextPage(),PaginateToPrevPage()}function PaginateToLastPage(){$("#Config-body").find(".PagedList-skipToLast").click(function(){var n=$("#TotalPages").val();AjaxPagination(n)})}function PaginateToFirstPage(){$("#Config-body").find(".PagedList-skipToFirst").click(function(){AjaxPagination(1)})}function PaginateToNextPage(){$("#Config-body").find(".PagedList-skipToNext").click(function(){var n=$("#Config-body").find(".active").find("a").html(),t=parseInt(n)+1;AjaxPagination(t)})}function PaginateToPrevPage(){$("#Config-body").find(".PagedList-skipToPrevious").click(function(){var n=$("#Config-body").find(".active").find("a").html(),t=parseInt(n)-1;AjaxPagination(t)})}function AjaxPagination(n){$.ajax({url:"../Routes/RoutePartLibrary",type:"GET",cache:!1,async:!1,data:{page:n},beforeSend:function(){$(".loading").show()},success:function(n){$("#Config-body").html($(n).find("#div_Route").html()),$("#div_Route").find(".head1").hide(),removeHLinks(),PaginateGrid(),RemoveDelete(),RemoveLinks_Map()},error:function(){},complete:function(){$(".loading").hide()}})}function RemoveDelete(){$("#tbl_User tr").each(function(){$(this).find("td").eq(2).remove()}),$("#tbl_User tr").each(function(){$(this).find("th").eq(2).remove()})}function RemoveLinks_Map(){$("#tbl_User").find("a").removeAttr("href").css("cursor","pointer")}function ViewRoute(){$("#tbl_User").find("a").live("click",function(){var n=$(this).attr("id");$.ajax({url:"../Routes/LibraryRoutePartDetails",type:"GET",cache:!1,async:!1,data:{routeName:n},beforeSend:function(){$(".loading").show()},success:function(n){$("#Config-body").html($(n).find("#Map_View").html()),CheckSessionTimeOut(),removeHLinks(),PaginateGrid(),RemoveDelete(),RemoveLinks_Map()},error:function(){},complete:function(){$(".loading").hide()}})})}function IfxRouteManager(){this.RoutePart={routePathList:[{routeSegmentList:[],routePointList:[],otherinfo:{features:[],routeType:0,state:"idle"},routePathType:0,pathNo:0,subpartNo:1}],routePartDetails:{}}}function getOffset(n){for(var t=0,i=0;n&&!isNaN(n.offsetLeft)&&!isNaN(n.offsetTop);)t+=n.offsetLeft,i+=n.offsetTop,n=n.offsetParent;return{top:i,left:t}}function createContextMenu(){var n=$("#PublicPortalContextMenu").val();$("#map").IntellizenzContext({columnType:[{colDetails:[{type:"image",name:"image",src:"../../Content/Images/startmarkersmall.png"},{type:"label",name:Lang_Key.ContextMenu_StarFlag,src:""}],func:function(n){var t=getOffset(document.getElementById("map"));searchSegmentByXY((parseInt(n.xcord)-parseInt(t.left)).toString(),(parseInt(n.ycord)-parseInt(t.top)).toString(),0)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/endmarkersmall.png"},{type:"label",name:Lang_Key.ContextMenu_ToFlag,src:""}],seperator:!0,func:function(n){var t=getOffset(document.getElementById("map"));searchSegmentByXY((parseInt(n.xcord)-parseInt(t.left)).toString(),(parseInt(n.ycord)-parseInt(t.top)).toString(),1)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/viamarkerW.png"},{type:"label",name:Lang_Key.ContextMenu_Add_waypoint,src:""}],func:function(n){var t=getOffset(document.getElementById("map"));searchSegmentByXY((parseInt(n.xcord)-parseInt(t.left)).toString(),(parseInt(n.ycord)-parseInt(t.top)).toString(),2)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/anchorpointW.png"},{type:"label",name:"Add viapoint",src:""}],seperator:!0,func:function(n){var t=getOffset(document.getElementById("map"));searchSegmentByXY((parseInt(n.xcord)-parseInt(t.left)).toString(),(parseInt(n.ycord)-parseInt(t.top)).toString(),3)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/delete.png"},{type:"label",name:Lang_Key.ContextMenu_Delete_waypoint,src:""}],seperator:!0,func:function(){deleteMouseOverWaypoint()}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/diverge.png"},{type:"label",name:"Diverge from",src:""}],func:function(n){var t=getOffset(document.getElementById("map"));searchSegmentByXY((parseInt(n.xcord)-parseInt(t.left)).toString(),(parseInt(n.ycord)-parseInt(t.top)).toString(),5)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/merge.png"},{type:"label",name:"Merge to",src:""}],seperator:!0,func:function(n){var t=getOffset(document.getElementById("map"));searchSegmentByXY((parseInt(n.xcord)-parseInt(t.left)).toString(),(parseInt(n.ycord)-parseInt(t.top)).toString(),4)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/annotation.png"},{type:"label",name:Lang_Key.ContextMenu_Add_annotation,src:""}],seperator:!0,func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};createAnnotation(i)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/delete.png"},{type:"label",name:Lang_Key.ContextMenu_Delete_annotation,src:""}],seperator:!1,func:function(){deleteAnnotation()}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/details.png"},{type:"label",name:Lang_Key.ContextMenu_View_details,src:""}],func:function(){showDetails()}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/contacts.png"},{type:"label",name:Lang_Key.ContextMenu_Show_struct_contacts,src:""}],func:function(){showStructureContact()}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/contacts.png"},{type:"label",name:Lang_Key.ContextMenu_Show_road_contacts,src:""}],seperator:!0,func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};ShowRoadContacts(i)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/ownercontact.png"},{type:"label",name:Lang_Key.ContextMenu_Show_road_owner,src:""}],func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};ShowRoadOwnerContacts(i)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/constraint_icons/constraint_generic.png"},{type:"label",name:Lang_Key.ContextMenu_Link_details,src:""}],func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};ShowLimitation(i)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/details.png"},{type:"label",name:Lang_Key.ContextMenu_Show_related_exemptions,src:""}],func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};showStructureExemption(i)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/zoomin.png"},{type:"label",name:Lang_Key.ContextMenu_Zoom_in,src:""}],func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};setCenterAndZoom(i,!1)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/zoomout.png"},{type:"label",name:Lang_Key.ContextMenu_Zoom_out,src:""}],func:function(){zoomOut()}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/centrehere.png"},{type:"label",name:Lang_Key.ContextMenu_Center_here,src:""}],func:function(n){var t=getOffset(document.getElementById("map")),i={x:(parseInt(n.xcord)-parseInt(t.left)).toString(),y:(parseInt(n.ycord)-parseInt(t.top)).toString()};setCenter(i,!1)}},{colDetails:[{type:"image",name:"image",src:"../../Content/Images/structure_orange.png"},{type:"label",name:Lang_Key.ContextMenu_ForcedViaPoint,src:""}],func:function(n){var i=getOffset(document.getElementById("map")),t;fvpXGeometry!=0&&fvpYGeometry!=0&&searchSegmentByXY(fvpXGeometry,fvpYGeometry,7),t={x:(parseInt(n.xcord)-parseInt(i.left)).toString(),y:(parseInt(n.ycord)-parseInt(i.top)).toString()},fvpAnnotationflag=1,FvpannotationPix=t,createAnnotation(t)}},]}),n==1&&$("#Show related exemptions").hide()}function translate_Slidingpanel(n){n==1?(all="Alle",aff="Op route",suit="Ongeschikt",struct="Kunstwerken",uBridge="Brug",oBridge="Viaduct",lCrossing="Spoorwegovergang",rAbout="Rotonde",tunnel="Tunnel",special="Bijzonder",rWorks="Wegwerkzaamheden",show_hide_struct="Filteren"):(all="All",aff="Affected",suit="Suitable",struct="Structures",uBridge="Under Bridge",oBridge="Over Bridge",lCrossing="Level Crossing",rAbout="Round About",tunnel="Tunnel",special="Special",rWorks="Roadworks",show_hide_struct="Show / hide stuctures")}function load_Structureslidingpanel(n,t){translate_Slidingpanel(languageFlag),pageType=t;var i="<span class='slidingpanelnav' style=''>"+show_hide_struct+"<span data-icon='&#xe111;' style='margin-right: 12px;' class='hideSlide3'><\/span><\/span><div class='slidingpanelstructures_content slidingpanelstructuresclose'>";n=="NWK"?((pageType=="REGEXEMPTION"||pageType=="CONSULTRESTRICTION")&&(i=i+"<form><fieldset style='border: 1px solid'><legend><\/legend><table class='table' style='margin-left: 7px;'><thead><tr style='border-top: hidden; border-bottom: hidden;'><td id='AffectedLabel' style='padding-bottom: 0px;padding-left: 0px;'>"+aff+"<input id='Affected' name='Affected' type='checkbox' value='true'><input name='Affected' type='hidden' value='false'><\/td><td id='AllLabel' style='padding-bottom: 0px'>"+all+"<br><input id='All' name='All' type='checkbox' value='true'><input name='All' type='hidden' value='false'><\/td><td id='SuitableLabel' style='padding-bottom: 0px'>"+suit+"<input id='Suitable' name='Suitable' type='checkbox' value='true'><input name='Suitable' type='hidden' value='false'><\/td><\/tr><\/thead><\/table><\/fieldset><\/form>"),i=i+"<form><fieldset style='border: 1px solid;'><legend><\/legend><table class='table' style='margin-left: 7px;'><thead><tr style='border-top: hidden; border-bottom: hidden;'><td id='StructsLabel'><input id='Structs' name='Structs' type='checkbox' value='true'>&nbsp;&nbsp;"+struct+"<input name='Structs' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td style='padding-bottom : 0px'><table class='table' style='margin-left: 20px; margin-top: -5px; margin-bottom: -5px'><thead><tr style='border-top: hidden; border-bottom: hidden;'><td id='UnderbridgeLabel' style='padding-bottom : 0px'><input id='Underbridge' name='Underbridge' type='checkbox' value='true'>&nbsp;&nbsp;"+uBridge+"<input name='Underbridge' type='hidden' value='false'><\/td><tr style='border-top: hidden; border-bottom: hidden;'><td id='OverbridgeLabel' style='padding-bottom : 0px'> <input id='Overbridge' name='Overbridge' type='checkbox' value='true'>&nbsp;&nbsp;"+oBridge+"<input name='Overbridge' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='LevelCrossingLabel' style='padding-bottom : 0px'> <input id='LevelCrossing' name='LevelCrossing' type='checkbox' value='true'>&nbsp;&nbsp;"+lCrossing+"<input name='LevelCrossing' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='RoundAboutLabel' style='padding-bottom : 0px'> <input id='RoundAbout' name='RoundAbout' type='checkbox' value='true'>&nbsp;&nbsp;"+rAbout+"<input name='RoundAbout' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='TunnelLabel' style='padding-bottom : 0px'> <input id='Tunnel' name='Tunnel' type='checkbox' value='true'>&nbsp;&nbsp;"+tunnel+"<input name='Tunnel' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='SpecialLabel' style='padding-bottom : 0px'><input id='Special' name='Special' type='checkbox' value='true'>&nbsp;&nbsp;"+special+" <input name='Special' type='hidden' value='false'><\/td><\/tr><\/thead><\/table><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='ConstraintsLabel'><input id='Constraints' name='Constraints' type='checkbox' value='true'>&nbsp;&nbsp;"+rWorks+" <input name='Constraints' type='hidden' value='false'><\/td><\/tr><\/thead><\/table><\/fieldset><\/form><\/div><\/div>"):i="<div class='slidingpanelstructures_content slidingpanelstructuresclose'><form><fieldset style='border: 1px solid'><legend><\/legend><table class='table' style='margin-left: 7px;'><thead><tr><td id='AffectedLabel' style='padding-left: 0px;opacity: 0.5;'>Affected <input id='Affected' name='Affected' type='checkbox' value='true' disabled='true'><input name='Affected' type='hidden' value='false'><\/td><\/tr><tr><td id='AllLabel'>All <br><input id='All' name='All' type='checkbox' value='true'><input name='All' type='hidden' value='false'><\/td><\/tr><\/thead><\/table><\/fieldset><\/form><form><fieldset style='border: 1px solid;'><legend><\/legend><table class='table' style='margin-left: 7px;'><thead><tr style='border-top: hidden; border-bottom: hidden;'><td id='StructsLabel'> <input id='Structs' name='Structs' type='checkbox' value='true'>&nbsp;&nbsp; Structures<input name='Structs' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td><table class='table' style='margin-left: 20px; margin-top: -5px; margin-bottom: -5px'><thead><tr style='border-top: hidden; border-bottom: hidden;'><td id='UnderbridgeLabel'> <input id='Underbridge' name='Underbridge' type='checkbox' value='true'>&nbsp;&nbsp; Underbridge<input name='Underbridge' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='OverbridgeLabel'> <input id='Overbridge' name='Overbridge' type='checkbox' value='true'>&nbsp;&nbsp; Overbridge<input name='Overbridge' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='UnderAndOverBLabel'> <input id='UnderAndOverbridge' name='UnderAndOverbridge' type='checkbox' value='true'>&nbsp;&nbsp; Under and over bridge<input name='UnderAndOverbridge' type='hidden' value='false'><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='LevelCrossingLabel'><input id='LevelCrossing' name='LevelCrossing' type='checkbox' value='true'>&nbsp;&nbsp; Level crossing <input name='LevelCrossing' type='hidden' value='false'><\/td><\/tr><\/thead><\/table><\/td><\/tr><tr style='border-top: hidden; border-bottom: hidden;'><td id='ConstraintsLabel'> <input id='Constraints' name='Constraints' type='checkbox' value='true'>&nbsp;&nbsp; Constraints<input name='Constraints' type='hidden' value='false'><\/td><\/tr><\/thead><\/table><\/fieldset><\/form><\/div><span class='slidingpanelnav' style=''>Show/hide structures<span data-icon='&#xe111;' style='margin-right: 12px;' class='hideSlide3'><\/span><\/span><\/div>",$("#slidingpanelstructures").html(i)}function init_structureslidingpanel(){slide=1,$(".slidingpanelnav").toggle(function(){$(this).parent().find(".slidingpanelstructures_content").removeClass("slidingpanelstructuresclose").addClass("slidingpanelstructuresopen"),$(this).find("span").removeClass("hideSlide3").addClass("openSlide3"),$(this).css({"margin-top":0})},function(){$(this).parent().find(".slidingpanelstructures_content").removeClass("slidingpanelstructuresopen").addClass("slidingpanelstructuresclose"),$(this).find("span").removeClass("openSlide3").addClass("hideSlide3"),$(this).css({"margin-top":0})}),$(".slidingpanelstructures_content").html().length>1&&($("#btnCreate").length>0?$(".quick_tbl").html().length>0&&$("#btnCreate").css({"margin-top":21,"margin-bottom":6}):$(".quick_tbl").css({"margin-top":21}),$(".slidingpanelnav").find(".slidingpanelstructuresclose").length>=1&&$(".slidingpanelnav").css({"margin-top":0})),$("#Affected").change(function(){if(this.checked){var n=getCurrentBoundsAndZoom();if(n.zoom<objifxStpmapStructures.defaultPointStructZoom&&document.getElementById("Structs").checked==!0){showNotification(Lang_Key.Notif_Zoom_View_struct_const),document.getElementById("Affected").checked=!1;return}document.getElementById("Structs").checked=!0,document.getElementById("Underbridge").checked=!0,document.getElementById("Overbridge").checked=!0,document.getElementById("LevelCrossing").checked=!0,document.getElementById("RoundAbout").checked=!0,document.getElementById("Tunnel").checked=!0,document.getElementById("Special").checked=!0,document.getElementById("Constraints").checked=!0,document.getElementById("Suitable").checked=!1,document.getElementById("All").checked=!1}else document.getElementById("Suitable").checked==!1&&document.getElementById("All").checked==!1&&(document.getElementById("Structs").checked=!1,document.getElementById("Underbridge").checked=!1,document.getElementById("Overbridge").checked=!1,document.getElementById("LevelCrossing").checked=!1,document.getElementById("RoundAbout").checked=!1,document.getElementById("Tunnel").checked=!1,document.getElementById("Special").checked=!1,document.getElementById("Constraints").checked=!1);showAnimation=!0,showStructBoundsA2B()}),$("#Suitable").change(function(){if(this.checked){var n=getCurrentBoundsAndZoom();if(n.zoom<objifxStpmapStructures.defaultPointStructZoom&&(document.getElementById("Structs").checked==!0||document.getElementById("Constraints").checked==!0)){showNotification(Lang_Key.Notif_Zoom_View_struct_const),document.getElementById("Suitable").checked=!1;return}document.getElementById("Structs").checked=!0,document.getElementById("Underbridge").checked=!0,document.getElementById("Overbridge").checked=!0,document.getElementById("LevelCrossing").checked=!0,document.getElementById("RoundAbout").checked=!0,document.getElementById("Tunnel").checked=!0,document.getElementById("Special").checked=!0,document.getElementById("Constraints").checked=!0,document.getElementById("Constraints").checked=!0,document.getElementById("Affected").checked=!1,document.getElementById("All").checked=!1}else document.getElementById("Affected").checked==!1&&document.getElementById("All").checked==!1&&(document.getElementById("Structs").checked=!1,document.getElementById("Underbridge").checked=!1,document.getElementById("Overbridge").checked=!1,document.getElementById("LevelCrossing").checked=!1,document.getElementById("Constraints").checked=!1,document.getElementById("RoundAbout").checked=!1,document.getElementById("Tunnel").checked=!1,document.getElementById("Special").checked=!1);showAnimation=!0,showStructBoundsA2B()}),$("#All").change(function(){if(this.checked){var n=getCurrentBoundsAndZoom();if(n.zoom<objifxStpmapStructures.defaultPointStructZoom){showNotification(Lang_Key.Notif_Zoom_View_struct_const),document.getElementById("All").checked=!1;return}document.getElementById("Structs").checked=!0,document.getElementById("Underbridge").checked=!0,document.getElementById("Overbridge").checked=!0,document.getElementById("LevelCrossing").checked=!0,document.getElementById("RoundAbout").checked=!0,document.getElementById("Tunnel").checked=!0,document.getElementById("Special").checked=!0,document.getElementById("Constraints").checked=!0,document.getElementById("Affected").checked=!1,document.getElementById("Suitable").checked=!1}else document.getElementById("Affected").checked==!1&&document.getElementById("Suitable").checked==!1&&(document.getElementById("Structs").checked=!1,document.getElementById("Underbridge").checked=!1,document.getElementById("Overbridge").checked=!1,document.getElementById("LevelCrossing").checked=!1,document.getElementById("Constraints").checked=!1,document.getElementById("RoundAbout").checked=!1,document.getElementById("Tunnel").checked=!1,document.getElementById("Special").checked=!1);showAnimation=!0,showStructBoundsA2B()}),$("#Structs").change(function(){if(this.checked){if(document.getElementById("Affected")&&document.getElementById("Affected").checked==!1){var n=getCurrentBoundsAndZoom();if(n.zoom<objifxStpmapStructures.defaultPointStructZoom&&(document.getElementById("Affected").checked==!0||document.getElementById("All").checked==!0)){showNotification(Lang_Key.Notif_Zoom_View_struct_const);return}}document.getElementById("Underbridge").checked=!0,document.getElementById("Overbridge").checked=!0,document.getElementById("LevelCrossing").checked=!0,document.getElementById("RoundAbout").checked=!0,document.getElementById("Tunnel").checked=!0,document.getElementById("Special").checked=!0,document.getElementById("All")&&document.getElementById("All").checked==!1&&document.getElementById("Suitable").checked==!1&&document.getElementById("Affected").checked==!1&&(document.getElementById("All").checked=!0)}else document.getElementById("Underbridge").checked=!1,document.getElementById("Overbridge").checked=!1,document.getElementById("LevelCrossing").checked=!1,document.getElementById("RoundAbout").checked=!1,document.getElementById("Tunnel").checked=!1,document.getElementById("Special").checked=!1,document.getElementById("All")&&document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!1&&(document.getElementById("All").checked=!1,document.getElementById("Suitable").checked=!1,document.getElementById("Affected").checked=!1);showAnimation=!0,showStructBoundsA2B(!0)}),$("#Underbridge").change(function(){var n=getCurrentBoundsAndZoom();StructureCheckBoxSyncronize(),this.checked?(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.underBridge,!0,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.underBridge,!0,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.underBridge,!0,2,n.zoom)):(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.underBridge,!1,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.underBridge,!1,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.underBridge,!1,2,n.zoom))}),$("#Overbridge").change(function(){var n=getCurrentBoundsAndZoom();StructureCheckBoxSyncronize(),this.checked?(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.overBridge,!0,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.overBridge,!0,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.overBridge,!0,2,n.zoom)):(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.overBridge,!1,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.overBridge,!1,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.overBridge,!1,2,n.zoom))}),$("#LevelCrossing").change(function(){var n=getCurrentBoundsAndZoom();StructureCheckBoxSyncronize(),this.checked?(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.levelCrossing,!0,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.levelCrossing,!0,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.levelCrossing,!0,2,n.zoom)):(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.levelCrossing,!1,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.levelCrossing,!1,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.levelCrossing,!1,2,n.zoom))}),$("#RoundAbout").change(function(){var n=getCurrentBoundsAndZoom();StructureCheckBoxSyncronize(),this.checked?(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.roundAbout,!0,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.roundAbout,!0,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.roundAbout,!0,2,n.zoom)):(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.roundAbout,!1,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.roundAbout,!1,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.roundAbout,!1,2,n.zoom))}),$("#Tunnel").change(function(){var n=getCurrentBoundsAndZoom();StructureCheckBoxSyncronize(),this.checked?(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.tunnel,!0,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.tunnel,!0,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.tunnel,!0,2,n.zoom)):(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.tunnel,!1,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.tunnel,!1,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.tunnel,!1,2,n.zoom))}),$("#Special").change(function(){var n=getCurrentBoundsAndZoom();StructureCheckBoxSyncronize(),this.checked?(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.special,!0,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.special,!0,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.special,!0,2,n.zoom)):(document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&affectedStructArr!=undefined&&filterStructures(affectedStructArr.special,!1,0,n.zoom),(pageType!="REGEXEMPTION"&&allStructArr!=undefined||pageType=="REGEXEMPTION"&&document.getElementById("All").checked==!0&&allStructArr!=undefined)&&filterStructures(allStructArr.special,!1,1,n.zoom),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&unsuitableStructArr!=undefined&&filterStructures(unsuitableStructArr.special,!1,2,n.zoom))}),$("#Constraints").change(function(){if(StructureCheckBoxSyncronize(),this.checked){var n=getCurrentBoundsAndZoom();if(n.zoom<objifxStpmapStructures.defaultPointStructZoom){showNotification(Lang_Key.Notif_Zoom_View_struct_const);return}document.getElementById("All")&&document.getElementById("All").checked==!1&&document.getElementById("Affected")&&document.getElementById("Affected").checked==!1&&document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!1&&(document.getElementById("All").checked=!0)}else document.getElementById("Structs")&&document.getElementById("Structs").checked==!1&&(document.getElementById("All")&&document.getElementById("All").checked==!0?document.getElementById("All").checked=!1:document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&(document.getElementById("Affected").checked=!1));showStructBoundsA2B(!0)})}function structureslidingpanel_show(){$(".slidingpanelstructures").removeClass("hide").addClass("show")}function structureslidingpanel_hide(){$(".slidingpanelstructures").removeClass("show").addClass("hide")}function structPanChangedA2B(){structPanTimeFlag=1}function clearStructFlags(){affectedStructTimeFlag=0,affectedConstTimeFlag=0,unsuitableStructTimeFlag=0,allStructTimeFlag=0}function checkDimensionValues(){dimensionFlag=0,($("#Height").val()||$("#LHeight").text()||$("#ULHeight").text())&&(dimensionFlag=1),($("#Weight").val()||$("#LWeight").text()||$("#ULWeight").text())&&(dimensionFlag=1),($("#Length").val()||$("#LLength").text()||$("#ULLength").text())&&(dimensionFlag=1),($("#Width").val()||$("#LWidth").text()||$("#ULWidth").text())&&(dimensionFlag=1)}function showStructBoundsA2B(){structPanTimeFlag==1&&(structPanTimeFlag=0,allStructTimeFlag=0,unsuitableStructTimeFlag=0,allConstTimeFlag=0,removePopups(),showAnimation=!1);var n=getCurrentBoundsAndZoom(),t="";document.getElementById("Structs").checked==!0&&document.getElementById("All")&&document.getElementById("All").checked==!0&&(allStructTimeFlag==0||unsuitableStructTimeFlag==0)&&(t="Loading structures"),document.getElementById("Constraints").checked==!0&&document.getElementById("All")&&document.getElementById("All").checked==!0&&allConstTimeFlag==0&&(t==""?t="Loading constraints":t+=" and constraints"),t!=""&&(t+=", "+Lang_Key.Animation_Please_wait),document.getElementById("Structs")&&document.getElementById("Structs").checked==!0?(document.getElementById("All")&&document.getElementById("All").checked==!0?allStructTimeFlag==0?(allStructTimeFlag=1,checkDimensionValues(),dimensionFlag==0?fetchStructBounds(1,n):dimensionFlag==1&&fetchStructBounds(3,n)):allStructArr!=undefined&&(document.getElementById("Underbridge").checked==!0&&filterStructures(allStructArr.underBridge,!0,1,n.zoom),document.getElementById("Overbridge").checked==!0&&filterStructures(allStructArr.overBridge,!0,1,n.zoom),document.getElementById("LevelCrossing").checked==!0&&filterStructures(allStructArr.levelCrossing,!0,1,n.zoom),document.getElementById("RoundAbout").checked==!0&&filterStructures(allStructArr.roundAbout,!0,1,n.zoom),document.getElementById("Tunnel").checked==!0&&filterStructures(allStructArr.tunnel,!0,1,n.zoom),document.getElementById("Special").checked==!0&&filterStructures(allStructArr.special,!0,1,n.zoom)):document.getElementById("All")&&document.getElementById("All").checked==!1&&allStructTimeFlag==1&&allStructArr!=undefined&&(document.getElementById("Underbridge").checked==!0&&filterStructures(allStructArr.underBridge,!1,1,n.zoom),document.getElementById("Overbridge").checked==!0&&filterStructures(allStructArr.overBridge,!1,1,n.zoom),document.getElementById("LevelCrossing").checked==!0&&filterStructures(allStructArr.levelCrossing,!1,1,n.zoom),document.getElementById("RoundAbout").checked==!0&&filterStructures(allStructArr.roundAbout,!1,1,n.zoom),document.getElementById("Tunnel").checked==!0&&filterStructures(allStructArr.tunnel,!1,1,n.zoom),document.getElementById("Special").checked==!0&&filterStructures(allStructArr.special,!1,1,n.zoom)),document.getElementById("Affected")&&document.getElementById("Affected").checked==!0?(btnAffectedStructures.activate(),document.getElementById("AffectStr").style.backgroundColor="lightgray",affectedStructTimeFlag==0?(showOnRouteStructures(),($("#PortalType").val()=="696008"||window.location.href.indexOf("/Exemption")>-1)&&(dwoID=2)):affectedStructArr!=undefined&&(document.getElementById("Underbridge").checked==!0&&filterStructures(affectedStructArr.underBridge,!0,0,n.zoom),document.getElementById("Overbridge").checked==!0&&filterStructures(affectedStructArr.overBridge,!0,0,n.zoom),document.getElementById("LevelCrossing").checked==!0&&filterStructures(affectedStructArr.levelCrossing,!0,0,n.zoom),document.getElementById("RoundAbout").checked==!0&&filterStructures(affectedStructArr.roundAbout,!0,0,n.zoom),document.getElementById("Tunnel").checked==!0&&filterStructures(affectedStructArr.tunnel,!0,0,n.zoom),document.getElementById("Special").checked==!0&&filterStructures(affectedStructArr.special,!0,0,n.zoom))):document.getElementById("Affected")&&document.getElementById("Affected").checked==!1&&n.zoom>=objifxStpmapStructures.defaultPointStructZoom&&affectedStructTimeFlag==1&&affectedStructArr!=undefined&&(document.getElementById("Underbridge").checked==!0&&filterStructures(affectedStructArr.underBridge,!1,0,n.zoom),document.getElementById("Overbridge").checked==!0&&filterStructures(affectedStructArr.overBridge,!1,0,n.zoom),document.getElementById("LevelCrossing").checked==!0&&filterStructures(affectedStructArr.levelCrossing,!1,0,n.zoom),document.getElementById("RoundAbout").checked==!0&&filterStructures(affectedStructArr.roundAbout,!1,0,n.zoom),document.getElementById("Tunnel").checked==!0&&filterStructures(affectedStructArr.tunnel,!1,0,n.zoom),document.getElementById("Special").checked==!0&&filterStructures(affectedStructArr.special,!1,0,n.zoom)),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0?unsuitableStructTimeFlag==0?(unsuitableStructTimeFlag=1,fetchStructBounds(2,n)):unsuitableStructArr!=undefined&&(document.getElementById("Underbridge").checked==!0&&filterStructures(unsuitableStructArr.underBridge,!0,2,n.zoom),document.getElementById("Overbridge").checked==!0&&filterStructures(unsuitableStructArr.overBridge,!0,2,n.zoom),document.getElementById("LevelCrossing").checked==!0&&filterStructures(unsuitableStructArr.levelCrossing,!0,2,n.zoom),document.getElementById("RoundAbout").checked==!0&&filterStructures(unsuitableStructArr.roundAbout,!0,2,n.zoom),document.getElementById("Tunnel").checked==!0&&filterStructures(unsuitableStructArr.tunnel,!0,2,n.zoom),document.getElementById("Special").checked==!0&&filterStructures(unsuitableStructArr.special,!0,2,n.zoom)):document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!1&&(document.getElementById("Affected")&&document.getElementById("Affected").checked==!1,unsuitableStructTimeFlag==1&&unsuitableStructArr!=undefined&&(document.getElementById("Underbridge").checked==!0&&filterStructures(unsuitableStructArr.underBridge,!1,2,n.zoom),document.getElementById("Overbridge").checked==!0&&filterStructures(unsuitableStructArr.overBridge,!1,2,n.zoom),document.getElementById("LevelCrossing").checked==!0&&filterStructures(unsuitableStructArr.levelCrossing,!1,2,n.zoom),document.getElementById("RoundAbout").checked==!0&&filterStructures(unsuitableStructArr.roundAbout,!1,2,n.zoom),document.getElementById("Tunnel").checked==!0&&filterStructures(unsuitableStructArr.tunnel,!1,2,n.zoom),document.getElementById("Special").checked==!0&&filterStructures(unsuitableStructArr.special,!1,2,n.zoom)))):document.getElementById("Structs")&&document.getElementById("Structs").checked==!1&&(affectedStructArr!=undefined&&(filterStructures(affectedStructArr.underBridge,!1,0,n.zoom),filterStructures(affectedStructArr.overBridge,!1,0,n.zoom),filterStructures(affectedStructArr.levelCrossing,!1,0,n.zoom),filterStructures(affectedStructArr.roundAbout,!1,0,n.zoom),filterStructures(affectedStructArr.tunnel,!1,0,n.zoom),filterStructures(affectedStructArr.special,!1,0,n.zoom)),allStructArr!=undefined&&(filterStructures(allStructArr.underBridge,!1,1,n.zoom),filterStructures(allStructArr.overBridge,!1,1,n.zoom),filterStructures(allStructArr.levelCrossing,!1,1,n.zoom),filterStructures(allStructArr.roundAbout,!1,1,n.zoom),filterStructures(allStructArr.tunnel,!1,1,n.zoom),filterStructures(allStructArr.special,!1,1,n.zoom)),unsuitableStructArr!=undefined&&(filterStructures(unsuitableStructArr.underBridge,!1,2,n.zoom),filterStructures(unsuitableStructArr.overBridge,!1,2,n.zoom),filterStructures(unsuitableStructArr.levelCrossing,!1,2,n.zoom),filterStructures(unsuitableStructArr.roundAbout,!1,2,n.zoom),filterStructures(unsuitableStructArr.tunnel,!1,2,n.zoom),filterStructures(unsuitableStructArr.special,!1,2,n.zoom))),document.getElementById("Affected")||document.getElementById("Suitable")||document.getElementById("All")||!document.getElementById("Structs")||document.getElementById("Structs").checked!=!0||(btnAffectedStructures.active==!1||btnAffectedStructures.active==null?fetchStructBounds(1,n):btnAffectedStructures.active==!0&&showOnRouteStructures()),document.getElementById("Affected")&&document.getElementById("Affected").checked==!1&&btnAffectedStructures.deactivate(),document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!0?(fetchAllConstraints(0,n),setBounds(n.bounds)):document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!1&&(clearConstraints(),clearConstraints(0))}function getTimeFlagA2B(){return{allStruct:allStructTimeFlag,allConst:allConstTimeFlag}}function fetchStructBounds(n,t){(dwoID=window.location.href.indexOf("/ConsultRestrictions")>-1?1:$("#PortalType").val()=="696008"||window.location.href.indexOf("/Exemption")>-1?2:0,t.zoom<objifxStpmapStructures.defaultPointStructZoom)||(n==1||n==3?allStructTimeFlag=1:n==2?unsuitableStructTimeFlag=1:n==0&&(affectedStructuresFlag=1),n==2||n==3?($("#Height").val()?height=$("#Height").val():document.getElementById("RtLoaded")&&document.getElementById("RtLoaded").checked==!0?height=$("#LHeight").text():document.getElementById("RtUnLoaded")&&document.getElementById("RtUnLoaded").checked==!0&&(height=$("#ULHeight").text()),$("#Weight").val()?weight=$("#Weight").val():document.getElementById("RtLoaded")&&document.getElementById("RtLoaded").checked==!0?weight=$("#LWeight").text():document.getElementById("RtUnLoaded")&&document.getElementById("RtUnLoaded").checked==!0&&(weight=$("#ULWeight").text()),$("#Length").val()?length=$("#Length").val():document.getElementById("RtLoaded")&&document.getElementById("RtLoaded").checked==!0?length=$("#LLength").text():document.getElementById("RtUnLoaded")&&document.getElementById("RtUnLoaded").checked==!0&&(length=$("#ULLength").text()),$("#Width").val()?width=$("#Width").val():document.getElementById("RtLoaded")&&document.getElementById("RtLoaded").checked==!0?width=$("#LWidth").text():document.getElementById("RtUnLoaded")&&document.getElementById("RtUnLoaded").checked==!0&&(width=$("#ULWidth").text())):(height=0,weight=0,length=0,width=0),$.ajax({type:"POST",dataType:"json",url:"../Structures/MyStructureInfoList",data:{otherOrg:-1,page:0,left:Math.floor(t.bounds.left),right:Math.ceil(t.bounds.right),bottom:Math.floor(t.bounds.bottom),top:Math.ceil(t.bounds.top),Height:height,Weight:weight,Length:length,Width:width,structFlag:n,affectedStructures:affectedStructuresFlag,DWOPartID:dwoID},beforeSend:function(){},complete:function(){isSuccessInvoked==!1&&(window.location.href="../Account/Login")},success:function(i){var u,r;for(isSuccessInvoked=!0,length=i.result,u=[],r=0;r<=length/1e3;r++)$.ajax({type:"POST",dataType:"json",cache:!0,url:"../Structures/MyStructureInfoList",data:{otherOrg:-1,page:r+1,left:Math.floor(t.bounds.left),right:Math.ceil(t.bounds.right),bottom:Math.floor(t.bounds.bottom),top:Math.ceil(t.bounds.top),Height:height,Weight:weight,Length:length,Width:width,structFlag:n,affectedStructures:affectedStructuresFlag},beforeSend:function(){},success:function(i){n==0?affectedStructArr=showStructures(i.result,0,"MYSTRUCTURES",t.zoom):n==1||n==3?allStructArr=showStructures(i.result,1,"MYSTRUCTURES",t.zoom):unsuitableStructArr=showStructures(i.result,2,"MYSTRUCTURES",t.zoom),stopAnimation()},complete:function(){stopAnimation()}})}}))}function fetchAllConstraints(n,t){var r="",u="",i=0;if(routeId=objifxStpMap.getRouteId(),$("#searchOnMapObj_StartDate").val()&&(r=$("#searchOnMapObj_StartDate").val()),$("#searchOnMapObj_EndDate").val()&&(u=$("#searchOnMapObj_EndDate").val()),$("#ExemptionStartDate").val()&&$("#ExemptionEndDate").val()&&(r=$("#ExemptionStartDate").val(),u=$("#ExemptionEndDate").val()),$("#StartDateTime").val()&&$("#EndDate").val()&&(r=$("#StartDateTime").val(),u=$("#EndDate").val()),$("#searchOnMapObj_Width").val()!=undefined&&(i=parseInt($("#searchOnMapObj_Width").val())),document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!0&&($("#Width").val()!=undefined?i=parseInt($("#Width").val()):$("#RtLoaded").is(":checked")&&$("#searchOnMapObj_Width").val()==undefined?i=parseInt($("#LWidth").text()):$("#RtUnLoaded").is(":checked")&&$("#searchOnMapObj_Width").val()==undefined&&(i=parseInt($("#ULWidth").text()))),document.getElementById("Affected")&&document.getElementById("Affected").checked==!0&&document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!0)showAffectedConstraints(routeId,r,u,i);else{if(t.zoom<objifxStpmapStructures.defaultPointStructZoom)return;showAllConstraints("",r,u,i)}}function StructureCheckBoxSyncronize(){document.getElementById("Underbridge").checked==!0||document.getElementById("Overbridge").checked==!0||document.getElementById("RoundAbout").checked==!0||document.getElementById("LevelCrossing").checked==!0||document.getElementById("Special").checked==!0||document.getElementById("Tunnel").checked==!0?(document.getElementById("Structs").checked=!0,document.getElementById("Affected")&&document.getElementById("Affected").checked==!1&&document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!1&&(document.getElementById("All").checked=!0)):(document.getElementById("Structs").checked=!1,document.getElementById("Affected")&&document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!1&&(document.getElementById("Affected").checked=!1),document.getElementById("All")&&document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!1&&(document.getElementById("All").checked=!1),document.getElementById("Suitable")&&(document.getElementById("Suitable").checked=!1))}function showOnRouteStructures(){clearStructures(1),clearStructures(2),affectedStructTimeFlag=1;var n=getCurrentBoundsAndZoom(),t=$("#RouteIDforStruc").val();showAffectedStructures(t,function(t){affectedStructArr=t,setBounds(n.bounds)})}function dateFormater(n,t){var i=n.split(t);return new Date(i[2],i[1],i[0])}function dateWidthValidation(n,t,i,r){for(var f=[],e=[],t=dateFormater(t,"-"),i=dateFormater(i,"-"),o,s,u=0;u<n.length;u++)o=dateFormater(n[u].StartDate,"/"),s=dateFormater(n[u].EndDate,"/"),o<=i&&s>=t&&f.push(n[u]);if(r!=0){for(u=0;u<f.length;u++)f[u].constraintValue.maxWidth<=r/100&&e.push(f[u]);return e}return f}function IfxStpmapRoadDelegation(){}function IfxStpmapRoadOwnership(){}function IfxStpmapDecisionSpace(){}function setGeoRegion(n){objifxStpMap.setGeoRegion(n)}function extendClass(n,t){n.prototype.__proto__=t.prototype}function IfxStpmapCommon(){}function setRouteID(n){routeId=n}function getRouteID(){return routeId}function resizeMap(){objifxStpMap!=undefined&&objifxStpMap.resizeMap()}function fillRoutePart(){}function zoomIn(){objifxStpMap.zoomIn()}function getConstraintDetails(){return objifxStpmapStructures.getConstraintDetails()}function ConstraintCreationflag(n,t){n==!0?(objifxStpmapStructures.markerConstraint[objifxStpmapStructures.markerConstraint.length]=objifxStpmapStructures.addConstraint(t.constraintId,t.constraintName,t.constraintCode,IfxStpmapCommon.getConstraintTypeDescription(t.constraintType),t.topologyType,t.constSuitability,t.geometry.OrdinatesArray),objifxStpmapStructures.redrawConstraints()):objifxStpmapStructures.clearMarkerConstriants()}function ConstraintDeletionflag(n,t){if(n==!0){var i=setInterval(function(){objifxStpmapStructures.deleteConstraint(t),clearTimeout(i)},500);removePopups()}}function zoomOut(){objifxStpMap.zoomOut()}function ownerShipCheck(n,t){this.getFeatureForRoads([n],1,t)}function createAnnotation(n){annotPosition=n,objifxStpMap.RetFeature=objifxStpMap.getNearestPathAndSegment(annotPosition.x,annotPosition.y,!1,!1),$("#PortalType").val()=="696011"?this.getFeatureForRoads([objifxStpMap.RetFeature.feature.attributes.LINK_ID],0,function(){resetdialogue(),$("#dialogue").load("../Annotation/CreateAnnotation",function(){CheckSessionTimeOut()})}):(resetdialogue(),$("#dialogue").load("../Annotation/CreateAnnotation",function(){CheckSessionTimeOut()}))}function getAnnotationObject(){return annotationObject}function showAnnotation(n,t,i){t==0?(annotationObject=objifxStpMap.routeManager.getAnnotation(n,t,i),resetdialogue(),$("#dialogue").load("../Annotation/CreateAnnotation?editmode=1",function(){CheckSessionTimeOut()})):(annotationObject=objifxStpMap.routeManager.getFVPAnnotation(n),resetdialogue(),fvpAnnotationflag=1,$("#dialogue").load("../Annotation/CreateAnnotation?editmode=1",function(){CheckSessionTimeOut()}))}function onAnnotationWindowClose(n,t,i){if(fvpAnnotationflag){fvpAnnotationflag=0,this.fvpAnnotation.annotText=n,this.fvpAnnotation.annotType=t,this.fvpAnnotation.annotationContactList=i,this.fvpAnnotation.easting=fvpXGeometry,this.fvpAnnotation.northing=fvpYGeometry,this.fvpAnnotation.linkId=fvpLinkId,this.fvpAnnotation.structureEsrn=fvpStructCode,this.fvpAnnotation.geometry.sdo_point.X=fvpXGeometry,this.fvpAnnotation.geometry.sdo_point.Y=fvpYGeometry,objifxStpMap.routeManager.addRoutePointAnnotation(fvpAnnotation);var r=objifxStpMap.routeManager.RoutePointcount(),u=objifxStpMap.setMarker("FVPANNOTATION",fvpXGeometry,fvpYGeometry,r);fvpAnnotation={annotText:null,annotType:null,annotationContactList:null,direction:1,easting:138288.92120639,geometry:{sdo_point:{X:"",Y:""}},linearRef:0,linkId:0,structureEsrn:null,northing:451720.32615757},fvpLinkId=0,fvpStructCode=null}else objifxStpMap.setRoutePointAtXY({pointType:"ANNOTATION",pointPos:0,X:annotPosition.x,Y:annotPosition.y,searchInBbox:!1,Zoomin:!1},function(r){r!=undefined&&r!=null?(r.annotationContactList=i,r.annotType=t,r.annotText=n,objifxStpMap.addAnnotation(r.otherinfo.pathIndex,r.otherinfo.segmentIndex,-1,r),objifxStpMap.getCurrentPathState()=="routedisplayed"&&(objifxStpMap.routeManager.setRoutePathState(objifxStpMap.currentActiveRoutePathIndex,"routeplanned"),updateUI())):showNotification(Lang_Key.Notif_Notification_failed),stopAnimation()})}function setCenter(n,t){objifxStpMap.setCenter(n,t)}function setCenterAndZoom(n,t){objifxStpMap.setCenterAndZoom(n,t)}function setZoomTo(n,t,i){objifxStpMap.setZoomTo(n,t,i)}function setCurrentActiveRoutePath(n){objifxStpMap.setCurrentActiveRoutePath(n)}function onRoutePointSelect(n){n==0&&objifxStpMap.getPathCount()>1?(objifxStpMap.clearAllRoutes(!1),clearselect(),updatewaypoints()):(n==0&&objifxStpMap.removeReturnLeg(),objifxStpMap.clearRoutePath(n),objifxStpMap.clearRestrictedLinks())}function onDragCompleteFn(n,t,i){i==!0?(t==0&&objifxStpMap.getPathCount()>1?(objifxStpMap.clearAllRoutes(!1),clearselect(),updatewaypoints()):(t==0&&objifxStpMap.removeReturnLeg(),n!=null&&(n.pointType==2||n.pointType==7)?clearRouteForPlan=!0:(objifxStpMap.clearRoutePath(t),objifxStpMap.clearRestrictedLinks())),updateUI(n),n!=null&&n!=undefined&&(n.pointType==0||n.pointType==1||objifxStpMap.getProject()=="NWK"&&n.pointType==2||objifxStpMap.getProject()!="NWK"&&n.pointType==3)&&ShowQASList(n,null,!0)):objifxStpMap.pageType=="DISPLAYONLY_EDITANNOTATION"?$("#btnmovsaveannotation").show():$("#btn_updateRoute").show()}function moveRoutePointPos(n,t){objifxStpMap.moveRoutePointPos(objifxStpMap.currentActiveRoutePathIndex,parseInt(n),parseInt(t))}function toggleCancelToolBar(){var t=objifxStpMap.routeManager.getRoutePathCount(),n=objifxStpMap.getCurrentPathState();n=="routeplanned"||n=="routedisplayed"?(toolbarPanel3.div.style.display="none",objifxStpMap.pageType!="DISPLAYONLY"&&objifxStpMap.pageType!="DISPLAYONLY_EDITANNOTATION"&&objifxStpMap.pageType!="SIMPNOTIF"&&(toolbarPanel.div.style.display="inline")):n=="idle"?(toolbarPanel3.div.style.display="none",toolbarPanel4.div.style.display="none"):(deactivateToolbarControls(),toolbarPanel.div.style.display="none",t>1&&(toolbarPanel3.div.style.display="inline"))}function hideMnvrCancelToolBar(){toolbarPanel4.div.style.display="none"}function hideroadDelegationToolbar(){roadDelegationToolbarPanel.div.style.display="none"}function ShowRoadDelegationToolbar(){roadDelegationToolbarPanel.div.style.display="inline"}function updateUI(n,t){var u,f,e,o,i,r,s,h,c,a,l;n!=undefined&&n!=null&&objifxStpMap.pageType!="NOMAPDISPLAY"&&(n.pointType==0?(u=n.pointDescr,u==""?$("#From_location").val(n.city):$("#From_location").val(u)):n.pointType==1?(f=n.pointDescr,f==""?$("#To_location").val(n.city):$("#To_location").val(f)):n.pointType==2?(i=document.getElementsByName("lblwaypoint").length,Checkprevptstatus(i,2),n.routePointNo>document.getElementsByName("lblwaypoint").length&&insertwaypoint(2),r="Viapoint"+n.routePointNo,e="#"+r,$(e).val(n.pointDescr)):n.pointType==3?(i=document.getElementsByName("lblwaypoint").length,Checkprevptstatus(i,3),n.routePointNo>document.getElementsByName("lblwaypoint").length&&insertwaypoint(3),r="Via-point"+n.routePointNo,o="#"+r,$(o).val(n.pointDescr),objifxStpMap.clearRoutePath()):n.pointType==7&&(i=document.getElementsByName("lblwaypoint").length,Checkprevptstatus(i,7),n.routePointNo>document.getElementsByName("lblwaypoint").length&&insertwaypoint(7),r="ForcedViapoint"+n.routePointNo,s="#"+r,$(s).val(n.pointDescr))),h=objifxStpMap.getCurrentPathState(),hideMnvrCancelToolBar();switch(h){case"idle":switch(objifxStpMap.getPageState()){case"readyidle":clearselect(),$("#From_location").val(""),$("#To_location").val(""),$("#sortable").html(""),$("#spn_WayPoint").hide(),$("#spn_ViaPoint").hide(),buttonsShowAndHide(2,2,2,2,2,2,2),showToolBar(!1,"A2BPLANNING"),toggleCancelToolBar();break;case"constraintadded":resetdialogue(),c=Math.random(),a="",$("#dialogue").load("../Constraint/CreateConstraint?topolgyType="+t+"&random="+c,function(){CheckSessionTimeOut(),removescroll(),$("#dialogue").show(),$("#overlay").show(),$(".loading").hide(),$("#div_saving").hide(),document.getElementById("OwnedByMe").checked=!0,document.getElementById("Constraints")&&(document.getElementById("Constraints").checked=!0)});break;case"constraintbydescription":resetdialogue(),$("#dialogue").load("../Constraint/CreateConstraintByDescription",function(){CheckSessionTimeOut()}),removescroll(),$("#dialogue").show(),$("#overlay").show();break;case"planninginprogress":l=objifxStpMap.routeManager.getRoutePathCount(),l>1&&(deactivateToolbarControls(),toolbarPanel.div.style.display="none",toolbarPanel3.div.style.display="inline")}break;case"firstpointselected":buttonsShowAndHide(0,0,0,1,0,0,0),toggleCancelToolBar(),hideMnvrCancelToolBar();break;case"secondpointselected":objifxStpMap.routeManager.RoutePart.routePartDetails.routeType=="outline"?buttonsShowAndHide(2,1,2,1,2,2,2):(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePathType==0?(mapfromroutesmenu==!0?buttonsShowAndHide(1,2,0,0,0,2,1):buttonsShowAndHide(1,2,0,0,0,1,1),showToolBar(!1,"A2BPLANNING")):buttonsShowAndHide(1,2,0,0,0,2,2),$("#btn_replanRoute").hide(),clearStructures(0),clearConstraints(0),clearStructFlags(),toggleCancelToolBar(),hideMnvrCancelToolBar(),btnAffectedStructures.deactivate(),btnAffectedConstraints.deactivate(),objifxStpMap.getProject()=="NWK"?($("#marginalheight")&&$("#chkMargin").val()&&document.getElementById("chkMargin").checked==!0&&($("#txtMarginalHeight").val()==0||$("#txtMarginalHeight").val()!="")&&planRouteOnly?(planRouteOnly=0,buttonsShowAndHide(1,2,2,0,0,0,0)):buttonsShowAndHide(1,0,2,0,0,0,0),$("#BtnEditRoute").hide(),$("#BtnAddRoute").hide(),$("#btnRemoveRoute").hide(),$("#spn_WayPoint").show()):$("#spn_ViaPoint").show());break;case"routeplanned":objifxStpMap.pageType=="CONSULTRESTRICTION"?(buttonsShowAndHide(2,2,2,1,2,2,2),swapflag==1&&($("#btn_plan").attr("disabled",!1),$("#btn_plan").css("opacity",1),swapflag=0)):$("#marginalheight")&&$("#chkMargin").val()&&document.getElementById("chkMargin").checked==!0&&($("#txtMarginalHeight").val()==0||$("#txtMarginalHeight").val()!="")&&planRouteOnly?(buttonsShowAndHide(2,2,2,0,0,0,0),$("#btn_replanRoute").show()):buttonsShowAndHide(2,1,2,1,2,2,2),objifxStpMap.pageType=="DISPLAYONLY_EDITANNOTATION"&&$("#btnmovsaveannotation").show(),showToolBar(!0,"A2BPLANNING"),clearStructures(0),clearConstraints(0),clearStructFlags(),btnAffectedStructures.deactivate(),btnAffectedConstraints.deactivate(),toggleCancelToolBar(),hideMnvrCancelToolBar(),objifxStpMap.getProject()=="NWK"&&$("#BtnPlanRoute").hide();break;case"routedisplayed":clearStructFlags(),buttonsShowAndHide(2,2,2,1,1,2,2),deactivateToolbarControls(),showToolBar(!0,"A2BPLANNING"),objifxStpMap.getProject()=="NWK"&&$("#PortalType").val()=="696011"?$("#spn_WayPoint").hide():window.location.href.indexOf("&PageFlag=V")>-1?$("#spn_WayPoint").hide():$("#spn_WayPoint").show(),$("#spn_ViaPoint").show(),toggleCancelToolBar(),hideMnvrCancelToolBar()}}function Checkprevptstatus(n){var r=document.getElementsByName("lblwaypoint"),i=n-1;if(n!=0){var e=r[i],u=r[i].innerHTML,f=$("#"+u).val();f==""&&$("#sortable").find("li").eq(i).remove()}}function showToolBar(n,t){t=="A2BPLANNING"?n==!1?(toolbarPanel.div.style.display="none",toolbarPanel2.div.style.display="none",toolbarPanel3.div.style.display="none",toolbarPanel4.div.style.display="none"):showRouteAssessment==!0&&pageIdentity!="PreferredRoute"&&($("#PortalType").val()=="696009"&&window.location.href.indexOf("/RegisterExemptionRoute")>-1&&$("#BrokenFlag").val()==1?toolbarPanel2.div.style.display="none":(toolbarPanel2.div.style.display="inline",document.getElementById("MaptoolBar").removeAttribute("style"))):t=="STRUCTURES"?constraintToolbarPanel.div.style.display=n==!1?"none":"inline":t=="ROUTEAPPRAISAL"&&objifxStpMap.pageType=="DISPLAYONLY"&&(n==!1?toolbarPanel2.div.style.display="none":showRouteAssessment==!0&&(toolbarPanel2.div.style.display="inline"))}function moveWayPointPosition(n,t){n!=t&&(objifxStpMap.moveRoutePointPos(Number(n),Number(t)),updateUI())}function searchSegmentByXY(n,t,i){i!=7&&startAnimation();var r=!1;i==7&&(r=!0,FVPflag=1),objifxStpMap.setRoutePointAtXY({pointType:IfxStpmapCommon.getPointTypeName(i),pointPos:-1,X:n,Y:t,searchInBbox:r,Zoomin:!1},function(n){if(n!=undefined&&n!=null){var t=objifxStpMap.getcurrentSelectedRouteType();n.otherinfo.pointfeature.attributes.ROUNDABOUT=="Y"&&t!=0&&showNotification("Diverge/merge route points cannot be placed on a roundabout: please adjust relevant point(s). For assistance call the Helpdesk on 01642 664197."),getCurrentActiveRoutePathIndex()==0&&objifxStpMap.getPathCount()>1&&(objifxStpMap.clearAllRoutes(!1),clearselect()),updateUI(n),n.pointType==0||n.pointType==1||objifxStpMap.getProject()=="NWK"&&n.pointType==2||objifxStpMap.getProject()!="NWK"&&n.pointType==3||objifxStpMap.getProject()!="NWK"&&n.pointType==7?ShowQASList(n,null,!0):i!=7&&stopAnimation()}else i!=7&&stopAnimation()})}function selectRoute(n){objifxStpMap!=null&&objifxStpMap.setRoutePart(n)}function showSketchedRoute(n){objifxStpMap.drawSketchedRoute(n)}function showOutlineRoute(n){objifxStpMap.drawSketchedRoute(n)}function showStructures(n,t,i,r){return objifxStpmapStructures.showStructures(n,t,i,r)}function clearStructures(n){objifxStpmapStructures.clearStructures(n)}function clearAllStructures(){objifxStpmapStructures.clearAllStructures()}function clearConstraints(n){objifxStpmapStructures.clearConstraints(n)}function filterStructures(n,t,i,r){objifxStpmapStructures.filterStructures(n,t,i,r)}function showOrHideAffectedStructures(n){objifxStpmapStructures.showOrHideAffectedStructures(n)}function checkboxValue(n,t){switch(n){case"CONSTRAINT":return document.getElementById("Constraints").checked==!0?t=="AFFECTED"?!0:!0:!1;default:return document.getElementById("Structs")&&document.getElementById("Structs").checked==!0&&n=="underbridge"&&document.getElementById("Underbridge")&&document.getElementById("Underbridge").checked==!0||n=="overbridge"&&document.getElementById("Overbridge")&&document.getElementById("Overbridge").checked==!0||n=="under and over bridge"&&document.getElementById("UnderAndOverbridge")&&document.getElementById("UnderAndOverbridge").checked==!0||n=="level crossing"&&document.getElementById("LevelCrossing")&&document.getElementById("LevelCrossing").checked==!0||n=="roundabout"&&document.getElementById("RoundAbout")&&document.getElementById("RoundAbout").checked==!0||n=="tunnel"&&document.getElementById("Tunnel")&&document.getElementById("Tunnel").checked==!0||n=="special"&&document.getElementById("Special")&&document.getElementById("Special").checked==!0?t=="AFFECTED"?!0:!0:!1}}function showConstraints(n,t){objifxStpmapStructures.showConstraints(n,t)}function showRoadWorksConstraints(n,t,i){objifxStpmapStructures.showRoadWorksConstraints(n,t,i)}function showPortalRoadWorksConstraints(n,t,i){objifxStpmapStructures.showPortalRoadWorksConstraints(n,t,i)}function showNWKConstraints(n,t){objifxStpmapStructures.showNWKConstraints(n,t)}function showNDWRoadWorks(n,t,i){objifxStpmapStructures.showNDWRoadWorks(n,t,i)}function showManuallyAddedRoadWorks(n,t,i){objifxStpmapStructures.showManuallyAddedRoadWorks(n,t,i)}function clearManuallyAddedConstraint(){objifxStpmapStructures.clearManuallyAddedConstraint()}function clearNDWConstraint(){objifxStpmapStructures.clearNDWConstraint()}function clearConstraintDetails(){objifxStpmapStructures.clearConstraintDetails()}function filterConstraints(n,t){objifxStpmapStructures.filterConstraints(n,t)}function confirmClearRoute(){var n=getRouteDetails();objifxStpMap.pageType!="CONSULTRESTRICTION"&&$("#PortalType").val()=="696009"?showWarningPopDialog("Weet u zeker dat u de route wilt verwijderen?","No","Yes","close_alert","clearRoute1",1,"warning"):objifxStpMap.pageType!="CONSULTRESTRICTION"?showWarningPopDialog("U heeft onopgeslagen wijzigingen, doorgaan?","No","Yes","close_alert","clearRoute",1,"warning"):clearRoute()}function clearRoute1(){objifxStpMap.pageType=="ROUTELIBRARY"&&$("#btn_showRoute").show(),close_alert(),HideFixedNotification(),objifxStpMap.clearAllRoutes(!0),clearConstraints(0),clearStructures(0),clearStructFlags(),Deleteroute(),slide==0&&(document.getElementById("Affected").checked=!1),document.getElementById("tblexemtionroutes").getElementsByTagName("tbody")[0].getElementsByTagName("tr").length==1&&(objifxStpMap.pageType="DISPLAYONLY"),updateUI()}function clearRoute(){objifxStpMap.pageType=="ROUTELIBRARY"&&$("#btn_showRoute").show(),close_alert(),HideFixedNotification(),objifxStpMap.clearAllRoutes(!0),clearConstraints(0),clearStructures(0),clearStructFlags(),slide==0&&(document.getElementById("Affected").checked=!1),updateUI()}function clearForReplan(){objifxStpMap.clearRouteForReplan()}function notifClearRoute(){objifxStpMap.clearRoutePart()}function debugSearch(n){var i,t;n[0]=="$"&&(n[1]!="("?(n=n.substring(1),i=n.split(","),objifxStpMap.searchFeaturesByLinkID(i,function(n){n!=null&&n.length>0&&objifxStpMap.highlightFeatures(n)})):(n=n.substring(2),n=n.substring(0,n.length-1).replace(/[,\s]/,"*"),t=n.split("*"),t.length==2&&objifxStpMap.setLocationIndicatorAtXY(t[0],t[1])))}function searchLinks(n){startAnimation(),n=n.replace("'","''");var t=n.split(",");objifxStpMap.clearAllFeaturesFromLayer(objifxStpMap.vectorLayerRoute),objifxStpMap.searchFeaturesByLinkID(t,function(n){objifxStpMap.getPageType()=="ROADOWNERSHIP_VIEWANDEDIT"?objifxStpmapRoadOwnership.searchAndSelectLinks(n):objifxStpMap.getPageType()=="DELEGATION_VIEWANDEDIT"?objifxStpMapRoadDelegation.searchAndSelectLinks(n):objifxStpMap.getPageType()=="NWK_STRUCTURES"||objifxStpMap.getPageType()=="MIG_STRUCTURES"?objifxStpmapRoadOwnership.searchAndSelectLinks(n):objifxStpMap.getPageType()=="STRUCTURES"?objifxStpmapRoadOwnership.searchAndSelectLinks(n):stopAnimation()})}function clearAllMapFeatures(){objifxStpMap!=null&&(objifxStpMap.clearAllFeaturesFromLayer(objifxStpMap.vectorLayerRoute),objifxStpMap.clearAllFeaturesFromLayer(objifxStpMap.vectorLayerMarkers))}function isSessionActive(){var n=!1;return $.ajax({async:!1,type:"POST",url:"../Routes/IsSessionActive",contentType:"application/json; charset=utf-8",data:JSON.stringify({rand:Math.random()}),success:function(t){t.Success==!0&&(n=!0)}}),n}function checkForReturnLeg(){var t,i,r;if(isSessionActive()==!1){location.reload();return}document.getElementsByName("lblwaypoint")&&document.getElementsByName("lblwaypoint").length!=0&&(t=document.getElementsByName("lblwaypoint").length,Checkprevptstatus(t,3)),document.getElementsByName("lblfvpoint")&&document.getElementsByName("lblfvpoint").length!=0&&(i=document.getElementsByName("lblfvpoint").length,Checkprevptstatus(i,7)),$("#marginalheight")&&$("#chkMargin").val()&&document.getElementById("chkMargin").checked==!0&&($("#txtMarginalHeight").val()==0||$("#txtMarginalHeight").val()!="")?(planRouteOnly=1,clearAllMapFeatures(),r=getRouteDetails(),objifxStpMap.drawAnnotations(r.routePathList[0],0),objifxStpMap.drawRoute(-1,!0),planRoute(!1)):PlanDirect(),affectedCheckBoxFlag=1}function PlanDirect(){planRoute(!1,function(n){if(n==!0){affectedCheckBoxFlag=1,deactivateToolbarControls(),$("#btn_updateRoute").hide();try{SaveRoute()}catch(t){}}})}function planRoute(n,t){var i;startAnimation(),HideFixedNotification(),i=$("#cbUnusable").is(":checked")?!1:!0,objifxStpMap.planRoute(!1,i,function(r){n==!0&&r==!0?objifxStpMap.planRoute(!0,i,function(n){planRouteCallback(n,t)}):planRouteCallback(r,t)})}function planRouteCallback(n,t){if(objifxStpMap.pageType!="NOMAPDISPLAY")if(updateUI(),stopAnimation(),n==!1){if(objifxStpMap.pageType=="CONSULTRESTRICTION"&&$("#cbUnusable").is(":checked")==!0){$(".popup1 .message1").css({height:"180px"}),$(".popup1").css({height:"210px"}),$(".POP-dialogue1").css({width:"350px"}),$(".popup1").css({width:"350px"}),showWarningPopDialogBootsstrap(Lang_Key.WngPopup_Legal_consult_restr,"Ok","","close_alert","",1,"info");return}$(".popup111 .message111").css({height:"130px"}),$(".popup111").css({height:"170px"}),$(".message111 div").css({width:"340px","margin-top":"39px"}),$(".popup111 .message111").css({width:"424px"}),$(".popup111").css({width:"355px"}),$(".popup111 .footer111").css({width:"422px"}),$(".POP-dialogue111").css({width:"357px"}),$(".message111").css({width:"362px"}),$(".popup111 .footer111").css({width:"368px"}),showWarningPopDialogBootsstrap(Lang_Key.WngPopup_Legal_Restriction,"Ok","","close_alert","",1,"info")}else t&&typeof t=="function"&&t(n);else n==!1&&(stopAnimation(),showWarningPopDialogBig("No route can be planned, which may be due to legal restrictions on the route. Please change the start/end/waypoints and plan the route.","Ok","","close_alert","",1,"info")),t&&typeof t=="function"&&t(n)}function showContextMenu(){var i,t,u,r,n;if(FVPflag=0,objifxStpMap.getProject()=="NWK"){NWK_showContextMenu();return}if(objifxStpMap.getPageState()!="mouseover")mapcontextMenuOn=!1,currentMouseOverFeature=null;else if(i=getCurrentMouseOverFeature(),t=i[0],t=="ANNOTATION"||t=="STRUCTURE"||t=="CONSTRAINT")mapcontextMenuOn=!0;else if(t!="WAYPOINT"&&t!="VIAPOINT"||objifxStpMap.pageType=="DISPLAYONLY"||objifxStpMap.pageType=="DISPLAYONLY_EDITANNOTATION"){for(n=0;n<12;n++)$("#ctxtable").find("tr:eq("+n+")").hide();return}switch(objifxStpMap.pageType){case"A2BPLANNING":case"ROUTELIBRARY":case"SIMPNOTIF":case"CONSULTRESTRICTION":u=objifxStpMap.getCurrentPathState();switch(u){case"idle":objifxStpMap.getcurrentSelectedRouteType()==0?($("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide()):objifxStpMap.getcurrentSelectedRouteType()==1?($("#ctxtable").find("tr:eq(1)").hide(),$("#ctxtable").find("tr:eq(5)").hide()):objifxStpMap.getcurrentSelectedRouteType()==2?($("#ctxtable").find("tr:eq(0)").hide(),$("#ctxtable").find("tr:eq(1)").hide()):objifxStpMap.getcurrentSelectedRouteType()==3&&($("#ctxtable").find("tr:eq(0)").hide(),$("#ctxtable").find("tr:eq(6)").hide()),$("#ctxtable").find("tr:eq(2)").hide(),$("#ctxtable").find("tr:eq(3)").hide(),$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(7)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(18)").hide();break;case"firstpointselected":objifxStpMap.getcurrentSelectedRouteType()==0?(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0?$("#ctxtable").find("tr:eq(0)").hide():$("#ctxtable").find("tr:eq(1)").hide(),$("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide()):objifxStpMap.getcurrentSelectedRouteType()==1?(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0?$("#ctxtable").find("tr:eq(0)").hide():$("#ctxtable").find("tr:eq(6)").hide(),$("#ctxtable").find("tr:eq(1)").hide(),$("#ctxtable").find("tr:eq(5)").hide()):objifxStpMap.getcurrentSelectedRouteType()==2?(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0?$("#ctxtable").find("tr:eq(5)").hide():$("#ctxtable").find("tr:eq(6)").hide(),$("#ctxtable").find("tr:eq(0)").hide(),$("#ctxtable").find("tr:eq(1)").hide()):objifxStpMap.getcurrentSelectedRouteType()==3&&(objifxStpMap.routeManager.RoutePart.routePathList[objifxStpMap.currentActiveRoutePathIndex].routePointList[0].pointType==0?$("#ctxtable").find("tr:eq(5)").hide():$("#ctxtable").find("tr:eq(1)").hide(),$("#ctxtable").find("tr:eq(0)").hide(),$("#ctxtable").find("tr:eq(6)").hide()),$("#ctxtable").find("tr:eq(2)").hide(),$("#ctxtable").find("tr:eq(3)").hide(),$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(7)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(18)").hide();break;case"secondpointselected":case"routeplanned":case"routedisplayed":$("#ctxtable").find("tr:eq(0)").hide(),$("#ctxtable").find("tr:eq(1)").hide(),$("#ctxtable").find("tr:eq(5)").hide(),$("#ctxtable").find("tr:eq(6)").hide(),u=="secondpointselected"&&$("#ctxtable").find("tr:eq(7)").hide(),$("#PortalType").val()=="696009"&&(objifxStpMap.pageType=="CONSULTRESTRICTION"&&$("#ctxtable").find("tr:eq(7)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(11)").hide());break;default:for(n=0;n<11;n++)$("#ctxtable").find("tr:eq("+n+")").hide()}r=objifxStpMap.getPageState();switch(r){case"mouseover":$("#ctxtable").find("tr:eq(2)").hide(),$("#ctxtable").find("tr:eq(3)").hide(),$("#ctxtable").find("tr:eq(7)").hide();var i=getCurrentMouseOverFeature(),t=i[0],f=i[9];$("#PortalType").val()=="696009"&&$("#ctxtable").find("tr:eq(18)").hide(),t=="ANNOTATION"?($("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide()):t=="WAYPOINT"||t=="VIAPOINT"?($("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide()):t=="STRUCTURE"||t=="CONSTRAINT"?(t!="STRUCTURE"&&($("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide()),f!="Unsuitable"&&$("#ctxtable").find("tr:eq(18)").hide(),$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(8)").hide()):($("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide());break;default:$("#ctxtable").find("tr:eq(4)").hide(),$("#ctxtable").find("tr:eq(8)").hide(),$("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(18)").hide()}$("#ctxtable").find("tr:eq(12)").hide(),$("#ctxtable").find("tr:eq(13)").hide();break;case"DISPLAYONLY":case"STRUCTURES":case"DISPLAYONLY_EDITANNOTATION":for(n=0;n<9;n++)$("#ctxtable").find("tr:eq("+n+")").hide();if(objifxStpMap.pageType=="DISPLAYONLY_EDITANNOTATION"){r=objifxStpMap.getPageState();switch(r){case"mouseover":$("#ctxtable").find("tr:eq(8)").show();break;default:$("#ctxtable").find("tr:eq(7)").show()}}objifxStpMap.getPageState()!="mouseover"&&($("#ctxtable").find("tr:eq(9)").hide(),$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(14)").hide()),t!="STRUCTURE"&&$("#ctxtable").find("tr:eq(10)").hide(),$("#ctxtable").find("tr:eq(12)").hide(),$("#ctxtable").find("tr:eq(13)").hide(),t=="CONSTRAINT"&&$("#ctxtable").find("tr:eq(9)").hide();break;case"DELEGATION_VIEWONLY":case"DELEGATION_VIEWANDEDIT":for(n=0;n<11;n++)$("#ctxtable").find("tr:eq("+n+")").hide();$("#ctxtable").find("tr:eq(12)").hide(),$("#ctxtable").find("tr:eq(13)").hide();break;case"ROADOWNERSHIP_VIEWANDEDIT":case"ROADOWNERSHIP_VIEWONLY":$("#ctxtable").find("tr:eq(13)").hide();case"MAINTAIN_CORRIDOR":case"MAINTAIN_CORRIDOR_EDITMODE":case"DS_ANALYSIS":case"CR_VIEWANDEDIT":for(n=0;n<12;n++)$("#ctxtable").find("tr:eq("+n+")").hide()}}function getRouteDetails(n){return objifxStpMap!=null?objifxStpMap.getRoutePart(n):n}function getOutlineRouteDetails(){return objifxStpMap.getRoutePart()}function confirmRemoveRoutePath(){showWarningPopDialog("U heeft onopgeslagen wijzigingen, doorgaan?","No","Yes","close_alert","removeRoutePath(pathIndex)",1,"warning")}function removeRoutePath(n){close_alert(),objifxStpMap.removeRoutePath(n-1),objifxStpMap.getCurrentPathState()=="routedisplayed"&&$("#btn_updateRoute").show(),updateUI()}function deleteWayPoint(n,t){var i=setInterval(function(){objifxStpMap.deleteRoutePoint(n+2,t,function(){clearTimeout(i)})},100);t==0&&objifxStpMap.getPathCount()>1?(objifxStpMap.clearAllRoutes(!1),clearselect()):clearRouteForPlan=!0,updateUI()}function getCurrentActiveRoutePathIndex(){return objifxStpMap.currentActiveRoutePathIndex}function isQASAllowed(n,t){switch(n){case 1:if(t=="ENDPOINT")return!1;break;case 2:if(t=="STARTPOINT"||t=="ENDPOINT")return!1;break;case 3:if(t=="STARTPOINT")return!1}return!0}function setRoutePoint(n,t,i,r,u,f,e,o){var s,h;if(u=IfxStpmapCommon.getPointTypeName(parseInt(u)),s=objifxStpMap.getcurrentSelectedRouteType(),!isQASAllowed(s,u)){showNotification("Address search is not allowed. Please select the location from the main route"),objifxStpMap.setLocationIndicatorAtXY(r,i),h={x:i,y:r},setCenter(h,!0);return}startAnimation(),objifxStpMap.setRoutePointAtXY({pointType:u,pointPos:t,X:i,Y:r,searchInBbox:!0,Zoomin:!0,locationDesc:n,isBorderCrossing:e,linkId:o},function(t){if(objifxStpMap.pageType!="NOMAPDISPLAY"){var e=document.getElementById("map");e.click(),t!=undefined&&t!=null?(getCurrentActiveRoutePathIndex()==0&&objifxStpMap.getPathCount()>1?(objifxStpMap.clearAllRoutes(!1),clearselect()):(t.pointDescr=n,objifxStpMap.clearRoutePath()),onRoutePointSelect(),updateUI(t)):(showNotification(Lang_Key.Notif_No_Road_Found_location),setZoomTo(i,r,9))}stopAnimation(),(objifxStpMap.pageType=="NOMAPDISPLAY"||objifxStpMap.pageType=="A2BPLANNING")&&f&&typeof f=="function"&&(t!=null?t.pointDescr=n:u=="STARTPOINT"?showWarningPopDialogBig(Lang_Key.WngPopup_No_Road_Found,"Ok","","close_alert","",1,"info"):u=="ENDPOINT"&&showWarningPopDialogBig(Lang_Key.WngPopup_No_Road_Found,"Ok","","close_alert","",1,"info"),f(t!=null))})}function setRouteDetails(){}function buttonsShowAndHide(n,t,i,r,u,f,e){var o,s,h;($("#hddnRDWPortal").val()==1&&(r=2),$("#IsMapupgrade").val()==1&&t==2&&(n=1),objifxStpMap.pageType!="DISPLAYONLY"&&objifxStpMap.pageType!="DISPLAYONLY_EDITANNOTATION")&&(o=!$("#btn_saveRoute").length,n==1?($("#btn_plan").attr("disabled",!1),$("#btn_plan").css("opacity",1)):n==2&&($("#btn_plan").attr("disabled",!1),$("#btn_plan").css("opacity",1)),t==1||i==1?o?$("#btn_updateRoute").show():$("#btn_saveRoute").show():(t==2||i==2)&&(o?$("#btn_updateRoute").hide():$("#btn_saveRoute").hide()),r==1?$("#btn_clear").show():r==2&&$("#btn_clear").hide(),u==1&&$("#PortalType").val()!="696011"?($("#btn_details").show(),$("#btn_replanRoute").show()):u==2&&($("#btn_details").hide(),$("#btn_replanRoute").hide()),f==1?$("#Outline_Save").show():f==2&&$("#Outline_Save").hide(),s=$("#Pageflag").val(),s!=2&&$("#Outline_Save").hide(),e==1&&returnLeg==!0?(h=objifxStpMap.pageType,document.getElementById("ReturnLeg").checked=!1,$("#ReturnLegDiv").show()):e==2&&$("#ReturnLegDiv").hide())}function deactivateOtherControl(n,t){var i;if(objifxStpmapDecisionSpace.removeDelegationMarker(1),objifxStpmapDecisionSpace.removeDelegationMarker(0),$("#intellizenz-ctxmenu").remove(),t=="A2BPLANNING"){for((n==0||n==1||n==2)&&(document.getElementById("From_location").value="",document.getElementById("To_location").value=""),objifxStpMap.getProject()=="NWK"&&(n-=6),i=0;i<toolbarPanel.controls.length;i++)i==n?toolbarPanel.controls[i].activate():toolbarPanel.controls[i].deactivate();n==-1||n>=4&&n<=6?toolbarPanel4.div.style.display="inline":(toolbarPanel2.div.style.display="none",toolbarPanel4.div.style.display="none")}else if(t=="STRUCTURES")for(i=0;i<constraintToolbarPanel.controls.length;i++)i==n?constraintToolbarPanel.controls[i].activate():constraintToolbarPanel.controls[i].deactivate();else if(t=="ROUTEAPPRAISAL")for(i=0;i<toolbarPanel2.controls.length;i++)i==n?toolbarPanel2.controls[i].activate():toolbarPanel2.controls[i].deactivate();else if(t=="ROADDELEGATION"||t=="ROADOWNERSHIP_VIEWANDEDIT")for(i=0;i<roadDelegationToolbarPanel.controls.length;i++)i==n?roadDelegationToolbarPanel.controls[i].activate():roadDelegationToolbarPanel.controls[i].deactivate()}function deactivateToolbarControls(){if(objifxStpMap.pageType!="DISPLAYONLY"&&objifxStpMap.pageType!="DISPLAYONLY_EDITANNOTATION"){for(var n=0;n<toolbarPanel.controls.length;n++)toolbarPanel.controls[n].deactivate();toolbarPanel4.div.style.display="none"}}function swapStartEnd(){if(objifxStpMap.swapRoutePoint(0,1)){var n=document.getElementById("To_location").value;console.log(n),document.getElementById("To_location").value=document.getElementById("From_location").value,document.getElementById("From_location").value=n,objifxStpMap.clearRoutePath(),updateUI()}}function clearRoadsOnMap(){objifxStpMap.clearRoutePath()}function setBounds(n){objifxStpMap.setBounds(n)}function checkStructPanelValues(){var t=getCurrentBoundsAndZoom();t.zoom<5?(document.getElementById("Affected")&&(document.getElementById("Affected").disabled=!0),document.getElementById("AffectedLabel")&&(document.getElementById("AffectedLabel").style.opacity="0.5"),document.getElementById("Suitable")&&(document.getElementById("Suitable").disabled=!0),document.getElementById("SuitableLabel")&&(document.getElementById("SuitableLabel").style.opacity="0.5"),document.getElementById("All")&&(document.getElementById("All").disabled=!0),document.getElementById("AllLabel")&&(document.getElementById("AllLabel").style.opacity="0.5"),document.getElementById("Structs")&&(document.getElementById("Structs").disabled=!0),document.getElementById("StructsLabel")&&(document.getElementById("StructsLabel").style.opacity="0.5"),document.getElementById("Underbridge")&&(document.getElementById("Underbridge").disabled=!0),document.getElementById("UnderbridgeLabel")&&(document.getElementById("UnderbridgeLabel").style.opacity="0.5"),document.getElementById("Overbridge")&&(document.getElementById("Overbridge").disabled=!0),document.getElementById("OverbridgeLabel")&&(document.getElementById("OverbridgeLabel").style.opacity="0.5"),document.getElementById("LevelCrossing")&&(document.getElementById("LevelCrossing").disabled=!0),document.getElementById("LevelCrossingLabel")&&(document.getElementById("LevelCrossingLabel").style.opacity="0.5"),document.getElementById("RoundAbout")&&(document.getElementById("RoundAbout").disabled=!0),document.getElementById("RoundAboutLabel")&&(document.getElementById("RoundAboutLabel").style.opacity="0.5"),document.getElementById("Tunnel")&&(document.getElementById("Tunnel").disabled=!0),document.getElementById("TunnelLabel")&&(document.getElementById("TunnelLabel").style.opacity="0.5"),document.getElementById("Special")&&(document.getElementById("Special").disabled=!0),document.getElementById("SpecialLabel")&&(document.getElementById("SpecialLabel").style.opacity="0.5"),document.getElementById("Constraints")&&(document.getElementById("Constraints").disabled=!0),document.getElementById("ConstraintsLabel")&&(document.getElementById("ConstraintsLabel").style.opacity="0.5"),document.getElementById("RoadWorksLabel")&&(document.getElementById("RoadWorksLabel").style.opacity="0.5"),document.getElementById("RoadWorks")&&(document.getElementById("RoadWorks").disabled=!0),document.getElementById("NDWLabel")&&(document.getElementById("NDWLabel").style.opacity="0.5"),document.getElementById("NDW")&&(document.getElementById("NDW").disabled=!0),document.getElementById("ManualLabel")&&(document.getElementById("ManualLabel").style.opacity="0.5"),document.getElementById("Manual")&&(document.getElementById("Manual").disabled=!0)):(affectedCheckBoxFlag==1&&($("#PortalType").val()=="696009"&&window.location.href.indexOf("/RegisterExemptionRoute")>-1&&$("#BrokenFlag").val()==1?(document.getElementById("Affected").checked=!1,document.getElementById("Affected").disabled=!0):(document.getElementById("Affected")&&(document.getElementById("Affected").disabled=!1),document.getElementById("AffectedLabel")&&(document.getElementById("AffectedLabel").style.opacity="1"))),unsuitableCheckBoxFlag==1&&(document.getElementById("Suitable")&&(document.getElementById("Suitable").disabled=!1),document.getElementById("SuitableLabel")&&(document.getElementById("SuitableLabel").style.opacity="1")),document.getElementById("All")&&(document.getElementById("All").disabled=!1),document.getElementById("AllLabel")&&(document.getElementById("AllLabel").style.opacity="1"),document.getElementById("Structs")&&(document.getElementById("Structs").disabled=!1),document.getElementById("StructsLabel")&&(document.getElementById("StructsLabel").style.opacity="1"),document.getElementById("Underbridge")&&(document.getElementById("Underbridge").disabled=!1),document.getElementById("UnderbridgeLabel")&&(document.getElementById("UnderbridgeLabel").style.opacity="1"),document.getElementById("Overbridge")&&(document.getElementById("Overbridge").disabled=!1),document.getElementById("OverbridgeLabel")&&(document.getElementById("OverbridgeLabel").style.opacity="1"),document.getElementById("LevelCrossing")&&(document.getElementById("LevelCrossing").disabled=!1),document.getElementById("LevelCrossingLabel")&&(document.getElementById("LevelCrossingLabel").style.opacity="1"),document.getElementById("RoundAbout")&&(document.getElementById("RoundAbout").disabled=!1),document.getElementById("RoundAboutLabel")&&(document.getElementById("RoundAboutLabel").style.opacity="1"),document.getElementById("Tunnel")&&(document.getElementById("Tunnel").disabled=!1),document.getElementById("TunnelLabel")&&(document.getElementById("TunnelLabel").style.opacity="1"),document.getElementById("Special")&&(document.getElementById("Special").disabled=!1),document.getElementById("SpecialLabel")&&(document.getElementById("SpecialLabel").style.opacity="1"),document.getElementById("Constraints")&&(document.getElementById("Constraints").disabled=!1),document.getElementById("ConstraintsLabel")&&(document.getElementById("ConstraintsLabel").style.opacity="1"),document.getElementById("RoadWorksLabel")&&(document.getElementById("RoadWorksLabel").style.opacity="1"),document.getElementById("RoadWorks")&&(document.getElementById("RoadWorks").disabled=!1),document.getElementById("NDWLabel")&&(document.getElementById("NDWLabel").style.opacity="1"),document.getElementById("NDW")&&(document.getElementById("NDW").disabled=!1),document.getElementById("ManualLabel")&&(document.getElementById("ManualLabel").style.opacity="1"),document.getElementById("Manual")&&(document.getElementById("Manual").disabled=!1))}function checkStructPanelValues1(n){if(slide==0)n=="A2B"||n=="STRUCTURES"||(document.getElementById("Structs").disabled=!1,document.getElementById("StructsLabel").style.opacity="1",document.getElementById("Underbridge").disabled=!1,document.getElementById("UnderbridgeLabel").style.opacity="1",document.getElementById("Overbridge").disabled=!1,document.getElementById("OverbridgeLabel").style.opacity="1",document.getElementById("LevelCrossing").disabled=!1,document.getElementById("LevelCrossingLabel").style.opacity="1",document.getElementById("RoundAbout").disabled=!1,document.getElementById("RoundAboutLabel").style.opacity="1",document.getElementById("Constraints").disabled=!1,document.getElementById("ConstraintsLabel").style.opacity="1");else if(slide==1){var t=getCurrentBoundsAndZoom();n=="A2B"&&t.zoom<objifxStpmapStructures.defaultPointStructZoom?(document.getElementById("Structs").disabled=!0,document.getElementById("StructsLabel").style.opacity="0.5",document.getElementById("Underbridge").disabled=!0,document.getElementById("UnderbridgeLabel").style.opacity="0.5",document.getElementById("Overbridge").disabled=!0,document.getElementById("OverbridgeLabel").style.opacity="0.5",document.getElementById("LevelCrossing").disabled=!0,document.getElementById("LevelCrossingLabel").style.opacity="0.5",document.getElementById("RoundAbout").disabled=!0,document.getElementById("RoundAboutLabel").style.opacity="0.5",document.getElementById("Tunnel").disabled=!0,document.getElementById("TunnelLabel").style.opacity="0.5",document.getElementById("Special").disabled=!0,document.getElementById("SpecialLabel").style.opacity="0.5",document.getElementById("Constraints").disabled=!0,document.getElementById("ConstraintsLabel").style.opacity="0.5"):(document.getElementById("Structs").disabled=!1,document.getElementById("StructsLabel").style.opacity="1",document.getElementById("Underbridge").disabled=!1,document.getElementById("UnderbridgeLabel").style.opacity="1",document.getElementById("Overbridge").disabled=!1,document.getElementById("OverbridgeLabel").style.opacity="1",document.getElementById("LevelCrossing").disabled=!1,document.getElementById("LevelCrossingLabel").style.opacity="1",document.getElementById("RoundAbout").disabled=!1,document.getElementById("RoundAboutLabel").style.opacity="1",document.getElementById("Tunnel").disabled=!1,document.getElementById("TunnelLabel").style.opacity="1",document.getElementById("Special").disabled=!1,document.getElementById("SpecialLabel").style.opacity="1",document.getElementById("Constraints").disabled=!1,document.getElementById("ConstraintsLabel").style.opacity="1")}}function clearAllRoads(){objifxStpmapDecisionSpace.clearAllRoads()}function showStructOnTimer(n,t){clearTimeout(timer),timer=setInterval(function(){n=="STRUCTURES"||(n=="CONSULTRESTRICTION"||n=="REGEXEMPTION"?(structPanChangedA2B(),showStructBoundsA2B(1)):slide==1?(structPanChangedA2B(),showStructBoundsA2B()):(structPanChangedA2B(),showStructBoundsA2B())),setBounds(t),clearTimeout(timer)},1e3)}function fetchRoadsOnTimer(){clearTimeout(timer),timer=setInterval(function(){objifxStpMapRoadDelegation.fetchDelegRoadsOnZoomChange(function(){objifxStpMapRoadDelegation.fetchDelegRoadsTimeFlag=1,(roadDelegationCheckValue("owned")||roadDelegationCheckValue("managed"))&&objifxStpMapRoadDelegation.fetchAllRoadsOnZoomChange(function(){objifxStpMapRoadDelegation.fetchAllRoadsTimeFlag=1})}),clearTimeout(timer)},3e3)}function fetchOwnedRoadsOnTimer(){clearTimeout(timer),timer=setInterval(function(){objifxStpmapRoadOwnership.fetchOwnedRoadsOnZoomChange(function(){objifxStpmapRoadOwnership.fetchOwnedRoadsTimeFlag=1,roadOwnershipCheckValue("unassigned")?objifxStpmapRoadOwnership.fetchUnassignedRoadsOnZoomChange(function(){objifxStpmapRoadOwnership.fetchUnassignedRoadsTimeFlag=1,stopAnimation()}):stopAnimation()}),clearTimeout(timer)},3e3)}function loadEnd(){objifxStpMap.getPageType()=="ROADOWNERSHIP_VIEWANDEDIT"&&setInterval(function(){document.getElementById("searchOrganisation").style.display="inline"},5e3)}function onCorridorSave(){objifxStpmapDecisionSpace.openInViewMode(),$("#idEditRoads").show(),objifxStpmapDecisionSpace.removeAllSelectedFeatures(),objifxStpmapDecisionSpace.fetchLimitedRoadsOnZoomChange(function(){objifxStpmapDecisionSpace.fetchLimitedRoadsTimeFlag=1,startAnimation(""),stopAnimation()})}function fetchLimitedRoadsOnTimer(){clearTimeout(timer),timer=setInterval(function(){objifxStpmapDecisionSpace.fetchLimitedRoadsOnZoomChange(function(){objifxStpmapDecisionSpace.fetchLimitedRoadsTimeFlag=1,startAnimation(""),stopAnimation()}),clearTimeout(timer)},3e3)}function panChanged(){var t,n;clearTimeout(timer),$("#intellizenz-ctxmenu").remove(),t=getCurrentBoundsAndZoom(),showmobiletooltip(),t.zoom>9?objifxStpMap.addHectoLayer():objifxStpMap.deleteMapLayer("HectoDVK layer"),n=objifxStpMap.getPageType(),n=="STRUCTURES"||n=="A2BPLANNING"||n=="ROUTELIBRARY"||n=="DISPLAYONLY"||n=="CONSULTRESTRICTION"||n=="REGEXEMPTION"?(n!="STRUCTURES"?checkStructPanelValues("A2B"):t.zoom<objifxStpmapStructures.defaultPointStructZoom?(document.getElementById("OwnedByMeLabel").style.opacity="0.5",document.getElementById("OwnedByMe").disabled=!0,document.getElementById("OwnedByOtherLabel").style.opacity="0.5",document.getElementById("OwnedByOtherOrganisations").disabled=!0):(document.getElementById("OwnedByMeLabel").style.opacity="1",document.getElementById("OwnedByMe").disabled=!1,document.getElementById("OwnedByOtherLabel").style.opacity="1",document.getElementById("OwnedByOtherOrganisations").disabled=!1),n=="STRUCTURES"?showStructOnTimer("STRUCTURES",t.bounds):n=="CONSULTRESTRICTION"?showStructOnTimer("CONSULTRESTRICTION",t.bounds):n=="REGEXEMPTION"?showStructOnTimer("REGEXEMPTION",t.bounds):showStructOnTimer("A2B",t.bounds)):n=="DELEGATION_VIEWANDEDIT"||n=="DELEGATION_VIEWONLY"?(objifxStpMapRoadDelegation.fetchAllRoadsTimeFlag=0,objifxStpMapRoadDelegation.fetchDelegRoadsTimeFlag=0,fetchRoadsOnTimer()):n=="ROADOWNERSHIP_VIEWANDEDIT"||n=="ROADOWNERSHIP_VIEWONLY"?(objifxStpmapRoadOwnership.fetchOwnedRoadsTimeFlag=0,objifxStpmapRoadOwnership.fetchUnassignedRoadsTimeFlag=0,fetchOwnedRoadsOnTimer()):n=="MAINTAIN_CORRIDOR"||n=="MAINTAIN_CORRIDOR_EDITMODE"||n=="CR_VIEWANDEDIT"?(objifxStpmapDecisionSpace.fetchLimitedRoadsTimeFlag=0,fetchLimitedRoadsOnTimer()):objifxStpMap.pageType=="NWK_STRUCTURES"||objifxStpMap.pageType!="MIG_STRUCTURES"?(objifxStpMap.pageType=="NWK_STRUCTURES"&&disableControls(),objIfxNwkMapStructures.showStructuresByMode(function(){objifxStpMap.pageType=="NWK_STRUCTURES"&&enableControls(),stopAnimation()})):objifxStpMap.pageType=="MIG_STRUCTURES"&&objIfxNwkMapStructures.showAllStructures(function(){if(objIfxNwkMapStructures.setStructureMarker(),objIfxNwkMapStructures.loadStruct=!0,document.getElementById("cbOldstructure")!=null&&document.getElementById("cbOldstructure").checked==!0){var n=objifxStpMap.structureType;objifxStpMap.structureType=0,objIfxNwkMapStructures.showStructureById(function(){objifxStpMap.structureType=n,objIfxNwkMapStructures.setStructureMarker(),self.structureEditFlag=!0,self.loadStruct=!0})}}),objifxStpMap.pageType=="STRUCTURES"&&t.zoom<5&&clearAllStructures(),objifxStpMap.reactivateControls()}function showmobiletooltip(){var i=getCurrentBoundsAndZoom(),c=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),h,f,n,s;if(c&&(h=calcBypixel(i.zoom),h)){var o=1e3,e=1e3,t=[],r=objifxStpMap.vectorLayerConstraintsCluster.features,u=[];r.length==0&&i.zoom>9&&panPopuppos!=0&&(u=objifxStpMap.vectorLayerConstraints.features,u.length>0&&(n=IfxStpmapCommon.findNearestFeatureIndexLine(u,panPopuppos.lon,panPopuppos.lat),isNearfeature(i.zoom,n.distance,!0)&&(t=u[n.index],e=n.distance))),r.length>0&&panPopuppos!=0&&(n=IfxStpmapCommon.findNearestFeatureIndex(r,panPopuppos.lon,panPopuppos.lat),isNearfeature(i.zoom,n.distance,!0)&&(t=r[n.index],e=n.distance)),f=objifxStpMap.vectorLayerStructures.features,f.length>0&&panPopuppos!=0&&(n=IfxStpmapCommon.findNearestFeatureIndexLine(f,panPopuppos.lon,panPopuppos.lat),isNearfeature(i.zoom,n.distance,!1)&&(t=f[n.index],o=n.distance)),e<=o?(r.length>0||u.length>0)&&panPopuppos!=0&&t.data!=undefined&&createPopupOnPanchange("CONSTRAINT",t,t.geometry):o<e&&f.length>0&&panPopuppos!=0&&(s=t.geometry.x!=undefined&&t.geometry.y!=undefined?t.geometry:{x:panPopuppos.lon,y:panPopuppos.lat},t.data!=undefined&&createPopupOnPanchange("STRUCTURE",t,s))}}function zoomChanged(){}function calcDistance(n){var t=500,i=500,r;if(panStartPos!=null&&panEndPos!=null){t=Math.abs(panStartPos.lat)-Math.abs(panEndPos.lat),i=Math.abs(panStartPos.lon)-Math.abs(panEndPos.lon);var u=objifxStpMap.olMap.getPixelFromLonLat(panStartPos),f=objifxStpMap.olMap.getPixelFromLonLat(panEndPos),e=Math.abs(u.x-f.x),o=Math.abs(u.y-f.y);console.log("diffrence X: "+e+" Y: "+o)}return t=Math.abs(t),i=Math.abs(i),r=-1,n==6&&t<=50&&i<=50?r=50:n==7&&t<=35&&i<=35?r=35:n==8&&t<=20&&i<=20?r=20:n==9&&t<=10&&i<=10?r=10:n==10&&t<=5&&i<=5?r=5:n==11&&t<=3&&i<=3?r=3:n==12&&t<=1&&i<=1?r=1:r}function calcBypixel(){if(panStartPos!=null&&panEndPos!=null){var t=objifxStpMap.olMap.getPixelFromLonLat(panStartPos),i=objifxStpMap.olMap.getPixelFromLonLat(panEndPos),r=Math.abs(t.x-i.x),u=Math.abs(t.y-i.y);return r<=4&&u<=4?!0:!1}return!1}function isNearfeature(n,t,i){return i?n==1&&t<=5e3?!0:n==2&&t<=3200?!0:n==3&&t<=1800?!0:n==4&&t<=1e3?!0:n==5&&t<=600?!0:n==6&&t<=400?!0:n==7&&t<=300?!0:n==8&&t<=150?!0:n==9&&t<=70?!0:n==10&&t<=30?!0:n==11&&t<=22?!0:n==12&&t<=15?!0:!1:n==1&&t<=3500?!0:n==2&&t<=2500?!0:n==3&&t<=1400?!0:n==4&&t<=800?!0:n==5&&t<=500?!0:n==6&&t<=300?!0:n==7&&t<=200?!0:n==8&&t<=100?!0:n==9&&t<=50?!0:n==10&&t<=18?!0:n==11&&t<=12?!0:n==12&&t<=8?!0:!1}function panStart(){panStartPos=objifxStpMap.olMap.getCenter()}function touchStart(){panStartPos=objifxStpMap.olMap.getCenter()}function touchEnd(){}function loadEnd(){objifxStpMap.getPageType()=="ROADOWNERSHIP_VIEWANDEDIT"&&$("#searchOrganisation").show()}function checkBoxStatus(){var n=!1,t=!1,i=!1;return document.getElementById("MyStructures").checked==!0&&(n=!0),document.getElementById("OtherStructures").checked==!0&&(t=!0),document.getElementById("Constraints").checked==!0&&(i=!0),{myStructures:n,otherStructures:t,constraints:i}}function onRouteLoaded(){updateUI()}function getCurrentMouseOverFeature(){try{var n=currentMouseOverFeature.data.name;return n!=undefined&&n!=null?currentMouseOverFeature.data.name.split(" "):["CONSTRAINT"]}catch(t){return 0}}function deleteAnnotation(){var n,t;if(objifxStpMap.pageType=="DISPLAYONLY_EDITANNOTATION"?$("#btnmovsaveannotation").show():$("#btn_updateRoute").show(),n=getCurrentMouseOverFeature(),t=n[0],t=="ANNOTATION"||t=="FVPANNOTATION")var u=this,i=null,r=setInterval(function(){$("#PortalType").val()=="696011"&&(i=!0),objifxStpMap.deleteAnnotation(n,n[1],n[2],n[3],i),clearTimeout(r)},500)}function deleteMouseOverWaypoint(){var n=getCurrentMouseOverFeature(),i=parseInt(n[1]),t=parseInt(n[2])-2;currentMouseOverFeature=null,deleteWayPoint(t,i),removewaypoint_map(t)}function showDetails(){var r=getCurrentMouseOverFeature(),f=r[0],e,i,s,n,u,o;if(f!="ANNOTATION"&&f!="FVPANNOTATION")if(e=parseInt(r[1]),f=="STRUCTURE"){var t=currentMouseOverFeature.data.name.match("STRUCTURE (.*) NAME"),h=currentMouseOverFeature.data.name.match("CODE (.*) SUITABILITY"),n=currentMouseOverFeature.data.name.match("OTHERORG (.*) TYPE");objifxStpMap?(i=objifxStpMap.getPageType(),i=="A2BPLANNING"||i=="ROUTELIBRARY"||i=="DISPLAYONLY"||i=="DISPLAYONLY_EDITANNOTATION"||i=="CONSULTRESTRICTION"?showStructureDetails("true",t[1]):n[1]=="true"?showStructureDetails(n[1],t[1]):showStructureDetails(n[1],t[1])):objIfxNwkMap.getPageType()=="STRUCTURES"?showStructureDetails("true",t[1]):n[1]=="true"?showStructureDetails(n[1],t[1]):showStructureDetails(n[1],t[1]),s=currentMouseOverFeature.data.name.split("LINKID ").pop()}else f=="CONSTRAINT"&&(n=currentMouseOverFeature.data.name.match("OTHERORG (.*) TYPE"),viewConstraintDetails(e,n[1]));else showAnnotation(r[1],r[2],r[3]);u=getCurrentBoundsAndZoom(),o={left:u.bounds.left,bottom:u.bounds.bottom,right:u.bounds.right,top:u.bounds.top},localStorage.setItem("mapLevel_temp",JSON.stringify(o))}function ShowRoadContacts(n){var t=this;objifxStpMap.searchFeaturesByXY(n.x,n.y,!1,objifxStpMap.boundaryOffset,function(t){if(t==null||t.length<=0){showNotification(Lang_Key.NotifNoRoadFnd);return}var r=this.objifxStpMap.olMap.getLonLatFromPixel({x:n.x,y:n.y}),i=IfxStpmapCommon.findNearestFeatureIndex(t,r.lon,r.lat),u=t[i.index],f=LRSMeasure(u.geometry,new OpenLayers.Geometry.Point(i.x1,i.y1),{tolerance:.5,details:!0});ShowRoadContactsDetails(u.attributes.LINK_ID,Math.round(f.length))})}function ShowRoadOwnerContacts(n){var t=this;objifxStpMap.searchFeaturesByXY(n.x,n.y,!1,objifxStpMap.boundaryOffset,function(t){if(t==null||t.length<=0){showNotification("No road found");return}var r=this.objifxStpMap.olMap.getLonLatFromPixel({x:n.x,y:n.y}),i=IfxStpmapCommon.findNearestFeatureIndex(t,r.lon,r.lat),u=t[i.index],f=LRSMeasure(u.geometry,new OpenLayers.Geometry.Point(i.x1,i.y1),{tolerance:.5,details:!0});ShowRoadOwnerContactsDetails(u.attributes.LINK_ID,Math.round(f.length))})}function ShowLimitation(n){var t=this;startAnimation(),objifxStpMap.searchFeaturesByXY(n.x,n.y,!1,objifxStpMap.boundaryOffset,function(t){if(t==null||t.length<=0){showNotification(Lang_Key.NotifNoRoadFnd),stopAnimation();return}var i=this.objifxStpMap.olMap.getLonLatFromPixel({x:n.x,y:n.y}),r=IfxStpmapCommon.findNearestFeatureIndex(t,i.lon,i.lat),u=t[r.index];ShowLimitationDetails(u.attributes.LINK_ID)})}function ShowRoadContactsDetails(n,t){resetdialogue(),pageType=objifxStpMap.getPageType(),startAnimation(),$("#dialogue").load("/Structures/RoadContact?linkID="+n+"&length="+t+"&pageType="+pageType,function(){CheckSessionTimeOut(),$(".loading").hide()}),removescroll(),$("#dialogue").show(),$("#overlay").show()}function ShowRoadOwnerContactsDetails(n,t){resetdialogue(),pageType=objifxStpMap.getPageType(),startAnimation(),$("#dialogue").load("/RoadOwnership/RoadOwnersContact?linkID="+n+"&length="+t+"&pageType="+pageType,function(){CheckSessionTimeOut(),$(".loading").hide()}),removescroll(),$("#dialogue").show(),$("#overlay").show()}function ShowLimitationDetails(n){var t=Math.random(),i=$("#MapUpgrade").val();resetdialogue(),$("#dialogue").load("../../DecisionSpace/CorridorLinkDetails?linkId="+n+"&random="+t+"&isMapUpgrade="+i,function(){CheckSessionTimeOut(),removescroll(),$("#dialogue").css("width",530),$("#dialogue").show(),$("#overlay").show(),$(".loading").hide()})}function showStructureContact(){var n=getCurrentMouseOverFeature(),i=n[0],t;i=="STRUCTURE"&&(t=parseInt(n[1]),showStructContactDetails(t))}function showStructContactDetails(n){resetdialogue(),$("#dialogue").load("../Structures/StructureContact?structureId="+n,function(){CheckSessionTimeOut()}),removescroll(),$("#dialogue").show(),$("#overlay").show()}function showStructureExemption(n){var t=getCurrentMouseOverFeature(),i,r;t!=0?(i=t[0],i=="STRUCTURE"&&(r=parseInt(t[1]),showStructExemptionDetails(r))):($(".loading").show(),objifxStpMap.searchFeaturesByXY(n.x,n.y,!1,objifxStpMap.boundaryOffset,function(t){if(t==null||t.length<=0){showNotification(Lang_Key.WngPopup_Polygone),stopAnimation();return}var i=this.objifxStpMap.olMap.getLonLatFromPixel({x:n.x,y:n.y}),r=IfxStpmapCommon.findNearestFeatureIndex(t,i.lon,i.lat),u=t[r.index];flag=1,showStructExemptionDetails(u.attributes.LINK_ID)}))}function showStructExemptionDetails(n){var t=0,i;flag==1&&(t=n,n=0,flag=0),i=$("#Exemption_ID").val()==undefined?0:$("#Exemption_ID").val(),resetdialogue(),$(".loading").show(),$("#dialogue").load("../Structures/StructureExemption?structureId="+n+"&ExemptionID="+i+"&linkID="+t,function(){CheckSessionTimeOut(),$(".loading").hide(),Resize_PopUp(650)}),removescroll(),$("#dialogue").show(),$("#overlay").show()}function loadconstraintdetails(n){var t=Math.random();startAnimation(),$("#dialogue").load("../Constraint/ViewConstraint?ConstraintID="+n+"&random="+t,function(){CheckSessionTimeOut()})}function viewConstraintDetails(n,t){var i=Math.random();t=t=="true"?!1:!0,startAnimation(),$("#dialogue").load("../Constraint/ViewConstraint?ConstraintID="+n+"&flageditmode="+t+"&random="+i,function(){CheckSessionTimeOut()})}function showStructureDetails(n,t){var i=$("#OrgId").val(),r=0;i!=0?$.ajax({type:"POST",url:"../Structures/GetStructureOwner",data:{StructureId:t,OrganisationId:i},beforeSend:function(){startAnimation()},success:function(n){r=n.result,r==0?viewStructureDetails(t):window.location.href="../Structures/ReviewSummary?structureId="+t},error:function(){alert("error")},complete:function(){}}):n=="true"?viewStructureDetails(t):window.location.href="../Structures/ReviewSummary?structureId="+t}function viewStructureDetails(n){var t=$("#MapUpgrade").val();resetdialogue(),$("#dialogue").load("../Structures/ReviewSummaryPopup?structureId="+n+"&IsMapUpgrade="+t,function(){CheckSessionTimeOut(),removescroll(),$("#dialogue").show(),$("#overlay").show()})}function calculateRelativePosition(n,t){var i;return i=n.y<t.y?"b":"t",i=n.x<t.x?i.concat("l"):i.concat("r")}function createConstraintByDescription(n,t,i){objifxStpmapStructures.createConstraintByDescription(n,t,i)}function featureOver(n,t){var i;removePopupsRdw(),removePopups(),objifxStpMap.setPageState("mouseover"),currentMouseOverFeature=n.feature,t=="STRUCTURE"&&(fvpXGeometry=n.feature.geometry.x,fvpYGeometry=n.feature.geometry.y,fvpStructName=n.feature.data.name.match("NAME (.*) CODE"),fvpLinkId=n.feature.data.name.split("LINKID ").pop(),fvpStructCode=n.feature.data.name.match("CODE (.*) SUITABILITY")[1]),t=="CONSTRAINT"&&(i=0,vectorLayerConstraintsFeatures.cluster.length>0&&(i=vectorLayerConstraintsFeatures.cluster[0].data.name.match("CONSTRAINT (.*) NAME")[1]),vectorLayerConstraintsFeatures.cluster.indexOf(n.feature)==-1&&(i==0||n.feature.data.name.match("CONSTRAINT (.*) NAME")[1]!=i)&&vectorLayerConstraintsFeatures.cluster.push(n.feature)),clearTimeout(popupTimer),popupTimer=setInterval(function(){if(t=="STRUCTURE"||t=="CONSTRAINT"){if(n.feature.geometry.components)if(vectorLayerConstraintsFeatures.cluster.length>0)createPopup(t,n.feature,n.feature.geometry);else if(n.feature.geometry.components[0].components)createPopup(t,n.feature,n.feature.geometry.components[0].components[0]);else{var i=calculateRelativePosition(n.feature.geometry.components[0],n.feature.geometry.components[n.feature.geometry.components.length-1]);createPopup(t,n.feature,n.feature.geometry.components[0],i)}else createPopup(t,n.feature,n.feature.geometry);this.vectorLayerConstraintsFeatures.cluster=[]}clearTimeout(popupTimer)},1e3)}function featureClick(n,t){removePopups(),clearTimeout(popupTimer),popupTimer=setInterval(function(){if(objifxStpMap.setPageState("mouseover"),currentMouseOverFeature=n.feature,t=="CONSTRAINT")if(n.feature.geometry.components)if(n.feature.geometry.components[0].components)createClickPopup(t,n.feature,n.feature.geometry);else{var i=calculateRelativePosition(n.feature.geometry.components[0],n.feature.geometry.components[n.feature.geometry.components.length-1]);createClickPopup(t,n.feature,n.feature.geometry.components[0],i)}else createClickPopup(t,n.feature,n.feature.geometry);clearTimeout(popupTimer)},1e3)}function featureOut(n,t){if(t=="CONSTRAINT"){vectorLayerConstraintsFeatures.cluster=[],currentMouseOverFeature=null;return}clearTimeout(popupTimer),popUpFlag=0,objifxStpMap.setPageState("readyidle"),removePopups(),mapcontextMenuOn==!1&&objifxStpMap.setPageState=="readyidle"&&(currentMouseOverFeature=null)}function createPopup(n,t,i){var c="",st,ht,y,ct,lt,fi,at,pt,k,ei,b,bt,ti,ut,w,ni,wt,kt,dt,nt,u,d,f,l,rt,tt,s,p,vt,it;if(FVPflag=0,n=="STRUCTURE")if(objifxStpMap.pageType!="MIG_STRUCTURES"){var ft=t.data.name.match("NAME (.*) CODE"),g=t.data.name.match("CODE (.*) SUITABILITY"),o=t.data.name.match("SUITABILITY (.*) HEIGHT"),yt=t.data.name.match("HEIGHT (.*) WIDTH");yt==null&&(yt=["",""]),st=t.data.name.match("WIDTH (.*) LENGTH"),st==null&&(st=["",""]),ht=t.data.name.match("LENGTH (.*) WEIGHT"),ht==null&&(ht=["",""]),dwoID==0&&$("#PortalType").val()!="696008"?(y=t.data.name.match("WEIGHT (.*) PHYSICAL_WEIGHT"),y==null&&(y=["",""])):dwoID==1&&$("#PortalType").val()!="696008"?(y=t.data.name.match("WEIGHT (.*) PHYSICAL_WEIGHT"),y==null&&(y=["",""]),y==0&&(y=t.data.name.match("PHYSICAL_WEIGHT (.*) ORGNAME"))):(dwoID==2||$("#PortalType").val()=="696008")&&(y=t.data.name.match("PHYSICAL_WEIGHT (.*) ORGNAME"),y==null&&(y=["",""]),ct=t.data.name.match("WEIGHT (.*) PHYSICAL_WEIGHT"),ct==null&&(ct=["",""])),lt=t.data.name.match("ORGNAME (.*) OTHERORG"),lt==null&&(lt=["",""]),fi=t.data.name.match("OTHERORG (.*) TYPE"),at=t.data.name.match("CROSSINGNUMBER (.*) REDTIMEEXT"),at==null&&(at=["",""]),pt=t.data.name.match("REDTIMEEXT (.*) TYPE"),pt==null&&(pt=["",""]),k=t.data.name.match("TYPE (.*) LINKID"),ei=t.data.name.split("LINKID ").pop();switch(k[1]){case"underbridge":k=Lang_Key.Tooltip_underbridge;break;case"overbridge":k=Lang_Key.Tooltip_overbridge;break;case"level crossing":k=Lang_Key.Tooltip_level_crossing;break;case"roundabout":k=Lang_Key.Tooltip_Round_about;break;case"tunnel":k=Lang_Key.Tooltip_Tooltip_Tunnel;break;default:k=Lang_Key.Tooltip_Special}o==null?o=["","Suitable"]:o&&o[1]=="Default"?o[1]="Suitable":o&&o[1]=="Unsuitable"?o[1]="Unsuitable for selected vehicle(s)":o&&o[1]=="Marginally suitable"&&(o[1]="Marginally suitable for selected vehicle(s)"),l="<div style='font-size:13px;font-size:1.0em;color: #808080 !important;'><table><tr><td>&nbsp;&nbsp;"+Lang_Key.Tooltip_Name+" : "+ft[1]+"<\/td><\/tr><\/table>"+Lang_Key.Tooltip_Owner+" : "+lt[1]+"<br>"+Lang_Key.Tooltip_Struct_type+" : "+IfxStpmapCommon.capitaliseString(k)+"<br>",b="",b+=ht[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Lengte : "+ht[1]+" cm <\/div>":"",b+=st[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Breedte&nbsp  : "+st[1]+" cm <\/div>":"",b+=yt[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Hoogte  : "+yt[1]+" cm <\/div>":"",dwoID==2&&$("#PortalType").val()!="696009"||$("#PortalType").val()=="696008"?(b+=y[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Maximum fysieke GTW : "+y[1]+" Kg <\/div>":"",b+=ct[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Gewicht : "+ct[1]+" Kg <\/div>":""):b+=y[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Gewicht : "+y[1]+" Kg <\/div>":"",k==Lang_Key.Tooltip_level_crossing&&(b+=pt[1]==0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Roodlicht extensie :  Nee <\/div>":"<div style='font-size:13px;width:100%;color: #808080 !important'>Roodlicht extensie :  Ja <\/div>",b+=at[1]!="0"?"<div style='font-size:13px;font-size:13px;width:100%;color: #808080 !important'>Overwegnummer : "+at[1]+" <\/div>":""),b+="<\/div>",l+=b,bt="<table style='font-size:1.0em;max-width:230px;'><tr><td style='color: #808080 !important'>"+Lang_Key.Tooltip_Name+" : "+ft[1]+"<\/td><\/tr><tr><td style='color: #808080 !important'>"+Lang_Key.Tooltip_Owner+" : "+lt[1]+"<\/td><\/tr><tr><td style='color: #808080 !important'>"+Lang_Key.Tooltip_Struct_type+" : "+IfxStpmapCommon.capitaliseString(k)+"<\/td><\/tr><\/table>",bt+=b,it=objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.x,i.y)),popupPixel={x:it.x,y:it.y},c=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),null,bt,new OpenLayers.Icon("",new OpenLayers.Size(8,8),new OpenLayers.Pixel(-4,-4)),!0),t.popup=c,objifxStpMap.olMap.addPopup(c)}else ti=t.data.name.match("STRUCTURE (.*) NAME"),$.ajax({url:"../Dataverification/MUViewStructureDetails",type:"POST",datatype:"json",async:!0,data:{structureId:ti[1]},success:function(n){var r=n.objStructureModel,i="<div style='font-size:1.0em'><table><tr><td>&nbsp;&nbsp;"+Lang_Key.Tooltip_Name+" : "+r.StructureName+"<\/td><\/tr><\/table>Unique ID : "+r.UniqueId+"<br>"+Lang_Key.Tooltip_Struct_type+" : "+r.StructuretypeName+"<br>";i=i+"Hectometer : "+r.Hecto+"<br>",i=i+"rijrichting : "+r.Direction+"<br>",i=i+"DVK letter : "+r.DVKNumber+"<br>",i=i+"Interne opmerkingen : "+r.Specifics+"<br>",i=i+"Kunstwerkeigenaar : "+r.StructOwnerName+"<br>",c=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel(objifxStpMap.olMap.getControlsByClass("OpenLayers.Control.MousePosition")[0].lastXy),null,i,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!1),t.popup=c,objifxStpMap.olMap.addPopup(c)}});else if(n=="CONSTRAINT"){if(currentMouseOverFeature==null)return;if(ut="",t.cluster)if(t.cluster.length>0){for(sortedClusters=sortClustersOnDate(t.cluster),l="<div style='width:100%;font-size:1.0em;'><id=''><table><tr><td><b>Locatie<\/b><\/td><td><b>Omschrijving<\/b><\/td><td><b>Begindatum<\/b><\/td><td><b>Einddatum<\/b><\/td><td><b>Breedte<\/b><\/td><td><\/td><\/tr>",w=0;w<sortedClusters.length;w++){var gt=sortedClusters[w].data.name.match("CONSTRAINT (.*) NAME")[1],ft=sortedClusters[w].data.name.match("NAME (.*) CODE")[1],g=sortedClusters[w].data.name.match("CODE (.*) ORGANISATIONID")[1],e=sortedClusters[w].data.name.match("DESCRIPTION (.*) SDATE"),et=sortedClusters[w].data.name.match("DESCRIPTION (.*) SDATE");et[1]=JSON.stringify(et[1]);var a=sortedClusters[w].data.name.match("SDATE (.*) EDATE")[1],v=sortedClusters[w].data.name.match("EDATE (.*) WIDTH")[1],u=sortedClusters[w].data.name.split("WIDTH ").pop(),ri=w+1;if(document.getElementsByClassName("MobilePop")[0]!=undefined)for(h=0;h<document.getElementsByClassName("MobilePop").length;h++)document.getElementsByClassName("MobilePop")[h].removeAttribute("id");if(nt="Rdw"+ri,nt=JSON.stringify(nt),e!=null){var ni=e[1],ii=e[1].substring(0,31),ot=e[1].substring(31);ot.length>8&&(ot="...<p style='margin-bottom: 0px; color: blue;float: right;margin-right: 20px;' >Bekijk meer<\/p>"),e=ii+ot}else ni="",e="";(a==undefined||a=="undefined"||a==null)&&(a="-"),(v==undefined||v=="undefined"||v==null)&&(v="-"),u==undefined||u=="undefined"||u==null||u=="null"?u="Onbekend":u=="-1"?u="Wegafsluiting":u=="0"||u==0?u="Geen":u+=" cm",wt="lightgray",w%2==0&&(wt="white"),l+="<tr title='"+ni+"\n\n"+g+"'><td>"+ft+"<\/td><td>"+e+"<\/td><td>"+a+"<\/td><td>"+v+"<\/td><td>"+u+"<\/td><\/tr>",ut+="<table style='font-size:1.0em;max-width:230px; background-color: "+wt+"'><tr><td>Locatie : "+ft+"<\/td><\/tr><tr><td id="+nt+" class='MobilePop' onclick='ShowFullDescription("+et[1]+","+nt+","+gt+")'>Omschrijving : "+e+"<\/td><\/tr><tr><td>Begindatum : "+a+"<\/td><\/tr><tr><td>Einddatum : "+v+"<\/td><\/tr><tr><td>Breedte : "+u+"<\/td><\/tr><\/table>"}l+="<\/table><\/div>",it=objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.x,i.y)),popupPixel={x:it.x,y:it.y},t.cluster.length>1?(c=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),new OpenLayers.Size(280,120),ut,new OpenLayers.Icon("",new OpenLayers.Size(8,8),new OpenLayers.Pixel(-4,-4)),!0),t.popup=c,c.closeOnMove=!1,objifxStpMap.olMap.addPopup(c)):(kt=455,dt=100,e.length<24&&e.length<=40?(kt=475,dt=120):(kt=500,dt=205),c=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),new OpenLayers.Size(280,120),ut,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0),t.popup=c,c.closeOnMove=!1,objifxStpMap.olMap.addPopup(c))}else{var g=t.cluster[0].data.name.match("CODE (.*) ORGANISATIONID"),o=t.cluster[0].data.name.match("SUITABILITY (.*) OTHERORG"),e=t.cluster[0].data.name.match("DESCRIPTION (.*) SDATE"),d=t.cluster[0].data.name.match("SDATE (.*) EDATE"),a=d[1],ui=t.cluster[0].data.name.match("EDATE (.*) WIDTH"),v=ui[1];if(a=="undefined"&&(a="Not Set"),v=="undefined"&&(v="Not Set"),u=t.cluster[0].data.name.match("WIDTH (.*)"),o[1]=="unsuitable"?o[1]="Unsuitable for selected vehicle(s)":o[1]=="null"&&(u[1]!="-1"&&u[1]!="undefined"&&u[1]!="null"?(o[1]=u[1],u=u[1]+" cm"):u[1]=="-1"?(o[1]="Wegafsluiting",u="Wegafsluiting"):u[1]=="0"||u[1]==0?(o[1]="Geen",u="Geen"):(u[1]==undefined||u[1]=="undefined"||u[1]==null||u[1]=="null")&&(o[1]="Onbekend",u="Onbekend")),d="",f="",g[1].length>50?(tt=g[1].substring(0,50),s=g[1].substring(50),d=tt+"<br />"+s):d=g[1],l="",rt="",e!=null&&e[1]!=null&&e[1].length>53){if(f=e[1],f!=null)if(f.indexOf("Location:")!=-1){var p=f.substr(1,f.indexOf("Location:")-1),tt=p.substring(0,53),s=p.substring(53);s.length>53&&(s=s.substring(0,50)+"..."),p=tt+"<br />"+s,l+="<div style='width:100%;font-size:small;'>"+p+"<\/div>",rt=f.substr(f.indexOf("Location:")+9,f.length),l+="<div style='width:100%;font-size:small;'>"+rt+"<\/div>"}else tt=f.substring(0,53),s=f.substring(53),s.length>53&&(s=s.substring(0,50)+"..."),p=tt+"<br />"+s,l+="<div style='width:100%;font-size:small;'>"+p+"<\/div>"}else e!=null&&e[1]!=null&&e[1].length<53&&(f=e[1],f.indexOf("Location:")!=-1?(p=f.substr(1,f.indexOf("Location:")-1),p!=""&&(l+="<div style='width:100%;font-size:small;'>"+p+"<\/div>"),rt=f.substr(f.indexOf("Location:")+9,f.length),l+="<div style='width:100%;font-size:small;'>"+rt+"<\/div>"):l+="<div style='width:100%;font-size:small;'>"+e[1]+"<\/div>");a!="Not Set"&&v!="Not Set"&&a!=""&&v!=""&&(l+="<br/><div style='width:100%;font-size:small;'><b>Van "+a+" tot "+v+"<\/b><\/div>"),o[1]!=null&&(l+="<br/><div style='width:100%;font-size:small;'>"+Lang_Key.Tooltip_Roadwork+" : "+o[1]+"<\/div>"),d!=null&&(l+="<div style='width:100%;font-size:x-small;text-align:right;'>("+d+")<\/div>"),c=new OpenLayers.Popup.FramedCloud("popup",OpenLayers.LonLat.fromString(i.toShortString()),objifxStpMap.olMap.getLonLatFromPixel(objifxStpMap.olMap.getControlsByClass("OpenLayers.Control.MousePosition")[0].lastXy),null,new OpenLayers.Size(30,30),l,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0,featureOut),t.popup=c,objifxStpMap.olMap.addPopup(c)}else{var gt=t.data.name.match("CONSTRAINT (.*) NAME")[1],ft=t.data.name.match("NAME (.*) CODE")[1],g=t.data.name.match("CODE (.*) ORGANISATIONID")[1],o=t.data.name.match("SUITABILITY (.*) OTHERORG"),e=t.data.name.match("DESCRIPTION (.*) SDATE"),ni=e[1],et=t.data.name.match("DESCRIPTION (.*) SDATE");et[1]=JSON.stringify(et[1]);var ii=e[1].substring(0,31),ot=e[1].substring(31),ri=w+1;if(document.getElementsByClassName("MobilePop")[0]!=undefined)for(h=0;h<document.getElementsByClassName("MobilePop").length;h++)document.getElementsByClassName("MobilePop")[h].removeAttribute("id");nt="Rdw"+ri,nt=JSON.stringify(nt),ot.length>8&&(ot="...<p style='margin-bottom: 0px; color: blue;float: right;margin-right: 20px;' >Bekijk meer<\/p>"),e=ii+ot;var d=t.data.name.match("SDATE (.*) EDATE"),a=d[1],ui=t.data.name.match("EDATE (.*) WIDTH"),v=ui[1];if(a=="undefined"&&(a="Not Set"),v=="undefined"&&(v="Not Set"),u=t.data.name.match("WIDTH (.*)"),o[1]=="unsuitable"?o[1]="Unsuitable for selected vehicle(s)":u[1]!="-1"&&u[1]!="undefined"&&u[1]!="null"&&u[1]!="0"?(o[1]=u[1],u=u[1]+" cm"):u[1]=="-1"?(o[1]="Wegafsluiting",u="Wegafsluiting"):u[1]=="0"||u[1]==0?(o[1]="Geen",u="Geen"):(u[1]==undefined||u[1]=="undefined"||u[1]==null||u[1]=="null")&&(o[1]="Onbekend",u="Onbekend"),d="",f="",g[1].length>50?(tt=g[1].substring(0,50),s=g[1].substring(50),d=tt+"<br />"+s):d=g[1],l="<div style='width:100%;font-size:1.0em;'><id=''><table><tr><td><b>Location<\/b><\/td><td><b>Description<\/b><\/td><td><b>Start date<\/b><\/td><td><b>End date<\/b><\/td><td><b>Width<\/b><\/td><td><\/td><\/tr>",rt="",e!=null&&e[1]!=null&&e[1].length>53){if(f=e[1],f!=null)if(f.indexOf("Location:")!=-1){var p=f.substr(1,f.indexOf("Location:")-1),tt=p.substring(0,53),s=p.substring(53);s.length>53&&(s=s.substring(0,50)+"..."),p=tt+"<br />"+s,rt=f.substr(f.indexOf("Location:")+9,f.length)}else tt=f.substring(0,53),s=f.substring(53),s.length>53&&(s=s.substring(0,50)+"..."),p=tt+"<br />"+s}else e!=null&&e[1]!=null&&e[1].length<53&&(f=e[1],f.indexOf("Location:")!=-1&&(p=f.substr(1,f.indexOf("Location:")-1),p!="",rt=f.substr(f.indexOf("Location:")+9,f.length)));a!="Not Set"&&v!="Not Set"&&a!=""&&v!="",o[1]!=null,d!=null,l+="<tr title='"+ni+"\n\n"+g+"'><td>"+ft+"<\/td><td>"+e+"<\/td><td>"+a+"<\/td><td>"+v+"<\/td><td>"+u+"<\/td><td><button type=button onclick='loadconstraintdetails("+gt+");' >"+Lang_Key.Details+"<\/button><\/td><\/tr>",ut+="<table style='font-size:1.0em;max-width:230px; background-color: "+wt+"'><tr><td>Locatie : "+ft+"<\/td><\/tr><tr><td id="+nt+" class='MobilePop' onclick='ShowFullDescription("+et[1]+","+nt+","+gt+")'>Omschrijving : "+e+"<\/td><\/tr><tr><td>Begindatum : "+a+"<\/td><\/tr><tr><td>Einddatum : "+v+"<\/td><\/tr><tr><td>Breedte : "+u+"<\/td><\/tr><\/table>",l+="<\/table><\/div>",vt=i.components.length/2,vt=Math.floor(vt),it=objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.components[vt].x,i.components[vt].y)),popupPixel={x:it.x,y:it.y},c=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),new OpenLayers.Size(280,120),ut,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0),t.popup=c,c.closeOnMove=!1,objifxStpMap.olMap.addPopup(c)}}}function ShowFullDescription(n,t,i){var r=document.getElementById(t);$.ajax({url:"/Constraint/GetConstraintFullDescription",dataType:"json",data:{ConstId:i},success:function(n){var t=n.result;r.innerHTML="Omschrijving :"+t},complete:function(){}})}function createPopupOnPanchange(n,t,i){var s,st,ht,y,ct,lt,fi,at,pt,k,ei,b,bt,ti,ut,w,ni,wt,kt,dt,nt,u,d,f,l,rt,tt,c,p,vt,it;if(removePopupsRdw(),s="",FVPflag=0,n=="STRUCTURE")if(objifxStpMap.pageType!="MIG_STRUCTURES"){var ft=t.data.name.match("NAME (.*) CODE"),g=t.data.name.match("CODE (.*) SUITABILITY"),o=t.data.name.match("SUITABILITY (.*) HEIGHT"),yt=t.data.name.match("HEIGHT (.*) WIDTH");yt==null&&(yt=["",""]),st=t.data.name.match("WIDTH (.*) LENGTH"),st==null&&(st=["",""]),ht=t.data.name.match("LENGTH (.*) WEIGHT"),ht==null&&(ht=["",""]),dwoID==0&&$("#PortalType").val()!="696008"?(y=t.data.name.match("WEIGHT (.*) PHYSICAL_WEIGHT"),y==null&&(y=["",""])):dwoID==1&&$("#PortalType").val()!="696008"?(y=t.data.name.match("WEIGHT (.*) PHYSICAL_WEIGHT"),y==null&&(y=["",""]),y==0&&(y=t.data.name.match("PHYSICAL_WEIGHT (.*) ORGNAME"))):(dwoID==2||$("#PortalType").val()=="696008")&&(y=t.data.name.match("PHYSICAL_WEIGHT (.*) ORGNAME"),y==null&&(y=["",""]),ct=t.data.name.match("WEIGHT (.*) PHYSICAL_WEIGHT"),ct==null&&(ct=["",""])),lt=t.data.name.match("PHYSICAL_WEIGHT (.*) ORGNAME"),lt==null&&(lt=["",""]),fi=t.data.name.match("OTHERORG (.*) TYPE"),at=t.data.name.match("CROSSINGNUMBER (.*) REDTIMEEXT"),at==null&&(at=["",""]),pt=t.data.name.match("REDTIMEEXT (.*) TYPE"),pt==null&&(pt=["",""]),k=t.data.name.match("TYPE (.*) LINKID"),ei=t.data.name.split("LINKID ").pop();switch(k[1]){case"underbridge":k=Lang_Key.Tooltip_underbridge;break;case"overbridge":k=Lang_Key.Tooltip_overbridge;break;case"level crossing":k=Lang_Key.Tooltip_level_crossing;break;case"roundabout":k=Lang_Key.Tooltip_Round_about;break;case"tunnel":k=Lang_Key.Tooltip_Tooltip_Tunnel;break;default:k=Lang_Key.Tooltip_Special}o==null?o=["","Suitable"]:o&&o[1]=="Default"?o[1]="Suitable":o&&o[1]=="Unsuitable"?o[1]="Unsuitable for selected vehicle(s)":o&&o[1]=="Marginally suitable"&&(o[1]="Marginally suitable for selected vehicle(s)"),l="<div style='font-size:13px;font-size:1.0em;color: #808080 !important;'><table><tr><td>&nbsp;&nbsp;"+Lang_Key.Tooltip_Name+" : "+ft[1]+"<\/td><\/tr><\/table>"+Lang_Key.Tooltip_Owner+" : "+lt[1]+"<br>"+Lang_Key.Tooltip_Struct_type+" : "+IfxStpmapCommon.capitaliseString(k)+"<br>",b="",b+=ht[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Lengte : "+ht[1]+" cm <\/div>":"",b+=st[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Breedte&nbsp  : "+st[1]+" cm <\/div>":"",b+=yt[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Hoogte  : "+yt[1]+" cm <\/div>":"",dwoID==2&&$("#PortalType").val()!="696009"||$("#PortalType").val()=="696008"?(b+=y[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Maximum fysieke GTW : "+y[1]+" Kg <\/div>":"",b+=ct[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Gewicht : "+ct[1]+" Kg <\/div>":""):b+=y[1]>0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Gewicht : "+y[1]+" Kg <\/div>":"",k==Lang_Key.Tooltip_level_crossing&&(b+=pt[1]==0?"<div style='font-size:13px;width:100%;color: #808080 !important'>Roodlicht extensie :  Nee <\/div>":"<div style='font-size:13px;width:100%;color: #808080 !important'>Roodlicht extensie :  Ja <\/div>",b+=at[1]!="0"?"<div style='font-size:13px;font-size:13px;width:100%;color: #808080 !important'>Overwegnummer : "+at[1]+" <\/div>":""),b+="<\/div>",l+=b,bt="<table style='font-size:1.0em;max-width:230px;'><tr><td style='color: #808080 !important'>"+Lang_Key.Tooltip_Name+" : "+ft[1]+"<\/td><\/tr><tr><td style='color: #808080 !important'>"+Lang_Key.Tooltip_Owner+" : "+lt[1]+"<\/td><\/tr><tr><td style='color: #808080 !important'>"+Lang_Key.Tooltip_Struct_type+" : "+IfxStpmapCommon.capitaliseString(k)+"<\/td><\/tr><\/table>",bt+=b,it=i.x!=undefined?objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.x,i.y)):objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.components[0].x,i.components[0].y)),popupPixel={x:it.x,y:it.y},s=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),null,bt,new OpenLayers.Icon("",new OpenLayers.Size(8,8),new OpenLayers.Pixel(-4,-4)),!0),t.popup=s,objifxStpMap.olMap.addPopup(s)}else ti=t.data.name.match("STRUCTURE (.*) NAME"),$.ajax({url:"../Dataverification/MUViewStructureDetails",type:"POST",datatype:"json",async:!0,data:{structureId:ti[1]},success:function(n){var r=n.objStructureModel,i="<div style='font-size:1.0em'><table><tr><td>&nbsp;&nbsp;"+Lang_Key.Tooltip_Name+" : "+r.StructureName+"<\/td><\/tr><\/table>Unique ID : "+r.UniqueId+"<br>"+Lang_Key.Tooltip_Struct_type+" : "+r.StructuretypeName+"<br>";i=i+"Hectometer : "+r.Hecto+"<br>",i=i+"rijrichting : "+r.Direction+"<br>",i=i+"DVK letter : "+r.DVKNumber+"<br>",i=i+"Interne opmerkingen : "+r.Specifics+"<br>",i=i+"Kunstwerkeigenaar : "+r.StructOwnerName+"<br>",s=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel(objifxStpMap.olMap.getControlsByClass("OpenLayers.Control.MousePosition")[0].lastXy),null,i,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!1),t.popup=s,objifxStpMap.olMap.addPopup(s)}});else if(n=="CONSTRAINT")if(ut="",t.cluster)if(t.cluster.length>0){for(sortedClusters=sortClustersOnDate(t.cluster),l="<div style='width:100%;font-size:1.0em;'><id=''><table><tr><td><b>Locatie<\/b><\/td><td><b>Omschrijving<\/b><\/td><td><b>Begindatum<\/b><\/td><td><b>Einddatum<\/b><\/td><td><b>Breedte<\/b><\/td><td><\/td><\/tr>",w=0;w<sortedClusters.length;w++){var gt=sortedClusters[w].data.name.match("CONSTRAINT (.*) NAME")[1],ft=sortedClusters[w].data.name.match("NAME (.*) CODE")[1],g=sortedClusters[w].data.name.match("CODE (.*) ORGANISATIONID")[1],e=sortedClusters[w].data.name.match("DESCRIPTION (.*) SDATE"),et=sortedClusters[w].data.name.match("DESCRIPTION (.*) SDATE");et[1]=JSON.stringify(et[1]);var a=sortedClusters[w].data.name.match("SDATE (.*) EDATE")[1],v=sortedClusters[w].data.name.match("EDATE (.*) WIDTH")[1],u=sortedClusters[w].data.name.split("WIDTH ").pop(),ri=w+1;if(document.getElementsByClassName("MobilePop")[0]!=undefined)for(h=0;h<document.getElementsByClassName("MobilePop").length;h++)document.getElementsByClassName("MobilePop")[h].removeAttribute("id");if(nt="Rdw"+ri,nt=JSON.stringify(nt),e!=null){var ni=e[1],ii=e[1].substring(0,31),ot=e[1].substring(31);ot.length>8&&(ot="...<p style='margin-bottom: 0px; color: blue;float: right;margin-right: 20px;' >Bekijk meer<\/p>"),e=ii+ot}else ni="",e="";(a==undefined||a=="undefined"||a==null)&&(a="-"),(v==undefined||v=="undefined"||v==null)&&(v="-"),u==undefined||u=="undefined"||u==null||u=="null"?u="Onbekend":u=="-1"?u="Wegafsluiting":u=="0"||u==0?u="Geen":u+=" cm",wt="lightgray",w%2==0&&(wt="white"),l+="<tr title='"+ni+"\n\n"+g+"'><td>"+ft+"<\/td><td>"+e+"<\/td><td>"+a+"<\/td><td>"+v+"<\/td><td>"+u+"<\/td><\/tr>",ut+="<table style='font-size:1.0em;max-width:230px; background-color: "+wt+"'><tr><td>Locatie : "+ft+"<\/td><\/tr><tr><td id="+nt+" class='MobilePop' onclick='ShowFullDescription("+et[1]+","+nt+","+gt+")'>Omschrijving : "+e+"<\/td><\/tr><tr><td>Begindatum : "+a+"<\/td><\/tr><tr><td>Einddatum : "+v+"<\/td><\/tr><tr><td>Breedte : "+u+"<\/td><\/tr><\/table>"}l+="<\/table><\/div>",it=objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.x,i.y)),popupPixel={x:it.x,y:it.y},t.cluster.length>1?(s=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),new OpenLayers.Size(280,120),ut,new OpenLayers.Icon("",new OpenLayers.Size(8,8),new OpenLayers.Pixel(-4,-4)),!0),t.popup=s,s.closeOnMove=!1,objifxStpMap.olMap.addPopup(s)):(kt=455,dt=100,e.length<24&&e.length<=40?(kt=475,dt=120):(kt=500,dt=205),s=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),new OpenLayers.Size(280,120),ut,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0),t.popup=s,s.closeOnMove=!1,objifxStpMap.olMap.addPopup(s))}else{var g=t.cluster[0].data.name.match("CODE (.*) ORGANISATIONID"),o=t.cluster[0].data.name.match("SUITABILITY (.*) OTHERORG"),e=t.cluster[0].data.name.match("DESCRIPTION (.*) SDATE"),d=t.cluster[0].data.name.match("SDATE (.*) EDATE"),a=d[1],ui=t.cluster[0].data.name.match("EDATE (.*) WIDTH"),v=ui[1];if(a=="undefined"&&(a="Not Set"),v=="undefined"&&(v="Not Set"),u=t.cluster[0].data.name.match("WIDTH (.*)"),o[1]=="unsuitable"?o[1]="Unsuitable for selected vehicle(s)":u[1]!="-1"&&u[1]!="undefined"&&u[1]!="null"?(o[1]=u[1],u=u[1]+" cm"):u[1]=="-1"?(o[1]="Wegafsluiting",u="Wegafsluiting"):u[1]=="0"||u[1]==0?(o[1]="Geen",u="Geen"):(u[1]==undefined||u[1]=="undefined"||u[1]==null||u[1]=="null")&&(o[1]="Onbekend",u="Onbekend"),d="",f="",g[1].length>50?(tt=g[1].substring(0,50),c=g[1].substring(50),d=tt+"<br />"+c):d=g[1],l="",rt="",e!=null&&e[1]!=null&&e[1].length>53){if(f=e[1],f!=null)if(f.indexOf("Location:")!=-1){var p=f.substr(1,f.indexOf("Location:")-1),tt=p.substring(0,53),c=p.substring(53);c.length>53&&(c=c.substring(0,50)+"..."),p=tt+"<br />"+c,l+="<div style='width:100%;font-size:small;'>"+p+"<\/div>",rt=f.substr(f.indexOf("Location:")+9,f.length),l+="<div style='width:100%;font-size:small;'>"+rt+"<\/div>"}else tt=f.substring(0,53),c=f.substring(53),c.length>53&&(c=c.substring(0,50)+"..."),p=tt+"<br />"+c,l+="<div style='width:100%;font-size:small;'>"+p+"<\/div>"}else e!=null&&e[1]!=null&&e[1].length<53&&(f=e[1],f.indexOf("Location:")!=-1?(p=f.substr(1,f.indexOf("Location:")-1),p!=""&&(l+="<div style='width:100%;font-size:small;'>"+p+"<\/div>"),rt=f.substr(f.indexOf("Location:")+9,f.length),l+="<div style='width:100%;font-size:small;'>"+rt+"<\/div>"):l+="<div style='width:100%;font-size:small;'>"+e[1]+"<\/div>");a!="Not Set"&&v!="Not Set"&&a!=""&&v!=""&&(l+="<br/><div style='width:100%;font-size:small;'><b>Van "+a+" tot "+v+"<\/b><\/div>"),o[1]!=null&&(l+="<br/><div style='width:100%;font-size:small;'>"+Lang_Key.Tooltip_Roadwork+" : "+o[1]+"<\/div>"),d!=null&&(l+="<div style='width:100%;font-size:x-small;text-align:right;'>("+d+")<\/div>"),s=new OpenLayers.Popup.FramedCloud("popup",OpenLayers.LonLat.fromString(i.toShortString()),objifxStpMap.olMap.getLonLatFromPixel(objifxStpMap.olMap.getControlsByClass("OpenLayers.Control.MousePosition")[0].lastXy),null,new OpenLayers.Size(30,30),l,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0,featureOut),t.popup=s,objifxStpMap.olMap.addPopup(s)}else{var gt=t.data.name.match("CONSTRAINT (.*) NAME")[1],ft=t.data.name.match("NAME (.*) CODE")[1],g=t.data.name.match("CODE (.*) ORGANISATIONID")[1],o=t.data.name.match("SUITABILITY (.*) OTHERORG"),e=t.data.name.match("DESCRIPTION (.*) SDATE"),ni=e[1],et=t.data.name.match("DESCRIPTION (.*) SDATE");et[1]=JSON.stringify(et[1]);var ii=e[1].substring(0,31),ot=e[1].substring(31),ri=w+1;if(document.getElementsByClassName("MobilePop")[0]!=undefined)for(h=0;h<document.getElementsByClassName("MobilePop").length;h++)document.getElementsByClassName("MobilePop")[h].removeAttribute("id");nt="Rdw"+ri,nt=JSON.stringify(nt),ot.length>8&&(ot="...<p style='margin-bottom: 0px; color: blue;float: right;margin-right: 20px;' >Bekijk meer<\/p>"),e=ii+ot;var d=t.data.name.match("SDATE (.*) EDATE"),a=d[1],ui=t.data.name.match("EDATE (.*) WIDTH"),v=ui[1];if(a=="undefined"&&(a="Not Set"),v=="undefined"&&(v="Not Set"),u=t.data.name.match("WIDTH (.*)"),o[1]=="unsuitable"?o[1]="Unsuitable for selected vehicle(s)":o[1]=="null"&&(u[1]!="-1"&&u[1]!="undefined"&&u[1]!="null"&&u[1]!="0"?(o[1]=u[1],u=u[1]+" cm"):u[1]=="-1"?(o[1]="Wegafsluiting",u="Wegafsluiting"):u[1]=="0"||u[1]==0?(o[1]="Geen",u="Geen"):(u[1]==undefined||u[1]=="undefined"||u[1]==null||u[1]=="null")&&(o[1]="Onbekend",u="Onbekend")),d="",f="",g[1].length>50?(tt=g[1].substring(0,50),c=g[1].substring(50),d=tt+"<br />"+c):d=g[1],l="<div style='width:100%;font-size:1.0em;'><id=''><table><tr><td><b>Location<\/b><\/td><td><b>Description<\/b><\/td><td><b>Start date<\/b><\/td><td><b>End date<\/b><\/td><td><b>Width<\/b><\/td><td><\/td><\/tr>",rt="",e!=null&&e[1]!=null&&e[1].length>53){if(f=e[1],f!=null)if(f.indexOf("Location:")!=-1){var p=f.substr(1,f.indexOf("Location:")-1),tt=p.substring(0,53),c=p.substring(53);c.length>53&&(c=c.substring(0,50)+"..."),p=tt+"<br />"+c,rt=f.substr(f.indexOf("Location:")+9,f.length)}else tt=f.substring(0,53),c=f.substring(53),c.length>53&&(c=c.substring(0,50)+"..."),p=tt+"<br />"+c}else e!=null&&e[1]!=null&&e[1].length<53&&(f=e[1],f.indexOf("Location:")!=-1&&(p=f.substr(1,f.indexOf("Location:")-1),p!="",rt=f.substr(f.indexOf("Location:")+9,f.length)));a!="Not Set"&&v!="Not Set"&&a!=""&&v!="",o[1]!=null,d!=null,l+="<tr title='"+ni+"\n\n"+g+"'><td>"+ft+"<\/td><td>"+e+"<\/td><td>"+a+"<\/td><td>"+v+"<\/td><td>"+u+"<\/td><td><button type=button onclick='loadconstraintdetails("+gt+");' >"+Lang_Key.Details+"<\/button><\/td><\/tr>",ut+="<table style='font-size:1.0em;max-width:230px; background-color: "+wt+"'><tr><td>Locatie : "+ft+"<\/td><\/tr><tr><td id="+nt+" class='MobilePop' onclick='ShowFullDescription("+et[1]+","+nt+","+gt+")'>Omschrijving : "+e+"<\/td><\/tr><tr><td>Begindatum : "+a+"<\/td><\/tr><tr><td>Einddatum : "+v+"<\/td><\/tr><tr><td>Breedte : "+u+"<\/td><\/tr><\/table>",l+="<\/table><\/div>",vt=i.components.length/2,vt=Math.floor(vt),it=objifxStpMap.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.components[vt].x,i.components[vt].y)),popupPixel={x:it.x,y:it.y},s=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel({x:popupPixel.x,y:popupPixel.y}),new OpenLayers.Size(280,120),ut,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0),t.popup=s,s.closeOnMove=!1,objifxStpMap.olMap.addPopup(s)}}function sortClustersOnDate(n){for(var t,f,i=0;i<n.length;i++)for(t=0;t<n.length-1;t++){var e=n[t].data.name.match("SDATE (.*) EDATE")[1],o=n[t+1].data.name.match("SDATE (.*) EDATE")[1],r=e.split("/"),u=o.split("/"),s=r[1]+"/"+r[0]+"/"+r[2],h=u[1]+"/"+u[0]+"/"+u[2];s>h&&(f=n[t],n[t]=n[t+1],n[t+1]=f)}return n}function createClickPopup(n,t){var h="",c,u,a,l;if(popUpFlag!=1){if(popUpFlag=1,n=="CONSTRAINT"&&t.cluster&&t.cluster.length>1){for(c="<div style='width:100%;font-size:1.0em;'><a href='no-javascript.html' id='popuplink'><table><tr><td><b>Location<\/b><\/td><td><b>Description<\/b><\/td><td><b>Start date<\/b><\/td><td><b>End date<\/b><\/td><td><b>Width<\/b><\/td><\/tr>",u=0;u<t.cluster.length;u++){var v=t.cluster[u].data.name.match("NAME (.*) CODE")[1],f=t.cluster[u].data.name.match("DESCRIPTION (.*) SDATE"),e=t.cluster[u].data.name.match("SDATE (.*) EDATE")[1],o=t.cluster[u].data.name.match("EDATE (.*) WIDTH")[1],s=t.cluster[u].data.name.split("WIDTH ").pop();f!=null?(a=f[1].substring(0,40),l=f[1].substring(40),l.length>3&&(l="..."),f=a+l):f="",(e==undefined||e=="undefined"||e==null)&&(e="-"),(o==undefined||o=="undefined"||o==null)&&(o="-"),(s==undefined||s=="undefined"||s==null)&&(s="None"),c+="<tr><td>"+v+"<\/td><td>"+f+"<\/td><td>"+e+"<\/td><td>"+o+"<\/td><td>"+s+"<\/td><\/tr>"}c+="<\/table><\/div>",h=new OpenLayers.Popup.FramedCloud("popup",objifxStpMap.olMap.getLonLatFromPixel(objifxStpMap.olMap.getControlsByClass("OpenLayers.Control.MousePosition")[0].lastXy),new OpenLayers.Size(400,175),c,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0)}t.popup=h,h.autoSize=!1,objifxStpMap.olMap.addPopup(h)}}function getDescriptionContent(n,t){var f="",u,e,i,r;if(u=t==!0?"":"<div style='width:100%;font-size:small;'>",n!=null&&n[1]!=null&&n[1].length>53){if(descriptionResult=n[1],descriptionResult!=null)if(descriptionResult.indexOf("Location:")!=-1){var r=descriptionResult.substr(1,descriptionResult.indexOf("Location:")-1),e=r.substring(0,53),i=r.substring(53);i.length>53&&(i=i.substring(0,50)+"..."),r=e+"<br />"+i,f+=u+r+"<\/div>",location=descriptionResult.substr(descriptionResult.indexOf("Location:")+9,descriptionResult.length),f+=u+location+"<\/div>"}else e=descriptionResult.substring(0,53),i=descriptionResult.substring(53),i.length>53&&(i=i.substring(0,50)+"..."),r=e+"<br />"+i,f+=u+r+"<\/div>"}else n!=null&&n[1]!=null&&n[1].length<53&&(descriptionResult=n[1],descriptionResult.indexOf("Location:")!=-1?(r=descriptionResult.substr(1,descriptionResult.indexOf("Location:")-1),r!=""&&(f+=u+r+"<\/div>"),location=descriptionResult.substr(descriptionResult.indexOf("Location:")+9,descriptionResult.length),f+=u+location+"<\/div>"):f+=u+n[1]+"<\/div>");return f}function removePopup(){}function removePopups(){}function removePopupsRdw(){while(objifxStpMap.olMap.popups.length)objifxStpMap.olMap.removePopup(objifxStpMap.olMap.popups[0])}function setMapUsageCount(n){$.ajax({url:"../Routes/setMapUsage",type:"POST",datatype:"json",async:!0,data:{type:n},success:function(){},error:function(){location.reload()},complete:function(){stopAnimation()}})}function remPath(){$("#intellizenz-ctxmenu").remove(),removepath(objifxStpMap.currentActiveRoutePathIndex),updateUI()}function setPageType(n){objifxStpMap.setPageType(n)}function setPageState(n){objifxStpMap.setPageState(n)}function changeMapPageType(n){clearStructures(0),clearConstraints(0),clearStructFlags(),toggleCancelToolBar(),hideMnvrCancelToolBar(),btnAffectedStructures.deactivate(),btnAffectedConstraints.deactivate(),slide==0&&(document.getElementById("AffectedLabel").style.opacity="0.5",document.getElementById("Affected").checked=!1,document.getElementById("Affected").disabled=!0),objifxStpMap.changePageType(n)}function getCurrentBoundsAndZoom(){return objifxStpMap.getCurrentBoundsAndZoom()}function showAffectedStructures(n,t){if((n==undefined||n=="0"||n=="")&&(n=objifxStpMap.getRouteId()),objifxStpMap.getCurrentPathState()=="routeplanned"||objifxStpMap.getCurrentPathState()=="routedisplayed"&&$("#PortalType").val()=="696009"&&(n==0||n==null))document.getElementById("chkMargin")&&document.getElementById("chkMargin").checked==!0&&(marginalHeight=$("#txtMarginalHeight").val()),(n==undefined||n=="0"||n=="")&&(n=0),objifxStpmapStructures.getInstantAnalysis(n,0,function(n){t&&typeof t=="function"&&t(n)});else{var i=!1;$("#HFSortFlag").val()!=undefined&&$("#HFSortFlag").val()=="True"&&(i=!0),objifxStpmapStructures.showAffectedStructures(n,objifxStpMap.getPageType(),i,function(n){t&&typeof t=="function"&&t(n)})}}function showAffectedConstraints(n,t,i,r){var f,u;(n==undefined||n=="0"||n=="")&&(n=objifxStpMap.getRouteId()),objifxStpMap.getCurrentPathState()=="routeplanned"||objifxStpMap.getCurrentPathState()=="routedisplayed"&&$("#PortalType").val()=="696009"&&(n==0||n==null)?((n==undefined||n=="0"||n=="")&&(n=0),u=setInterval(function(){objifxStpmapStructures.getInstantAnalysis(n,1,null,t,i,r),clearTimeout(u)},1e3)):(f=!1,$("#HFSortFlag").val()!=undefined&&$("#HFSortFlag").val()=="True"&&(f=!0),u=setInterval(function(){objifxStpmapStructures.showAffectedConstraints(n,objifxStpMap.getPageType(),f,t,i,r),clearTimeout(u)},1e3))}function showAllStructures(n,t,i){objifxStpmapStructures.showAllStructures(n,t,function(n){i&&typeof i=="function"&&i(n)})}function showAllConstraints(n,t,i,r){var u=setInterval(function(){objifxStpmapStructures.showAllConstraints(n,t,i,r),clearTimeout(u)},1e3)}function toggleStructures(n,t){if($("#intellizenz-ctxmenu").remove(),n=="STRUCTURES"){if(t==!0)try{document.getElementById("Suitable")&&(document.getElementById("Suitable").checked=!1),document.getElementById("All")&&(document.getElementById("All").checked=!1),document.getElementById("Affected")&&(document.getElementById("Affected").checked=!0),document.getElementById("Structs")&&(document.getElementById("Structs").checked=!0),document.getElementById("Underbridge")&&(document.getElementById("Underbridge").checked=!0),document.getElementById("Overbridge")&&(document.getElementById("Overbridge").checked=!0),document.getElementById("UnderAndOverbridge")&&(document.getElementById("UnderAndOverbridge").checked=!0),document.getElementById("LevelCrossing")&&(document.getElementById("LevelCrossing").checked=!0),document.getElementById("RoundAbout")&&(document.getElementById("RoundAbout").checked=!0),document.getElementById("Tunnel")&&(document.getElementById("Tunnel").checked=!0),document.getElementById("Special")&&(document.getElementById("Special").checked=!0)}catch(i){}else try{document.getElementById("All")&&document.getElementById("All").checked==!1&&document.getElementById("Suitable")&&document.getElementById("Suitable").checked==!1&&(document.getElementById("Structs")&&(document.getElementById("Structs").checked=!1),document.getElementById("Underbridge")&&(document.getElementById("Underbridge").checked=!1),document.getElementById("Overbridge")&&(document.getElementById("Overbridge").checked=!1),document.getElementById("UnderAndOverbridge")&&(document.getElementById("UnderAndOverbridge").checked=!1),document.getElementById("LevelCrossing")&&(document.getElementById("LevelCrossing").checked=!1),document.getElementById("RoundAbout")&&(document.getElementById("RoundAbout").checked=!1),document.getElementById("Tunnel")&&(document.getElementById("Tunnel").checked=!1),document.getElementById("Special")&&(document.getElementById("Special").checked=!1),document.getElementById("Affected")&&(document.getElementById("Affected").checked=!1))}catch(i){}slide==1?showStructBoundsA2B():slide==0&&showStructBoundsA2B1()}else t==!0?(document.getElementById("Constraints")&&(document.getElementById("Constraints").checked=!0),document.getElementById("Affected")&&(document.getElementById("Affected").checked=!0)):document.getElementById("All")&&document.getElementById("All").checked==!1?(btnAffectedStructures.active!=!0&&document.getElementById("Affected")&&(document.getElementById("Affected").checked=!1),document.getElementById("Constraints")&&(document.getElementById("Constraints").checked=!1)):document.getElementById("Structs")&&document.getElementById("Structs").checked==!0&&document.getElementById("Affected")&&(document.getElementById("Affected").checked=!1),showStructBoundsA2B()}function toggleconstraintslist(n){var v=objifxStpMap.getRouteId(),l,t,e,o,i,r,u,f,s,a,h,c;objifxStpMap.pageType=="DISPLAYONLY"&&$("#UserTitle").text()!="Public Portal"||v>0?n==!0&&(l=setInterval(function(){GetaffectedConstraintsList(),clearTimeout(l)},1e3)):(objifxStpMap.pageType=="CONSULTRESTRICTION"?(t=$("#searchOnMapObj_StartDate").val(),e=$("#searchOnMapObj_EndDate").val(),i=$("#Height").val(),r=$("#Weight").val(),u=$("#Length").val(),f=$("#Width").val()):(mode=document.getElementById("RtLoaded")&&document.getElementById("RtLoaded").checked==!0?1:0,mode==1?(t=$("#StartDateTime").val(),o=$("#DurationInWeek").val(),i=$("#LHeight").text(),r=$("#LWeight").text(),u=$("#LLength").text(),f=$("#LWidth").text()):(t=$("#StartDateTime").val(),o=$("#DurationInWeek").val(),i=$("#ULHeight").text(),r=$("#ULWeight").text(),u=$("#ULLength").text(),f=$("#ULWidth").text()),$("#EndDate").val()&&(e=$("#EndDate").val())),s=getRouteDetails(),s.routePathList.length>0&&(a=s.routePathList[0],h=a.routeSegmentList[0],c=h!="undefined"?h.routeLinkList:null,startAnimation(Lang_Key.Animation_Affected_constraint),$.ajax({url:"../Routes/GetInstantConstraintsList",contentType:"application/json; charset=utf-8",type:"POST",datatype:"json",data:JSON.stringify({LinkinfoList:c,StartDate:t,EndDate:e,Duration:o,height:i,weight:r,length:u,width:f}),beforeSend:function(){},success:function(n){(n!=null||n!="")&&ResizeMobile_PopUp(300),ClearPopUp(),removePopupsRdw(),$("#dialogue").html(n),$("#overlay").show(),$("#dialogue").show()},error:function(){},complete:function(){addscroll(),$("#save_anim").hide(),$(".loading").hide()}})))}function GetaffectedConstraintsList(){var h=Math.random(),u;$("#idConstraint").html(" ");var f=$("#Exemption_ID").val(),e=$("#VersionNumber").val(),o=$("#AnalysisID").val(),s=objifxStpMap.getRouteId();startAnimation(Lang_Key.Animation_Affected_constraint);var n="",t="",i="",r=0;window.location.href.indexOf("/MobileRegisterExemptionRoute")>-1?($("#searchOnMapObj_StartDate").val()&&(t=$("#searchOnMapObj_StartDate").val()),$("#searchOnMapObj_EndDate").val()&&(i=$("#searchOnMapObj_EndDate").val()),$("#searchOnMapObj_Width").val()!=undefined&&(r=parseInt($("#searchOnMapObj_Width").val())),n="../Exemption/ListConstraints"):n="../RDWPortal/ListConstraints",u=n+"?analysisID="+o+"&versionId="+f+"&route_id="+s+"&startDate="+t+"&endDate="+i+"&Width="+r+"&versionNum="+e,$("#dialogue").load(u,function(n,t){$(".loading").hide(),$("#dialogue").show(),t=="error"&&location.reload(),removePopupsRdw()}),$("#overlay").show(),$("#dialogue").show(),ResizeMobile_PopUp(300),ClearPopUp()}function offRoadAdded(){updateUI(),toolbarPanel4.div.style.display="inline"}function flashRoute(n){var t=0,i=setInterval(function(){objifxStpMap.flashRoutePath(n,t),t==7&&clearTimeout(i),t++},85)}function setManoeuvre(n,t){drawManouevre=t;var i=objifxStpMap.getNearestPathAndSegment(n.xy.x,n.xy.y,!1);i.pathIndex!=objifxStpMap.currentActiveRoutePathIndex&&i.distance<1e3?showWarningPopDialog("Trying to select a road segment which is nearest to another route path. Do you want to continue?","No","Yes","close_alert","close_alert();drawManouevre",1,"warning"):t()}function setTrimPoint(n){objifxStpMap.setTrimPoint(n)}function trimRoute(n){objifxStpMap.trimRoute(n)}function ShowQASList(n,t,i){var u,f,r,e;(borderCrossResult=null,n!=null&&n!=undefined)&&(checkBorderCrossing(n.linkId),borderCrossResult!=null&&borderCrossResult.Street==borderCrossResult.City?(u=borderCrossResult.Street,f={City:borderCrossResult.City,Street:borderCrossResult.Street,HouseNumber:borderCrossResult.HouseNumber},NWK_setRoutePointDesc(n.pointType,n.routePointNo,u,f)):(r=i?n.pointGeom.sdo_point.X+","+n.pointGeom.sdo_point.Y:n.pointDescr,e="../QAS/Search",$.ajax({url:e,type:"POST",async:!0,data:{searchKeyword:r,isReverseLookup:i==!0?0:1},beforeSend:function(){startAnimation()},success:function(t){var u,f,i,e;if(t.length>0)if(objifxStpMap.getProject()=="NWK")u={City:t[0].City,Street:t[0].Street,HouseNumber:t[0].HouseNumber},NWK_setRoutePointDesc(n.pointType,n.routePointNo,t[0].AddressLine,u);else{f=getTextField(n),x=$(f),x.parent().append("<div id='search_anim' class='search_anim'><\/div>");var r=x.offset().top,o=x.offset().left,s=x.css("height");for(r=parseInt(r)+parseInt(s)+parseInt(72),$(x).parent().append("<div id='route_search_popup' class='route_search_popup'><\/div>"),$("#route_search_popup").append("<ul id='newList'><\/ul>"),i=0;i<t.length;i++)e=t[i].AddressLine,$("#newList").append("<li onclick='selectFromQASList(this);'><div ><span class='icon'><\/span> <span class='serch_text'>"+e+"<\/span><\/div><\/li>");x.parent().find("#route_search_popup").css({top:r-61,left:o,width:350}),x.parent().find("#route_search_popup").show()}else t.isRedirect==1?$.ajax({url:"../Routes/GetStreetAddress",type:"POST",async:!0,data:{linkId:n.linkId},beforeSend:function(){startAnimation()},success:function(t){var i,r;t!=null&&(i="",i=t.Street==t.City?t.Street:t.Street+", "+t.City,r={City:t.City,Street:t.Street,HouseNumber:t.HouseNumber},NWK_setRoutePointDesc(n.pointType,n.routePointNo,i,r))},error:function(n,t,i){Error_showNotification(x,i)},complete:function(){stopAnimation()}}):$.ajax({url:"../Routes/GetStreetAddress",type:"POST",async:!0,data:{linkId:n.linkId},beforeSend:function(){startAnimation()},success:function(t){var i,r;t!=null&&(i="",i=t.Street==t.City?t.Street:t.Street+", "+t.City,r={City:t.City,Street:t.Street,HouseNumber:t.HouseNumber},NWK_setRoutePointDesc(n.pointType,n.routePointNo,i,r))},error:function(n,t,i){Error_showNotification(x,i)},complete:function(){stopAnimation()}})},error:function(n,t,i){Error_showNotification(x,i)},complete:function(){$("#search_anim").remove(),stopAnimation()}})),objifxStpMap.getProject()!="NWK"&&(notifrouteedit==!1&&($(document).find("#Map_View").css("z-index",-1),$(document).find("#map").css("z-index",-1)),$(document).find("#wraper_leftpanel_content").css("overflow","auto")))}function selectFromQASList(n){var t=$(n).parent().parent().parent().find("input[type=text]").attr("id"),i=jQuery.trim($(n).text()),r;setRoutePointDesc(t,i),r="#"+t,$(r).val(i)}function getTextField(n){var i,t,r,u,f;return n.pointType==0?"#From_location":n.pointType==1?"#To_location":n.pointType==2?(t="Viapoint"+n.routePointNo,i="#"+t,i):n.pointType==3?(t="Viapoint"+n.routePointNo,r="#"+t,r):n.pointType==7?(u="ForcedViapoint"+n.routePointNo,f="#"+u,f):void 0}function setRoutePointDesc(n,t){var r,i,u;switch(n){case"From_location":objifxStpMap.setRoutePointDescription(0,t);break;case"To_location":objifxStpMap.setRoutePointDescription(1,t);break;default:for(r="",i=8;i<n.length;i++)r+=n.charAt(i);u=parseInt(r)+1,objifxStpMap.setRoutePointDescription(u,t)}}function validateRoutePoints(){return objifxStpMap.validateRoutePoints()}function updateFullAddress(n,t,i){objifxStpMap.updateFullAddress(n,t,i)}function highlightRoads(n){startAnimation(),objifxStpMapRoadDelegation.highlightRoads(n,!1,function(){stopAnimation()})}function getDelegLinkInfoList(){return objifxStpMapRoadDelegation.getLinkInfoList()}function getOwnerLinkInfoList(){return objifxStpmapRoadOwnership.getOwnerLinkInfoList()}function getCorridorLinkInfo(){return objifxStpmapDecisionSpace.getCorridorLinkInfo()}function changeCorridorValues(n,t){objifxStpmapDecisionSpace.changeCorridorValues(n,t)}function getAllDSLBOVLinks(n){objifxStpmapDecisionSpace.getAllDSLBOVLinks(n)}function fetchRoadLinks(n,t){objifxStpMapRoadDelegation.fetchRoadLinks(n,t)}function showAllRoads(n){objifxStpMapRoadDelegation.showAllRoads(n)}function showUnassignedRoads(){objifxStpmapRoadOwnership.showUnassignedRoads()}function showUnassignedRoadsMap(){objifxStpmapRoadOwnership.showUnassignedRoadsMap()}function hideUnassignedRoads(){objifxStpmapRoadOwnership.hideUnassignedRoads()}function selectAllOwnedRoads(n,t){startAnimation(),objifxStpmapRoadOwnership.selectAllOwnedRoads(n,t)}function deSelectAllOwnedRoads(n){objifxStpmapRoadOwnership.deSelectAllOwnedRoads(n)}function selectAllOwnedRoadsDS(){startAnimation(),objifxStpmapDecisionSpace.selectAllOwnedRoads()}function selectAllCorridorRoadsPOC(n){objifxStpmapDecisionSpace.selectAllCorridorRoads(n)}function FetchAllCorridorRoads(n,t){startAnimation(),objifxStpmapDecisionSpace.FetchAllCorridorRoads(n,t)}function selectAllCorridorRoads(n){objifxStpmapDecisionSpace.selectAllCorridorRoads(n)}function deselectAllCorridorRoads(n){startAnimation(),objifxStpmapDecisionSpace.deselectAllCorridorRoads(n)}function clearAllOrgData(){objifxStpmapRoadOwnership.clearAllOrgData()}function clearAllSelectedRoads(){objifxStpmapRoadOwnership.clearAllSelectedRoads()}function clearAllSelectedCorridorRoads(){objifxStpmapDecisionSpace.clearAllSelectedRoads()}function editDSpace(n){objifxStpmapDecisionSpace.editDSpace(n)}function clearSearchSegments(){objifxStpmapRoadOwnership.clearSearchSegments()}function zoomInToDelegRoad(n,t,i){objifxStpMapRoadDelegation.zoomInToDelegRoad(n,t,i)}function zoomInToOwnedRoad(n,t,i){objifxStpmapRoadOwnership.zoomInToOwnedRoad(n,t,i)}function zoomInToLinkId(n,t){objifxStpmapRoadOwnership.zoomInToSelectedLinkId(n,t)}function zoomInToLimitedRoad(n,t,i,r){objifxStpmapDecisionSpace.zoomInToLimitedRoad(n,t,i,r)}function zoomInToDSArea(n,t,i,r,u,f,e,o,s,h){objifxStpmapDecisionSpace.zoomInToDSArea(n,t,i,r,u,f,e,o,s,h)}function viewLimitation(n,t){objifxStpmapDecisionSpace.viewLimitation(n,t)}function addToDelegatedRoadLinks(n){objifxStpMapRoadDelegation.addToRoadLinks(n)}function showAndHideRoads(n,t){t&&objifxStpMapRoadDelegation.fetchAllRoadsTimeFlag==0?objifxStpMapRoadDelegation.fetchAllRoadLinks(function(){objifxStpMapRoadDelegation.fetchAllRoadsTimeFlag=1}):objifxStpMapRoadDelegation.showAndHideRoads(n,t)}function roadDelegationCheckValue(n){switch(n){case"owned":return document.getElementById("owned").checked;case"managed":return document.getElementById("managed").checked}}function roadOwnershipCheckValue(){return document.getElementById("unassigned").checked}function corridorCheckValue(){return document.getElementById("IncludeMandate").checked}function displaySelectedCorridors(n,t,i,r,u,f,e){objifxStpmapDecisionSpace.displaySelectedCorridors(n,t,i,r,u,f,e)}function DisplayAnalysedDSInmap(n,t,i,r,u,f,e,o,s,h){objifxStpmapDecisionSpace.DisplayAnalysedDSInmap(n,t,i,r,u,f,e,o,s,h)}function openCorridorSelection(n,t,i){objifxStpmapDecisionSpace.openCorridorSelection(n,t,i)}function zoomToCorridor(n){objifxStpmapDecisionSpace.zoomToCorridor(n)}function mapResize(){objifxStpMap.updateMapSize()}function showRoadsOnMap(n,t){var i;if(objifxStpMap.mapType=="Q42016")i=objifxStpMap.getPageType(),i=="MIG_ITS"?(objifxStpmapDecisionSpace.organisationId=n,objifxStpmapDecisionSpace.selectAllOwnedRoads()):objifxStpmapRoadOwnership.showRoadOwnershipMap(n);else if(i=objifxStpMap.getPageType(),i=="ROADOWNERSHIP_VIEWANDEDIT"||i=="CR_VIEWANDEDIT"){t&&$.ajax({type:"POST",url:"/DecisionSpace/GetBounds",contentType:"application/json; charset=utf-8",data:JSON.stringify({id:n,fetchFlag:0}),beforeSend:function(){},complete:function(){},success:function(n){n.Min_X=="277964"&&n.Min_Y=="833252"&&n.Max_X=="-124667"&&n.Max_Y=="306850"?(showNotification(Lang_Key.NotifNoRoadFnd),setZoomTo(objifxStpMap.defaultZoom.X,objifxStpMap.defaultZoom.Y,2)):setGeoRegion({x1:n.Min_X,y1:n.Min_Y,x2:n.Max_X,y2:n.Max_Y})}}),objifxStpmapRoadOwnership.showRoadOwnershipMap(n),objifxStpmapDecisionSpace.organisationId=n;switch(i){case"CR_VIEWANDEDIT":objifxStpmapDecisionSpace.createPolygonDrawControl(),objifxStpmapDecisionSpace.createRoadDelegationToolBar(),roadDelegationToolbarPanel.div.style.display="inline"}}else i=="MAINTAIN_CORRIDOR"||i=="MAINTAIN_CORRIDOR_EDITMODE"?(t&&$.ajax({type:"POST",url:"/DecisionSpace/GetBounds",contentType:"application/json; charset=utf-8",data:JSON.stringify({id:n,fetchFlag:1}),beforeSend:function(){},complete:function(){},success:function(n){n.Min_X=="277964"&&n.Min_Y=="833252"&&n.Max_X=="-124667"&&n.Max_Y=="306850"?(showNotification(Lang_Key.NotifNoRoadFnd),setZoomTo(objifxStpMap.defaultZoom.X,objifxStpMap.defaultZoom.Y,2)):setGeoRegion({x1:n.Min_X,y1:n.Min_Y,x2:n.Max_X,y2:n.Max_Y})}}),objifxStpmapDecisionSpace.viewLimitation(n,0)):(i=="LZV"||i=="AGRICULTURE"||i=="ITS"||i=="MIG_ITS")&&(objifxStpmapDecisionSpace.organisationId=n,objifxStpmapDecisionSpace.selectAllOwnedRoads())}function setGeoRegion(n){objifxStpMap.setGeoRegion(n)}function viewConvoy(n){var t=null;t=$("#MapUpgrade").val()==1?"/DataVerification/GetBounds":"/DecisionSpace/GetBounds",$.ajax({type:"POST",url:t,contentType:"application/json; charset=utf-8",data:JSON.stringify({id:n,fetchFlag:2}),beforeSend:function(){},complete:function(){},success:function(n){setGeoRegion({x1:n.Min_X,y1:n.Min_Y,x2:n.Max_X,y2:n.Max_Y})}}),objifxStpmapDecisionSpace.viewConvoy(n)}function toggleUnassignedRoadsMap(n){objifxStpmapRoadOwnership.toggleUnassignedRoadsMap(n)}function toggleGeoassignedRoadsMap(n){objifxStpmapRoadOwnership.toggleGeoassignedRoadsMap(n)}function toggleDSUnassignedRoads(n){objifxStpmapDecisionSpace.toggleDSUnassignedRoads(n)}function toggleLZVAgriUnassignedRoads(n,t){objifxStpmapDecisionSpace.toggleLZVAgriUnassignedRoads(n,t)}function toggleDSAutoAssignedRoads(n){objifxStpmapDecisionSpace.toggleDSAutoAssignedRoads(n)}function DeleteLZVAgricultureLayer(n){objifxStpmapDecisionSpace.DeleteLZVAgricultureLayer(n)}function viewLzvAgriculture(n,t){n=="lzv"?selProductFlag=1:n=="agriculture"&&(selProductFlag=2),objifxStpmapDecisionSpace.viewLzvAgriculture(n,t),$("#divUnusable").hide()}function viewLBOV(n,t,i){selProductFlag=3,objifxStpmapDecisionSpace.viewLBOV(n,t,i),$("#divUnusable").hide()}function viewITSLinks(n){objifxStpmapDecisionSpace.viewITSLinks(n)}function viewITS_COREAREAS(n,t){objifxStpmapDecisionSpace.viewITS_COREAREAS(n,t)}function viewITS_EXEMPTIONS(n,t){objifxStpmapDecisionSpace.viewITS_EXEMPTIONS(n,t)}function viewITS_HISTORIC_EXEMPTIONS(n,t){objifxStpmapDecisionSpace.viewITS_HISTORIC_EXEMPTIONS(n,t)}function editITSSpace(n){objifxStpmapDecisionSpace.editITSSpace(n)}function ITSMapZoomDetails(n,t){objifxStpmapDecisionSpace.ITSMapZoomDetails(n,t)}function ITSMapDefaultZoom(){objifxStpmapDecisionSpace.ITSMapDefaultZoom()}function viewConsultRestriction(n,t,i,r){objifxStpmapDecisionSpace.viewConsultRestriction(n,t,i,r)}function getVehicleDimensions(){if(objifxStpMap.getProject()=="NWK"){var n=[];return objifxStpMap.pageType=="CONSULTRESTRICTION"?n={Length:$("#Length").val()==undefined?0:$("#Length").val(),Width:$("#Width").val()==undefined?0:$("#Width").val(),Height:$("#Height").val()==undefined?0:$("#Height").val(),Gross_Weight:$("#Weight").val()==undefined?0:$("#Weight").val()}:document.getElementById("RtLoaded")&&document.getElementById("RtLoaded").checked?n={Length:$("#LLength").html(),Width:$("#LWidth").html(),Height:$("#LHeight").html(),Gross_Weight:$("#LWeight").html()}:document.getElementById("RtUnloaded")&&!document.getElementById("RtLoaded").checked?n={Length:$("#ULLength").html(),Width:$("#ULWidth").html(),Height:$("#ULHeight").html(),Gross_Weight:$("#ULWeight").html()}:($("#txtHmin").val()||$("#txtHmax").val()||$("#txtBrmin").val()||$("#txtBrmax").val()||$("#txtLmax").val()||$("#txtLmin").val()||$("#txtWmin").val()||$("#txtWmax").val())&&(n={Length:$("#txtLmax").val()==undefined?0:$("#txtLmax").val(),Width:$("#txtBrmax").val()==undefined?0:$("#txtBrmax").val(),Height:$("#txtHmax").val()==undefined?0:$("#txtHmax").val(),Gross_Weight:$("#txtWmax").val()==undefined?0:$("#txtWmax").val()}),n}return{Length:0,Width:0,Height:0,Gross_Weight:0}}function setRtStAddress(n){objifxStpMap.setRtStartAddress(n)}function loadmap(n,t,i,r,u,f,e,o,s,h){f=$("#ProjectName").val(),objifxStpMap=new IfxStpMap(s,h),objifxStpmapStructures=new IfxStpmapStructures,objifxStpMapRoadDelegation=new IfxStpmapRoadDelegation,objifxStpmapRoadOwnership=new IfxStpmapRoadOwnership,objifxStpmapContainers=new IfxStpmapContainers,objifxStpmapDecisionSpace=new IfxStpmapDecisionSpace,objIfxNwkMap=new IfxNwkMap,objIfxNwkMapStructures=new IfxNwkMapStructures,objifxStpMap.registerEvent("ONDRAGCOMPLETE",onDragCompleteFn),objifxStpMap.registerEvent("ADDPATH",updateUI),objifxStpMap.registerEvent("ROUTELOADED",onRouteLoaded),objifxStpMap.registerEvent("CONSTRAINTADDED",updateUI),objifxStpMap.registerEvent("MANOEUVRESELECT",setManoeuvre),objifxStpMap.registerEvent("MANOEUVREADDED",createAnnotation),objifxStpMap.registerEvent("CONSTRAINTBYDESCRIPTION",updateUI),objifxStpMap.registerEvent("DEACTIVATECONTROL",deactivateOtherControl),objifxStpMap.registerEvent("ZOOMCHANGED",zoomChanged),objifxStpMap.registerEvent("PANCHANGED",panChanged),objifxStpMap.registerEvent("PANSTART",panStart),objifxStpMap.registerEvent("TOUCHSTART",touchStart),objifxStpMap.registerEvent("TOUCHEND",touchEnd),objifxStpMap.registerEvent("FEATURECLICK",featureOver),objifxStpMap.registerEvent("ADVRPCANCEL",remPath),objifxStpMap.registerEvent("OFFROADADDED",offRoadAdded),objifxStpMap.registerEvent("TOGGLESTRUCTURES",toggleStructures),objifxStpMap.registerEvent("PATHSTATECHANGED",updateUI),objifxStpMap.registerEvent("ROUTEPOINTADDED",updateUI),objifxStpMap.registerEvent("ROUTEPOINTSELECTED",onRoutePointSelect),objifxStpMap.registerEvent("ROADOWNERSHIP_VIEWANDEDIT",updateUI),objifxStpMap.registerEvent("STRUCTUREMODIFIED",NWK_updateStructure),objifxStpMap.registerEvent("MODECHANGED",NWK_panChanged),objifxStpMap.registerEvent("VEHICLEDETAILS",getVehicleDimensions),objifxStpMap.registerEvent("TOGGLECONSTRAINTSLIST",toggleconstraintslist),(i==!0||i!=undefined&&i.toLowerCase()=="true")&&(returnLeg=!0),r!=undefined&&(r==!1||typeof r=="string"&&r.toLowerCase()=="false")&&(showRouteAssessment=!1),n!="NOMAPDISPLAY"&&(setMapUsageCount(0),(n=="DISPLAYONLY"||n=="DISPLAYONLY_EDITANNOTATION")&&o==undefined&&structureslidingpanel_show()),n!="STRUCTURES"&&n!="NWK_STRUCTURES"&&n!="CONVOY"&&n!="MIG_STRUCTURES"&&o==undefined&&(load_Structureslidingpanel(f,n),init_structureslidingpanel(),structureslidingpanel_show()),t=="DEFAULT"&&(t=null);var c=IfxStpmapCommon.getRoutePlanUnit($("#HdnRoutePlanUnit").val());objifxStpMap.loadMap(n,t,c,u,f,e),loadEnd();try{btnSelectAndPlan.deactivate(),btnSelectByPolygon.deactivate(),btnSelectByLink.deactivate()}catch(l){}}function GetBoundingBoxGeom(){return objifxStpMap.GetBoundingBoxGeom()}function DeleteFVP(n){var i=objifxStpMap.deleteFVPRoutePointByType("FORCEDVIAPOINT",n)}function ViewITSZoomMap(n,t){var i;i=t==!0?{id:n,fetchFlag:5}:{id:n,fetchFlag:4},$.ajax({type:"POST",dataType:"json",async:!1,cache:!0,url:"../DecisionSpace/GetBounds",data:i,beforeSend:function(){},success:function(n){objifxStpMap.setGeoRegion({x1:n.Min_X,y1:n.Min_Y,x2:n.Max_X,y2:n.Max_Y})}})}function ShowSelectedLink(n,t,i){var r=objifxStpMap.pageType;r=="ROADOWNERSHIP_VIEWANDEDIT"?objifxStpmapRoadOwnership.showLinkOnMap(n):objifxStpmapDecisionSpace.showLinkOnMap(n,t,i)}function Deletelayer(n){return objifxStpMap!=null?objifxStpMap.deleteMapLayer(n):n}function highlightLinkID(n){return objifxStpMap.HighlightLink(n)}function ShowHistoricRoute(n){n!=null&&objifxStpMap.showHistoricRouteMap(n)}function ShowSelectedLinks(){objifxStpmapDecisionSpace.showSelectedLinks()}function ActivateSelectByLink(){objifxStpmapDecisionSpace.activateSelectByLink()}function setCurrentRoutePathState(){objifxStpMap.setCurrentRoutePathState()}function checkBorderCrossing(n){$.ajax({url:"../Routes/GetStreetAddress",type:"POST",async:!1,data:{linkId:n},beforeSend:function(){startAnimation()},success:function(n){if(n!=null){var t={City:n.City,Street:n.Street,HouseNumber:n.HouseNumber};borderCrossResult=t}},error:function(n,t,i){Error_showNotification(x,i)},complete:function(){$("#search_anim").remove(),stopAnimation()}})}function IfxStpMap(n,t){this.mapType=n,this.structureType=t,this.routeManager=new IfxRouteManager}function IfxStpmapStructures(){this.structureClassList={},this.structureList=null,this.markerStructure=[],this.markerStructureOther=[],this.markerStructureUnusitable=[],this.markerStructureLine=[],this.markerStructureLineOther=[],this.markerStructureLineUnusitable=[],this.markerConstraint=[],this.markerConstraintOther=[],this.pointLayer=null,this.lineLayer=null,this.polygonLayer=null,this.defaultPointStructZoom=5,this.defaultLineStructZoom=13,this.defaultLineConstraintZoom=8,this.constraintDetails={topologyType:"",geometry:"",ConstraintReferences:""},this.featuresConstraints=[]}function IfxStpmapContainers(){}var nwk_mapcontextMenuOn,nwk_publicPortal,optn,pointType,affectedStructuresFlag,multiSort,annotationObject,flag,borderCrossResult,click,editRouteModeFlag,pageIdentity,toolbarPublic,mHeight,isPreferredRouteFlag;IfxNwkMapCommon.getRoutePlanUnit=function(n){switch(n){case"692002":return"imperial";default:return"metric"}},IfxNwkMapCommon.getSdo_gtype=function(n){switch(n){case"POINT":return 2001;case"LINE":return 2002;case"POLYGON":return 2003}},IfxNwkMapCommon.getSdo_srid=function(){return 28992},IfxNwkMapCommon.getFinalSuitability=function(n){var i="Default",t;if(n)for(t=0;t<n.length;t++){if(n[t]=="Unsuitable")return"Unsuitable";n[t]=="Marginally suitable"&&i!="Marginally suitable"&&(i="Marginally suitable")}return i},IfxNwkMapCommon.getSuitabilityColor=function(n,t,i){n=n==null||n==undefined?"":n.toLowerCase();switch(t){case 0:switch(i){case"selected":return"#f70012";case"edit":return"#44FF00";default:switch(n){case"unsuitable":return"#f70012";case"marginally suitable":return"#ffdb17";default:return"#17b6ff"}}default:return"#ff0000"}},IfxNwkMapCommon.getStructureImage=function(n,t,i){t=t==null||t==undefined?"":t.toLowerCase();switch(n){case"underbridge":case"overbridge":case"tunnel":case"special":case"roundabout":case"level crossing":case"roundabout":case"tunnel":default:switch(i){case"selected":return"/Content/Images/structure_red.png";default:switch(t){case"unsuitable":return"/Content/Images/structure_red.png";case"marginally suitable":return"/Content/Images/structure_yellow.png";default:return"/Content/Images/structure.png"}}}},IfxNwkMapCommon.capitaliseString=function(n){return n.charAt(0).toUpperCase()+n.substring(1)},IfxNwkMapCommon.findNearestFeatureIndex=function(n,t,i){var f,u,o=0,e=new OpenLayers.Geometry.Point(t,i),r;for(u=e.distanceTo(n[0].geometry,{details:!0,edge:!0}),u.index=0,r=1;r<n.length;r++)f=e.distanceTo(n[r].geometry,{details:!0,edge:!0}),f.index=r,f.distance<u.distance&&(u=f,o=r,u.index=r);return u},IfxNwkMapCommon.createGeometry=function(n,t){var r,u,i;if(t=="LINE")for(u=IfxNwkMapCommon.getSdo_gtype("LINE"),i={OrdinatesArray:[],ElemArray:[1,2,1],sdo_gtype:u,sdo_srid:IfxNwkMapCommon.getSdo_srid()},r=0;r<n.length;r++)i.OrdinatesArray.push(n[r].x),i.OrdinatesArray.push(n[r].y);else u=IfxNwkMapCommon.getSdo_gtype("POINT"),i={OrdinatesArray:[],ElemArray:[1,1,1],sdo_gtype:u,sdo_srid:IfxNwkMapCommon.getSdo_srid()},i.OrdinatesArray.push(n.x),i.OrdinatesArray.push(n.y);return i},IfxNwkMap.prototype.navigationEnabled=!1,IfxNwkMap.prototype.navigationControlIndex=-1,IfxNwkMap.prototype.verifyCheck=!1,IfxNwkMap.prototype.addNavigationControl=function(n,t){var i=objifxStpMap.getControlByIndex("olControlNavigation");n==!0&&(i==-1?(objifxStpMap.olMap.addControl(new OpenLayers.Control.Navigation),this.navigationControlIndex=objifxStpMap.olMap.controls.length-1):this.navigationControlIndex=i,t==!1?objifxStpMap.olMap.controls[this.navigationControlIndex].disableZoomWheel():this.navigationEnabled=!0),t==!0&&(i==-1?(objifxStpMap.olMap.addControl(new OpenLayers.Control.Navigation),this.navigationControlIndex=objifxStpMap.olMap.controls.length-1):objifxStpMap.olMap.controls[this.navigationControlIndex].enableZoomWheel(),this.navigationEnabled=!0)},IfxNwkMap.prototype.showLinkDetails=function(n){var t=objifxStpMap.olMap.getLonLatFromViewPortPx(n.xy);objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(i){var h,f,u,o;if(i!=null&&!(i.length<=0)){var s=IfxStpmapCommon.findNearestFeatureIndex(i,t.lon,t.lat),r=i[s.index],e=objifxStpMap.getPageType();if(e=="ITS"){if(h=window.location.href,e=="ViewITSDetails"){for(f=[],u=0;u<i.length;u++)f.push(i[u].attributes.LINK_ID);objifxStpMap.getITSShowDetailPortal(objifxStpMap.projectTypeITSDetailsPortal,f,function(t){var i,e,c,h,u,f;if(t!=null&&t.itsDetailsPortal.length>0)if(t.itsDetailsPortal.length>1){for(i="<div style='height:100px; width:500px;font-size:1.0em;'><a href='javascript:' id='popuplink'><table><tr><td><b>ITS Project naam<\/b><\/td><td><b>Beschrijving<\/b><\/td><td><b>Start op<\/b><\/td><td><b>Eindigt op<\/b><\/td><td><b>Type<\/b><\/td><\/tr>",e=0;e<t.itsDetailsPortal.length;e++){var l=t.itsDetailsPortal[e].DECISION_SPACE_NAME,o=t.itsDetailsPortal[e].ITS_DESCRIPTION,u=t.itsDetailsPortal[e].START_DATE,f=t.itsDetailsPortal[e].END_DATE,s=t.itsDetailsPortal[e].FEATURE_TYPE;o!=null?(c=o.substring(0,40),h=o.substring(40),h.length>3&&(h="..."),o=c+h):o="",(u==undefined||u=="undefined"||u==null)&&(u="---"),(f==undefined||f=="undefined"||f==null)&&(f="---"),(s==undefined||s=="undefined"||s==null)&&(s="---"),i+="<tr><td>"+l+"<\/td><td>"+o+"<\/td><td>"+u+"<\/td><td>"+f+"<\/td><td>"+s+"<\/td><\/tr>"}i+="<\/table><\/div>",objifxStpMap.olMap.addPopup(new OpenLayers.Popup.FramedCloud("LINK DETAILS",objifxStpMap.olMap.getLonLatFromPixel(n.xy),new OpenLayers.Size(500,175),i,new OpenLayers.Icon("",new OpenLayers.Size(16,16),new OpenLayers.Pixel(-8,-8)),!0))}else u=r.attributes.START_DATE,f=r.attributes.END_DATE,u===null&&(u="---"),f===null&&(f="---"),i="<div class='body' style='font-size:1.0em;width:400px;height:220px;font-family:Helvetica, Arial, sans-serif;'><table style='background:#ffffff !important;color:#1f497d !important;'><tr><td colspan='2'><b>&nbsp;&nbsp;ITS DETAILS<\/b><\/td><\/tr><tr><td class='editor-label' style='width:30%'>&nbsp;&nbsp;ITS Project naam:<\/td><td class='editor-field' style='width:70%'>"+r.attributes.DECISION_SPACE_NAME+"<\/td><\/tr>",i=i+"<tr><td class='editor-label' style='width:30%'>&nbsp;&nbsp;Beschrijving:<\/td><td class='editor-field' style='width:70%'>"+r.attributes.ITS_DESCRIPTION+"<\/td><\/tr>",i=i+"<tr><td class='editor-label' style='width:30%'>&nbsp;&nbsp;Start op:<\/td><td class='editor-field' style='width:70%'>"+u+"<\/td><\/tr>",i=i+"<tr><td class='editor-label' style='width:30%'>&nbsp;&nbsp;Eindigt op:<\/td><td class='editor-field' style='width:70%'>"+f+"<\/td><\/tr>",i=i+"<tr><td class='editor-label' style='width:30%'>&nbsp;&nbsp;Type:<\/td><td class='editor-field' style='width:70%'>"+r.attributes.FEATURE_TYPE+"<\/td><\/tr>",i=i+"<\/table><\/div>",objifxStpMap.olMap.addPopup(new OpenLayers.Popup.FramedCloud("LINK DETAILS",objifxStpMap.olMap.getLonLatFromPixel(n.xy),null,i,null,!0))})}}else o="<div style='font-size:1.0em'><table><tr><td><b>LINK DETAILS<\/b><\/td><\/tr><\/table><br>LINK ID: "+r.attributes.LINK_ID+"<br>REF IN ID: "+r.attributes.REF_IN_ID+"<br>NREF IN ID: "+r.attributes.NREF_IN_ID+"<br>PRIVATE: "+r.attributes.PRIVATE+"<br>PAVED: "+r.attributes.PAVED+"<br>PUB_ACCESS: "+r.attributes.PUB_ACCESS+"<br>ST_NAME: "+r.attributes.ST_NAME+"<br>TUNNEL: "+r.attributes.TUNNEL+"<br>AR_AUTO: "+r.attributes.AR_AUTO+"<br>AR_BUS: "+r.attributes.AR_BUS+"<br>AR_MOTOR: "+r.attributes.AR_MOTOR+"<br>AR_PEDEST: "+r.attributes.AR_PEDEST+"<br>AR_TAXIS: "+r.attributes.AR_TAXIS+"<br>AR_TRAFF: "+r.attributes.AR_TRAFF+"<br>AR_TRUCKS: "+r.attributes.AR_TRUCKS+"<br>DIR_TRAVEL: "+r.attributes.DIR_TRAVEL+"<br>FERRY_TYPE: "+r.attributes.FERRY_TYPE+"<br>FUNC_CLASS: "+r.attributes.FUNC_CLASS+"<\/div>",objifxStpMap.olMap.addPopup(new OpenLayers.Popup.FramedCloud("LINK DETAILS",objifxStpMap.olMap.getLonLatFromPixel(n.xy),null,o,null,!0))}})},IfxNwkMap.prototype.searchFeaturesByXY=function(n,t,i,r,u){var f,e;if(i!=undefined&&i==!0){this.searchFeaturesInBBox(n,t,r,u);return}f=objifxStpMap.getPageType(),this.LayerRoadName=f=="ITS"||f=="ViewITSDetails"?"NWKMAP:NWK_ITS_SHOWDETAILS":f=="MIG_ITS"?"NWKMAPUPGRADE:NWK_ITS_SHOWDETAILS":"NWKMAP:NWK_STREETS",e={REQUEST:"GetFeatureInfo",EXCEPTIONS:"application/vnd.ogc.se_xml",BBOX:this.olMap.getExtent().toBBOX(),VERSION:"1.1.1",SERVICE:"WMS",INFO_FORMAT:"application/json",QUERY_LAYERS:this.LayerRoadName,FEATURE_COUNT:50,Layers:this.LayerRoadName,WIDTH:this.olMap.size.w,HEIGHT:this.olMap.size.h,format:this.imageFormat,styles:this.olMap.layers[0].params.STYLES,srs:this.olMap.layers[0].params.SRS},e.x=parseInt(n),e.y=parseInt(t),OpenLayers.Request.GET({url:this.geoserverWfsUrl,params:e,headers:{Accept:"application/json"},success:function(n){var t,i;if(u&&typeof u=="function")try{i=new OpenLayers.Format.GeoJSON,t=i.read(n.responseText),u(t)}catch(r){u(null)}},failure:function(){u&&typeof u=="function"&&u(null)}})},IfxNwkMap.prototype.searchFeaturesInBBox=function(n,t,i,r){var u=[];u.push("BBOX(GEOM,"+(Number(n)-i).toString()+","+(Number(t)+i).toString()+","+(Number(n)+i).toString()+","+(Number(t)-i).toString()+")"),this.searchFeaturesByCQL(u,r)},IfxNwkMap.prototype.searchFeaturesByCQL=function(n,t){var i=n.length,u=[],r,f,e;if(i>0)for(r=n.length-1;r>=0;r--)f=this.geoserverWfsUrl+this.requestPart1+n[r],e=OpenLayers.Request.GET({url:f,headers:{Accept:"application/json"},async:!0,success:function(n){if(i--,n.responseText.length>0){var f=new OpenLayers.Format.GeoJSON,r;try{r=f.read(n.responseText),r.splice(r.length/2,r.length/2),Array.prototype.push.apply(u,r)}catch(e){i==0&&t&&typeof t=="function"&&t()}}i==0&&t&&typeof t=="function"&&t(u)},failure:function(){i==0&&t&&typeof t=="function"&&t()}});else t&&typeof t=="function"&&t()},IfxNwkMap.prototype.searchFeaturesByLinkID=function(n,t){var i=IfxStpmapCommon.getCQLFilerFromLinkIDs(n);this.searchFeaturesByCQL(i,t)},IfxNwkMap.prototype.getVerifyCheck=function(){return this.verifyCheck},IfxNwkMap.prototype.mouseClickTrigger=function(n){var t=objifxStpMap.getPageType(),i,r;if(t=="MIG_STRUCTURES"&&(structureType=objifxStpMap.structureType,structureType==undefined&&(structureType=1),mapType=objifxStpMap.mapType),n.ctrlKey==!0&&n.shiftKey==!0){i=objifxStpMap.olMap.getLonLatFromViewPortPx(n.xy),showNotification("X, Y: "+i.lon+", "+i.lat);return}if(t=objifxStpMap.getPageType(),n.altKey!=!0||n.shiftKey!=!0)if(n.ctrlKey==!0)(t=="MAINTAIN_CORRIDOR_EDITMODE"||t=="LZV"||t=="AGRICULTURE"||t=="CONVOY"||t=="LBOV"||t=="CR_VIEWANDEDIT")&&btnSelectAndPlan.active==!0?objifxStpmapDecisionSpace.selectAndPlanLink(n,"ENDPOINT",t):t=="STRUCTURES"&&btnLinearConstraint.active==!0?(objifxStpmapDecisionSpace.selectAndPlanLink(n,"ENDPOINT",t),btnLinearConstraint.deactivate()):t=="ITS"||t=="MIG_ITS"?(r=window.location.href,btnSelectAndPlan!=undefined&&btnSelectAndPlan.active==!0&&objifxStpmapDecisionSpace.selectAndPlanLink(n,"ENDPOINT",t)):t=="ViewITSDetails"?this.showLinkDetails(n):t=="ROADOWNERSHIP_VIEWANDEDIT"&&btnSelectAndPlan.active==!0?objifxStpmapRoadOwnership.selectAndPlanLink(n,"ENDPOINT"):this.showLinkDetails(n);else switch(t){case"NWK_STRUCTURES":this.navigationEnabled==!1&&this.addNavigationControl(!1,!0),(objIfxNwkMapStructures.Structure.mode==1||objIfxNwkMapStructures.Structure.mode==2)&&objIfxNwkMapStructures.selectLink(n);break;case"MIG_STRUCTURES":this.navigationEnabled==!1&&this.addNavigationControl(!1,!0),mapType=="Q42016"&&(this.verifyCheck=!0,objIfxNwkMapStructures.selectLink(n));break;case"CONVOY":this.navigationEnabled==!1&&this.addNavigationControl(!1,!0),btnSelectAndPlan.active==!0?objifxStpmapDecisionSpace.selectAndPlanLink(n,"STARTPOINT",t):btnSelectByLink.active==!0?objifxStpmapDecisionSpace.selectByLink(n,t):btnDeselectLink.active==!0&&objifxStpmapDecisionSpace.deselectLink(n,t);break;case"STRUCTURES":btnLinearConstraint.active==!0&&(objifxStpmapDecisionSpace.clearAllRoads(),objifxStpmapDecisionSpace.selectAndPlanLink(n,"STARTPOINT",t));break;case"MAINTAIN_CORRIDOR_EDITMODE":btnformatpainter.active==!0&&objifxStpmapDecisionSpace.selectFormatLink(n,t);case"LZV":case"AGRICULTURE":case"ITS":case"LBOV":case"MIG_ITS":case"CR_VIEWANDEDIT":btnSelectAndPlan.active==!0?objifxStpmapDecisionSpace.selectAndPlanLink(n,"STARTPOINT",t):btnSelectByLink.active==!0?objifxStpmapDecisionSpace.selectByLink(n,t):btnDeselectLink.active==!0&&objifxStpmapDecisionSpace.deselectLink(n,t);break;case"ViewITSDetails":this.showLinkDetails(n);break;case"A2BPLANNING":case"CONSULTRESTRICTION":btnConfirmedMnvr.active==!0?objifxStpMap.drawManoeuvreSet(n,"CONFIRMED"):btnCutRoute.active==!0&&objifxStpMap.cutRoute(n);break;case"ROADOWNERSHIP_VIEWANDEDIT":btnSelectAndPlan!=undefined&&btnSelectAndPlan.active==!0?objifxStpmapRoadOwnership.selectAndPlanLink(n,"STARTPOINT"):btnSelectByLink!=undefined&&btnSelectByLink.active==!0?objifxStpmapRoadOwnership.selectByLink(n):btnDeselectLink!=undefined&&btnDeselectLink.active==!0?objifxStpmapRoadOwnership.deselectLink(n):btnformatpainter.active==!0&&self.pageType=="ROADOWNERSHIP_VIEWANDEDIT"&&objifxStpmapRoadOwnership.selectFormatLink(n,self.pageType,function(){var n=Math.random();$("#dialogue").load("../../RoadOwnership/CreateRoadOwnership?&random="+n,function(n,t){$("#Create_RoadOwnership").show(),$("#header").show(),$("#managerName").val($("#hdnManagerName").val()),$("#manager_Id").val($("#hdnorganisationId").val()),$("#saveownerdata").show(),t=="error"&&location.reload()})})}$("#intellizenz-ctxmenu").remove()},IfxNwkMapStructures.prototype.Structure={structureId:0,structureName:"",structureClass:"",linkId:0,easting:0,northing:0,lineGeometry:null,pointGeometry:null,mode:0},IfxNwkMapStructures.prototype.structureClassList={},IfxNwkMapStructures.prototype.loadStruct=!1,IfxNwkMapStructures.prototype.structureEditFlag=!1,IfxNwkMapStructures.prototype.defaultZoom=9,IfxNwkMapStructures.prototype.defaultPointStructZoom=7,IfxNwkMapStructures.prototype.defaultLineStructZoom=11,IfxNwkMapStructures.prototype.clearStructureClassList=function(){this.structureClassList={underBridge:[],overBridge:[],underAndOverBridge:[],levelCrossing:[]}},IfxNwkMapStructures.prototype.setStructureDetails=function(n,t,i,r){this.Structure.structureId=n,this.Structure.easting=t,this.Structure.northing=i,this.Structure.mode=r,r==1?objifxStpMap.setZoomTo(objifxStpMap.defaultZoom.X,objifxStpMap.defaultZoom.Y,3):t!=0&&i!=0&&t!=null&&i!=null&&t!=undefined&&i!=undefined?objifxStpMap.getPageType()=="MIG_STRUCTURES"?objifxStpMap.setZoomTo(t,i,12):objifxStpMap.setZoomTo(t,i,this.defaultZoom):objifxStpMap.setZoomTo(objifxStpMap.defaultZoom.X,objifxStpMap.defaultZoom.Y,this.defaultPointStructZoom),objifxStpMap.eventList.MODECHANGED!=undefined&&typeof objifxStpMap.eventList.MODECHANGED=="function"&&objifxStpMap.eventList.MODECHANGED()},IfxNwkMapStructures.prototype.setStructureMarker=function(){var n,t,i;objifxStpMap.vectorLayerStructureMarker.removeFeatures(objifxStpMap.vectorLayerStructureMarker.features),n=objifxStpMap.olMap.getZoom(),(n>=this.defaultLineStructZoom||objifxStpMap.getPageType()=="MIG_STRUCTURES")&&(t={externalGraphic:"/Content/Images/location.png",graphicHeight:n*2+5,graphicWidth:n*2+5},i=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(this.Structure.easting,this.Structure.northing),{name:""},t),objifxStpMap.vectorLayerStructureMarker.addFeatures(i))},IfxNwkMapStructures.prototype.clearStructures=function(){this.clearStructureClassList(),objifxStpMap.vectorLayerStructures.removeFeatures(objifxStpMap.vectorLayerStructures.features)},IfxNwkMapStructures.prototype.showStructuresByMode=function(n){var t=this;switch(this.Structure.mode){case 0:this.showAllStructures(function(){t.setStructureMarker(),t.loadStruct=!0,n()});break;case 1:this.showAllStructures(function(){t.loadStruct=!0,n()});break;case 2:objifxStpMap.structureEditFlag==!1?objifxStpMap.structureType==2?(objifxStpMap.structureType=0,t.showStructureById(function(){t.loadStruct=!0,objifxStpMap.structureType=1,t.showStructureById(function(){t.loadStruct=!0,stopAnimation()})})):this.showStructureById(function(){t.setStructureMarker(),t.structureEditFlag=!0,objifxStpMap.getPageType()=="MIG_STRUCTURES"?(t.loadStruct=!0,n()):t.showAllStructures(function(){t.loadStruct=!0,n()})}):objifxStpMap.getPageType()=="MIG_STRUCTURES"?objifxStpMap.structureType==1?this.showStructureById(function(){t.setStructureMarker(),t.structureEditFlag=!0,t.loadStruct=!0,t.showAllStructures(function(){t.setStructureMarker(),t.loadStruct=!0,n()}),n()}):objifxStpMap.structureType==2?(objifxStpMap.structureType=1,this.showStructureById(function(){t.setStructureMarker(),t.structureEditFlag=!0,t.loadStruct=!0,n(),t.showAllStructures(function(){t.setStructureMarker(),t.loadStruct=!0,n(),objifxStpMap.structureType=0,t.showStructureById(function(){t.setStructureMarker(),t.structureEditFlag=!0,t.loadStruct=!0,n()})})})):this.showStructureById(function(){t.setStructureMarker(),t.structureEditFlag=!0,t.loadStruct=!0,t.showAllStructures(function(){t.setStructureMarker(),t.loadStruct=!0,n()}),n()}):this.showAllStructures(function(){t.loadStruct=!0,n()});break;default:n()}},IfxNwkMapStructures.prototype.showStructures=function(n,t,i,r,u){var e,f,o,s,h;if(n.length!=0){for((r==undefined||r==null)&&(r=objifxStpMap.olMap.getZoom()),e=[],this.clearStructures(),f=0;f<n.length;f++)if(e[f]=[],n[f].pointGeometry&&n[f].pointGeometry.sdo_point!=null?(o=n[f].pointGeometry.sdo_point.x,s=n[f].pointGeometry.sdo_point.y):n[f].pointGeometry&&n[f].pointGeometry.sdo_point!=null?(o=n[f].pointGeometry.sdo_point.x==undefined?n[f].pointGeometry.sdo_point.X:n[f].pointGeometry.sdo_point.x,s=n[f].pointGeometry.sdo_point.y==undefined?n[f].pointGeometry.sdo_point.Y:n[f].pointGeometry.sdo_point.y):n[f].pointGeometry&&n[f].pointGeometry.OrdinatesArray!=null?(o=n[f].pointGeometry.OrdinatesArray[0],s=n[f].pointGeometry.OrdinatesArray[1]):(o=n[f].easting,s=n[f].northing),e[f][0]=this.setMarkerStructure(n[f].structureID,n[f].structureName,n[f].structureCode,n[f].structureClass,"point",o,s,null,n[f].suitability,n[f].sHeight,n[f].sWidth,n[f].sLength,n[f].sWeight,n[f].sPhyWeight,n[f].organisationName,t,r,u,n[f].sectionNO,n[f].redTimeExtension,n[f].linkId),n[f].lineGeometry&&(e[f][1]=this.drawStructuresLine(n[f],r,t,u)),u?(objifxStpMap.vectorLayerEditStructure.addFeatures(e[f][0]),e[f][1]&&objifxStpMap.vectorLayerEditStructure.addFeatures(e[f][1])):(objifxStpMap.vectorLayerStructures.addFeatures(e[f][0]),e[f][1]&&objifxStpMap.vectorLayerStructures.addFeatures(e[f][1])),r>=this.defaultLineStructZoom)e[f][0].style.display="none";else if(e[f][1])for(h=0;h<e[f][1].length;h++)e[f][1][h].style.display="none";return u?objifxStpMap.vectorLayerEditStructure.redraw():objifxStpMap.vectorLayerStructures.redraw(),t==!1?this.markerStructure=e:this.markerStructureOther=e,this.structureClassList}},IfxNwkMapStructures.prototype.drawStructuresLine=function(n,t,i,r){for(var o=[],s,f,h=0,e,u=0;u*3<n.lineGeometry.ElemArray.length;u++){for(s=n.lineGeometry.ElemArray[u*3]-1,f=u*3+3<n.lineGeometry.ElemArray.length?n.lineGeometry.ElemArray[u*3+3]-1:n.lineGeometry.OrdinatesArray.length,e=[],j=s;j<f;j+=2)e.push(new OpenLayers.Geometry.Point(n.lineGeometry.OrdinatesArray[j],n.lineGeometry.OrdinatesArray[j+1]));o[h]=this.setMarkerStructure(n.structureID,n.structureName,n.structureCode,n.structureClass,"line",0,0,e,n.suitability,n.sHeight,n.sWidth,n.sLength,n.sWeight,n.sPhyWeight,n.organisationName,i,t,r,n.sectionNO,n.redTimeExtension),h++}return o},IfxNwkMapStructures.prototype.setMarkerStructure=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g){var nt=IfxNwkMapCommon.getFinalSuitability(s),it=b?"edit":n==this.Structure.structureId?"selected":"default",rt="STRUCTURE "+n+" NAME "+t+" CODE "+i+" SUITABILITY "+nt+" HEIGHT "+h+" WIDTH "+c+" LENGTH "+l+" WEIGHT "+a+" PHYSICAL_WEIGHT "+v+" ORGNAME "+y+" OTHERORG "+p+" CROSSINGNUMBER "+k+" REDTIMEEXT "+d+" TYPE "+r+" LINKID "+g,tt,ut;if(u=="point")var ft=IfxNwkMapCommon.getStructureImage(r,nt,it),tt={externalGraphic:ft,graphicHeight:18,graphicWidth:18,title:t},ut=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(f,e),{name:rt},tt);else tt={strokeColor:IfxNwkMapCommon.getSuitabilityColor(nt,0,it),strokeWidth:w-5,title:t},ut=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(o),{name:rt},tt);return ut},IfxNwkMapStructures.prototype.showAllStructures=function(n){var i=this,e=this.Structure.structureId,r=!1,u=0,t,f;if(objifxStpMap.mapType=="Q42016"&&(u=1),t=objifxStpMap.getCurrentBoundsAndZoom(),t.zoom<this.defaultPointStructZoom){this.clearStructures(),n&&typeof n=="function"&&n();return}f={OrdinatesArray:[t.bounds.left,t.bounds.top,t.bounds.right,t.bounds.top,t.bounds.right,t.bounds.bottom,t.bounds.left,t.bounds.bottom,t.bounds.left,t.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxNwkMapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxNwkMapCommon.getSdo_srid()},$.ajax({type:"POST",url:"../../Structures/GetStructuresList",contentType:"application/json; charset=utf-8",data:JSON.stringify({areaGeom:f,structureId:this.Structure.mode==0?0:this.Structure.structureId,IsMapUpgrade:u}),beforeSend:function(){},complete:function(){objifxStpMap.pageType=="NWK_STRUCTURES"&&(objifxStpMap.structureType=0,i.showStructureById(function(){objIfxNwkMapStructures.setStructureMarker()})),r==!1&&(stopAnimation(),window.location.href="../Account/Login")},success:function(t){if(t.length>0&&objifxStpMap.getPageType()=="MIG_STRUCTURES")for(var u=0;u<t.length;u++)if(t[u].structureID==e){t.splice(u,1);break}r=!0,i.showStructures(t,!1),n&&typeof n=="function"&&n()}})},IfxNwkMapStructures.prototype.showStructureById=function(n){var t=this;structureType=objifxStpMap.structureType,$.ajax({type:"POST",url:"../../Structures/GetStructuresById",contentType:"application/json; charset=utf-8",data:JSON.stringify({structureId:this.Structure.structureId,structureType:structureType}),beforeSend:function(){t.loadStruct==!1&&startAnimation(Lang_Key.Animation_Please_wait)},complete:function(){isSuccessInvoked==!1&&(stopAnimation(),window.location.href="../Account/Login")},success:function(i){isSuccessInvoked=!0,objifxStpMap.structureType==0?t.showStructure([i],!1,null,null,!1):t.showStructure([i],!1,null,null,!0),n&&typeof n=="function"&&n()}})},IfxNwkMapStructures.prototype.showStructure=function(n,t,i,r,u){var e,f,o,s,h;if(n.length!=0){for((r==undefined||r==null)&&(r=objifxStpMap.olMap.getZoom()),e=[],f=0;f<n.length;f++)if(e[f]=[],n[f].pointGeometry&&n[f].pointGeometry.sdo_point!=null?(o=n[f].pointGeometry.sdo_point.x,s=n[f].pointGeometry.sdo_point.y):n[f].pointGeometry&&n[f].pointGeometry.sdo_point!=null?(o=n[f].pointGeometry.sdo_point.x==undefined?n[f].pointGeometry.sdo_point.X:n[f].pointGeometry.sdo_point.x,s=n[f].pointGeometry.sdo_point.y==undefined?n[f].pointGeometry.sdo_point.Y:n[f].pointGeometry.sdo_point.y):n[f].pointGeometry&&n[f].pointGeometry.OrdinatesArray!=null?(o=n[f].pointGeometry.OrdinatesArray[0],s=n[f].pointGeometry.OrdinatesArray[1]):(o=n[f].easting,s=n[f].northing),e[f][0]=this.setMarkerStructure(n[f].structureID,n[f].structureName,n[f].structureCode,n[f].structureClass,"point",o,s,null,n[f].suitability,n[f].sHeight,n[f].sWidth,n[f].sLength,n[f].sWeight,n[f].sPhyWeight,n[f].organisationName,t,r,u,n[f].sectionNO,n[f].redTimeExtension,n[f].linkId),n[f].lineGeometry&&(e[f][1]=this.drawStructuresLine(n[f],r,t,u)),u?(objifxStpMap.vectorLayerEditStructure.addFeatures(e[f][0]),e[f][1]&&objifxStpMap.vectorLayerEditStructure.addFeatures(e[f][1])):(objifxStpMap.vectorLayerStructures.addFeatures(e[f][0]),e[f][1]&&objifxStpMap.vectorLayerStructures.addFeatures(e[f][1])),r>=this.defaultLineStructZoom)e[f][0].style.display="none";else if(e[f][1])for(h=0;h<e[f][1].length;h++)e[f][1][h].style.display="none";return u?objifxStpMap.vectorLayerEditStructure.redraw():objifxStpMap.vectorLayerStructures.redraw(),t==!1?this.markerStructure=e:this.markerStructureOther=e,this.structureClassList}},IfxNwkMapStructures.prototype.selectLink=function(n){startAnimation();var t=this,i=objifxStpMap.olMap.getLonLatFromViewPortPx(n.xy);objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(n){var u,r,f;if(n==null||n.length<=0){showNotification(Lang_Key.NotifNoRoadSelected),stopAnimation();return}u=IfxNwkMapCommon.findNearestFeatureIndex(n,i.lon,i.lat),r=n[u.index],t.Structure.linkId=r.attributes.LINK_ID,t.Structure.lineGeometry=IfxNwkMapCommon.createGeometry(r.geometry.components,"LINE"),t.Structure.pointGeometry=IfxNwkMapCommon.createGeometry(r.geometry.components,"POINT"),t.Structure.easting=u.x1,t.Structure.northing=u.y1,objifxStpMap.vectorLayerEditStructure.removeFeatures(objifxStpMap.vectorLayerEditStructure.features),objifxStpMap.vectorLayerEditStructure.addFeatures(r),objifxStpMap.eventList.STRUCTUREMODIFIED!=undefined&&typeof objifxStpMap.eventList.STRUCTUREMODIFIED=="function"&&objifxStpMap.eventList.STRUCTUREMODIFIED(t.Structure.linkId,Math.round(t.Structure.easting),Math.round(t.Structure.northing)),f=objifxStpMap.mapType,f=="Q42016"&&(t.setStructureMarker(),$("#btnSaveSec").show()),stopAnimation()})},nwk_mapcontextMenuOn=!1,nwk_publicPortal=!1,function(n){n.fn.extend({IntellizenzContext:function(t){var h={columnType:[{colDetails:[{type:"label",name:"",src:""}],seperator:!1,func:function(){},submenu:[{colDetails:[{type:"label",name:"",src:""}],seperator:!1,func:function(){}}]}]},l=this,c=n.extend(h,t),i=c,u=i.columnType.length,r=0,f=0,e=0,o,s;optn=i,n(document).click(function(){n("#intellizenz-ctxmenu").remove()}),n(this).addClass("context-wrap");n(document).on("mousemove","body",function(t){var i=n(t.target).attr("class");typeof i=="undefined"&&i!="context-wrap"&&n("#intellizenz-ctxmenu").remove()});n("#map").on("contextmenu",this,function(t){var h,c,l,a,p;for(n("#intellizenz-ctxmenu").remove(),o=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,s=t.clientY+document.body.scrollTop+document.documentElement.scrollTop,n("#ghost-cover").remove(),t.preventDefault(),u>0&&(n("body").append('<div id="intellizenz-ctxmenu" class="context-wrap"><table id="ctxtable"><\/table><\/div>'),e=i.columnType[0].colDetails.length),h=0;h<u;h++){for(n("#ctxtable").append('<tr onclick="ClickIntellizenzLinkData('+h+","+o+","+s+')"><\/tr>'),c=0;c<e;c++){typeof i.columnType[h].seperator!="undefined"&&i.columnType[h].seperator&&n("#ctxtable tr").eq(h).attr("style","border-bottom:1px solid");var v=i.columnType[h].colDetails[c].type,k=i.columnType[h].colDetails[c].name,y="";typeof i.columnType[h].colDetails[c].src!="undefined"&&(y=i.columnType[h].colDetails[c].src),v=="label"?n("#ctxtable tr").eq(h).append("<td><span>"+k+"<\/span><\/td>"):v=="image"&&n("#ctxtable tr").eq(h).append('<td><span><img src="'+y+'"/><\/span><\/td>')}for(i.columnType[h].submenu!=null&&(r=i.columnType[h].submenu.length),r>0&&(n("#ctxtable tr").eq(h).append('<table class="iz_submenu"><\/table>'),f=i.columnType[0].submenu[0].colDetails.length),l=0;l<r;l++)for(n("#ctxtable tr").eq(h).find(".iz_submenu").append("<tr><\/tr>"),a=0;a<f;a++)p="hello",n("#ctxtable tr").eq(h).find(".iz_submenu").eq(l).append("<td><span>"+p+"<\/span><\/td>");n("#intellizenz-ctxmenu table,tr,td,input,select,img,span").addClass("context-wrap")}showContextMenu();var w=n("#intellizenz-ctxmenu").width(),b=n("#intellizenz-ctxmenu").height(),d=n("#map").width(),g=n("#map").height(),nt=d-t.pageX,tt=g-t.pageY;nt<=w?n("#intellizenz-ctxmenu").css("left",t.pageX-w):n("#intellizenz-ctxmenu").css("left",t.pageX),tt<=b?n("#intellizenz-ctxmenu").css("top",t.pageY-b):n("#intellizenz-ctxmenu").css("top",t.pageY),objifxStpMap.reactivateClick()})}})}(jQuery),pointType=0;var PageFlag=$("#Pageflag").val(),AppRouteType="planned",origin="";IfxRouteManager.prototype.RoutePart=null,IfxRouteManager.prototype.getSegmentCount=function(n){return this.RoutePart.routePathList[n].routeSegmentList.length},IfxRouteManager.prototype.getRoutePathCount=function(){return this.RoutePart.routePathList.length},IfxRouteManager.prototype.getRoutePointCount=function(n){return this.RoutePart.routePathList[n].routePointList.length},IfxRouteManager.prototype.getFVPRoutePointCount=function(n){var i=0,t;if(this.RoutePart.routePathList[n].routePointList.length>2)for(t=2;t<this.RoutePart.routePathList[n].routePointList.length;t++)this.RoutePart.routePathList[n].routePointList[t].pointType==2&&i++;return this.RoutePart.routePathList[n].routePointList.length-i},IfxRouteManager.prototype.setRoutePart=function(n){return this.RoutePart=n},IfxRouteManager.prototype.clearRoutePart=function(n){n==!0?this.RoutePart={routePathList:[{routeSegmentList:[],routePointList:[],otherinfo:{features:[],routeType:0,state:"idle"},routePathType:0,pathNo:0,subpartNo:1}],routePartDetails:{}}:this.RoutePart.routePathList.splice(1,this.RoutePart.routePathList.length)},IfxRouteManager.prototype.addRouteSegment=function(n,t){this.RoutePart.routePathList[t].routeSegmentList.push(n)},IfxRouteManager.prototype.addAnnotation=function(n,t,i,r){this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList==null&&(this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList=[]),i>=0?this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList.splice(i,0,r):this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList.push(r)},IfxRouteManager.prototype.getAnnotation=function(n,t,i){return this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList[i]},IfxRouteManager.prototype.getAnnotationCount=function(n,t){return this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList==null?0:this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList.length},IfxRouteManager.prototype.deleteAnnotation=function(n,t,i){this.RoutePart.routePathList[n].routeSegmentList[t].routeAnnotationsList.splice(i,1)},IfxRouteManager.prototype.addRoutePath=function(n){var t={routeSegmentList:[],routePointList:[],otherinfo:{features:[],routeType:n,state:"idle"}};return t.routePathType=n,t.pathNo=this.RoutePart.routePathList.length,t.subpartNo=n==0||n==1?1:n,this.RoutePart.routePathList.push(t),this.RoutePart.routePathList.length},IfxRouteManager.prototype.removeRoutePath=function(n){this.RoutePart.routePathList.splice(n,1)},IfxRouteManager.prototype.getRoutePath=function(n){return this.RoutePart.routePathList[n]},IfxRouteManager.prototype.getStateFromPointList=function(n){var t=this.RoutePart.routePathList[n].routePointList;if(t==undefined||t.length==0)return"idle";if(t.length==1){if(t[0].pointType==0||t[0].pointType==1)return"firstpointselected"}else{if(t[1].pointType==1)return"secondpointselected";if(t[0].pointType==0)return"firstpointselected"}return"idle"},IfxRouteManager.prototype.addRoutePointAnnotation=function(n){this.RoutePart.routePathList[0].routePointList[this.RoutePart.routePathList[0].routePointList.length-1].routeAnnotationList.push(n)},IfxRouteManager.prototype.RoutePointcount=function(){return this.RoutePart.routePathList[0].routePointList.length-1},IfxRouteManager.prototype.getFVPAnnotation=function(n){return this.RoutePart.routePathList[0].routePointList[n].routeAnnotationList[0]},IfxRouteManager.prototype.deleteFVPAnnotation=function(n){this.RoutePart.routePathList[0].routePointList[n].routeAnnotationList.splice(0,1)},IfxRouteManager.prototype.addRoutePoint=function(n,t,i,r){if(i.pointType<2&&this.RoutePart.routePathList[n].routePointList.length>i.pointType){if(this.RoutePart.routePathList[n].routePointList[i.pointType].pointType!=i.pointType){this.RoutePart.routePathList[n].routePointList.splice(i.pointType,0,i);return}this.RoutePart.routePathList[n].routePointList.push(i);return}t!=-1&&t<this.RoutePart.routePathList[n].routePointList.length?r==!1?this.RoutePart.routePathList[n].routePointList[t]=i:this.RoutePart.routePathList[n].routePointList.splice(t,0,i):this.RoutePart.routePathList[n].routePointList.length==1?this.RoutePart.routePathList[n].routePointList[0].pointType==i.pointType?this.RoutePart.routePathList[n].routePointList[0]=i:this.RoutePart.routePathList[n].routePointList.push(i):this.RoutePart.routePathList[n].routePointList.push(i)},IfxRouteManager.prototype.removeRouteSegment=function(n,t){this.RoutePart.routePathList[n].routeSegmentList.splice(t,1)},IfxRouteManager.prototype.insertRouteSegment=function(n,t,i,r){r?this.RoutePart.routePathList[n].routeSegmentList.splice(t,1,i):this.RoutePart.routePathList[n].routeSegmentList.splice(t,0,i)},IfxRouteManager.prototype.getRoutePoint=function(n,t){return t<this.RoutePart.routePathList[n].routePointList.length?this.RoutePart.routePathList[n].routePointList[t]:null},IfxRouteManager.prototype.removeRoutePoint=function(n,t){this.RoutePart.routePathList[n].routePointList.splice(t,1)},IfxRouteManager.prototype.swapRoutePoint=function(n,t,i){var r=this.RoutePart.routePathList[n].routePointList[t];this.RoutePart.routePathList[n].routePointList[t]=this.RoutePart.routePathList[n].routePointList[i],this.RoutePart.routePathList[n].routePointList[i]=r},IfxRouteManager.prototype.updateRoutePoint=function(n,t,i){this.RoutePart.routePathList[n].routePointList[t]=i},IfxRouteManager.prototype.updateRoutePointField=function(n,t,i,r){this.RoutePart.routePathList[n].routePointList[t][i]=r},IfxRouteManager.prototype.moveRoutePointPos=function(n,t,i){this.RoutePart.routePathList[n].routePointList.splice(i,0,this.RoutePart.routePathList[n].routePointList.splice(t,1)[0])},IfxRouteManager.prototype.formatRouteRequest=function(n,t,i){var u,o,s,r,f,e;if(this.getRoutePointCount(n)<2)return null;for(u={WayPoints:[],MaxHeight:t!=null||t!=undefined?Math.round(t.Height).toString():"0",MaxWeight:t!=null||t!=undefined?Math.round(t.Gross_Weight).toString():"0",MaxLength:t!=null||t!=undefined?Math.round(t.Length).toString():"0",MaxWidth:t!=null||t!=undefined?Math.round(t.Width).toString():"0",MaxNormAxleLoad:"0",MaxShutAxleLoad:"0"},u.BeginStartNode=this.RoutePart.routePathList[n].routePointList[0].otherinfo.beginNodeId,u.BeginPointLinkId=this.RoutePart.routePathList[n].routePointList[0].otherinfo.linkId,u.BeginPointEndNode=this.RoutePart.routePathList[n].routePointList[0].otherinfo.endNodeId,u.EndPointStartNode=this.RoutePart.routePathList[n].routePointList[1].otherinfo.beginNodeId,u.EndPointLinkId=this.RoutePart.routePathList[n].routePointList[1].otherinfo.linkId,u.EndPointEndNode=this.RoutePart.routePathList[n].routePointList[1].otherinfo.endNodeId,o=[],r=2;r<this.RoutePart.routePathList[n].routePointList.length;r++)f={},e={},this.RoutePart.routePathList[n].routePointList[r].pointType==7?(e.WayPointBeginNode=this.RoutePart.routePathList[n].routePointList[r].segmentId,e.WayPointLinkId=this.RoutePart.routePathList[n].routePointList[r].otherinfo.linkId,e.WayPointEndNode=0,u.WayPoints.push(e),f.WayPointBeginNode=this.RoutePart.routePathList[n].routePointList[r].otherinfo.beginNodeId,f.WayPointLinkId=this.RoutePart.routePathList[n].routePointList[r].otherinfo.linkId,f.WayPointEndNode=this.RoutePart.routePathList[n].routePointList[r].otherinfo.endNodeId):(f.WayPointBeginNode=this.RoutePart.routePathList[n].routePointList[r].otherinfo.beginNodeId,f.WayPointLinkId=this.RoutePart.routePathList[n].routePointList[r].otherinfo.linkId,f.WayPointEndNode=this.RoutePart.routePathList[n].routePointList[r].otherinfo.endNodeId),u.WayPoints.push(f);return u.IdentifyUsableLinks=i?0:1,u},IfxRouteManager.prototype.doProcessPlanRouteRequest=function(n,t,i){var f=0,e=0,r,u;objifxStpMap.mapType=="Q42016"&&(f=1),selProductFlag==3&&(e=902007),t?(r="/RoutePlannerInterface/PostAdv",u=JSON.stringify({routeViaPointadv:n,DS_Type:e})):(r="/RoutePlannerInterface/PostEx",u=JSON.stringify({routeViaPointEx:n,MapUpgradeFlag:f})),$.ajax({type:"POST",datatype:"json",url:r,contentType:"application/json; charset=utf-8",data:u,success:function(n){n!=""?i&&typeof i=="function"&&i(n.listSegments):i&&typeof i=="function"&&i(null)},error:function(){i&&typeof i=="function"&&i(null)}})},IfxRouteManager.prototype.getCQLFilerFromLinkIds=function(n){var t="",u=[],r,i;if(n&&n.length>0){for(t="LINK_ID="+n[n.length-1],r=0,i=n.length-2;i>=0;i--){if(r++,r>=50){u.push(t),r=0,t="LINK_ID="+n[i];continue}t=t+"%20OR%20LINK_ID="+n[i]}u.push(t)}return u},IfxRouteManager.prototype.processRoutePart=function(n,t){var e=0,i,r,u,f;for(i=n!=undefined&&n==!0?jQuery.extend(!0,{},t.RoutePart):jQuery.extend(!0,{},this.RoutePart),delete i.otherinfo,r=0;r<i.routePathList.length;r++){for(delete i.routePathList[r].otherinfo,delete i.routePathList[r].pathNo,u=0;u<i.routePathList[r].routePointList.length;u++)delete i.routePathList[r].routePointList[u].otherinfo,i.routePathList[r].routePointList[u].pointGeom={sdo_point:{X:i.routePathList[r].routePointList[u].pointGeom.sdo_point.X,Y:i.routePathList[r].routePointList[u].pointGeom.sdo_point.Y},sdo_gtype:IfxStpmapCommon.getSdo_gtype("POINT"),sdo_srid:IfxStpmapCommon.getSdo_srid()};for(u=0;u<i.routePathList[r].routeSegmentList.length;u++){if(delete i.routePathList[r].routeSegmentList[u].otherinfo,i.routePathList[r].routeSegmentList[u].startPointGeometry={sdo_point:{X:i.routePathList[r].routeSegmentList[u].startPointGeometry.sdo_point.X,Y:i.routePathList[r].routeSegmentList[u].startPointGeometry.sdo_point.Y},sdo_gtype:IfxStpmapCommon.getSdo_gtype("POINT"),sdo_srid:IfxStpmapCommon.getSdo_srid()},i.routePathList[r].routeSegmentList[u].endPointGeometry={sdo_point:{X:i.routePathList[r].routeSegmentList[u].endPointGeometry.sdo_point.X,Y:i.routePathList[r].routeSegmentList[u].endPointGeometry.sdo_point.Y},sdo_gtype:IfxStpmapCommon.getSdo_gtype("POINT"),sdo_srid:IfxStpmapCommon.getSdo_srid()},i.routePathList[r].routeSegmentList[u].segmentType=IfxStpmapCommon.getSegmentTypeID(i.routePathList[r].routeSegmentList[u].segmentType),i.routePathList[r].routeSegmentList[u].segmentType==3&&(i.routePathList[r].routeSegmentList[u].offRoadGeometry={OrdinatesArray:i.routePathList[r].routeSegmentList[u].offRoadGeometry.OrdinatesArray,ElemArray:[1,2,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("LINE"),sdo_srid:IfxStpmapCommon.getSdo_srid()}),i.routePathList[r].routeSegmentList[u].routeAnnotationsList!=null)for(f=0;f<i.routePathList[r].routeSegmentList[u].routeAnnotationsList.length;f++)delete i.routePathList[r].routeSegmentList[u].routeAnnotationsList[f].otherinfo,i.routePathList[r].routeSegmentList[u].routeAnnotationsList[f].geometry={sdo_point:{X:i.routePathList[r].routeSegmentList[u].routeAnnotationsList[f].geometry.sdo_point.X,Y:i.routePathList[r].routeSegmentList[u].routeAnnotationsList[f].geometry.sdo_point.Y},sdo_gtype:IfxStpmapCommon.getSdo_gtype("POINT"),sdo_srid:IfxStpmapCommon.getSdo_srid()};this.updateRouteLinkList(i.routePathList[r].routeSegmentList[u])}}return i},IfxRouteManager.prototype.getRoutePart=function(n,t){return this.processRoutePart(n,t)},IfxRouteManager.prototype.getRouteId=function(){return this.RoutePart.routePartDetails.routeID},IfxRouteManager.prototype.createRouteLinkList=function(n,t){var u=[],r;for(i=0;i<n.length;i++)r={},r.linkId=Number(n[i]),r.linkNo=i+1,r.direction=t!=undefined&&t!=null&&t[i]!=undefined&&t[i]!=null?t[i]:1,u.push(r);return u},IfxRouteManager.prototype.updateRouteLinkList=function(n){var t,i;if(n.routeLinkList.length>0&&n.routeLinkList[0].linkId==n.startLinkId)for(t=0;t<n.routeLinkList.length;t++)n.routeLinkList[t].linkNo=t;else i={linkId:n.startLinkId,linkNo:0,direction:n.startPointDirection},n.routeLinkList.length>0?n.routeLinkList.splice(0,0,i):n.routeLinkList.push(i);return n.routeLinkList.length>0&&n.routeLinkList[n.routeLinkList.length-1].linkId!=n.endLinkId&&(i={linkId:n.endLinkId,linkNo:n.routeLinkList.length,direction:n.endPointDirection},n.routeLinkList.push(i)),n},IfxRouteManager.prototype.createRouteSegmentObject=function(n,t,i,r,u,f,e,o){var s={routeLinkList:[],otherinfo:{}};return s.subpartNo=u,s.segmentNo=f,s.segmentType=e,s.routeAnnotationsList=[],IfxStpmapCommon.getSegmentTypeID(e)==1?(s.startLinkId=t.linkId,s.endLinkId=i.linkId,s.startPointGeometry=jQuery.extend(!0,{},t.pointGeom),s.endPointGeometry=jQuery.extend(!0,{},i.pointGeom),s.startLrs=t.lrs,s.endLrs=i.lrs,s.startPointDirection=t.direction,s.endPointDirection=i.direction,s.routeLinkList=this.createRouteLinkList(n,o),s.otherinfo.startSegmentfeature=t.otherinfo.pointfeature,s.otherinfo.endSegmentfeature=i.otherinfo.pointfeature,s.otherinfo.completefeatures=[]):IfxStpmapCommon.getSegmentTypeID(e)==3?r!=null&&(s.offRoadGeometry={OrdinatesArray:[]},s.offRoadGeometry.OrdinatesArray=r,s.startPointGeometry={sdo_point:{X:"",Y:""}},s.endPointGeometry={sdo_point:{X:"",Y:""}},s.startPointGeometry.sdo_point.X=s.offRoadGeometry.OrdinatesArray[0],s.startPointGeometry.sdo_point.Y=s.offRoadGeometry.OrdinatesArray[1],s.endPointGeometry.sdo_point.X=s.offRoadGeometry.OrdinatesArray[s.offRoadGeometry.OrdinatesArray.length-2],s.endPointGeometry.sdo_point.Y=s.offRoadGeometry.OrdinatesArray[s.offRoadGeometry.OrdinatesArray.length-1]):n!=undefined&&n!=null?(s.startLinkId=t.linkId,s.endLinkId=i.linkId,s.startPointGeometry=jQuery.extend(!0,{},t.pointGeom),s.endPointGeometry=jQuery.extend(!0,{},i.pointGeom),s.startLrs=t.lrs,s.endLrs=i.lrs,s.startPointDirection=t.direction,s.endPointDirection=i.direction,s.routeLinkList=this.createRouteLinkList(n,o),s.otherinfo.startSegmentfeature=t.otherinfo.pointfeature,s.otherinfo.endSegmentfeature=i.otherinfo.pointfeature,s.otherinfo.completefeatures=[]):(s.routeLinkList=[],s.startPointGeometry={sdo_point:{X:"",Y:""}},s.endPointGeometry={sdo_point:{X:"",Y:""}},s.otherinfo.isAdded=!0,s.otherinfo.completefeatures=[],s.otherinfo.isComplete=!1),s},IfxRouteManager.prototype.setRoutePathState=function(n,t){this.RoutePart.routePathList[n].otherinfo==undefined&&(this.RoutePart.routePathList[n].otherinfo={completefeatures:[],features:[]}),this.RoutePart.routePathList[n].otherinfo.state=t},IfxRouteManager.prototype.setPathNo=function(n,t){this.RoutePart.routePathList[n].pathNo=t},IfxRouteManager.prototype.setCurrentRoutePathState=function(){this.RoutePart.routePathList[0].otherinfo.state="routedisplayed"},IfxRouteManager.prototype.getRoutePathState=function(n,t){return t!=!0&&this.RoutePart.routePathList[n].otherinfo&&this.RoutePart.routePathList[n].otherinfo.state&&(this.RoutePart.routePathList[n].otherinfo.state=="routeplanned"||this.RoutePart.routePathList[n].otherinfo.state=="routeplanninginprogress"||this.RoutePart.routePathList[n].otherinfo.state=="routedisplayed")?clearRouteForPlan?(clearRouteForPlan=!1,"secondpointselected"):this.RoutePart.routePathList[n].otherinfo.state:this.getStateFromPointList(n)},IfxRouteManager.prototype.setRoutePart=function(n){this.RoutePart=n},IfxRouteManager.prototype.findStartAndEndPointsFromRoutePointList=function(n){for(var u=this.RoutePart.routePathList[n],i=null,r=null,t=0;t<u.routePointList.length;t++)if(i==null&&u.routePointList[t].pointType==0?i=t:r==null&&u.routePointList[t].pointType==1&&(r=t),i!=null&&r!=null)break;return{startIndex:i,endIndex:r}},IfxRouteManager.prototype.reArrangeRouteSegmentList=function(n){for(var i=[],r=this.RoutePart.routePathList[n],h=this.findStartAndEndPointsFromRoutePointList(n),c=r.routePointList[h.startIndex].pointGeom.sdo_point,l=r.routePointList[h.endIndex].pointGeom.sdo_point,e=[],o=[],s=jQuery.extend(!0,{},c),f,u,t=0;t<r.routeSegmentList.length;t++){for(f=0,u=0;u<e.length;u++)if(e[u]==t){f=1;break}if(IfxStpmapCommon.getSegmentTypeID(r.routeSegmentList[t].segmentType)==2){o.push(t),e.push(t);break}f==0&&(IfxStpmapCommon.compareGeometries(r.routeSegmentList[t].startPointGeometry.sdo_point,s)?(i.push(r.routeSegmentList[t]),i[i.length-1].segmentNo=i.length,s=jQuery.extend(!0,{},r.routeSegmentList[t].endPointGeometry.sdo_point),e.push(t),t=-1):IfxStpmapCommon.compareGeometries(r.routeSegmentList[t].endPointGeometry.sdo_point,s)&&(i.push(r.routeSegmentList[t]),i[i.length-1].segmentNo=i.length,s=jQuery.extend(!0,{},r.routeSegmentList[t].startPointGeometry.sdo_point),e.push(t),t=-1))}for(t=0;t<o.length;t++)for(u=0;u<i.length;u++)if(IfxStpmapCommon.compareGeometries(r.routeSegmentList[o[t]].startPointGeometry.sdo_point,i[u].endPointGeometry.sdo_point)){i.splice(u+1,0,jQuery.extend(!0,{},r.routeSegmentList[o[t]]));break}if(i.length!=r.routeSegmentList.length)for(t=0;t<r.routeSegmentList.length;t++){for(f=0,u=0;u<i.length;u++)if(i[u].startPointGeometry==r.routeSegmentList[t].startPointGeometry&&i[u].endPointGeometry==r.routeSegmentList[t].endPointGeometry){f=1;break}f==0&&(i.push(r.routeSegmentList[t]),i[i.length-1].segmentNo=i.length)}if(o.length>0)for(t=0;t<i.length;t++)i[t].segmentNo=t+1;r.routeSegmentList=[],r.routeSegmentList=i};var allStructTimeFlag=0,allConstTimeFlag=0,unsuitableStructTimeFlag=0,affectedStructTimeFlag=0,affectedConstTimeFlag=0,allStructArr=null,unsuitableStructArr=null,affectedStructArr=null,structPanTimeFlag=0,pageType=null,languageFlag=1,uBridge="",oBridge="",lCrossing="",rAbout="",tunnel="",special="",struct="",all="",aff="",suit="",rWorks="",dimensionFlag=0;affectedStructuresFlag=0,IfxStpmapRoadDelegation.prototype.roadSegment={startPointGeom:{sdo_point:{X:"",Y:""}},endPointGeom:{sdo_point:{X:"",Y:""}},linkInfoList:[],delegatedFeatures:[],ownedFeatures:[],managedFeatures:[],removedFeatures:[],otherinfo:{startPoint:{geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},endPoint:{geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},linkIds:[],features:[],completefeatures:[]}},IfxStpmapRoadDelegation.prototype.polygonLayer=null,IfxStpmapRoadDelegation.prototype.fetchAllRoadsTimeFlag=0,IfxStpmapRoadDelegation.prototype.fetchDelegRoadsTimeFlag=0,IfxStpmapRoadDelegation.prototype.setAllRoadsFetchStart=!1,IfxStpmapRoadDelegation.prototype.setDelegRoadsFetchStart=!1,IfxStpmapRoadDelegation.prototype.currentArrangementId=null,IfxStpmapRoadDelegation.prototype.createRoadDelegationToolBar=function(){var n=this;roadDelegationToolbarPanel=new OpenLayers.Control.Panel({displayClass:"roaddelegationtoolbarpanel"}),objifxStpMap.olMap.addControl(roadDelegationToolbarPanel),btnSelectAndPlan=new OpenLayers.Control.Button({displayClass:"selectAndPlanLinks",title:Lang_Key.Tooltip_Select_plann,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(0,"ROADDELEGATION")},deactivate:function(){}}}),btnSelectByPolygon=new OpenLayers.Control.Button({displayClass:"selectLinksByPolygon",title:Lang_Key.Tooltip_Select_polygon,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){var n=objifxStpMap.olMap.getZoom();n<8?(selectByPolygon.deactivate(),showWarningPopDialog("Selecting road links by polygon is allowed only at zoom level 8 or above.","Ok","","close_alert","",1,"info")):selectByPolygon.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(1,"ROADDELEGATION")},deactivate:function(){selectByPolygon.deactivate()}}}),btnSelectByLink=new OpenLayers.Control.Button({displayClass:"selectLinks",title:Lang_Key.Tooltip_Select_Random,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(2,"ROADDELEGATION")},deactivate:function(){}}}),btnDeselectByPolygon=new OpenLayers.Control.Button({displayClass:"deselectLinksByPolygon",title:Lang_Key.Tooltip_DeSelect_polygon,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){deselectByPolygon.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(3,"ROADDELEGATION")},deactivate:function(){deselectByPolygon.deactivate()}}}),btnDeselectLink=new OpenLayers.Control.Button({displayClass:"deselectLinks",title:Lang_Key.Tooltip_DeSelect_Random,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(4,"ROADDELEGATION")},deactivate:function(){}}}),btnUndoSelectAndPlan=new OpenLayers.Control.Button({displayClass:"undoSelectLinks",title:Lang_Key.Tooltip_Undo,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(5,"ROADDELEGATION"),objifxStpMapRoadDelegation.undoSelectLink()},deactivate:function(){}}}),roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan])},IfxStpmapRoadDelegation.prototype.createPolygonDrawControl=function(){var n=this,t=new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({strokeOpacity:.7,strokeColor:"#1919FF",strokeWidth:3},OpenLayers.Feature.Vector.style["default"]));this.polygonLayer=new OpenLayers.Layer.Vector("Polygon Layer",{styleMap:t}),objifxStpMap.olMap.addLayers([this.polygonLayer]),selectByPolygon=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_Select_polygon,featureAdded:function(t){n.addFeatureForRoads(t),btnSelectByPolygon.deactivate(),n.polygonLayer.removeFeatures(n.polygonLayer.features)}}),deselectByPolygon=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_DeSelect_polygon,featureAdded:function(t){n.removeFeatureForArea(t),btnDeselectByPolygon.deactivate(),n.polygonLayer.removeFeatures(n.polygonLayer.features)}}),objifxStpMap.olMap.addControl(selectByPolygon),objifxStpMap.olMap.addControl(deselectByPolygon)},IfxStpmapRoadDelegation.prototype.highlightRoads=function(n,t,i,r){var f,h,s,u,c,o,e,l,a,v,y;if(startAnimation(),n==null||n==undefined){showNotification(Lang_Key.Notif_No_data_available);return}if(f=this,t!=!0){for(h=[],u=0;u<n.length;u++)h.push(n[u].linkId);f.roadSegment.linkInfoList=n,objifxStpMap.searchFeaturesByLinkID(h,function(n){f.roadSegment.delegatedFeatures=n,f.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(n),objifxStpMap.olMap.zoomToExtent(objifxStpMap.vectorLayerDelegRoads.getDataExtent()),r&&typeof r=="function"&&r()})}else{for(s=[],u=0;u<n.length;u++){if(n[u].linkGeom!=null){for(c=[],o=0;o<n[u].linkGeom.OrdinatesArray.length;o+=2)c.push(new OpenLayers.Geometry.Point(n[u].linkGeom.OrdinatesArray[o],n[u].linkGeom.OrdinatesArray[o+1]));e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(c)),(n[u].fromLinearRef!=null||n[u].toLinearRef!=null)&&(l=IfxStpmapCommon.getLengthOfFeature(e),a=n[u].fromLinearRef==null?0:n[u].fromLinearRef/l,v=n[u].toLinearRef==null?1:n[u].toLinearRef/l,y=LRSSubstring(e.geometry,a,v),e=new OpenLayers.Feature.Vector(y)),e.data=n[u].linkManageStatus,e.attributes={LINK_ID:n[u].linkId},s.push(e)}if(i)f.roadSegment.linkInfoList.push({linkId:n[u].linkId,fromLinearRef:n[u].fromLinearRef,toLinearRef:n[u].toLinearRef}),f.roadSegment.delegatedFeatures.push(e);else switch(n[u].linkManageStatus){case"a":f.roadSegment.ownedFeatures.push(e);break;case"b":case"c":f.roadSegment.managedFeatures.push(e)}}i&&(f.roadSegment.otherinfo.completefeatures=s),f.addVectorLayers("DelegRoads"),r&&typeof r=="function"&&r(s)}},IfxStpmapRoadDelegation.prototype.addVectorLayers=function(n){for(var t=0;t<objifxStpMap.olMap.layers.length;t++)if(objifxStpMap.olMap.layers[t].name==n)return;n=="DelegRoads"?(objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerDelegRoads]),objifxStpMap.olMap.setLayerIndex(objifxStpMap.vectorLayerDelegRoads,1)):n=="DelegMarkers"&&(objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerDelegMarkers]),objifxStpMap.olMap.setLayerIndex(objifxStpMap.vectorLayerDelegMarkers,1))},IfxStpmapRoadDelegation.prototype.selectAndPlanLink=function(n,t){if(t=="STARTPOINT"?startAnimation(Lang_Key.Animation_Please_wait):startAnimation(Lang_Key.Animation_Please_wait),t=="ENDPOINT"&&this.roadSegment.otherinfo.startPoint.linkId==""){stopAnimation();return}var i=this;objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(r){var f,s;if(r==null||r.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{var o=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),u=IfxStpmapCommon.findNearestFeatureIndex(r,o.lon,o.lat),e=LRSMeasure(r[u.index].geometry,new OpenLayers.Geometry.Point(u.x1,u.y1),{tolerance:.5,details:!0});t=="STARTPOINT"?(i.removeDelegationMarker(1),i.removeDelegationMarker(0),i.roadSegment.startPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(0,u.x1,u.y1),i.fillPointDetails(0,e,r[u.index],{x:u.x1,y:u.y1})):(t="ENDPOINT")&&(i.roadSegment.otherinfo.endPoint.linkId==""?(i.roadSegment.endPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(1,u.x1,u.y1),i.fillPointDetails(1,e,r[u.index],{x:u.x1,y:u.y1})):(i.removeDelegationMarker(1),i.roadSegment.endPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(1,u.x1,u.y1),i.roadSegment.otherinfo.startPoint=jQuery.extend(!0,{},i.roadSegment.otherinfo.endPoint),i.fillPointDetails(1,e,r[u.index],{x:u.x1,y:u.y1})))}t=="ENDPOINT"?(f=i.formatRouteRequest(!1),f.BeginPointLinkId==f.EndPointLinkId?s=i.drawPartial(f.BeginPointLinkId,function(n){if(n!=undefined){i.roadSegment.otherinfo.startPoint.lrs<i.roadSegment.otherinfo.endPoint.lrs?i.roadSegment.linkInfoList.push({linkId:f.BeginPointLinkId,fromLinearRef:i.roadSegment.otherinfo.startPoint.lrs,toLinearRef:i.roadSegment.otherinfo.endPoint.lrs}):i.roadSegment.linkInfoList.push({linkId:f.BeginPointLinkId,fromLinearRef:i.roadSegment.otherinfo.endPoint.lrs,toLinearRef:i.roadSegment.otherinfo.startPoint.lrs}),i.roadSegment.otherinfo.features=n,i.addVectorLayers("DelegRoads"),i.roadSegment.otherinfo.completefeatures.push(n);for(var t=0;t<i.roadSegment.otherinfo.completefeatures.length;t++)i.roadSegment.delegatedFeatures.push(i.roadSegment.otherinfo.completefeatures[t]);objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.otherinfo.completefeatures),stopAnimation()}else stopAnimation()}):objifxStpMap.doProcessPlanRouteRequest(f,!1,function(n){if(n!=null&&n.length>0)i.highlightPlannedLinks(n,!1);else{var t=i.formatRouteRequest(!0);objifxStpMap.doProcessPlanRouteRequest(t,!1,function(n){i.highlightPlannedLinks(n,!0)})}})):stopAnimation()})},IfxStpmapRoadDelegation.prototype.highlightPlannedLinks=function(n,t){var i=this;i.checkLinkOwnership(n,null,function(n){i.roadSegment.otherinfo.linkIds=[];for(var r=0;r<n.length;r++)i.roadSegment.otherinfo.linkIds.push(n[r]);if(n[0]==i.roadSegment.otherinfo.startPoint.feature.attributes.LINK_ID&&i.roadSegment.otherinfo.linkIds.splice(0,1),n[n.length-1]==i.roadSegment.otherinfo.endPoint.feature.attributes.LINK_ID&&i.roadSegment.otherinfo.linkIds.splice(i.roadSegment.otherinfo.linkIds.length-1,1),i.roadSegment.otherinfo.linkIds.length==0){i.addVectorLayers("DelegRoads"),i.createFeatureForRoadSegment(t),i.updateLinkInfoList(),objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.otherinfo.completefeatures),stopAnimation();return}objifxStpMap.searchFeaturesByLinkID(i.roadSegment.otherinfo.linkIds,function(n){if(n!=undefined){i.roadSegment.otherinfo.features=n,i.addVectorLayers("DelegRoads"),i.createFeatureForRoadSegment(t),i.updateLinkInfoList();for(var r=0;r<i.roadSegment.otherinfo.completefeatures.length;r++)i.roadSegment.delegatedFeatures.push(i.roadSegment.otherinfo.completefeatures[r]);objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.otherinfo.completefeatures),stopAnimation()}else stopAnimation()})})},IfxStpmapRoadDelegation.prototype.selectByLink=function(n){startAnimation(Lang_Key.Animation_Please_wait);var t=this;objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(i){if(i==null||i.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{var u=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),r=IfxStpmapCommon.findNearestFeatureIndex(i,u.lon,u.lat);t.checkLinkOwnership(i[r.index].attributes.LINK_ID,null,function(n){n.length>0?(t.roadSegment.otherinfo.completefeatures=i[r.index],t.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(i[r.index]),t.roadSegment.linkInfoList.push({linkId:i[r.index].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),t.roadSegment.delegatedFeatures.push(i[r.index]),stopAnimation()):stopAnimation()})}})},IfxStpmapRoadDelegation.prototype.searchAndSelectLinks=function(n){var i,t,f,r,e,u;if(startAnimation(Lang_Key.Animation_Please_wait),i=this,n==null||n.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{for(t=[],f=[],r=0;r<n.length;r++){for(e=!0,u=0;u<t.length;u++)if(n[r].attributes.LINK_ID==t[u].attributes.LINK_ID){e=!1;break}e&&(t.push(n[r]),f.push(n[r].attributes.LINK_ID))}i.checkLinkOwnership(f,null,function(n){var u,f,r;if(n.length>0){for(u=[],r=0;r<t.length;r++)for(f=0;f<n.length;f++)if(t[r].attributes.LINK_ID==n[f]){u.push(t[r]);break}for(i.roadSegment.otherinfo.completefeatures=u,i.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(u),r=0;r<u.length;r++)i.roadSegment.linkInfoList.push({linkId:u[r].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),i.roadSegment.delegatedFeatures.push(u[r]);objifxStpMap.olMap.zoomToExtent(objifxStpMap.vectorLayerDelegRoads.getDataExtent()),stopAnimation()}else stopAnimation()})}},IfxStpmapRoadDelegation.prototype.fillPointDetails=function(n,t,i,r){var u;n==0?(u=this.roadSegment.otherinfo.startPoint,this.roadSegment.otherinfo.endPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""}):u=this.roadSegment.otherinfo.endPoint,u.lrsValue=Math.round(t.length),u.linkId=i.attributes.LINK_ID,u.geom.sdo_point={X:r.x,Y:r.y},u.feature=i,i.attributes.DIR_TRAVEL=="B"?t.measure<=.5?(u.beginNodeId=i.attributes.REF_IN_ID,u.endNodeId=i.attributes.NREF_IN_ID):(u.beginNodeId=i.attributes.NREF_IN_ID,u.endNodeId=i.attributes.REF_IN_ID):i.attributes.DIR_TRAVEL=="F"&&n==0||i.attributes.DIR_TRAVEL=="T"&&n==1?(u.beginNodeId=i.attributes.NREF_IN_ID,u.endNodeId=i.attributes.REF_IN_ID):(u.beginNodeId=i.attributes.REF_IN_ID,u.endNodeId=i.attributes.NREF_IN_ID)},IfxStpmapRoadDelegation.prototype.formatRouteRequest=function(n){var t={WayPoints:[],MaxHeight:"0",MaxWeight:"0",MaxLength:"0",MaxWidth:"0",MaxNormAxleLoad:"0",MaxShutAxleLoad:"0"};return n!=!0?(t.BeginStartNode=this.roadSegment.otherinfo.startPoint.beginNodeId,t.BeginPointLinkId=this.roadSegment.otherinfo.startPoint.linkId,t.BeginPointEndNode=this.roadSegment.otherinfo.startPoint.endNodeId,t.EndPointStartNode=this.roadSegment.otherinfo.endPoint.beginNodeId,t.EndPointLinkId=this.roadSegment.otherinfo.endPoint.linkId,t.EndPointEndNode=this.roadSegment.otherinfo.endPoint.endNodeId):(t.BeginStartNode=this.roadSegment.otherinfo.endPoint.beginNodeId,t.BeginPointLinkId=this.roadSegment.otherinfo.endPoint.linkId,t.BeginPointEndNode=this.roadSegment.otherinfo.endPoint.endNodeId,t.EndPointStartNode=this.roadSegment.otherinfo.startPoint.beginNodeId,t.EndPointLinkId=this.roadSegment.otherinfo.startPoint.linkId,t.EndPointEndNode=this.roadSegment.otherinfo.startPoint.endNodeId),t},IfxStpmapRoadDelegation.prototype.createFeatureForRoadSegment=function(n){var t,u,i,r;n!=!0?(i=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint),r=jQuery.extend(!0,{},this.roadSegment.otherinfo.endPoint)):(i=jQuery.extend(!0,{},this.roadSegment.otherinfo.endPoint),r=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint)),this.roadSegment.otherinfo.features!=null&&(this.roadSegment.otherinfo.completefeatures=this.roadSegment.otherinfo.features.slice(0)),this.roadSegment.otherinfo.linkIds.length>0?(u=IfxStpmapCommon.getFeatureOfLinkId(this.roadSegment.otherinfo.features,this.roadSegment.otherinfo.linkIds[0]),t=IfxStpmapCommon.getRoutePointSegmentFeature(i.geom,i.feature,u,"STARTPOINT"),t.feature.geometry!=null?(i.feature&&(t.feature.attributes=i.feature.attributes),this.roadSegment.otherinfo.completefeatures.push(t.feature),this.updatePointLrs(t.feature,"STARTPOINT")):this.roadSegment.otherinfo.completefeatures.push(i.feature),u=IfxStpmapCommon.getFeatureOfLinkId(this.roadSegment.otherinfo.features,this.roadSegment.otherinfo.linkIds[this.roadSegment.otherinfo.linkIds.length-1]),t=IfxStpmapCommon.getRoutePointSegmentFeature(r.geom,r.feature,u,"ENDPOINT"),t.feature.geometry!=null?(r.feature&&(t.feature.attributes=r.feature.attributes),this.roadSegment.otherinfo.completefeatures.push(t.feature),this.updatePointLrs(t.feature,"ENDPOINT")):this.roadSegment.otherinfo.completefeatures.push(r.feature)):(t=IfxStpmapCommon.getRoutePointSegmentFeature(i.geom,i.feature,r.feature,"STARTPOINT"),t.feature.geometry!=null&&i.feature&&(t.feature.attributes=i.feature.attributes),this.roadSegment.otherinfo.completefeatures.push(t.feature),t=IfxStpmapCommon.getRoutePointSegmentFeature(r.geom,r.feature,i.feature,"ENDPOINT"),t.feature.geometry!=null&&r.feature&&(t.feature.attributes=r.feature.attributes),this.roadSegment.otherinfo.completefeatures.push(t.feature))},IfxStpmapRoadDelegation.prototype.undoSelectLink=function(){this.deletePreviousLinks(),this.roadSegment.otherinfo.startPoint.geom.sdo_point.X==this.roadSegment.startPointGeom.sdo_point.X&&this.roadSegment.otherinfo.startPoint.geom.sdo_point.Y==this.roadSegment.startPointGeom.sdo_point.Y?(this.roadSegment.otherinfo.startPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},this.roadSegment.otherinfo.endPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},this.removeDelegationMarker(1),this.removeDelegationMarker(0)):(this.roadSegment.otherinfo.endPoint=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint),this.removeDelegationMarker(1),this.setMarkerPoint(1,this.roadSegment.otherinfo.endPoint.geom.sdo_point.X,this.roadSegment.otherinfo.endPoint.geom.sdo_point.Y))},IfxStpmapRoadDelegation.prototype.setMarkerPoint=function(n,t,i){var r,u;n==0?(markerName="DELEGSTARTPOINT",r=IfxStpmapCommon.getDelegationMarkerImage(n),markerStyle={externalGraphic:r,graphicHeight:40,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-40}):(markerName="DELEGENDPOINT",r=IfxStpmapCommon.getDelegationMarkerImage(n),markerStyle={externalGraphic:r,graphicHeight:40,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-40}),u=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t,i),{name:markerName},markerStyle),this.addVectorLayers("DelegMarkers"),objifxStpMap.vectorLayerDelegMarkers.addFeatures(u)},IfxStpmapRoadDelegation.prototype.removeDelegationMarker=function(n){objifxStpMap.vectorLayerDelegMarkers.removeFeatures(objifxStpMap.vectorLayerDelegMarkers.features[n])},IfxStpmapRoadDelegation.prototype.updateLinkInfoList=function(){for(var t=!1,i,r,u,n=this.roadSegment.linkInfoList.length-1;n>0;n--)if(this.roadSegment.linkInfoList[n].linkId==this.roadSegment.otherinfo.startPoint.linkId){this.roadSegment.linkInfoList[n].fromLinearRef=null,this.roadSegment.linkInfoList[n].toLinearRef=null,t=!0;break}for(t||(i={linkId:this.roadSegment.otherinfo.startPoint.linkId,fromLinearRef:this.roadSegment.otherinfo.startPoint.fromLrs,toLinearRef:this.roadSegment.otherinfo.startPoint.toLrs},this.roadSegment.linkInfoList.push(i)),n=0;n<this.roadSegment.otherinfo.linkIds.length;n++)r={linkId:this.roadSegment.otherinfo.linkIds[n],fromLinearRef:null,toLinearRef:null},this.roadSegment.linkInfoList.push(r);u={linkId:this.roadSegment.otherinfo.endPoint.linkId,fromLinearRef:this.roadSegment.otherinfo.endPoint.fromLrs,toLinearRef:this.roadSegment.otherinfo.endPoint.toLrs},this.roadSegment.linkInfoList.push(u)},IfxStpmapRoadDelegation.prototype.deletePreviousLinks=function(){for(var t,i,n=0;n<this.roadSegment.otherinfo.completefeatures.length;n++){for(t=this.roadSegment.linkInfoList.length-1;t>=0;t--)this.roadSegment.otherinfo.completefeatures[n].attributes.LINK_ID==this.roadSegment.linkInfoList[t].linkId&&this.roadSegment.linkInfoList.splice(t,1);for(i=this.roadSegment.delegatedFeatures.length-1;i>=0;i--)this.roadSegment.otherinfo.completefeatures[n].attributes.LINK_ID==this.roadSegment.delegatedFeatures[i].attributes.LINK_ID&&this.roadSegment.delegatedFeatures.splice(i,1)}objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.otherinfo.completefeatures)},IfxStpmapRoadDelegation.prototype.deleteFromLinkInfoList=function(n){for(var t=this.roadSegment.linkInfoList.length-1;t>=0;t--)if(this.roadSegment.linkInfoList[t].linkId==n){this.roadSegment.linkInfoList.splice(t,1);break}},IfxStpmapRoadDelegation.prototype.getLinkInfoList=function(){return this.roadSegment.linkInfoList},IfxStpmapRoadDelegation.prototype.addFeatureForRoads=function(n){startAnimation(Lang_Key.Animation_Please_wait),this.getFeatureForRoads(n,function(){stopAnimation()})},IfxStpmapRoadDelegation.prototype.getFeatureForRoads=function(n){for(var r=this,u={OrdinatesArray:[],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},e,i=0,f=0;i<n.geometry.components[0].components.length;i++)u.OrdinatesArray[f++]=n.geometry.components[0].components[i].x,u.OrdinatesArray[f++]=n.geometry.components[0].components[i].y;e=parseInt($("#fromOrgId").val()),$.ajax({url:"/RoadDelegation/GetRoadDelegationDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({arrangementId:0,fetchFlag:3,areaGeom:u,searchParam:{fromOrgId:e}}),success:function(n){n=="Session timeout"&&(location.reload(),stopAnimation()),n.length>0?r.highlightRoads(n,!0,!0,function(){objifxStpMap.vectorLayerDelegRoads.addFeatures(r.roadSegment.delegatedFeatures),r.removeFeatureFromDelegated(),stopAnimation()}):(showWarningPopDialog("Selection failed. The selected road(s) cannot be delegated.","Ok","","close_alert","",1,"info"),stopAnimation())},complete:function(){stopAnimation()}})},IfxStpmapRoadDelegation.prototype.deselectLink=function(n){var i=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),t=IfxStpmapCommon.findNearestFeatureIndex(this.roadSegment.delegatedFeatures,i.lon,i.lat);objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.delegatedFeatures[t.index]),this.roadSegment.removedFeatures.push(this.roadSegment.delegatedFeatures[t.index]),this.deleteFromLinkInfoList(this.roadSegment.delegatedFeatures[t.index].attributes.LINK_ID),this.roadSegment.delegatedFeatures.splice(t.index,1)},IfxStpmapRoadDelegation.prototype.fetchAllRoadLinks=function(n){var i=this,r=parseInt($("#fromOrgId").val()),t=objifxStpMap.getCurrentBoundsAndZoom(),u={OrdinatesArray:[t.bounds.left,t.bounds.top,t.bounds.right,t.bounds.top,t.bounds.right,t.bounds.bottom,t.bounds.left,t.bounds.bottom,t.bounds.left,t.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()};$.ajax({url:"/RoadDelegation/GetRoadDelegationDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({arrangementId:0,fetchFlag:5,areaGeom:u,zoomLevel:t.zoom,searchParam:{fromOrgId:r}}),beforeSend:function(){startAnimation(Lang_Key.Animation_Please_wait),objifxStpMap.vectorLayerDelegRoads.removeFeatures(objifxStpMap.vectorLayerDelegRoads.features),i.roadSegment.ownedFeatures=[],i.roadSegment.managedFeatures=[]},success:function(t){t=="Session timeout"?(location.reload(),stopAnimation()):t.length>0?i.highlightRoads(t,!0,!1,function(){roadDelegationCheckValue("owned")&&objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.ownedFeatures),roadDelegationCheckValue("managed")&&objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.managedFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.delegatedFeatures),i.removeFeatureFromDelegated(),stopAnimation()}):(objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.delegatedFeatures),i.removeFeatureFromDelegated(),stopAnimation()),n&&typeof n=="function"&&n()},complete:function(){stopAnimation()}})},IfxStpmapRoadDelegation.prototype.showAllRoads=function(n){var t=this,i=parseInt($("#fromOrgId").val());n?this.zoomToGeoRegion(i,function(n){if(n!=undefined&&n!=null){var i=new OpenLayers.Bounds;i.extend(new OpenLayers.LonLat(n.x1,n.y1)),i.extend(new OpenLayers.LonLat(n.x2,n.y2)),objifxStpMap.olMap.zoomToExtent(i,!0)}t.fetchAllRoadLinks(function(){t.fetchAllRoadsTimeFlag=1,t.setAllRoadsFetchStart=!0})}):t.fetchAllRoadLinks(function(){t.fetchAllRoadsTimeFlag=1,t.setAllRoadsFetchStart=!0})},IfxStpmapRoadDelegation.prototype.zoomToGeoRegion=function(n,t){$.ajax({url:"/RoadDelegation/FetchOrgGeoRegion",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({orgId:n}),success:function(n){if(n=="Session timeout"?(location.reload(),stopAnimation()):res=n.result,res.orgGeoRegion&&res.orgGeoRegion.OrdinatesArray!=null){var i=res.orgGeoRegion.OrdinatesArray[0],r=res.orgGeoRegion.OrdinatesArray[1],u=res.orgGeoRegion.OrdinatesArray[2],f=res.orgGeoRegion.OrdinatesArray[3];t&&typeof t=="function"&&t({x1:i,y1:r,x2:u,y2:f})}},complete:function(){}})},IfxStpmapRoadDelegation.prototype.fetchAllRoadsOnZoomChange=function(n){this.setAllRoadsFetchStart?this.fetchAllRoadLinks(n):n&&typeof n=="function"&&n()},IfxStpmapRoadDelegation.prototype.fetchDelegRoadsOnZoomChange=function(n){this.setDelegRoadsFetchStart?this.showDelegatedRoads(n):n&&typeof n=="function"&&n()},IfxStpmapRoadDelegation.prototype.showDelegatedRoads=function(n){if(this.currentArrangementId!=null&&this.currentArrangementId!=undefined){var i=this,t=objifxStpMap.getCurrentBoundsAndZoom(),r={OrdinatesArray:[t.bounds.left,t.bounds.top,t.bounds.right,t.bounds.top,t.bounds.right,t.bounds.bottom,t.bounds.left,t.bounds.bottom,t.bounds.left,t.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()};$.ajax({url:"/RoadDelegation/GetRoadDelegationDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({arrangementId:i.currentArrangementId,fetchFlag:6,areaGeom:r,zoomLevel:t.zoom}),beforeSend:function(){startAnimation(Lang_Key.Animation_Please_wait)},success:function(t){objifxStpMap.vectorLayerDelegRoads.removeFeatures(objifxStpMap.vectorLayerDelegRoads.features),t=="Session timeout"?(location.reload(),stopAnimation()):t.length>0?i.highlightRoads(t,!0,!1,function(n){i.roadSegment.delegatedFeatures=n,objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.delegatedFeatures),i.removeFeatureFromDelegated(),stopAnimation()}):(objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.delegatedFeatures),i.removeFeatureFromDelegated(),stopAnimation()),n&&typeof n=="function"&&n()},complete:function(){stopAnimation()}})}},IfxStpmapRoadDelegation.prototype.zoomInToDelegRoad=function(n,t,i){var r=this;this.currentArrangementId=t,objifxStpMap.searchFeaturesByLinkID([n.linkId],function(n){objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,8),r.showDelegatedRoads(i),r.fetchDelegRoadsTimeFlag=1,r.setDelegRoadsFetchStart=!0})},IfxStpmapRoadDelegation.prototype.addToRoadLinks=function(n){for(var t=0;t<n.length;t++)this.roadSegment.linkInfoList.push({linkId:n[t].linkId,fromLinearRef:n[t].fromLinearRef,toLinearRef:n[t].toLinearRef})},IfxStpmapRoadDelegation.prototype.showAndHideRoads=function(n,t){switch(n){case"owned":switch(t){case!0:objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.ownedFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.delegatedFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.delegatedFeatures);break;case!1:objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.ownedFeatures)}break;case"managed":switch(t){case!0:objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.managedFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.delegatedFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.delegatedFeatures);break;case!1:objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.managedFeatures)}break;default:switch(t){case!0:objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.delegatedFeatures);break;case!1:objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.delegatedFeatures)}}},IfxStpmapRoadDelegation.prototype.removeFeatureForArea=function(n){for(var t=this.roadSegment.delegatedFeatures.length-1;t>=0;t--)n.geometry.intersects(this.roadSegment.delegatedFeatures[t].geometry)&&(objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.delegatedFeatures[t]),this.roadSegment.removedFeatures.push(this.roadSegment.delegatedFeatures[t]),this.deleteFromLinkInfoList(this.roadSegment.delegatedFeatures[t].attributes.LINK_ID),this.roadSegment.delegatedFeatures.splice(t,1))},IfxStpmapRoadDelegation.prototype.checkLinkOwnership=function(n,t,i){var r=this;t==null&&(t=parseInt($("#fromOrgId").val())),$.ajax({url:"/RoadDelegation/GetLinksAllowedForDelegation",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({linkIdList:n,fromOrgId:t}),success:function(n){n=="Session timeout"&&(location.reload(),stopAnimation()),n.result.length>0?i&&typeof i=="function"&&i(n.result):i([25422932,25422876])},complete:function(){stopAnimation()}})},IfxStpmapRoadDelegation.prototype.removeFeatureFromDelegated=function(){for(var n,t=0;t<this.roadSegment.removedFeatures.length;t++)for(n=0;n<this.roadSegment.delegatedFeatures.length;n++)if(this.roadSegment.removedFeatures[t].attributes.LINK_ID==this.roadSegment.delegatedFeatures[n].attributes.LINK_ID){objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.delegatedFeatures[n]);break}},IfxStpmapRoadDelegation.prototype.drawPartial=function(n,t){var i=this;objifxStpMap.searchFeaturesByLinkID([n],function(n){var r=LRSMeasure(n[0].geometry,new OpenLayers.Geometry.Point(i.roadSegment.startPointGeom.sdo_point.X,i.roadSegment.startPointGeom.sdo_point.Y),{tolerance:2}),u=LRSMeasure(n[0].geometry,new OpenLayers.Geometry.Point(i.roadSegment.endPointGeom.sdo_point.X,i.roadSegment.endPointGeom.sdo_point.Y),{tolerance:2}),f;f=r<u?LRSSubstring(n[0].geometry,r,u):LRSSubstring(n[0].geometry,u,r),t(new OpenLayers.Feature.Vector(f))})},IfxStpmapRoadDelegation.prototype.updatePointLrs=function(n,t){t=="STARTPOINT"?IfxStpmapCommon.compareGeometries(this.roadSegment.startPointGeom.sdo_point,n.geometry.components[0])?(this.roadSegment.otherinfo.startPoint.fromLrs=this.roadSegment.otherinfo.startPoint.lrsValue,this.roadSegment.otherinfo.startPoint.toLrs=null):IfxStpmapCommon.compareGeometries(this.roadSegment.startPointGeom.sdo_point,n.geometry.components[n.geometry.components.length-1])&&(this.roadSegment.otherinfo.startPoint.fromLrs=null,this.roadSegment.otherinfo.startPoint.toLrs=this.roadSegment.otherinfo.startPoint.lrsValue):IfxStpmapCommon.compareGeometries(this.roadSegment.endPointGeom.sdo_point,n.geometry.components[0])?(this.roadSegment.otherinfo.endPoint.fromLrs=this.roadSegment.otherinfo.endPoint.lrsValue,this.roadSegment.otherinfo.endPoint.toLrs=null):IfxStpmapCommon.compareGeometries(this.roadSegment.endPointGeom.sdo_point,n.geometry.components[n.geometry.components.length-1])&&(this.roadSegment.otherinfo.endPoint.fromLrs=null,this.roadSegment.otherinfo.endPoint.toLrs=this.roadSegment.otherinfo.endPoint.lrsValue)},IfxStpmapRoadOwnership.prototype.csvImportFlag=!1,IfxStpmapRoadOwnership.prototype.roadSegment={startPointGeom:{sdo_point:{X:"",Y:""}},endPointGeom:{sdo_point:{X:"",Y:""}},linkInfoList:[],ownedFeatures:[],ownedLinkIds:[],unassignedFeatures:[],selectedFeatures:[],removedFeatures:[],otherinfo:{startPoint:{geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},endPoint:{geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},linkIds:[],features:[],currentfeatures:[]}},IfxStpmapRoadOwnership.prototype.polygonLayer=null,IfxStpmapRoadOwnership.prototype.fetchUnassignedRoadsTimeFlag=0,IfxStpmapRoadOwnership.prototype.fetchOwnedRoadsTimeFlag=0,IfxStpmapRoadOwnership.prototype.setUnassignedRoadsFetchStart=!1,IfxStpmapRoadOwnership.prototype.setOwnedRoadsFetchStart=!1,IfxStpmapRoadOwnership.prototype.organisationId=null,IfxStpmapRoadOwnership.prototype.colorCode=null,IfxStpmapRoadOwnership.prototype.isSelectAll=null,IfxStpmapRoadOwnership.prototype.unassignedTimeFlag=0,IfxStpmapRoadOwnership.prototype.deselectTimeFlag=0,IfxStpmapRoadOwnership.prototype.showRoadOwnershipMap=function(n){objifxStpMap.deleteMapLayer("RoadOwnership");var i="org_id:"+n,t=new OpenLayers.Layer.WMS("RoadOwnership",objifxStpMap.geoserverUrl,{layers:objifxStpMap.roadOwnershipLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:i,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(t),objifxStpMap.olMap.setLayerIndex(t,1)},IfxStpmapRoadOwnership.prototype.showUnassignedRoadsMap=function(){objifxStpMap.deleteMapLayer("Unassigned layer");var n=new OpenLayers.Layer.WMS("Unassigned layer",objifxStpMap.geoserverUrl,{layers:objifxStpMap.unassignedRoadsLayer,format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(n),objifxStpMap.olMap.setLayerIndex(n,1)},IfxStpmapRoadOwnership.prototype.toggleUnassignedRoadsMap=function(n){if(n)this.showUnassignedRoadsMap();else for(var t=0;t<objifxStpMap.olMap.layers.length;t++)objifxStpMap.olMap.layers[t].name=="Unassigned layer"&&objifxStpMap.deleteMapLayer("Unassigned layer")},IfxStpmapRoadOwnership.prototype.createRoadDelegationToolBar=function(){var n=this,t=objifxStpMap.mapType;roadDelegationToolbarPanel=new OpenLayers.Control.Panel({displayClass:"roaddelegationtoolbarpanel"}),objifxStpMap.olMap.addControl(roadDelegationToolbarPanel),btnSelectAndPlan=new OpenLayers.Control.Button({displayClass:"selectAndPlanLinks",title:Lang_Key.Tooltip_Select_plann,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(0,"ROADDELEGATION")},deactivate:function(){n.removeDelegationMarker(1),n.removeDelegationMarker(0)}}}),btnSelectByPolygon=new OpenLayers.Control.Button({displayClass:"selectLinksByPolygon",title:Lang_Key.Tooltip_Select_polygon,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){var n=objifxStpMap.olMap.getZoom();n<8?(selectByPolygon.deactivate(),showWarningPopDialog(Lang_Key.WngPopup_Polygon,"Ok","","close_alert","",1,"info")):selectByPolygon.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(1,"ROADDELEGATION")},deactivate:function(){selectByPolygon.deactivate()}}}),btnSelectByLink=new OpenLayers.Control.Button({displayClass:"selectLinks",title:Lang_Key.Tooltip_Select_Random,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(2,"ROADDELEGATION")},deactivate:function(){}}}),btnDeselectByPolygon=new OpenLayers.Control.Button({displayClass:"deselectLinksByPolygon",title:Lang_Key.Tooltip_DeSelect_polygon,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){deselectByPolygon.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(3,"ROADDELEGATION")},deactivate:function(){deselectByPolygon.deactivate()}}}),btnDeselectLink=new OpenLayers.Control.Button({displayClass:"deselectLinks",title:Lang_Key.Tooltip_DeSelect_Random,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(4,"ROADDELEGATION")},deactivate:function(){}}}),btnUndoSelectAndPlan=new OpenLayers.Control.Button({displayClass:"undoSelectLinks",title:Lang_Key.Tooltip_Undo,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(5,"ROADDELEGATION"),objifxStpmapRoadOwnership.undoSelectLink()},deactivate:function(){}}}),btnformatpainter=new OpenLayers.Control.Button({displayClass:"formatpainter",title:Lang_Key.Tooltip_formatpainter,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(6,"ROADDELEGATION")},deactivate:function(){$("#manager_Id").val(""),$("#managerName").val("")}}}),roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan]),$("#MapUpgrade").val()==1&&roadDelegationToolbarPanel.addControls([btnformatpainter])},IfxStpmapRoadOwnership.prototype.createPolygonDrawControl=function(){var n=this,t=new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({strokeOpacity:.7,strokeColor:"#1919FF",strokeWidth:3},OpenLayers.Feature.Vector.style["default"]));this.polygonLayer=new OpenLayers.Layer.Vector("Polygon Layer",{styleMap:t}),objifxStpMap.olMap.addLayers([this.polygonLayer]),selectByPolygon=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_Select_polygon,featureAdded:function(t){n.addFeatureForRoads(t),btnSelectByPolygon.deactivate(),n.polygonLayer.removeFeatures(n.polygonLayer.features)}}),deselectByPolygon=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_DeSelect_polygon,featureAdded:function(t){n.removeFeatureForArea(t),btnDeselectByPolygon.deactivate(),n.polygonLayer.removeFeatures(n.polygonLayer.features)}}),objifxStpMap.olMap.addControl(selectByPolygon),objifxStpMap.olMap.addControl(deselectByPolygon)},IfxStpmapRoadOwnership.prototype.highlightRoads=function(n,t,i,r){var f,h,p,s,u,c,o,e,l,a,v,y;if(n==null||n==undefined){showNotification(Lang_Key.Notif_No_data_available);return}if(f=this,t!=!0){for(h=[],u=0;u<n.length;u++)h.push(n[u].linkId);objifxStpMap.searchFeaturesByLinkID(h,function(n){f.roadSegment.linkInfoList=n,f.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(n),objifxStpMap.olMap.zoomToExtent(objifxStpMap.vectorLayerDelegRoads.getDataExtent()),r&&typeof r=="function"&&r()})}else{for(s=[],u=0;u<n.length;u++){if(n[u].linkGeom!=null){for(c=[],o=0;o<n[u].linkGeom.OrdinatesArray.length;o+=2)c.push(new OpenLayers.Geometry.Point(n[u].linkGeom.OrdinatesArray[o],n[u].linkGeom.OrdinatesArray[o+1]));e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(c)),(n[u].fromLinearRef!=null||n[u].toLinearRef!=null)&&(l=IfxStpmapCommon.getLengthOfFeature(e),a=n[u].fromLinearRef==null?0:n[u].fromLinearRef/l,v=n[u].toLinearRef==null?1:n[u].toLinearRef/l,y=LRSSubstring(e.geometry,a,v),e=new OpenLayers.Feature.Vector(y)),e.data=n[u].linkStatus,e.attributes={LINK_ID:n[u].linkId},s.push(e)}i&&(f.roadSegment.linkInfoList.push({linkId:n[u].linkId,fromLinearRef:n[u].fromLinearRef,toLinearRef:n[u].toLinearRef}),f.showAssignedButton())}i&&(f.roadSegment.otherinfo.currentfeatures=s),f.addVectorLayers("DelegRoads"),r&&typeof r=="function"&&r(s)}},IfxStpmapRoadOwnership.prototype.addVectorLayers=function(n){for(var t=0;t<objifxStpMap.olMap.layers.length;t++)if(objifxStpMap.olMap.layers[t].name==n)return;n=="DelegRoads"?objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerDelegRoads]):n=="DelegMarkers"&&objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerDelegMarkers])},IfxStpmapRoadOwnership.prototype.selectAndPlanLink=function(n,t){if(t=="STARTPOINT"?startAnimation(Lang_Key.Animation_Please_wait):startAnimation(Lang_Key.Animation_Please_wait),t=="ENDPOINT"&&this.roadSegment.otherinfo.startPoint.linkId==""){stopAnimation();return}var i=this;objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(r){var f,o,h;if(r==null||r.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{var s=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),u=IfxStpmapCommon.findNearestFeatureIndex(r,s.lon,s.lat),e=LRSMeasure(r[u.index].geometry,new OpenLayers.Geometry.Point(u.x1,u.y1),{tolerance:.5,details:!0});t=="STARTPOINT"?(i.removeDelegationMarker(1),i.removeDelegationMarker(0),i.roadSegment.startPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(0,u.x1,u.y1),i.fillPointDetails(0,e,r[u.index],{x:u.x1,y:u.y1})):(t="ENDPOINT")&&(i.roadSegment.otherinfo.endPoint.linkId==""?(i.roadSegment.endPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(1,u.x1,u.y1),i.fillPointDetails(1,e,r[u.index],{x:u.x1,y:u.y1})):(i.removeDelegationMarker(1),i.roadSegment.endPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(1,u.x1,u.y1),i.roadSegment.otherinfo.startPoint=jQuery.extend(!0,{},i.roadSegment.otherinfo.endPoint),i.fillPointDetails(1,e,r[u.index],{x:u.x1,y:u.y1})))}t=="ENDPOINT"?(f=i.formatRouteRequest(!1),f.BeginPointLinkId==f.EndPointLinkId?(o=[],o[0]=f.BeginPointLinkId,h=objifxStpMap.searchFeaturesByLinkID(o,function(n){if(n!=undefined){i.roadSegment.otherinfo.features=n[0],i.showAssignedButton(),i.addVectorLayers("DelegRoads"),i.roadSegment.otherinfo.currentfeatures.push(n[0]);for(var t=0;t<i.roadSegment.otherinfo.currentfeatures.length;t++)i.roadSegment.selectedFeatures.push(i.roadSegment.otherinfo.currentfeatures[t]);objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.otherinfo.currentfeatures),stopAnimation()}else stopAnimation()})):objifxStpMap.doProcessPlanRouteRequest(f,!1,function(n){var t=0;n.length==0&&(i.roadSegment.otherinfo.startPoint.beginNodeId==i.roadSegment.otherinfo.endPoint.beginNodeId||i.roadSegment.otherinfo.startPoint.beginNodeId==i.roadSegment.otherinfo.endPoint.endNodeId||i.roadSegment.otherinfo.startPoint.endNodeId==i.roadSegment.otherinfo.endPoint.beginNodeId||i.roadSegment.otherinfo.startPoint.endNodeId==i.roadSegment.otherinfo.endPoint.endNodeId)&&(n.unshift(i.roadSegment.otherinfo.startPoint.linkId),n.push(i.roadSegment.otherinfo.endPoint.linkId),t=1),n!=null&&n.length>0?(t==0&&(n.unshift(i.roadSegment.otherinfo.startPoint.linkId),n.push(i.roadSegment.otherinfo.endPoint.linkId)),i.highlightPlannedLinks(n,!1)):stopAnimation()})):stopAnimation()})},IfxStpmapRoadOwnership.prototype.highlightPlannedLinks=function(n,t){var i=this,r;for(i.roadSegment.otherinfo.linkIds=[],r=0;r<n.length;r++)i.roadSegment.otherinfo.linkIds.push(n[r]);objifxStpMap.searchFeaturesByLinkID(i.roadSegment.otherinfo.linkIds,function(n){var f,r,u;if(n!=undefined){for(f=n,u=0;u<f.length;u++)for(r=u+1;r<f.length;r++)f[u].attributes.LINK_ID==f[r].attributes.LINK_ID&&(f.splice(r,1),r--);for(i.roadSegment.otherinfo.features=f,i.addVectorLayers("DelegRoads"),i.createFeatureForRoadSegment(t),i.updateLinkInfoList(),r=0;r<i.roadSegment.otherinfo.currentfeatures.length;r++)i.roadSegment.selectedFeatures=i.roadSegment.selectedFeatures.concat(i.roadSegment.otherinfo.currentfeatures[r]);objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.otherinfo.currentfeatures),stopAnimation()}else stopAnimation();for(r=0;r<i.roadSegment.selectedFeatures.length;r++)for(u=0;u<objifxStpMap.vectorLayerRoute.features.length;u++)i.roadSegment.selectedFeatures[r].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[u].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[u])})},IfxStpmapRoadOwnership.prototype.selectByLink=function(n){startAnimation(Lang_Key.Animation_Please_wait);var t=this;t.organisationId=$("#hdnorganisationId").val(),objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(i){var r,f;if(i==null||i.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{var e=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),u=IfxStpmapCommon.findNearestFeatureIndex(i,e.lon,e.lat),o=0;for(r=0;r<t.roadSegment.linkInfoList.length;r++)if(t.roadSegment.linkInfoList[r].linkId==i[u.index].attributes.LINK_ID){o=1;break}if(o==0)for(t.roadSegment.otherinfo.currentfeatures=[i[u.index]],t.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(i[u.index]),t.roadSegment.linkInfoList.push({linkId:i[u.index].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),t.roadSegment.selectedFeatures=t.roadSegment.selectedFeatures.concat(i[u.index]),r=0;r<t.roadSegment.selectedFeatures.length;r++)for(f=0;f<objifxStpMap.vectorLayerRoute.features.length;f++)t.roadSegment.selectedFeatures[r].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[f].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[f]);t.showAssignedButton(),stopAnimation()}})},IfxStpmapRoadOwnership.prototype.searchAndSelectLinks=function(n){var i,u,t,r;if(startAnimation(Lang_Key.Animation_Please_wait),n==null||n.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{for(i=[],t=0;t<n.length;t++){for(u=!0,r=0;r<i.length;r++)if(n[t].attributes.LINK_ID==i[r].attributes.LINK_ID){u=!1;break}u&&i.push(n[t])}for(this.roadSegment.otherinfo.currentfeatures=i,this.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(i),t=0;t<i.length;t++)this.roadSegment.linkInfoList.push({linkId:i[t].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),this.roadSegment.selectedFeatures=this.roadSegment.selectedFeatures.concat(i[t]);for(t=0;t<this.roadSegment.selectedFeatures.length;t++)for(r=0;r<objifxStpMap.vectorLayerRoute.features.length;r++)this.roadSegment.selectedFeatures[t].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[r].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[r]);objifxStpMap.olMap.zoomToExtent(objifxStpMap.vectorLayerDelegRoads.getDataExtent()),this.showAssignedButton(),stopAnimation()}},IfxStpmapRoadOwnership.prototype.fillPointDetails=function(n,t,i,r){var u;n==0?(u=this.roadSegment.otherinfo.startPoint,this.roadSegment.otherinfo.endPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""}):u=this.roadSegment.otherinfo.endPoint,u.lrsValue=Math.round(t.length),u.linkId=i.attributes.LINK_ID,u.geom.sdo_point={X:r.x,Y:r.y},u.feature=i,i.attributes.DIR_TRAVEL=="B"?t.measure<=.5?(u.beginNodeId=i.attributes.REF_IN_ID,u.endNodeId=i.attributes.NREF_IN_ID):(u.beginNodeId=i.attributes.NREF_IN_ID,u.endNodeId=i.attributes.REF_IN_ID):i.attributes.DIR_TRAVEL=="F"&&n==0||i.attributes.DIR_TRAVEL=="T"&&n==1?(u.beginNodeId=i.attributes.NREF_IN_ID,u.endNodeId=i.attributes.REF_IN_ID):(u.beginNodeId=i.attributes.REF_IN_ID,u.endNodeId=i.attributes.NREF_IN_ID)},IfxStpmapRoadOwnership.prototype.formatRouteRequest=function(n){var t={WayPoints:[],MaxHeight:"0",MaxWeight:"0",MaxLength:"0",MaxWidth:"0",MaxNormAxleLoad:"0",MaxShutAxleLoad:"0"};return n!=!0?(t.BeginStartNode=this.roadSegment.otherinfo.startPoint.beginNodeId,t.BeginPointLinkId=this.roadSegment.otherinfo.startPoint.linkId,t.BeginPointEndNode=this.roadSegment.otherinfo.startPoint.endNodeId,t.EndPointStartNode=this.roadSegment.otherinfo.endPoint.beginNodeId,t.EndPointLinkId=this.roadSegment.otherinfo.endPoint.linkId,t.EndPointEndNode=this.roadSegment.otherinfo.endPoint.endNodeId):(t.BeginStartNode=this.roadSegment.otherinfo.endPoint.beginNodeId,t.BeginPointLinkId=this.roadSegment.otherinfo.endPoint.linkId,t.BeginPointEndNode=this.roadSegment.otherinfo.endPoint.endNodeId,t.EndPointStartNode=this.roadSegment.otherinfo.startPoint.beginNodeId,t.EndPointLinkId=this.roadSegment.otherinfo.startPoint.linkId,t.EndPointEndNode=this.roadSegment.otherinfo.startPoint.endNodeId),t},IfxStpmapRoadOwnership.prototype.createFeatureForRoadSegment=function(n){var t,u,i,r;n!=!0?(i=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint),r=jQuery.extend(!0,{},this.roadSegment.otherinfo.endPoint)):(i=jQuery.extend(!0,{},this.roadSegment.otherinfo.endPoint),r=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint)),this.roadSegment.otherinfo.features!=null&&(this.roadSegment.otherinfo.currentfeatures=this.roadSegment.otherinfo.features.slice(0)),this.roadSegment.otherinfo.linkIds.length>0?(u=IfxStpmapCommon.getFeatureOfLinkId(this.roadSegment.otherinfo.features,this.roadSegment.otherinfo.linkIds[0]),t=IfxStpmapCommon.getRoutePointSegmentFeature(i.geom,i.feature,u,"STARTPOINT"),t.feature.geometry!=null?(i.feature&&(t.feature.attributes=i.feature.attributes),this.updatePointLrs(t.feature,"STARTPOINT")):this.roadSegment.otherinfo.currentfeatures.push(i.feature),u=IfxStpmapCommon.getFeatureOfLinkId(this.roadSegment.otherinfo.features,this.roadSegment.otherinfo.linkIds[this.roadSegment.otherinfo.linkIds.length-1]),t=IfxStpmapCommon.getRoutePointSegmentFeature(r.geom,r.feature,u,"ENDPOINT"),t.feature.geometry!=null?(r.feature&&(t.feature.attributes=r.feature.attributes),this.updatePointLrs(t.feature,"ENDPOINT")):this.roadSegment.otherinfo.currentfeatures.push(r.feature)):(t=IfxStpmapCommon.getRoutePointSegmentFeature(i.geom,i.feature,r.feature,"STARTPOINT"),t.feature.geometry!=null&&i.feature&&(t.feature.attributes=i.feature.attributes),this.roadSegment.otherinfo.currentfeatures.push(t.feature),t=IfxStpmapCommon.getRoutePointSegmentFeature(r.geom,r.feature,i.feature,"ENDPOINT"),t.feature.geometry!=null&&r.feature&&(t.feature.attributes=r.feature.attributes),this.roadSegment.otherinfo.currentfeatures.push(t.feature))},IfxStpmapRoadOwnership.prototype.undoSelectLink=function(){this.deletePreviousLinks(),this.roadSegment.otherinfo.startPoint.geom.sdo_point.X==this.roadSegment.startPointGeom.sdo_point.X&&this.roadSegment.otherinfo.startPoint.geom.sdo_point.Y==this.roadSegment.startPointGeom.sdo_point.Y?(this.roadSegment.otherinfo.startPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},this.roadSegment.otherinfo.endPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},this.removeDelegationMarker(1),this.removeDelegationMarker(0)):(this.roadSegment.otherinfo.endPoint=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint),this.removeDelegationMarker(1),this.setMarkerPoint(1,this.roadSegment.otherinfo.endPoint.geom.sdo_point.X,this.roadSegment.otherinfo.endPoint.geom.sdo_point.Y))},IfxStpmapRoadOwnership.prototype.setMarkerPoint=function(n,t,i){var r,u;n==0?(markerName="DELEGSTARTPOINT",r=IfxStpmapCommon.getDelegationMarkerImage(n),markerStyle={externalGraphic:r,graphicHeight:40,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-40}):(markerName="DELEGENDPOINT",r=IfxStpmapCommon.getDelegationMarkerImage(n),markerStyle={externalGraphic:r,graphicHeight:40,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-40}),u=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t,i),{name:markerName},markerStyle),this.addVectorLayers("DelegMarkers"),objifxStpMap.vectorLayerDelegMarkers.addFeatures(u)},IfxStpmapRoadOwnership.prototype.removeDelegationMarker=function(n){objifxStpMap.vectorLayerDelegMarkers.removeFeatures(objifxStpMap.vectorLayerDelegMarkers.features[n])},IfxStpmapRoadOwnership.prototype.updateLinkInfoList=function(){for(var t,n=0;n<this.roadSegment.otherinfo.linkIds.length;n++)t={linkId:this.roadSegment.otherinfo.linkIds[n],fromLinearRef:null,toLinearRef:null},this.roadSegment.linkInfoList.push(t);this.showAssignedButton()},IfxStpmapRoadOwnership.prototype.deletePreviousLinks=function(){for(var t,i,n=0;n<this.roadSegment.otherinfo.currentfeatures.length;n++){for(t=this.roadSegment.linkInfoList.length-1;t>=0;t--)if(this.roadSegment.otherinfo.currentfeatures[n].attributes.LINK_ID==this.roadSegment.linkInfoList[t].linkId){this.roadSegment.linkInfoList.splice(t,1);break}for(i=this.roadSegment.selectedFeatures.length-1;i>=0;i--)this.roadSegment.otherinfo.currentfeatures[n].attributes.LINK_ID==this.roadSegment.selectedFeatures[i].attributes.LINK_ID&&this.roadSegment.selectedFeatures.splice(i,1)}objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.otherinfo.currentfeatures),this.showAssignedButton()},IfxStpmapRoadOwnership.prototype.deleteFromLinkInfoList=function(n){for(var t=this.roadSegment.linkInfoList.length-1;t>=0;t--)if(this.roadSegment.linkInfoList[t].linkId==n){this.roadSegment.linkInfoList.splice(t,1);break}this.showAssignedButton()},IfxStpmapRoadOwnership.prototype.getOwnerLinkInfoList=function(){for(var n=this.roadSegment.linkInfoList,t,i=0;i<n.length;i++)for(t=i+1;t<n.length;t++)n[i].linkId==n[t].linkId&&(n.splice(t,1),t--);return n},IfxStpmapRoadOwnership.prototype.addFeatureForRoads=function(n){startAnimation(Lang_Key.Animation_Please_wait),this.getFeatureForRoads(n,function(){stopAnimation()})},IfxStpmapRoadOwnership.prototype.getFeatureForRoads=function(n){for(var i=this,o=objifxStpMap.getCurrentBoundsAndZoom(),u={OrdinatesArray:[],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},e,r=0,f=0;r<n.geometry.components[0].components.length;r++)u.OrdinatesArray[f++]=n.geometry.components[0].components[r].x,u.OrdinatesArray[f++]=n.geometry.components[0].components[r].y;e=4,$("#MapUpgrade").val()=="1"&&(e=7),$.ajax({url:"/RoadOwnership/GetRoadOwnedDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({fetchFlag:e,areaGeom:u,zoomLevel:o.zoom}),success:function(n){n=="Session timeout"&&(location.reload(),stopAnimation()),n.length>0?i.highlightRoads(n,!0,!0,function(n){var r,t;for(i.roadSegment.selectedFeatures=i.roadSegment.selectedFeatures.concat(n),i.roadSegment.otherinfo.currentfeatures=n,objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.selectedFeatures),i.removeFeatureFromDelegated(),r=0;r<i.roadSegment.selectedFeatures.length;r++)for(t=0;t<objifxStpMap.vectorLayerRoute.features.length;t++)i.roadSegment.selectedFeatures[r].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[t].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[t]);stopAnimation()}):$("#MapUpgrade").val()=="1"?(showWarningPopDialog(Lang_Key.Notification_nounassignedroads,"Ok","","close_alert","",1,"info"),stopAnimation()):(showWarningPopDialog("Selectie is mislukt","Ok","","close_alert","",1,"info"),stopAnimation())},complete:function(){stopAnimation()}})},IfxStpmapRoadOwnership.prototype.deselectLink=function(n){var i=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),t=IfxStpmapCommon.findNearestFeatureIndex(this.roadSegment.selectedFeatures,i.lon,i.lat);objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures[t.index]),this.roadSegment.removedFeatures.push(this.roadSegment.selectedFeatures[t.index]),this.deleteFromLinkInfoList(this.roadSegment.selectedFeatures[t.index].attributes.LINK_ID),this.roadSegment.selectedFeatures.splice(t.index,1)},IfxStpmapRoadOwnership.prototype.showUnassignedRoads=function(){this.csvImportFlag!=!0&&(this.unassignedTimeFlag==0?(startAnimation(Lang_Key.Animation_Please_wait),this.showOwnedRoads("unassigned",function(){stopAnimation()})):objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.unassignedFeatures))},IfxStpmapRoadOwnership.prototype.hideUnassignedRoads=function(){var n=this;objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.unassignedFeatures)},IfxStpmapRoadOwnership.prototype.showAssignedButton=function(){this.roadSegment.linkInfoList.length==0||this.roadSegment.linkInfoList==undefined?($("#assignroads").css("display","none"),$("#clearSelectedRoads").css("display","none")):($("#assignroads").css("display","block"),$("#clearSelectedRoads").css("display","block"))},IfxStpmapRoadOwnership.prototype.clearAllOrgData=function(){objifxStpMap.deleteMapLayer("RoadOwnership"),this.deSelectAllOwnedRoads(!0),clearAllSelectedRoads(),objifxStpMap.vectorLayerDelegRoads.removeFeatures(objifxStpMap.vectorLayerDelegRoads.features),this.roadSegment.ownedFeatures=[],this.roadSegment.ownedLinkIds=[],$("#pageheader").find("h3").text(Lang_Key.RoadOwnerShip_Header),$("#clearOrgData").hide(),document.getElementById("owned").checked=!1,$("#showowned").hide(),this.showAssignedButton()},IfxStpmapRoadOwnership.prototype.clearAllSelectedRoads=function(){objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.unassignedFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(objifxStpMap.vectorLayerDelegRoads.features),this.organisationId=null,document.getElementById("txtLinkSearch").value="",document.getElementById("owned").checked=!1,this.roadSegment.selectedFeatures=[],this.roadSegment.removedFeatures=[],this.roadSegment.linkInfoList=[],this.roadSegment.otherinfo.currentfeatures=[],this.removeDelegationMarker(1),this.removeDelegationMarker(0),this.showAssignedButton(),this.isSelectAll=!1,this.setOwnedRoadsFetchStart=!1},IfxStpmapRoadOwnership.prototype.clearSearchSegments=function(){objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features),document.getElementById("txtLinkSearch").value="",document.getElementById("clearsearchsegments").style.display="none"},IfxStpmapRoadOwnership.prototype.getAllOwnedRoads=function(n){var r,i=this,t=objifxStpMap.getCurrentBoundsAndZoom(),u={OrdinatesArray:[t.bounds.left,t.bounds.top,t.bounds.right,t.bounds.top,t.bounds.right,t.bounds.bottom,t.bounds.left,t.bounds.bottom,t.bounds.left,t.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()};i.organisationId!=null&&i.organisationId!=undefined&&(r=6,$.ajax({url:"/RoadOwnership/GetRoadOwnedDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({organisationId:i.organisationId,fetchFlag:r,areaGeom:u,zoomLevel:t.zoom}),beforeSend:function(){startAnimation(Lang_Key.Animation_Please_wait)},success:function(t){t=="Session timeout"?(location.reload(),stopAnimation()):t.length>0&&i.highlightRoads(t,!0,!0,function(t){n&&typeof n=="function"&&n(t),stopAnimation()})},complete:function(){stopAnimation()}}))},IfxStpmapRoadOwnership.prototype.selectAllOwnedRoads=function(n,t,i){var r=this;this.organisationId=t,this.getAllOwnedRoads(function(t){var f,u;for(r.roadSegment.ownedLinkIds=[],r.roadSegment.selectedFeatures=[],r.isSelectAll=!0,u=0;u<t.length;u++)t[u].data="selected";for(r.roadSegment.ownedFeatures=t,r.roadSegment.selectedFeatures=r.roadSegment.selectedFeatures.concat(t),u=r.roadSegment.selectedFeatures.length-1;u>=0;u--)for(f=0;f<r.roadSegment.removedFeatures.length;f++)if(r.roadSegment.selectedFeatures[u].attributes.LINK_ID==r.roadSegment.removedFeatures[f].attributes.LINK_ID){r.roadSegment.selectedFeatures.splice(u,1);break}if(!n){for(u=0;u<t.length;u++)r.roadSegment.ownedLinkIds.push(t[u].attributes.LINK_ID);r.showAssignedButton()}objifxStpMap.vectorLayerDelegRoads.addFeatures(r.roadSegment.selectedFeatures),i&&typeof i=="function"&&i()})},IfxStpmapRoadOwnership.prototype.deSelectAllOwnedRoads=function(n){var r,t,i;for(this.isSelectAll=!1,r=[],t=this.roadSegment.selectedFeatures.length-1;t>=0;t--)for(i=0;i<this.roadSegment.ownedLinkIds.length;i++)if(this.roadSegment.selectedFeatures[t].attributes.LINK_ID==this.roadSegment.ownedLinkIds[i].linkId){r.push(this.roadSegment.selectedFeatures[t]),this.roadSegment.selectedFeatures.splice(t,1);break}objifxStpMap.vectorLayerDelegRoads.removeFeatures(r),n==!0&&this.deselectAllOwnedLinkIds()},IfxStpmapRoadOwnership.prototype.deselectAllOwnedLinkIds=function(){for(var t,n=this.roadSegment.linkInfoList.length-1;n>=0;n--)for(t=0;t<this.roadSegment.ownedLinkIds.length;t++)if(this.roadSegment.linkInfoList[n].linkId==this.roadSegment.ownedLinkIds[t]){this.roadSegment.linkInfoList.splice(n,1),objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures[n]);break}this.showAssignedButton()},IfxStpmapRoadOwnership.prototype.fetchUnassignedRoadsOnZoomChange=function(n){this.csvImportFlag!=!0&&document.getElementById("unassigned").checked&&this.showOwnedRoads("unassigned",n,!0)},IfxStpmapRoadOwnership.prototype.fetchOwnedRoadsOnZoomChange=function(n){this.csvImportFlag!=!0&&this.setOwnedRoadsFetchStart&&this.showOwnedRoads("owned",n)},IfxStpmapRoadOwnership.prototype.showOwnedRoads=function(n,t,i){if(this.csvImportFlag!=!0){var f,r=this,u=objifxStpMap.getCurrentBoundsAndZoom(),e={OrdinatesArray:[u.bounds.left,u.bounds.top,u.bounds.right,u.bounds.top,u.bounds.right,u.bounds.bottom,u.bounds.left,u.bounds.bottom,u.bounds.left,u.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()};if(n=="owned"){if(r.organisationId==null||r.organisationId==undefined){t&&typeof t=="function"&&t();return}f=1}else f=i?3:2;$.ajax({url:"/RoadOwnership/GetRoadOwnedDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({organisationId:r.organisationId,fetchFlag:f,areaGeom:e,zoomLevel:u.zoom}),beforeSend:function(){},success:function(i){n=="owned"?(objifxStpMap.vectorLayerDelegRoads.removeFeatures(r.roadSegment.ownedFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(r.roadSegment.selectedFeatures)):n=="selected"?objifxStpMap.vectorLayerDelegRoads.removeFeatures(r.roadSegment.selectedFeatures):objifxStpMap.vectorLayerDelegRoads.removeFeatures(r.roadSegment.unassignedFeatures),i=="Session timeout"?(location.reload(),stopAnimation()):i.length>0&&(f==2&&objifxStpMap.searchFeaturesByLinkID([i[Math.round(i.length/2)-1].linkId],function(n){objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,9),r.showOwnedRoads("unassigned",t,!0);return}),r.highlightRoads(i,!0,!1,function(i){n=="owned"?(r.roadSegment.ownedFeatures=[],r.roadSegment.ownedFeatures=i,objifxStpMap.vectorLayerDelegRoads.addFeatures(r.roadSegment.ownedFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(r.roadSegment.selectedFeatures),r.setOwnedRoadsFetchStart=!0,stopAnimation()):n=="selected"?(r.roadSegment.selectedFeatures=[],t&&typeof t=="function"&&t(i),stopAnimation()):(r.roadSegment.unassignedFeatures=[],r.roadSegment.unassignedFeatures=i,objifxStpMap.vectorLayerDelegRoads.addFeatures(r.roadSegment.unassignedFeatures),r.setUnassignedRoadsFetchStart=!0,r.unassignedTimeFlag=1),n=="owned"&&r.isSelectAll==!0?(r.deSelectAllOwnedRoads(!1),r.selectAllOwnedRoads(!1,null,function(){t&&typeof t=="function"&&t()})):t&&typeof t=="function"&&t()}))},complete:function(){r.showAssignedButton()}})}},IfxStpmapRoadOwnership.prototype.zoomInToSelectedLinkId=function(n,t){this.csvImportFlag!=!0&&objifxStpMap.searchFeaturesByLinkID([n],function(n){objifxStpMap.mapType=="Q42016"?objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,9):objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,10),t&&typeof t=="function"&&t()})},IfxStpmapRoadOwnership.prototype.zoomInToOwnedRoad=function(n,t,i){var r,u;this.csvImportFlag!=!0&&(r=this,this.roadSegment.ownedLinkIds=n,u=Math.round(n.length/2),this.organisationId=t,this.roadSegment.linkInfoList=[],n&&n.length>0&&objifxStpMap.searchFeaturesByLinkID([n[u].linkId],function(n){objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,8),startAnimation(Lang_Key.Animation_Please_wait),r.showOwnedRoads("owned",i)}))},IfxStpmapRoadOwnership.prototype.removeFeatureForArea=function(n){for(var t=this.roadSegment.selectedFeatures.length-1;t>=0;t--)n.geometry.intersects(this.roadSegment.selectedFeatures[t].geometry)&&(objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures[t]),this.roadSegment.removedFeatures.push(this.roadSegment.selectedFeatures[t]),this.deleteFromLinkInfoList(this.roadSegment.selectedFeatures[t].attributes.LINK_ID),this.roadSegment.selectedFeatures.splice(t,1),this.roadSegment.otherinfo.currentfeatures.splice(t,1))},IfxStpmapRoadOwnership.prototype.removeFeatureFromDelegated=function(){for(var n,t=0;t<this.roadSegment.removedFeatures.length;t++)for(n=0;n<this.roadSegment.ownedFeatures.length;n++)if(this.roadSegment.removedFeatures[t].attributes.LINK_ID==this.roadSegment.ownedFeatures[n].attributes.LINK_ID){objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.ownedFeatures[n]);break}},IfxStpmapRoadOwnership.prototype.drawPartial=function(n,t){var i=this;objifxStpMap.searchFeaturesByLinkID([n],function(n){var r=LRSMeasure(n[0].geometry,new OpenLayers.Geometry.Point(i.roadSegment.startPointGeom.sdo_point.X,i.roadSegment.startPointGeom.sdo_point.Y),{tolerance:2}),u=LRSMeasure(n[0].geometry,new OpenLayers.Geometry.Point(i.roadSegment.endPointGeom.sdo_point.X,i.roadSegment.endPointGeom.sdo_point.Y),{tolerance:2}),f;f=r<u?LRSSubstring(n[0].geometry,r,u):LRSSubstring(n[0].geometry,u,r),t(new OpenLayers.Feature.Vector(f))})},IfxStpmapRoadOwnership.prototype.updatePointLrs=function(n,t){t=="STARTPOINT"?IfxStpmapCommon.compareGeometries(this.roadSegment.startPointGeom.sdo_point,n.geometry.components[0])?(this.roadSegment.otherinfo.startPoint.fromLrs=this.roadSegment.otherinfo.startPoint.lrsValue,this.roadSegment.otherinfo.startPoint.toLrs=null):IfxStpmapCommon.compareGeometries(this.roadSegment.startPointGeom.sdo_point,n.geometry.components[n.geometry.components.length-1])&&(this.roadSegment.otherinfo.startPoint.fromLrs=null,this.roadSegment.otherinfo.startPoint.toLrs=this.roadSegment.otherinfo.startPoint.lrsValue):IfxStpmapCommon.compareGeometries(this.roadSegment.endPointGeom.sdo_point,n.geometry.components[0])?(this.roadSegment.otherinfo.endPoint.fromLrs=this.roadSegment.otherinfo.endPoint.lrsValue,this.roadSegment.otherinfo.endPoint.toLrs=null):IfxStpmapCommon.compareGeometries(this.roadSegment.endPointGeom.sdo_point,n.geometry.components[n.geometry.components.length-1])&&(this.roadSegment.otherinfo.endPoint.fromLrs=null,this.roadSegment.otherinfo.endPoint.toLrs=this.roadSegment.otherinfo.endPoint.lrsValue)},IfxStpmapRoadOwnership.prototype.showLinkOnMap=function(n){var t=this;objifxStpMap.searchFeaturesByLinkID([n],function(i){var u,r;for(t.roadSegment.otherinfo.currentfeatures=[i[0]],t.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(i[0]),t.roadSegment.linkInfoList.push({linkId:i[0].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),t.roadSegment.selectedFeatures=t.roadSegment.selectedFeatures.concat(i[0]),u=0;u<t.roadSegment.selectedFeatures.length;u++)for(r=0;r<objifxStpMap.vectorLayerRoute.features.length;r++)t.roadSegment.selectedFeatures[u].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[r].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[r]);t.zoomInToSelectedLinkId(n),stopAnimation()})},IfxStpmapRoadOwnership.prototype.selectFormatLink=function(n,t,i){var u=this,r=0;t=="ROADOWNERSHIP_VIEWANDEDIT"&&(r=$("#MapUpgrade").val()),objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(r){var e,o,f,s;r==null||r.length<=0?(stopAnimation(),showNotification("No road selected. Select a valid location.")):(e=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),o=IfxStpmapCommon.findNearestFeatureIndex(r,e.lon,e.lat),t=="ROADOWNERSHIP_VIEWANDEDIT"&&(f=0,s=setInterval(function(){objifxStpMap.flashSelectedLink(r[o.index],f),f==12&&clearTimeout(s),f++},200),u.fetchLinkOwnerShip(r[o.index],i)))},r)},IfxStpmapRoadOwnership.prototype.fetchLinkOwnerShip=function(n,t){var r=this,i=$("#MapUpgrade").val();$.ajax({url:"/DataVerification/LinkOwnerShipDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({linkId:n.attributes.LINK_ID,isMapUpgrade:i,flag:1}),success:function(n){n=="Session timeout"?(location.reload(),stopAnimation()):n!=""?($("#hdnManagerName").val(n.managerName),$("#hdnorganisationId").val(n.manager_Id),n.manager_Id!=undefined&&($("#OrgNam").show(),$("#OrgNmId").val(n.managerName),$("#DDsearchCriteria").val(n.RoadOwnerType),objifxStpMap.geoserverUrl=objifxStpMap.configGeoserverUrl,objifxStpMap.roadOwnershipLayer="NWKMAP:RoadOwnership",objifxStpmapRoadOwnership.showRoadOwnershipMap($("#hdnorganisationId").val())),stopAnimation()):showNotification("Selected road does not have owner. Please select an assigned road")},complete:function(){$("#hdnorganisationId").val()>0?(objifxStpMap.geoserverUrl=objifxStpMap.configGeoserverMU_Url,objifxStpMap.roadOwnershipLayer="NWKMAPUPGRADE:RoadOwnership",t()):showNotification("Selected road does not have owner. Please select an assigned road")}})},IfxStpmapRoadOwnership.prototype.showGeoassignedRoadsMap=function(){objifxStpMap.deleteMapLayer("AutoAssignedLinks");var n=new OpenLayers.Layer.WMS("AutoAssignedLinks",objifxStpMap.configGeoserverMU_Url,{layers:"NWKMAPUPGRADE:AutoAssignedLinks",format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(n),objifxStpMap.olMap.setLayerIndex(n,1)},IfxStpmapRoadOwnership.prototype.toggleGeoassignedRoadsMap=function(n){if(n)this.showGeoassignedRoadsMap();else for(var t=0;t<objifxStpMap.olMap.layers.length;t++)objifxStpMap.olMap.layers[t].name=="AutoAssignedLinks"&&objifxStpMap.deleteMapLayer("AutoAssignedLinks")},IfxStpmapDecisionSpace.prototype.roadSegment={dataArea:"",corridorSelectionValue:"",startPointGeom:{sdo_point:{X:"",Y:""}},endPointGeom:{sdo_point:{X:"",Y:""}},linkInfoList:[],linepartFeatures:[],mandateFeatures:[],corridorFeatures:[],limitedLinkIds:[],selectedFeatures:[],selectedLinkIds:[],removedFeatures:[],basicCheck:"",corridorType:"",status:903001,otherinfo:{startPoint:{geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},endPoint:{geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},linkIds:[],features:[],currentfeatures:[]}},IfxStpmapDecisionSpace.prototype.polygonLayer=null,IfxStpmapDecisionSpace.prototype.fetchLimitedRoadsTimeFlag=0,IfxStpmapDecisionSpace.prototype.setLimitedRoadsFetchStart=!1,IfxStpmapDecisionSpace.prototype.organisationId=0,IfxStpmapDecisionSpace.prototype.colorCode=null,IfxStpmapDecisionSpace.prototype.isSelectAll=null,IfxStpmapDecisionSpace.prototype.deselectTimeFlag=0,IfxStpmapDecisionSpace.prototype.viewLimitationFlag=!1,IfxStpmapDecisionSpace.prototype.includeMandateFlag=!1,IfxStpmapDecisionSpace.prototype.createRoadDelegationToolBar=function(){var t=this,i,n;roadDelegationToolbarPanel=new OpenLayers.Control.Panel({displayClass:"roaddelegationtoolbarpanel"}),objifxStpMap.olMap.addControl(roadDelegationToolbarPanel),i=objifxStpMap.mapType,btnSelectAndPlan=new OpenLayers.Control.Button({displayClass:"selectAndPlanLinks",title:Lang_Key.Tooltip_Select_plann,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(0,"ROADDELEGATION")},deactivate:function(){t.removeDelegationMarker(1),t.removeDelegationMarker(0)}}}),btnSelectByPolygon=new OpenLayers.Control.Button({displayClass:"selectLinksByPolygon",title:Lang_Key.Tooltip_Select_polygon,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){var n=objifxStpMap.olMap.getZoom();n<=8?(selectByPolygon.deactivate(),showWarningPopDialog(Lang_Key.WngPopup_Polygon,"Ok","","close_alert","",1,"info")):selectByPolygon.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(1,"ROADDELEGATION")},deactivate:function(){selectByPolygon.deactivate()}}}),btnSelectByLink=new OpenLayers.Control.Button({displayClass:"selectLinks",title:Lang_Key.Tooltip_Select_Random,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(2,"ROADDELEGATION")},deactivate:function(){}}}),btnDeselectByPolygon=new OpenLayers.Control.Button({displayClass:"deselectLinksByPolygon",type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){deselectByPolygon.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(3,"ROADDELEGATION")},deactivate:function(){deselectByPolygon.deactivate()}}}),btnDeselectLink=new OpenLayers.Control.Button({displayClass:"deselectLinks",title:Lang_Key.Tooltip_DeSelect_Random,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(4,"ROADDELEGATION")},deactivate:function(){}}}),btnUndoSelectAndPlan=new OpenLayers.Control.Button({displayClass:"undoSelectLinks",title:Lang_Key.Tooltip_Undo,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(5,"ROADDELEGATION"),t.undoSelectLink()},deactivate:function(){}}}),btnformatpainter=new OpenLayers.Control.Button({displayClass:"formatpainter",title:Lang_Key.Tooltip_Copy_Restriction,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(6,"ROADDELEGATION")},deactivate:function(){}}}),btncopytocorridor=new OpenLayers.Control.Button({displayClass:"copytocorridor",title:Lang_Key.Tooltip_Copy_to_corridor,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(7,"ROADDELEGATION"),t.selectTargetCorridor(null)},deactivate:function(){}}}),btncopytochangerequests=new OpenLayers.Control.Button({displayClass:"copytochangerequest",title:Lang_Key.Tooltip_Add_corridor_to_selection,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(8,"ROADDELEGATION");var n=$("#dsRes_OrganisationId").val();t.selectTargetCorridor(n)},deactivate:function(){}}}),n=objifxStpMap.getPageType(),n=="MAINTAIN_CORRIDOR_EDITMODE"||n=="MAINTAIN_CORRIDOR"?$("#MapUpgrade").val()==1?$("#OrgId").val()==0?roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan,btnformatpainter]):roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan,btnformatpainter,btncopytocorridor]):roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan,btnformatpainter,btncopytocorridor]):n=="CR_VIEWANDEDIT"||n=="CR_VIEWONLY"?(roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan,btncopytochangerequests]),n=="CR_VIEWANDEDIT"&&(roadDelegationToolbarPanel.div.style.display="inline")):roadDelegationToolbarPanel.addControls([btnSelectAndPlan,btnSelectByPolygon,btnSelectByLink,btnDeselectByPolygon,btnDeselectLink,btnUndoSelectAndPlan]),objifxStpMap.project=="NWK"&&btnSelectByLink.activate()},IfxStpmapDecisionSpace.prototype.activateSelectByLink=function(){btnSelectByLink.activate()},IfxStpmapDecisionSpace.prototype.createPolygonDrawControl=function(){var n=this,t=new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({strokeOpacity:.7,strokeColor:"#1919FF",strokeWidth:3},OpenLayers.Feature.Vector.style["default"]));this.polygonLayer=new OpenLayers.Layer.Vector("Polygon Layer",{styleMap:t}),objifxStpMap.olMap.addLayers([this.polygonLayer]),selectByPolygon=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_Select_polygon,featureAdded:function(t){n.addFeatureForRoads(t),btnSelectByPolygon.deactivate(),n.polygonLayer.removeFeatures(n.polygonLayer.features)}}),deselectByPolygon=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_DeSelect_polygon,featureAdded:function(t){n.removeFeatureForArea(t),btnDeselectByPolygon.deactivate(),n.polygonLayer.removeFeatures(n.polygonLayer.features)}}),objifxStpMap.olMap.addControl(selectByPolygon),objifxStpMap.olMap.addControl(deselectByPolygon)},IfxStpmapDecisionSpace.prototype.highlightRoads=function(n,t,i,r){var f,h,w,c,s,u,l,o,e,a,v,y,p;if(n==null||n==undefined){showNotification(Lang_Key.Notif_No_data_available);return}if(f=this,t!=!0){for(h=[],u=0;u<n.length;u++)h.push(n[u].linkId);objifxStpMap.searchFeaturesByLinkID(h,function(n){f.roadSegment.linkInfoList=n,f.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(n),objifxStpMap.olMap.setLayerIndex("DelegRoads",objifxStpMap.olMap.layers.length-1),objifxStpMap.olMap.zoomToExtent(objifxStpMap.vectorLayerDelegRoads.getDataExtent()),r&&typeof r=="function"&&r()})}else{for(c=objifxStpMap.getPageType(),s=[],u=0;u<n.length;u++){if(n[u].LinkGeometry!=null){for(l=[],o=0;o<n[u].LinkGeometry.OrdinatesArray.length;o+=2)l.push(new OpenLayers.Geometry.Point(n[u].LinkGeometry.OrdinatesArray[o],n[u].LinkGeometry.OrdinatesArray[o+1]));e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(l)),(n[u].fromLinearRef!=null||n[u].toLinearRef!=null)&&(a=IfxStpmapCommon.getLengthOfFeature(e),v=n[u].fromLinearRef==null?0:n[u].fromLinearRef/a,y=n[u].toLinearRef==null?1:n[u].toLinearRef/a,p=LRSSubstring(e.geometry,v,y),e=new OpenLayers.Feature.Vector(p)),n[u].LinkStatus=n[u].LinkStatus==null||n[u].LinkStatus==undefined||n[u].LinkStatus==1||n[u].LinkStatus==0&&c!="MAINTAIN_CORRIDOR_EDITMODE"&&c!="CR_VIEWANDEDIT"?"dsselectown":"dsselectotr",e.data=n[u].LinkStatus,e.attributes={LINK_ID:n[u].LinkId},s.push(e)}i&&(f.roadSegment.linkInfoList.push({linkId:n[u].LinkId}),f.showAssignedButton())}i&&(f.roadSegment.otherinfo.currentfeatures=s),f.addVectorLayers("DelegRoads"),r&&typeof r=="function"&&r(s)}},IfxStpmapDecisionSpace.prototype.addVectorLayers=function(n){for(var t=0;t<objifxStpMap.olMap.layers.length;t++)if(objifxStpMap.olMap.layers[t].name==n)return;n=="DelegRoads"?objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerDelegRoads]):n=="DelegMarkers"&&objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerDelegMarkers])},IfxStpmapDecisionSpace.prototype.selectAndPlanLink=function(n,t){if(t=="STARTPOINT"?startAnimation(Lang_Key.Animation_Please_wait):startAnimation(Lang_Key.Animation_Please_wait),t=="ENDPOINT"&&this.roadSegment.otherinfo.startPoint.linkId==""){stopAnimation();return}var i=this;objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(r){var o;if(r==null||r.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{var e=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),u=IfxStpmapCommon.findNearestFeatureIndex(r,e.lon,e.lat),f=LRSMeasure(r[u.index].geometry,new OpenLayers.Geometry.Point(u.x1,u.y1),{tolerance:.5,details:!0});t=="STARTPOINT"?(i.removeDelegationMarker(1),i.removeDelegationMarker(0),i.roadSegment.startPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(0,u.x1,u.y1),i.fillPointDetails(0,f,r[u.index],{x:u.x1,y:u.y1})):(t="ENDPOINT")&&(i.roadSegment.otherinfo.endPoint.linkId==""?(i.roadSegment.endPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(1,u.x1,u.y1),i.fillPointDetails(1,f,r[u.index],{x:u.x1,y:u.y1})):(i.removeDelegationMarker(1),i.roadSegment.endPointGeom.sdo_point={X:u.x1,Y:u.y1},i.setMarkerPoint(1,u.x1,u.y1),i.roadSegment.otherinfo.startPoint=jQuery.extend(!0,{},i.roadSegment.otherinfo.endPoint),i.fillPointDetails(1,f,r[u.index],{x:u.x1,y:u.y1})))}t=="ENDPOINT"?(o=i.formatRouteRequest(),objifxStpMap.doProcessPlanRouteRequest(o,!1,function(n){var r,t;n[0]!=i.roadSegment.otherinfo.startPoint.feature.attributes.LINK_ID&&n.splice(0,0,i.roadSegment.otherinfo.startPoint.feature.attributes.LINK_ID),n[n.length-1]!=i.roadSegment.otherinfo.endPoint.feature.attributes.LINK_ID&&n.push(i.roadSegment.otherinfo.endPoint.feature.attributes.LINK_ID),i.getFeatureForRoads(null,n,null,function(){stopAnimation()}),r=objifxStpMap.getPageType(),r=="STRUCTURES"&&(t="linear",objifxStpMap.searchFeaturesByLinkID(n,function(n){var i=objifxStpmapStructures.createConstraintReference(null,n,t),r=objifxStpmapStructures.createConstraintGeometry();objifxStpmapStructures.createConstraint(t,r,i),this.clearAllRoads()}))})):stopAnimation()})},IfxStpmapDecisionSpace.prototype.selectByLink=function(n,t){var i=this;objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(r){var f,e;if(r==null||r.length<=0)stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected);else{var o=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),u=IfxStpmapCommon.findNearestFeatureIndex(r,o.lon,o.lat),s=0;for(f=0;f<i.roadSegment.linkInfoList.length;f++)if(i.roadSegment.linkInfoList[f].linkId==r[u.index].attributes.LINK_ID){s=1;break}if(s==0)if(t=="MAINTAIN_CORRIDOR_EDITMODE"||t=="CR_VIEWANDEDIT")if($("#MapUpgrade").val()==1)for(i.roadSegment.otherinfo.currentfeatures=[r[u.index]],i.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(r[u.index]),i.roadSegment.linkInfoList.push({linkId:r[u.index].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),i.roadSegment.selectedFeatures=i.roadSegment.selectedFeatures.concat(r[u.index]),f=0;f<i.roadSegment.selectedFeatures.length;f++)for(e=0;e<objifxStpMap.vectorLayerRoute.features.length;e++)i.roadSegment.selectedFeatures[f].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[e].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[e]);else i.selectRestrictionLink(r[u.index]);else t=="LBOV"?i.selectDSLBOVLink(r[u.index]):i.selectLZVAgriConvoyLink(r[u.index])}})},IfxStpmapDecisionSpace.prototype.selectRestrictionLink=function(n){var t=this;this.getFeatureForRoads(null,[n.attributes.LINK_ID],null,function(){stopAnimation()})},IfxStpmapDecisionSpace.prototype.selectFormatLink=function(n,t){var i=this,r=0;t=="MAINTAIN_CORRIDOR_EDITMODE"&&(r=$("#MapUpgrade").val()),objifxStpMap.searchFeaturesByXY(n.xy.x,n.xy.y,!1,objifxStpMap.boundaryOffset,function(r){var e,u,f,o;r==null||r.length<=0?(stopAnimation(),showNotification(Lang_Key.NotifNoRoadSelected)):(e=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),u=IfxStpmapCommon.findNearestFeatureIndex(r,e.lon,e.lat),t=="MAINTAIN_CORRIDOR_EDITMODE"?(f=0,o=setInterval(function(){objifxStpMap.flashSelectedLink(r[u.index],f),f==12&&clearTimeout(o),f++},200),i.fetchLinkRestriction(r[u.index])):i.selectLZVAgriConvoyLink(r[u.index]))},r)},IfxStpmapDecisionSpace.prototype.selectTargetCorridor=function(n){var u=Math.random(),r;resetdialogue();var t="",i=1,f=0;n!=null?t=n:$("#MapUpgrade").val()==1?(t=$("#OrgId").val(),i=0):t=this.organisationId,r="../../DecisionSpace/RestrictionSellection?page=1&pageSize=10&TypeId="+t+"&random="+u+"&copytoflag="+i+"&isMapUpgrade="+f,$("#dialogue").load(r,function(){CheckSessionTimeOut(),removescroll(),$("#dialogue").show(),$("#overlay").show(),$(".loading").hide()})},IfxStpmapDecisionSpace.prototype.fetchLinkRestriction=function(n){var i=this,t=$("#MapUpgrade").val();$.ajax({url:"/DecisionSpace/CorridorLinkDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({linkId:n.attributes.LINK_ID,restrictSelectFlag:1,isMapUpgrade:t,flag:1}),success:function(n){n=="Session timeout"?(location.reload(),stopAnimation()):n!=""?(t==1&&n.IsBasic==1&&$("#hdnIsBasic").val(n.IsBasic),$("#txtMaxLen").val(n.MaxLength),$("#txtMaxWidth").val(n.MaxWidth),$("#txtMaxHeight").val(n.MaxHeight),$("#txtMaxWeight").val(n.MaxWeight),$("#txtMaxNormalAxel").val(n.MaxNormalAxisLoad),$("#txtMaxShuttleaxel").val(n.MaxShuttleAxisLoad),$("#cbLengthFL").prop("checked",n.PhysicalLengthFL=="1"?!0:!1),$("#cbMaxWidthFL").prop("checked",n.PhysicalWidthFL=="1"?!0:!1),$("#cbMaxHeightFL").prop("checked",n.PhysicalHeightFL=="1"?!0:!1),$("#cbMaxWeightFL").prop("checked",n.PhysicalWeightFL=="1"?!0:!1),$("#cbMaxNormalAxelFL").prop("checked",n.PhysicalMaxNormalAxisFL=="1"?!0:!1),$("#cbMaxShuttleaxelFL").prop("checked",n.PhysicalMaxShuttleAxisFL=="1"?!0:!1),$("#MapUpgrade").val()==1&&($("#idCorridorSelectedTable").show(),$("#saveRoads").show(),$("#orgNam").show(),$("#DDsearchCriteria").val(n.DSCode),$("#OrgNmId").val(n.OrganisationName),$("#corridorSelectButton").show(),DecisionSpaceId=n.DecisionSpaceId,corridor.RestrictionId=n.RestrictionId,corridor.TypeId=n.RestrictionId,corridor.MaxLength=n.MaxLength,corridor.MaxWidth=n.MaxWidth,corridor.MaxHeight=n.MaxHeight,corridor.MaxWeight=n.MaxWeight,corridor.MaxNormalAxisLoad=n.MaxNormalAxisLoad,corridor.MaxShuttleAxisLoad=n.MaxShuttleAxisLoad,$("#OrgId").val(n.OrganisationId),objifxStpMap.geoserverUrl=objifxStpMap.configGeoserverUrl,objifxStpMap.restrictionLayer="NWKMAP:DS_Restrictions",openCorridorSelection(corridor,$("#OrgId").val(),DecisionSpaceId),objifxStpmapDecisionSpace.createRoadDelegationToolBar()),stopAnimation()):showNotification(Lang_Key.Notif_No_Resstriction_Found)},complete:function(){$("#MapUpgrade").val()==1&&(objifxStpMap.geoserverUrl=objifxStpMap.configGeoserverMU_Url,objifxStpMap.restrictionLayer="NWKMAPUPGRADE:DS_Restrictions"),stopAnimation()}})},IfxStpmapDecisionSpace.prototype.selectLZVAgriConvoyLink=function(n){var i,t;for(this.roadSegment.linkInfoList.push({linkId:n.attributes.LINK_ID}),n.data="dsselectown",this.roadSegment.selectedFeatures=this.roadSegment.selectedFeatures.concat([n]),this.roadSegment.otherinfo.currentfeatures=[n],this.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.selectedFeatures),this.removeFeatureFromDelegated(),i=0;i<this.roadSegment.selectedFeatures.length;i++)for(t=0;t<objifxStpMap.vectorLayerRoute.features.length;t++)this.roadSegment.selectedFeatures[i].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[t].attributes.LINK_ID&&this.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[t]);this.showAssignedButton(),stopAnimation()},IfxStpmapDecisionSpace.prototype.selectDSLBOVLink=function(n){var i,t,r;for(this.roadSegment.linkInfoList.push({linkId:n.attributes.LINK_ID}),n.data="dsselectown",this.roadSegment.selectedFeatures=this.roadSegment.selectedFeatures.concat([n]),this.roadSegment.otherinfo.currentfeatures=[n],this.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(this.roadSegment.selectedFeatures),this.removeFeatureFromDelegated(),i=0;i<this.roadSegment.selectedFeatures.length;i++)for(t=0;t<objifxStpMap.vectorLayerRoute.features.length;t++)this.roadSegment.selectedFeatures[i].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[t].attributes.LINK_ID&&this.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[t]);this.showAssignedButton(),r=getCorridorLinkInfo(),r.length>0&&$("#tblOrgLBOVSave").show(),stopAnimation()},IfxStpmapDecisionSpace.prototype.removePreviousLinkStatus=function(n){for(var t=0;t<this.roadSegment.linkInfoList.length;t++)if(this.roadSegment.linkInfoList[t].linkId==n){this.roadSegment.linkInfoList.splice(t,1);break}},IfxStpmapDecisionSpace.prototype.setStatus=function(n){this.roadSegment.status=n},IfxStpmapDecisionSpace.prototype.fillPointDetails=function(n,t,i,r){var u;n==0?(u=this.roadSegment.otherinfo.startPoint,this.roadSegment.otherinfo.endPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""}):u=this.roadSegment.otherinfo.endPoint,u.lrsValue=Math.round(t.length),u.linkId=i.attributes.LINK_ID,u.geom.sdo_point={X:r.x,Y:r.y},u.feature=i,i.attributes.DIR_TRAVEL=="B"?t.measure<=.5?(u.beginNodeId=i.attributes.REF_IN_ID,u.endNodeId=i.attributes.NREF_IN_ID):(u.beginNodeId=i.attributes.NREF_IN_ID,u.endNodeId=i.attributes.REF_IN_ID):i.attributes.DIR_TRAVEL=="F"&&n==0||i.attributes.DIR_TRAVEL=="T"&&n==1?(u.beginNodeId=i.attributes.NREF_IN_ID,u.endNodeId=i.attributes.REF_IN_ID):(u.beginNodeId=i.attributes.REF_IN_ID,u.endNodeId=i.attributes.NREF_IN_ID)},IfxStpmapDecisionSpace.prototype.formatRouteRequest=function(){var n={WayPoints:[],MaxHeight:"0",MaxWeight:"0",MaxLength:"0",MaxWidth:"0",MaxNormAxleLoad:"0",MaxShutAxleLoad:"0"};return n.BeginStartNode=this.roadSegment.otherinfo.startPoint.beginNodeId,n.BeginPointLinkId=this.roadSegment.otherinfo.startPoint.linkId,n.BeginPointEndNode=this.roadSegment.otherinfo.startPoint.endNodeId,n.EndPointStartNode=this.roadSegment.otherinfo.endPoint.beginNodeId,n.EndPointLinkId=this.roadSegment.otherinfo.endPoint.linkId,n.EndPointEndNode=this.roadSegment.otherinfo.endPoint.endNodeId,n},IfxStpmapDecisionSpace.prototype.createFeatureForRoadSegment=function(){var n,t;this.roadSegment.otherinfo.features!=null&&(this.roadSegment.otherinfo.currentfeatures=this.roadSegment.otherinfo.features.slice(0)),this.roadSegment.otherinfo.linkIds.length>0?(t=IfxStpmapCommon.getFeatureOfLinkId(this.roadSegment.otherinfo.features,this.roadSegment.otherinfo.linkIds[0]),n=IfxStpmapCommon.getRoutePointSegmentFeature(this.roadSegment.otherinfo.startPoint.geom,this.roadSegment.otherinfo.startPoint.feature,t,"STARTPOINT"),n.feature.data="corridorselect",n.feature.geometry!=null?(this.roadSegment.otherinfo.startPoint.feature&&(n.feature.attributes=this.roadSegment.otherinfo.startPoint.feature.attributes),this.roadSegment.otherinfo.currentfeatures.push(n.feature),this.updatePointLrs(n.feature,"STARTPOINT")):this.roadSegment.otherinfo.currentfeatures.push(this.roadSegment.otherinfo.startPoint.feature),t=IfxStpmapCommon.getFeatureOfLinkId(this.roadSegment.otherinfo.features,this.roadSegment.otherinfo.linkIds[this.roadSegment.otherinfo.linkIds.length-1]),n=IfxStpmapCommon.getRoutePointSegmentFeature(this.roadSegment.otherinfo.endPoint.geom,this.roadSegment.otherinfo.endPoint.feature,t,"ENDPOINT"),n.feature.data="corridorselect",n.feature.geometry!=null?(this.roadSegment.otherinfo.endPoint.feature&&(n.feature.attributes=this.roadSegment.otherinfo.endPoint.feature.attributes),this.roadSegment.otherinfo.currentfeatures.push(n.feature),this.updatePointLrs(n.feature,"ENDPOINT")):this.roadSegment.otherinfo.currentfeatures.push(routeSegment.otherinfo.endSegmentfeature)):(n=IfxStpmapCommon.getRoutePointSegmentFeature(this.roadSegment.otherinfo.startPoint.geom,this.roadSegment.otherinfo.startPoint.feature,this.roadSegment.otherinfo.endPoint.feature,"STARTPOINT"),n.feature.data="corridorselect",n.feature.geometry!=null&&this.roadSegment.otherinfo.startPoint.feature&&(n.feature.attributes=this.roadSegment.otherinfo.startPoint.feature.attributes),this.roadSegment.otherinfo.currentfeatures.push(n.feature),n=IfxStpmapCommon.getRoutePointSegmentFeature(this.roadSegment.otherinfo.endPoint.geom,this.roadSegment.otherinfo.endPoint.feature,this.roadSegment.otherinfo.startPoint.feature,"ENDPOINT"),n.feature.data="corridorselect",n.feature.geometry!=null&&this.roadSegment.otherinfo.endPoint.feature&&(n.feature.attributes=this.roadSegment.otherinfo.endPoint.feature.attributes),this.roadSegment.otherinfo.currentfeatures.push(n.feature))},IfxStpmapDecisionSpace.prototype.undoSelectLink=function(){if(this.deletePreviousLinks(),this.roadSegment.otherinfo.startPoint.geom.sdo_point.X==this.roadSegment.startPointGeom.sdo_point.X&&this.roadSegment.otherinfo.startPoint.geom.sdo_point.Y==this.roadSegment.startPointGeom.sdo_point.Y?(this.roadSegment.otherinfo.startPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},this.roadSegment.otherinfo.endPoint={geom:{sdo_point:{X:"",Y:""}},feature:"",beginNodeId:"",endNodeId:"",linkId:"",fromLrs:"",toLrs:"",lrsValue:""},this.removeDelegationMarker(1),this.removeDelegationMarker(0)):(this.roadSegment.otherinfo.endPoint=jQuery.extend(!0,{},this.roadSegment.otherinfo.startPoint),this.removeDelegationMarker(1),this.setMarkerPoint(1,this.roadSegment.otherinfo.endPoint.geom.sdo_point.X,this.roadSegment.otherinfo.endPoint.geom.sdo_point.Y)),pageType="LBOV"){var n=getCorridorLinkInfo();n.length==0&&$("#tblOrgLBOVSave").hide()}},IfxStpmapDecisionSpace.prototype.setMarkerPoint=function(n,t,i){var r,u;n==0?(markerName="DELEGSTARTPOINT",r=IfxStpmapCommon.getDelegationMarkerImage(n),markerStyle={externalGraphic:r,graphicHeight:40,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-40}):(markerName="DELEGENDPOINT",r=IfxStpmapCommon.getDelegationMarkerImage(n),markerStyle={externalGraphic:r,graphicHeight:40,graphicWidth:24,graphicXOffset:-12,graphicYOffset:-40}),u=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t,i),{name:markerName},markerStyle),this.addVectorLayers("DelegMarkers"),objifxStpMap.vectorLayerDelegMarkers.addFeatures(u)},IfxStpmapDecisionSpace.prototype.removeDelegationMarker=function(n){objifxStpMap.vectorLayerDelegMarkers.removeFeatures(objifxStpMap.vectorLayerDelegMarkers.features[n])},IfxStpmapDecisionSpace.prototype.updateLinkInfoList=function(){for(var t=!1,i,r,u,n=this.roadSegment.linkInfoList.length-1;n>0;n--)if(this.roadSegment.linkInfoList[n].linkId==this.roadSegment.otherinfo.startPoint.linkId){this.roadSegment.linkInfoList[n].fromLinearRef=null,this.roadSegment.linkInfoList[n].toLinearRef=null,t=!0;break}for(t||(i={linkId:this.roadSegment.otherinfo.startPoint.linkId,fromLinearRef:this.roadSegment.otherinfo.startPoint.fromLrs,toLinearRef:this.roadSegment.otherinfo.startPoint.toLrs},this.roadSegment.linkInfoList.push(i)),n=0;n<this.roadSegment.otherinfo.linkIds.length;n++)r={linkId:this.roadSegment.otherinfo.linkIds[n],fromLinearRef:null,toLinearRef:null},this.roadSegment.linkInfoList.push(r);u={linkId:this.roadSegment.otherinfo.endPoint.linkId,fromLinearRef:this.roadSegment.otherinfo.endPoint.fromLrs,toLinearRef:this.roadSegment.otherinfo.endPoint.toLrs},this.roadSegment.linkInfoList.push(u),this.showAssignedButton()},IfxStpmapDecisionSpace.prototype.deletePreviousLinks=function(){for(var t,i,n=0;n<this.roadSegment.otherinfo.currentfeatures.length;n++){for(t=this.roadSegment.linkInfoList.length-1;t>=0;t--)if(this.roadSegment.otherinfo.currentfeatures[n].attributes.LINK_ID==this.roadSegment.linkInfoList[t].linkId){this.roadSegment.linkInfoList.splice(t,1);break}for(i=this.roadSegment.selectedFeatures.length-1;i>=0;i--)this.roadSegment.otherinfo.currentfeatures[n].attributes.LINK_ID==this.roadSegment.selectedFeatures[i].attributes.LINK_ID&&this.roadSegment.selectedFeatures.splice(i,1)}objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.otherinfo.currentfeatures),this.showAssignedButton()},IfxStpmapDecisionSpace.prototype.deleteFromLinkInfoList=function(n){for(var t=this.roadSegment.linkInfoList.length-1;t>=0;t--)if(this.roadSegment.linkInfoList[t].linkId==n){this.roadSegment.linkInfoList.splice(t,1);break}this.showAssignedButton()},IfxStpmapDecisionSpace.prototype.getCorridorLinkInfo=function(){var t,n;for(this.roadSegment.limitedLinkIds=[],this.isSelectAll=!1,t=[],n=0;n<this.roadSegment.linkInfoList.length;n++)t.push({linkID:this.roadSegment.linkInfoList[n].linkId,Status:""});return t},IfxStpmapDecisionSpace.prototype.addFeatureForRoads=function(n){startAnimation(Lang_Key.Animation_Please_wait),this.getFeatureForRoads(n,null,null,function(){stopAnimation()})},IfxStpmapDecisionSpace.prototype.getFeatureForRoads=function(n,t,i){var p=0,f,u,s,e,l,h,c,o,a,v,y;if(objifxStpMap.pageType=="CONVOY"&&(p=1),f=this,n!=null){for(u=objifxStpMap.getCurrentBoundsAndZoom(),s={OrdinatesArray:[],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},e=0,l=0;e<n.geometry.components[0].components.length;e++)s.OrdinatesArray[l++]=n.geometry.components[0].components[e].x,s.OrdinatesArray[l++]=n.geometry.components[0].components[e].y;h="",objifxStpMap.mapType=="Q42016"&&objifxStpMap.pageType=="LZV"?h="2016LZV":objifxStpMap.mapType=="Q42016"&&objifxStpMap.pageType=="AGRICULTURE"&&(h="2016AGRI");var c=$("#MapUpgrade").val(),o="/DecisionSpace/GetLinkDetails",a=JSON.stringify({organisationId:f.organisationId,areaGeom:s,zoomLevel:u.zoom,mapType:h,isMapUpgrade:c,IsConvoy:p})}else if(t!=null)c=0,objifxStpMap.mapType=="Q42016"&&(c=1),o="/DecisionSpace/GetOwnedLinks",a=JSON.stringify({organisationId:f.organisationId,linkIdList:t,isMapUpgrade:c});else if(i!=null)o=null,o=$("#MapUpgrade").val()==1?"/DataVerification/GetCorridorLinks":objifxStpMap.mapType=="Q42016"?"/DataVerification/GetCorridorLinks":"/DecisionSpace/GetCorridorLinks",a=JSON.stringify({dsId:i});else var u=objifxStpMap.getCurrentBoundsAndZoom(),s={OrdinatesArray:[u.bounds.left,u.bounds.top,u.bounds.right,u.bounds.top,u.bounds.right,u.bounds.bottom,u.bounds.left,u.bounds.bottom,u.bounds.left,u.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},o="/DecisionSpace/GetRoadOwnedDetails",a=JSON.stringify({organisationId:f.organisationId,fetchFlag:6,areaGeom:s,zoomLevel:u.zoom});v=!0,y=!0,objifxStpMap.pageType=="CONVOY"&&(v=!1,y=!1),$.ajax({url:o,type:"POST",cache:v,async:y,contentType:"application/json; charset=utf-8",data:a,beforeSend:function(){},success:function(n){var i,t,r;if(n=="Session timeout"&&(location.reload(),stopAnimation()),n.length>0){if(i=[],t=[],$("#MapUpgrade").val()==1)for(e=0;e<n.length;e++)n[e].LinkStatus=1;$.each(n,function(n,r){objifxStpMap.getPageType()=="MAINTAIN_CORRIDOR_EDITMODE"||objifxStpMap.getPageType()=="CR_VIEWANDEDIT"?(r.LinkStatus==1||$("#MapUpgrade").val()==1)&&$.inArray(r.LinkId,t)===-1&&(i.push(r),t.push(r.LinkId)):$.inArray(r.LinkId,t)===-1&&(i.push(r),t.push(r.LinkId))}),f.highlightRoads(i,!0,!0,function(n){var i,t;for(f.roadSegment.selectedFeatures=f.roadSegment.selectedFeatures.concat(n),f.roadSegment.otherinfo.currentfeatures=n,objifxStpMap.vectorLayerDelegRoads.addFeatures(f.roadSegment.selectedFeatures),f.removeFeatureFromDelegated(),i=0;i<f.roadSegment.selectedFeatures.length;i++)for(t=0;t<objifxStpMap.vectorLayerRoute.features.length;t++)f.roadSegment.selectedFeatures[i].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[t].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[t])}),objifxStpMap.pageType=="LBOV"&&(r=getCorridorLinkInfo(),r.length>0&&$("#tblOrgLBOVSave").show())}else showNotification(Lang_Key.NotifNoRoadFnd)},complete:function(){stopAnimation()}})},IfxStpmapDecisionSpace.prototype.FetchAllCorridorRoads=function(n,t){var i=this.roadSegment,r="/DecisionSpace/GetCorridorLinks",u=JSON.stringify({dsId:n});$.ajax({url:r,type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:u,success:function(n){var u,t,r;if(n=="Session timeout"&&(location.reload(),stopAnimation()),n.length>0)for(u=[],t=[],$.each(n,function(n,i){$.inArray(i.LinkId,t)===-1&&(u.push(i),t.push(i.LinkId))}),r=0;r<t.length;r++)i.linkInfoList.push({linkId:t[r]})},complete:function(){t()}})},IfxStpmapDecisionSpace.prototype.deselectLink=function(n){var i=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y}),t=IfxStpmapCommon.findNearestFeatureIndex(this.roadSegment.selectedFeatures,i.lon,i.lat),r;objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures[t.index]),this.roadSegment.removedFeatures.push(this.roadSegment.selectedFeatures[t.index]),this.deleteFromLinkInfoList(this.roadSegment.selectedFeatures[t.index].attributes.LINK_ID),this.roadSegment.selectedFeatures.splice(t.index,1),(pageType="LBOV")&&(r=getCorridorLinkInfo(),r.length==0&&$("#tblOrgLBOVSave").hide())},IfxStpmapDecisionSpace.prototype.showAssignedButton=function(){this.roadSegment.linkInfoList.length==0||this.roadSegment.linkInfoList==undefined?($("#divReplaceLinks").hide(),$("#divSetDafault").hide(),$("#clearSelectedRoads").hide(),$("#btn_clearAll").hide(),$("#btnSave").hide(),$("#divReplaceLinks").hide(),$("#divSetDafault").hide(),$("#btnClear").hide(),objifxStpMap.mapType=="Q42016"&&objifxStpMap.pageType=="LZV"&&$("input:radio[name='LZV']").hide(),objifxStpMap.mapType=="Q42016"&&objifxStpMap.pageType=="AGRICULTURE"&&$("input:radio[name='AGRICULTURE']").hide()):($("#idEditRoads").hide(),$("#MapUpgrade").val()==0&&$("#saveRoads").show(),$("#divReplaceLinks").show(),$("#divSetDafault").show(),$("#clearSelectedRoads").show(),$("#btn_clearAll").show(),$("#errLinkID").hide(),$("#btnSave").show(),$("#btnClear").show(),objifxStpMap.mapType=="Q42016"&&objifxStpMap.pageType=="LZV"&&$("input:radio[name='LZV']").show(),objifxStpMap.mapType=="Q42016"&&objifxStpMap.pageType=="AGRICULTURE"&&$("input:radio[name='AGRICULTURE']").show())},IfxStpmapRoadOwnership.prototype.showAssignedButton=function(){this.roadSegment.linkInfoList.length==0||this.roadSegment.linkInfoList==undefined?($("#assignroads").css("display","none"),$("#clearSelectedRoads").css("display","none")):($("#assignroads").css("display","block"),$("#clearSelectedRoads").css("display","block"))},IfxStpmapDecisionSpace.prototype.clearAllOrgData=function(){this.deselectAllCorridorRoads(!0),objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.linepartFeatures),this.roadSegment.linepartFeatures=[],this.roadSegment.limitedLinkIds=[],$("#pageheader").find("h3").text("Selecteer wegbeheerder"),$("#clearOrgData").hide(),document.getElementById("limited").checked=!1,$("#showlimited").hide(),this.showAssignedButton()},IfxStpmapDecisionSpace.prototype.clearAllSelectedRoads=function(){objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures),this.roadSegment.selectedFeatures=[],this.roadSegment.removedFeatures=[],this.roadSegment.linkInfoList=[],this.roadSegment.otherinfo.currentfeatures=[],this.removeDelegationMarker(1),this.removeDelegationMarker(0),this.showAssignedButton(),this.isSelectAll=!1},IfxStpmapDecisionSpace.prototype.clearAllRoads=function(){objifxStpMap.vectorLayerDelegRoads.removeFeatures(objifxStpMap.vectorLayerDelegRoads.features),this.roadSegment.linkInfoList=[],this.roadSegment.linepartFeatures=[],this.roadSegment.mandateFeatures=[],this.roadSegment.corridorFeatures=[],this.roadSegment.limitedLinkIds=[],this.roadSegment.selectedFeatures=[],this.roadSegment.selectedLinkIds=[],this.roadSegment.removedFeatures=[],this.roadSegment.basicCheck="",this.roadSegment.corridorType="",this.removeDelegationMarker(1),this.removeDelegationMarker(0),this.showAssignedButton(),this.isSelectAll=!1},IfxStpmapDecisionSpace.prototype.clearSearchSegments=function(){objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features),document.getElementById("txtLinkSearch").value="",document.getElementById("clearsearchsegments").style.display="none"},IfxStpmapDecisionSpace.prototype.getAllCorridorRoads=function(n){var u=this,t=objifxStpMap.getCurrentBoundsAndZoom(),f={OrdinatesArray:[t.bounds.left,t.bounds.top,t.bounds.right,t.bounds.top,t.bounds.right,t.bounds.bottom,t.bounds.left,t.bounds.bottom,t.bounds.left,t.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},i,r;this.roadSegment.corridorSelectionValue=="corridor"?(i=4,r=this.roadSegment.corridorType.TypeId):(i=6,r=this.roadSegment.basicCheck.TypeId),$.ajax({url:"/DecisionSpace/GetLimitedRoadDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({organisationId:u.organisationId,fetchFlag:i,areaGeom:f,zoomLevel:t.zoom,typeId:r}),beforeSend:function(){startAnimation(Lang_Key.Animation_Please_wait)},success:function(t){t=="Session timeout"?(location.reload(),stopAnimation()):t.length>0&&u.highlightRoads(t,!0,!1,function(t){n&&typeof n=="function"&&n(t),stopAnimation()})},complete:function(){stopAnimation()}})},IfxStpmapDecisionSpace.prototype.selectITSCoreAreas=function(n){var t=this;this.getFeatureForRoads(null,null,n,function(){stopAnimation()})},IfxStpmapDecisionSpace.prototype.selectAllOwnedRoads=function(){this.getFeatureForRoads(null,null,null,function(){stopAnimation()})},IfxStpmapDecisionSpace.prototype.selectAllCorridorRoads=function(n){var t=this;this.getFeatureForRoads(null,null,n,function(){stopAnimation()})},IfxStpmapDecisionSpace.prototype.deselectAllCorridorRoads=function(n){startAnimation(Lang_Key.Animation_Please_wait);var t=this;t.isSelectAll=!1,objifxStpMap.vectorLayerDelegRoads.removeFeatures(t.roadSegment.selectedFeatures),t.roadSegment.selectedFeatures=[],n==!0&&t.deselectAllCorridorLinkIds()},IfxStpmapDecisionSpace.prototype.deselectAllCorridorLinkIds=function(){this.roadSegment.linkInfoList=[],this.showAssignedButton(),stopAnimation()},IfxStpmapDecisionSpace.prototype.fetchLimitedRoadsOnZoomChange=function(n){var t=this;this.setLimitedRoadsFetchStart&&(this.viewLimitationFlag?this.includeMandateFlag?this.showLimitedRoads("mandate",function(){t.showLimitedRoads("linepart",function(){t.showLimitedRoads("corridor",n)})}):t.showLimitedRoads("linepart",function(){t.showLimitedRoads("corridor",n)}):t.showLimitedRoads("corridor",n))},IfxStpmapDecisionSpace.prototype.showLimitedRoads=function(n,t){var o="",i=this,f=0,r=objifxStpMap.getCurrentBoundsAndZoom(),e={OrdinatesArray:[r.bounds.left,r.bounds.top,r.bounds.right,r.bounds.top,r.bounds.right,r.bounds.bottom,r.bounds.left,r.bounds.bottom,r.bounds.left,r.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},u;i.organisationId!=null&&i.organisationId!=undefined&&i.organisationId!=0&&(n=="linepart"?u=1:n=="mandate"?u=3:n=="corridor"&&(this.roadSegment.corridorSelectionValue=="corridor"?(u=4,f=this.roadSegment.corridorType.TypeId):(u=6,f=this.roadSegment.basicCheck.TypeId)),$.ajax({url:"/DecisionSpace/GetLimitedRoadDetails",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({organisationId:i.organisationId,fetchFlag:u,areaGeom:e,zoomLevel:r.zoom,typeId:f}),beforeSend:function(){},success:function(r){n=="linepart"?(objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.linepartFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.selectedFeatures)):n=="mandate"?(objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.mandateFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.selectedFeatures)):n=="corridor"?(objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.corridorFeatures),objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.selectedFeatures)):n=="selected"&&objifxStpMap.vectorLayerDelegRoads.removeFeatures(i.roadSegment.selectedFeatures),r=="Session timeout"?(location.reload(),stopAnimation()):r.length>0?i.highlightRoads(r,!0,!1,function(r){n=="linepart"?(i.roadSegment.linepartFeatures=[],i.roadSegment.linepartFeatures=r,objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.linepartFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.selectedFeatures),i.setLimitedRoadsFetchStart=!0):n=="mandate"?(i.roadSegment.mandateFeatures=[],i.roadSegment.mandateFeatures=r,objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.mandateFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.selectedFeatures),i.setLimitedRoadsFetchStart=!0):n=="corridor"?(i.roadSegment.corridorFeatures=[],i.roadSegment.corridorFeatures=r,objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.corridorFeatures),objifxStpMap.vectorLayerDelegRoads.addFeatures(i.roadSegment.selectedFeatures),i.setLimitedRoadsFetchStart=!0):n=="selected"&&(i.roadSegment.selectedFeatures=[],t&&typeof t=="function"&&t(r)),n=="corridor"&&i.isSelectAll==!0?(i.deselectAllCorridorRoads(!1),i.selectAllCorridorRoads(!1,function(){t&&typeof t=="function"&&t()})):t&&typeof t=="function"&&t()}):t&&typeof t=="function"&&t()},complete:function(){}}))},IfxStpmapDecisionSpace.prototype.zoomInToSelectedLinkId=function(n,t,i,r){objifxStpMap.searchFeaturesByLinkID([n],function(n){if(i==!0){var u=new OpenLayers.Bounds;u.extend(new OpenLayers.LonLat(r.x1,r.y1)),u.extend(new OpenLayers.LonLat(r.x2,r.y2)),objifxStpMap.olMap.zoomToExtent(u,!0)}else objifxStpMap.mapType=="Q42016"&&(objifxStpMap.pageType=="LZV"||objifxStpMap.pageType=="AGRICULTURE"||objifxStpMap.pageType=="MAINTAIN_CORRIDOR_EDITMODE")?objifxStpMap.olMap.setCenter([n[0].geometry.components[0].x,n[0].geometry.components[0].y],9):objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,12);t&&typeof t=="function"&&t()})},IfxStpmapDecisionSpace.prototype.zoomInToLimitedRoad=function(n,t,i,r){var u=this,e=Math.round(n.length/2)-1,f;this.organisationId=t,this.roadSegment.linkInfoList=[],i=="corridor"?(f=8,this.roadSegment.limitedLinkIds=n):f=6,n&&n.length>0&&objifxStpMap.searchFeaturesByLinkID([n[e].linkId],function(n){objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,f),u.viewLimitationFlag?u.includeMandateFlag?(startAnimation(Lang_Key.Animation_Please_wait),u.showLimitedRoads("mandate",function(){startAnimation(Lang_Key.Animation_Please_wait),u.showLimitedRoads("linepart",function(){i=="corridor"?(startAnimation(Lang_Key.Animation_Please_wait),u.showLimitedRoads("corridor",r)):r&&typeof r=="function"&&r()})})):(startAnimation(Lang_Key.Animation_Please_wait),u.showLimitedRoads("linepart",function(){i=="corridor"?(startAnimation(Lang_Key.Animation_Please_wait),u.showLimitedRoads("corridor",r)):r&&typeof r=="function"&&r()})):i=="corridor"?(startAnimation(Lang_Key.Animation_Please_wait),u.showLimitedRoads("corridor",r)):r&&typeof r=="function"&&r()})},IfxStpmapDecisionSpace.prototype.removeFeatureForArea=function(n){for(var i,t=this.roadSegment.selectedFeatures.length-1;t>=0;t--)n.geometry.intersects(this.roadSegment.selectedFeatures[t].geometry)&&(objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.selectedFeatures[t]),this.roadSegment.removedFeatures.push(this.roadSegment.selectedFeatures[t]),this.deleteFromLinkInfoList(this.roadSegment.selectedFeatures[t].attributes.LINK_ID),this.roadSegment.selectedFeatures.splice(t,1));(pageType="LBOV")&&(i=getCorridorLinkInfo(),i.length==0&&$("#tblOrgLBOVSave").hide())},IfxStpmapDecisionSpace.prototype.removeFeatureFromDelegated=function(){for(var n,t=0;t<this.roadSegment.removedFeatures.length;t++)for(n=0;n<this.roadSegment.linepartFeatures.length;n++)if(this.roadSegment.removedFeatures[t].attributes.LINK_ID==this.roadSegment.linepartFeatures[n].attributes.LINK_ID){objifxStpMap.vectorLayerDelegRoads.removeFeatures(this.roadSegment.linepartFeatures[n]);break}},IfxStpmapDecisionSpace.prototype.drawPartial=function(n,t){var i=this;objifxStpMap.searchFeaturesByLinkID([n],function(n){var r=LRSMeasure(n[0].geometry,new OpenLayers.Geometry.Point(i.roadSegment.startPointGeom.sdo_point.X,i.roadSegment.startPointGeom.sdo_point.Y),{tolerance:2}),u=LRSMeasure(n[0].geometry,new OpenLayers.Geometry.Point(i.roadSegment.endPointGeom.sdo_point.X,i.roadSegment.endPointGeom.sdo_point.Y),{tolerance:2}),f;f=r<u?LRSSubstring(n[0].geometry,r,u):LRSSubstring(n[0].geometry,u,r),t(new OpenLayers.Feature.Vector(f))})},IfxStpmapDecisionSpace.prototype.updatePointLrs=function(n,t){t=="STARTPOINT"?IfxStpmapCommon.compareGeometries(this.roadSegment.startPointGeom.sdo_point,n.geometry.components[0])?(this.roadSegment.otherinfo.startPoint.fromLrs=this.roadSegment.otherinfo.startPoint.lrsValue,this.roadSegment.otherinfo.startPoint.toLrs=null):IfxStpmapCommon.compareGeometries(this.roadSegment.startPointGeom.sdo_point,n.geometry.components[n.geometry.components.length-1])&&(this.roadSegment.otherinfo.startPoint.fromLrs=null,this.roadSegment.otherinfo.startPoint.toLrs=this.roadSegment.otherinfo.startPoint.lrsValue):IfxStpmapCommon.compareGeometries(this.roadSegment.endPointGeom.sdo_point,n.geometry.components[0])?(this.roadSegment.otherinfo.endPoint.fromLrs=this.roadSegment.otherinfo.endPoint.lrsValue,this.roadSegment.otherinfo.endPoint.toLrs=null):IfxStpmapCommon.compareGeometries(this.roadSegment.endPointGeom.sdo_point,n.geometry.components[n.geometry.components.length-1])&&(this.roadSegment.otherinfo.endPoint.fromLrs=null,this.roadSegment.otherinfo.endPoint.toLrs=this.roadSegment.otherinfo.endPoint.lrsValue)},IfxStpmapDecisionSpace.prototype.DisplayAnalysedDSInmap=function(n,t,i,r,u,f,e,o,s,h){this.zoomToDSLinks(n,t,i,r,u,f,e,o,s,h),this.viewAnalysedDs(n,t,i,r,u,f,e,o,s,h)},IfxStpmapDecisionSpace.prototype.displaySelectedCorridors=function(n,t,i,r,u,f,e){this.viewSelectedLimitations(n,t,i,r,u,f,e)},IfxStpmapDecisionSpace.prototype.openCorridorSelection=function(n,t,i){this.roadSegment.corridorType=n,this.roadSegment.dataArea=t,this.organisationId=t,this.viewLimitation(t,i),$.ajax({type:"POST",url:"/DecisionSpace/GetBounds",contentType:"application/json; charset=utf-8",data:JSON.stringify({id:i,fetchFlag:2}),beforeSend:function(){},complete:function(){},success:function(n){$("#MapUpgrade").val()==0&&objifxStpMap.setGeoRegion({x1:n.Min_X,y1:n.Min_Y,x2:n.Max_X,y2:n.Max_Y})}})},IfxStpmapDecisionSpace.prototype.zoomToCorridor=function(n){$.ajax({url:"/DecisionSpace/GetALink",type:"POST",data:{dsId:n,fetchFlag:1},beforeSend:function(){},success:function(n){n&&n.length>0&&objifxStpmapRoadOwnership.zoomInToSelectedLinkId(n[0].LinkId)},complete:function(){}})},IfxStpmapDecisionSpace.prototype.getAllDSLBOVLinks=function(n){var r=IfxStpmapCommon.getDecisionSpaceType(objifxStpMap.pageType),t=this;$.ajax({url:"/DecisionSpace/GetDSLBOVLinks",type:"POST",data:{ds_type:r,ds_length:n},beforeSend:function(){startAnimation()},success:function(n){var u,r,f;if(n=="Session timeout"&&(location.reload(),stopAnimation()),n&&n.length>0){if(u=[],r=[],$("#MapUpgrade").val()==1)for(i=0;i<n.length;i++)n[i].LinkStatus=1;$.each(n,function(n,t){objifxStpMap.getPageType()=="MAINTAIN_CORRIDOR_EDITMODE"||objifxStpMap.getPageType()=="CR_VIEWANDEDIT"?(t.LinkStatus==1||$("#MapUpgrade").val()==1)&&$.inArray(t.LinkId,r)===-1&&(u.push(t),r.push(t.LinkId)):$.inArray(t.LinkId,r)===-1&&(u.push(t),r.push(t.LinkId))}),t.highlightRoads(u,!0,!0,function(n){var r,i;for(t.roadSegment.selectedFeatures=t.roadSegment.selectedFeatures.concat(n),t.roadSegment.otherinfo.currentfeatures=n,objifxStpMap.vectorLayerDelegRoads.addFeatures(t.roadSegment.selectedFeatures),t.removeFeatureFromDelegated(),r=0;r<t.roadSegment.selectedFeatures.length;r++)for(i=0;i<objifxStpMap.vectorLayerRoute.features.length;i++)t.roadSegment.selectedFeatures[r].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[i].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[i])}),f=getCorridorLinkInfo(),f.length>0&&$("#tblOrgLBOVSave").show()}else showNotification(Lang_Key.NotifNoRoadFnd)},complete:function(){stopAnimation()}})},IfxStpmapDecisionSpace.prototype.zoomToDSLinks=function(n,t,i,r,u,f,e,o,s,h){$.ajax({url:"/DSAnalysis/GetZoomBound",type:"POST",data:{OrgId:n,FRCMin:t,FRCMax:i,MinLength:r,MinWidth:u,MinHeight:f,MinWeight:e,StartDate:o,EndDate:s,EXCount:h},beforeSend:function(){},success:function(n){n.Min_X==277964&&n.Min_Y==833252&&n.Max_X==-124667&&n.Max_Y==306850?(objifxStpMap.olMap.setCenter([objifxStpMap.defaultZoom.X,objifxStpMap.defaultZoom.Y],objifxStpMap.defaultZoom.zoom),showNotification(Lang_Key.Notif_No_data_available)):setGeoRegion({x1:n.Min_X,y1:n.Min_Y,x2:n.Max_X,y2:n.Max_Y})},complete:function(){}})},IfxStpmapDecisionSpace.prototype.editDSpace=function(n){objifxStpmapDecisionSpace.createPolygonDrawControl(),objifxStpmapDecisionSpace.createRoadDelegationToolBar(),roadDelegationToolbarPanel.div.style.display="inline",n=="RESTRICTION"?objifxStpMap.setPageType("MAINTAIN_CORRIDOR_EDITMODE"):objifxStpMap.setPageType(n)},IfxStpmapDecisionSpace.prototype.editITSSpace=function(n){objifxStpmapDecisionSpace.createPolygonDrawControl(),objifxStpmapDecisionSpace.createRoadDelegationToolBar(),roadDelegationToolbarPanel.div.style.display="inline",n=="RESTRICTION"?objifxStpMap.setPageType("MAINTAIN_CORRIDOR_EDITMODE"):objifxStpMap.setPageType(n)},IfxStpmapDecisionSpace.prototype.openInViewMode=function(){roadDelegationToolbarPanel.div.style.display="none",objifxStpMap.setPageType("MAINTAIN_CORRIDOR")},IfxStpmapDecisionSpace.prototype.zoomInToCorridorRoad=function(n,t,i){var r=this,u=Math.round(n.length/2);this.organisationId=t,this.roadSegment.linkInfoList=[],n&&n.length>0&&objifxStpMap.searchFeaturesByLinkID([n[u].linkId],function(n){objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,6),r.viewLimitationFlag?r.includeMandateFlag?(startAnimation(Lang_Key.Animation_Please_wait),r.showLimitedRoads("mandate",function(){startAnimation(Lang_Key.Animation_Please_wait),r.showLimitedRoads("linepart",i)})):(startAnimation(Lang_Key.Animation_Please_wait),r.showLimitedRoads("linepart",i)):i&&typeof i=="function"&&i()})},IfxStpmapDecisionSpace.prototype.changeCorridorValues=function(n,t){switch(n){case"typeId":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.TypeId=t:this.roadSegment.basicCheck.TypeId=t;break;case"length":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.MaxLength=t:this.roadSegment.basicCheck.MaxLength=t;break;case"width":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.MaxWidth=t:this.roadSegment.basicCheck.MaxWidth=t;break;case"height":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.MaxHeight=t:this.roadSegment.basicCheck.MaxHeight=t;break;case"weight":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.MaxWeight=t:this.roadSegment.basicCheck.MaxWeight=t;break;case"normalaxle":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.MaxNormalAxisLoad=t:this.roadSegment.basicCheck.MaxNormalAxisLoad=t;break;case"shuttleaxle":this.roadSegment.corridorSelectionValue=="corridor"?this.roadSegment.corridorType.MaxShuttleAxisLoad=t:this.roadSegment.basicCheck.MaxShuttleAxisLoad=t}},IfxStpmapDecisionSpace.prototype.viewAnalysedDs=function(n,t,i,r,u,f,e,o,s,h){objifxStpMap.deleteMapLayer("DECISIONSPACE_ANALYSIS");var l="org_id:"+n+";frc_min:"+t+";frc_max:"+i+";min_len:"+r+";min_width:"+u+";min_height:"+f+";min_weight:"+e+";start_date:"+o+";end_date:"+s+";ex_Count:"+h,c=new OpenLayers.Layer.WMS("DECISIONSPACE_ANALYSIS",objifxStpMap.geoserverUrl,{layers:objifxStpMap.decisionspaceAnalysisLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:l,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(c),objifxStpMap.olMap.setLayerIndex(c,1)},IfxStpmapDecisionSpace.prototype.viewSelectedLimitations=function(n,t,i,r,u,f,e){objifxStpMap.deleteMapLayer("CORRIDOR_ANALYSIS");var s="ds_id_1:"+n+";ds_id_2:"+t+";ds_id_3:"+i+";ds_id_4:"+r+";ds_id_5:"+u+";ds_id_6:"+f+";ds_id_7:"+e,o=new OpenLayers.Layer.WMS("CORRIDOR_ANALYSIS",objifxStpMap.geoserverUrl,{layers:objifxStpMap.corridorAnalysisLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:s,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(o),objifxStpMap.olMap.setLayerIndex(o,1)},IfxStpmapDecisionSpace.prototype.viewLimitation=function(n,t){objifxStpMap.deleteMapLayer("DSRestrictions"),objifxStpMap.deleteMapLayer("RoadOwnership");var r="org_id:"+n+";ds_id:"+t,i=new OpenLayers.Layer.WMS("DSRestrictions",objifxStpMap.geoserverUrl,{layers:objifxStpMap.restrictionLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:r,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(i),objifxStpMap.olMap.setLayerIndex(i,1)},IfxStpmapDecisionSpace.prototype.DeleteLZVAgricultureLayer=function(n){objifxStpMap.deleteMapLayer(n)},IfxStpmapDecisionSpace.prototype.viewLzvAgriculture=function(n,t){var r,u="",i,e,f;t==1?(r=objifxStpMap.configGeoserverMU_Url,u="LzvAndAgricultureNew"):(r=objifxStpMap.configGeoserverUrl,u="LzvAndAgriculture"),objifxStpMap.deleteMapLayer("LzvAndAgriculture"),objifxStpMap.deleteMapLayer("LzvAndAgricultureNew"),objifxStpMap.deleteMapLayer("ConsultRestrictions"),objifxStpMap.deleteMapLayer("LBOVLayer");switch(n.toLowerCase()){case"agriculture":i=t==1?"NWKMAPUPGRADE:DS_Agriculture":"NWKMAP:DS_Agriculture";break;case"lzv":i=t==1?"NWKMAPUPGRADE:DS_LZV":"NWKMAP:DS_LZV"}e=IfxStpmapCommon.getDecisionSpaceType(n),f=new OpenLayers.Layer.WMS(u,r,{layers:i,format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()}),objifxStpMap.olMap.addLayer(f),objifxStpMap.olMap.setLayerIndex(f,this.lzvAgriLayerOrder())},IfxStpmapDecisionSpace.prototype.viewLBOV=function(n,t,i){var u,f="",r;t==1?(u=objifxStpMap.configGeoserverMU_Url,f="LBOVLayerNew"):(u=objifxStpMap.configGeoserverUrl,f="LBOVLayer"),objifxStpMap.deleteMapLayer("LBOVLayer"),objifxStpMap.deleteMapLayer("LBOVLayerNew"),objifxStpMap.deleteMapLayer("ConsultRestrictions"),objifxStpMap.deleteMapLayer("LzvAndAgriculture"),objifxStpMap.deleteMapLayer("LzvAndAgricultureNew"),r=t==1?"NWKMAPUPGRADE:DS_LBOV":$("#PortalType").val()=="696008"?"NWKMAP:DS_LBOV_RDW":"NWKMAP:DS_LBOV_Public";var s=IfxStpmapCommon.getDecisionSpaceType(n),o="ds_length:"+i,e=new OpenLayers.Layer.WMS(f,u,{layers:r,format:objifxStpMap.imageFormat,transparent:"true",viewparams:o,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(e),objifxStpMap.olMap.setLayerIndex(e,this.lbovLayerOrder())},IfxStpmapDecisionSpace.prototype.lzvAgriLayerOrder=function(){for(var n=0;n<objifxStpMap.olMap.layers.length;n++)if(objifxStpMap.olMap.layers[n].name=="Affected LZV layer"||objifxStpMap.olMap.layers[n].name=="Affected AGR layer")return 2;return 1},IfxStpmapDecisionSpace.prototype.lbovLayerOrder=function(){for(var n=0;n<objifxStpMap.olMap.layers.length;n++)if(objifxStpMap.olMap.layers[n].name=="Affected LBOV layer")return 2;return 1},IfxStpmapDecisionSpace.prototype.viewITSLinks=function(n,t){var i,u,r;objifxStpMap.deleteMapLayer("ViewITSLinks"),i="",i=t==1?"NWKMAPUPGRADE:NWK_ViewITSLinks":"NWKMAP:NWK_ViewITSLinks",u="DSID:"+n,r=new OpenLayers.Layer.WMS("ViewITSLinks",objifxStpMap.geoserverUrl,{layers:i,format:objifxStpMap.imageFormat,transparent:"true",viewparams:u,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()}),objifxStpMap.olMap.addLayer(r),objifxStpMap.olMap.setLayerIndex(r,1)},IfxStpmapDecisionSpace.prototype.ITSMapZoomDetails=function(n,t){objifxStpMap.deleteMapLayer("ITS_ZOOMAREA");var r=IfxStpmapCommon.getDecisionSpaceType(n),u="ds_type:"+r+";ds_id:"+t,i=new OpenLayers.Layer.WMS("ITS_ZOOMAREA",objifxStpMap.geoserverUrl,{layers:"NWKMAP:DS_ITS_ZOOMAREA",format:objifxStpMap.imageFormat,transparent:"true",viewparams:u,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(i),objifxStpMap.olMap.setLayerIndex(i,5),ViewITSZoomMap(t)},IfxStpmapDecisionSpace.prototype.ITSMapDefaultZoom=function(){objifxStpMap.olMap.setCenter([138288.92120639,451720.32615757],3)},IfxStpmapDecisionSpace.prototype.viewITS_COREAREAS=function(n,t){var i;if(objifxStpMap.deleteMapLayer("ITS_ZOOMAREA"),t){objifxStpMap.deleteMapLayer("ITS_COREAREAS");var u=IfxStpmapCommon.getDecisionSpaceType(n),f="ds_type:"+u,r=new OpenLayers.Layer.WMS("ITS_COREAREAS",objifxStpMap.geoserverUrl,{layers:"NWKMAP:DS_ITS_COREAREAS",format:objifxStpMap.imageFormat,transparent:"true",viewparams:f,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(r),objifxStpMap.olMap.setLayerIndex(r,1)}else for(i=0;i<objifxStpMap.olMap.layers.length;i++)if(objifxStpMap.olMap.layers[i].name=="ITS_COREAREAS"){objifxStpMap.olMap.removeLayer(objifxStpMap.olMap.layers[i]);break}},IfxStpmapDecisionSpace.prototype.viewITS_EXEMPTIONS=function(n,t){var i;if(objifxStpMap.deleteMapLayer("ITS_ZOOMAREA"),t){objifxStpMap.deleteMapLayer("ITS_EXEMPTIONS");var u=IfxStpmapCommon.getDecisionSpaceType(n),f="ds_type:"+u,r=new OpenLayers.Layer.WMS("ITS_EXEMPTIONS",objifxStpMap.geoserverUrl,{layers:"NWKMAP:DS_ITS_EXEMPTIONS",format:objifxStpMap.imageFormat,transparent:"true",viewparams:f,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(r),objifxStpMap.olMap.setLayerIndex(r,1)}else for(i=0;i<objifxStpMap.olMap.layers.length;i++)if(objifxStpMap.olMap.layers[i].name=="ITS_EXEMPTIONS"){objifxStpMap.olMap.removeLayer(objifxStpMap.olMap.layers[i]);break}},IfxStpmapDecisionSpace.prototype.viewITS_HISTORIC_EXEMPTIONS=function(n,t){var i;if(objifxStpMap.deleteMapLayer("ITS_ZOOMAREA"),t){objifxStpMap.deleteMapLayer("ITS_HISTORIC_EXEMPTIONS");var u=IfxStpmapCommon.getDecisionSpaceType(n),f="ds_type:"+u,r=new OpenLayers.Layer.WMS("ITS_HISTORIC_EXEMPTIONS",objifxStpMap.geoserverUrl,{layers:"NWKMAP:DS_ITS_HISTORIC_EXEMPTIONS",format:objifxStpMap.imageFormat,transparent:"true",viewparams:f,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(r),objifxStpMap.olMap.setLayerIndex(r,1)}else for(i=0;i<objifxStpMap.olMap.layers.length;i++)if(objifxStpMap.olMap.layers[i].name=="ITS_HISTORIC_EXEMPTIONS"){objifxStpMap.olMap.removeLayer(objifxStpMap.olMap.layers[i]);break}},IfxStpmapDecisionSpace.prototype.viewConvoy=function(n){objifxStpMap.deleteMapLayer("Convoy");var i="ds_id:"+n,t=new OpenLayers.Layer.WMS("Convoy",objifxStpMap.geoserverUrl,{layers:objifxStpMap.convoyLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:i,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(t),objifxStpMap.olMap.setLayerIndex(t,1)},IfxStpmapDecisionSpace.prototype.viewConsultRestriction=function(n,t,i,r){n=n==undefined?0:parseInt(n),t=t==undefined?0:parseInt(t),i=i==undefined?0:parseInt(i),r=r==undefined?0:parseInt(r),objifxStpMap.deleteMapLayer("ConsultRestrictions"),objifxStpMap.deleteMapLayer("LzvAndAgriculture");var f="_height:"+n+";_weight:"+t+";_length:"+i+";_width:"+r,u=new OpenLayers.Layer.WMS("ConsultRestrictions",objifxStpMap.geoserverUrl,{layers:objifxStpMap.consultRestrictionLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:f,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(u),objifxStpMap.olMap.setLayerIndex(u,1)},IfxStpmapDecisionSpace.prototype.checkLinkOwnership=function(n,t){var i=this,r=this.organisationId;$.ajax({url:"/DecisionSpace/GetOwnedLinks",type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({linkIdList:n,orgId:r}),success:function(n){n=="Session timeout"&&(location.reload(),stopAnimation()),n.result.length>0?t&&typeof t=="function"&&t(n.result):(i.removeDelegationMarker(1),i.removeDelegationMarker(0),showWarningPopDialog(Lang_Key.WngPopup_Selection_failed,"Ok","","close_alert","",1,"info"))},complete:function(){stopAnimation()}})},IfxStpmapDecisionSpace.prototype.removeAllSelectedFeatures=function(){this.roadSegment.selectedFeatures=[]},IfxStpmapDecisionSpace.prototype.showLinkOnMap=function(n,t,i){var r=this;objifxStpMap.searchFeaturesByLinkID([n],function(u){var e,f;for(r.roadSegment.otherinfo.currentfeatures=[u[0]],r.addVectorLayers("DelegRoads"),objifxStpMap.vectorLayerDelegRoads.addFeatures(u[0]),r.roadSegment.linkInfoList.push({linkId:u[0].attributes.LINK_ID,fromLinearRef:null,toLinearRef:null}),r.roadSegment.selectedFeatures=r.roadSegment.selectedFeatures.concat(u[0]),e=0;e<r.roadSegment.selectedFeatures.length;e++)for(f=0;f<objifxStpMap.vectorLayerRoute.features.length;f++)r.roadSegment.selectedFeatures[e].attributes.LINK_ID==objifxStpMap.vectorLayerRoute.features[f].attributes.LINK_ID&&objifxStpMap.vectorLayerRoute.removeFeatures(objifxStpMap.vectorLayerRoute.features[f]);r.zoomInToSelectedLinkId(n,null,t,i),stopAnimation()})},IfxStpmapDecisionSpace.prototype.showSelectedLinks=function(){var t=objifxStpmapDecisionSpace.roadSegment.selectedFeatures,n;if(t.length>0){for(objifxStpmapDecisionSpace.addVectorLayers("DelegRoads"),n=0;n<t.length;n++)objifxStpmapDecisionSpace.roadSegment.otherinfo.currentfeatures=[t[n]],objifxStpMap.vectorLayerDelegRoads.addFeatures(t[n]);$("#btnSave").show(),$("#btnClear").show()}},IfxStpmapDecisionSpace.prototype.showLinkOnLZVMap=function(n){var r=this;objifxStpMap.searchFeaturesByLinkID([n],function(n){r.roadSegment.otherinfo.currentfeatures=[n[0]],objifxStpMap.setZoomTo(n[0].geometry.components[0].x,n[0].geometry.components[0].y,12),stopAnimation()})},IfxStpmapDecisionSpace.prototype.toggleDSUnassignedRoads=function(n){if(n)this.showUnassignedRoadsMap();else for(var t=0;t<objifxStpMap.olMap.layers.length;t++)objifxStpMap.olMap.layers[t].name=="Affected DS layer"&&objifxStpMap.deleteMapLayer("Affected DS layer")},IfxStpmapDecisionSpace.prototype.showUnassignedRoadsMap=function(){var r,t,i,n;for(objifxStpMap.deleteMapLayer("Affected DS layer"),r=new OpenLayers.Layer.WMS("Affected DS layer",objifxStpMap.geoserverUrl,{layers:"NWKMAPUPGRADE:AffectedDSLinks",format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()}),objifxStpMap.olMap.addLayer(r),t=0,n=0;n<objifxStpMap.olMap.layers.length;n++)if(objifxStpMap.olMap.layers[n].name=="DSRestrictions")break;else t=t+1;for(i=0,n=0;n<objifxStpMap.olMap.layers.length;n++)if(objifxStpMap.olMap.layers[n].name=="DelegRoads")break;else i=i+1;i<t?objifxStpMap.olMap.setLayerIndex(r,i-1):objifxStpMap.olMap.setLayerIndex(r,t+1)},IfxStpmapDecisionSpace.prototype.toggleDSAutoAssignedRoads=function(n){if(n)this.showGeoassignedRoadsMap();else for(var t=0;t<objifxStpMap.olMap.layers.length;t++)objifxStpMap.olMap.layers[t].name=="AutoAssignedDSLinks"&&objifxStpMap.deleteMapLayer("AutoAssignedDSLinks")},IfxStpmapDecisionSpace.prototype.showGeoassignedRoadsMap=function(){var r,t,i,n;for(objifxStpMap.deleteMapLayer("AutoAssignedDSLinks"),r=new OpenLayers.Layer.WMS("AutoAssignedDSLinks",objifxStpMap.configGeoserverMU_Url,{layers:"NWKMAPUPGRADE:AutoAssignedDSLinks",format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()}),objifxStpMap.olMap.addLayer(r),t=0,n=0;n<objifxStpMap.olMap.layers.length;n++)if(objifxStpMap.olMap.layers[n].name=="Affected DS layer")break;else t=t+1;for(i=0,n=0;n<objifxStpMap.olMap.layers.length;n++)if(objifxStpMap.olMap.layers[n].name=="DelegRoads")break;else i=i+1;i<t?objifxStpMap.olMap.setLayerIndex(r,i-1):objifxStpMap.olMap.setLayerIndex(r,t+1)},IfxStpmapDecisionSpace.prototype.toggleLZVAgriUnassignedRoads=function(n,t){var i;if(n)t=="LZV"?this.showUnassignedRoadsLZVMap():this.showUnassignedRoadsAGRMap();else if(t=="LZV")for(i=0;i<objifxStpMap.olMap.layers.length;i++)objifxStpMap.olMap.layers[i].name=="Affected LZV layer"&&objifxStpMap.deleteMapLayer("Affected LZV layer");else for(i=0;i<objifxStpMap.olMap.layers.length;i++)objifxStpMap.olMap.layers[i].name=="Affected AGR layer"&&objifxStpMap.deleteMapLayer("Affected AGR layer")},IfxStpmapDecisionSpace.prototype.showUnassignedRoadsLZVMap=function(){var i,n,t;for(objifxStpMap.deleteMapLayer("Affected LZV layer"),i=new OpenLayers.Layer.WMS("Affected LZV layer",objifxStpMap.geoserverUrl,{layers:"NWKMAPUPGRADE:AffectedLZVLinks",format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()}),objifxStpMap.olMap.addLayer(i),n=0,t=0;t<objifxStpMap.olMap.layers.length;t++)if(objifxStpMap.olMap.layers[t].name=="DelegRoads")break;else n=n+1;objifxStpMap.olMap.setLayerIndex(i,n-1)},IfxStpmapDecisionSpace.prototype.showUnassignedRoadsAGRMap=function(){var i,n,t;for(objifxStpMap.deleteMapLayer("Affected AGR layer"),i=new OpenLayers.Layer.WMS("Affected AGR layer",objifxStpMap.geoserverUrl,{layers:"NWKMAPUPGRADE:AffectedAGRICLinks",format:objifxStpMap.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()}),objifxStpMap.olMap.addLayer(i),n=0,t=0;t<objifxStpMap.olMap.layers.length;t++)if(objifxStpMap.olMap.layers[t].name=="DelegRoads")break;else n=n+1;objifxStpMap.olMap.setLayerIndex(i,n-1)},OpenLayers.Control.ScaleBar=OpenLayers.Class(OpenLayers.Control,{element:null,scale:1,displaySystem:"metric",minWidth:100,maxWidth:200,divisions:2,subdivisions:2,showMinorMeasures:!1,abbreviateLabel:!1,singleLine:!1,align:"left",div:null,thousandsSeparator:"",measurementProperties:{english:{units:["miles","feet","inches"],abbr:["mi","ft","in"],inches:[63360,12,1]},metric:{units:["kilometers","meters","centimeters"],abbr:["km","m","cm"],inches:[39370.07874,39.370079,.393701]}},limitedStyle:!1,customStyles:null,defaultStyles:{Bar:{height:11,top:12,borderLeftWidth:0,borderRightWidth:0},BarAlt:{height:11,top:12,borderLeftWidth:0,borderRightWidth:0},MarkerMajor:{height:13,width:13,top:12,borderLeftWidth:0,borderRightWidth:0},MarkerMinor:{height:13,width:13,top:12,borderLeftWidth:0,borderRightWidth:0},NumbersBox:{height:13,width:40,top:24},LabelBox:{height:15,top:-2},LabelBoxSingleLine:{height:15,width:35,top:5,left:10}},appliedStyles:null,initialize:function(n){OpenLayers.Control.prototype.initialize.apply(this,[n]),document.styleSheets||(this.limitedStyle=!0),this.limitedStyle&&(this.appliedStyles=OpenLayers.Util.extend({},this.defaultStyles),OpenLayers.Util.extend(this.appliedStyles,this.customStyles)),this.element=document.createElement("div"),this.element.style.position="relative",this.element.className=this.displayClass+"Wrapper",this.labelContainer=document.createElement("div"),this.labelContainer.className=this.displayClass+"Units",this.labelContainer.style.position="absolute",this.graphicsContainer=document.createElement("div"),this.graphicsContainer.style.position="absolute",this.graphicsContainer.className=this.displayClass+"Graphics",this.numbersContainer=document.createElement("div"),this.numbersContainer.style.position="absolute",this.numbersContainer.className=this.displayClass+"Numbers",this.element.appendChild(this.graphicsContainer),this.element.appendChild(this.labelContainer),this.element.appendChild(this.numbersContainer)},destroy:function(){this.map.events.unregister("moveend",this,this.onMoveend),this.div.innerHTML="",OpenLayers.Control.prototype.destroy.apply(this)},draw:function(){var n,t,i,r;for(OpenLayers.Control.prototype.draw.apply(this,arguments),this.dxMarkerMajor=(this.styleValue("MarkerMajor","borderLeftWidth")+this.styleValue("MarkerMajor","width")+this.styleValue("MarkerMajor","borderRightWidth"))/2,this.dxMarkerMinor=(this.styleValue("MarkerMinor","borderLeftWidth")+this.styleValue("MarkerMinor","width")+this.styleValue("MarkerMinor","borderRightWidth"))/2,this.dxBar=(this.styleValue("Bar","borderLeftWidth")+this.styleValue("Bar","borderRightWidth"))/2,this.dxBarAlt=(this.styleValue("BarAlt","borderLeftWidth")+this.styleValue("BarAlt","borderRightWidth"))/2,this.dxNumbersBox=this.styleValue("NumbersBox","width")/2,n=["Bar","BarAlt","MarkerMajor","MarkerMinor"],this.singleLine?n.push("LabelBoxSingleLine"):n.push("NumbersBox","LabelBox"),t=0,i=0;i<n.length;++i)r=n[i],t=Math.max(t,this.styleValue(r,"top")+this.styleValue(r,"height"));return this.element.style.height=t+"px",this.xOffsetSingleLine=this.styleValue("LabelBoxSingleLine","width")+this.styleValue("LabelBoxSingleLine","left"),this.div.appendChild(this.element),this.map.events.register("moveend",this,this.onMoveend),this.update(),this.div},onMoveend:function(){this.update()},update:function(n){var a,f,o,t,r,h,c,l,u,e,i,s;if(this.map.baseLayer!=null&&this.map.getScale()){for(this.scale=n!=undefined?n:this.map.getScale(),this.element.title=this.scaleText+OpenLayers.Number.format(this.scale),this.element.style.width=this.maxWidth+"px",a=this.getComp(),this.setSubProps(a),this.labelContainer.innerHTML="",this.graphicsContainer.innerHTML="",this.numbersContainer.innerHTML="",f=this.divisions*this.subdivisions,o={left:0+(this.singleLine?0:this.dxNumbersBox),center:this.maxWidth/2-f*this.subProps.pixels/2-(this.singleLine?this.xOffsetSingleLine/2:0),right:this.maxWidth-f*this.subProps.pixels-(this.singleLine?this.xOffsetSingleLine:this.dxNumbersBox)},u=0;u<this.divisions;++u)for(t=u*this.subdivisions*this.subProps.pixels+o[this.align],this.graphicsContainer.appendChild(this.createElement("MarkerMajor"," ",t-this.dxMarkerMajor)),this.singleLine||(r=u==0?0:OpenLayers.Number.format(u*this.subdivisions*this.subProps.length,this.subProps.dec,this.thousandsSeparator),this.numbersContainer.appendChild(this.createElement("NumbersBox",r,t-this.dxNumbersBox))),e=0;e<this.subdivisions;++e)e%2==0?(c="Bar",l=t-this.dxBar):(c="BarAlt",l=t-this.dxBarAlt),this.graphicsContainer.appendChild(this.createElement(c," ",l,this.subProps.pixels)),e<this.subdivisions-1&&(h=u*this.subdivisions+e+1,t=h*this.subProps.pixels+o[this.align],this.graphicsContainer.appendChild(this.createElement("MarkerMinor"," ",t-this.dxMarkerMinor)),this.showMinorMeasures&&!this.singleLine&&(r=h*this.subProps.length,this.numbersContainer.appendChild(this.createElement("NumbersBox",r,t-this.dxNumbersBox))));t=f*this.subProps.pixels,t+=o[this.align],this.graphicsContainer.appendChild(this.createElement("MarkerMajor"," ",t-this.dxMarkerMajor)),r=OpenLayers.Number.format(f*this.subProps.length,this.subProps.dec,this.thousandsSeparator),this.singleLine||this.numbersContainer.appendChild(this.createElement("NumbersBox",r,t-this.dxNumbersBox)),i=document.createElement("div"),i.style.position="absolute",this.singleLine?(s=r,i.className=this.displayClass+"LabelBoxSingleLine",i.style.left=Math.round(t+this.styleValue("LabelBoxSingleLine","left"))+"px"):(s="",i.className=this.displayClass+"LabelBox",i.style.textAlign="center",i.style.width=Math.round(f*this.subProps.pixels)+"px",i.style.left=Math.round(o[this.align])+"px",i.style.overflow="hidden"),s+=this.abbreviateLabel?" "+this.subProps.abbr:" "+this.subProps.units,i.appendChild(document.createTextNode(s)),this.labelContainer.appendChild(i)}},createElement:function(n,t,i,r){var u=document.createElement("div");return u.className=this.displayClass+n,OpenLayers.Util.extend(u.style,{position:"absolute",textAlign:"center",overflow:"hidden",left:Math.round(i)+"px"}),u.appendChild(document.createTextNode(t)),r&&(u.style.width=Math.round(r)+"px"),u},getComp:function(){for(var o=this.measurementProperties[this.displaySystem],s=o.units.length,e=new Array(s),u=this.divisions*this.subdivisions,t,r,i=0;i<s;++i){e[i]={};var h=OpenLayers.DOTS_PER_INCH*o.inches[i]/this.scale,a=(this.minWidth-this.dxNumbersBox)/h/u,v=(this.maxWidth-this.dxNumbersBox)/h/u;for(t=0;t<u;++t){var y=a*(t+1),p=v*(t+1),c=this.getHandsomeNumber(y,p),n={value:c.value/(t+1),score:0,tie:0,dec:0,displayed:0};for(r=0;r<u;++r){var l=c.value*(r+1)/(t+1),f=this.getHandsomeNumber(l,l),w=(r+1)%this.subdivisions==0,b=r+1==u;this.singleLine&&b||!this.singleLine&&(w||this.showMinorMeasures)?(n.score+=f.score,n.tie+=f.tie,n.dec=Math.max(n.dec,f.dec),n.displayed+=1):(n.score+=f.score/this.subdivisions,n.tie+=f.tie/this.subdivisions)}n.score*=(i+1)*n.tie/n.displayed,e[i][t]=n}}return e},setSubProps:function(n){for(var r=this.measurementProperties[this.displaySystem],u=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY,e,o,t,i=0;i<n.length;++i){e=OpenLayers.DOTS_PER_INCH*r.inches[i]/this.scale;for(o in n[i])t=n[i][o],(t.score<u||t.score==u&&t.tie<f)&&(this.subProps={length:t.value,pixels:e*t.value,units:r.units[i],abbr:r.abbr[i],dec:t.dec},u=t.score,f=t.tie)}},styleValue:function(n,t){var u=0,f,i,e,o,r;if(this.limitedStyle)u=this.appliedStyles[n][t];else{n="."+this.displayClass+n;n:for(f=document.styleSheets.length-1;f>=0;--f)if(i=document.styleSheets[f],!i.disabled){try{if(typeof i.cssRules=="undefined")if(typeof i.rules=="undefined")continue;else e=i.rules;else e=i.cssRules}catch(s){continue}for(o=0;o<e.length;++o)if(r=e[o],r.selectorText&&r.selectorText.toLowerCase()==n.toLowerCase()&&r.style[t]!=""){u=parseInt(r.style[t]);break n}}}return u?u:0},getHandsomeNumber:function(n,t,i){var r,h,c,l,f,o,s,a,e,u;for(i=i==null?10:i,r={value:n,score:Number.POSITIVE_INFINITY,tie:Number.POSITIVE_INFINITY,dec:3},e=0;e<3;++e)for(h=Math.pow(2,-1*e),c=Math.floor(Math.log(t/h)/Math.LN10),u=c;u>c-i+1;--u)l=Math.max(e-u,0),f=h*Math.pow(10,u),f*Math.floor(t/f)>=n&&(o=n%f==0?n/f:Math.floor(n/f)+1,s=o+2*e,a=u<0?Math.abs(u)+1:u,(s<r.score||s==r.score&&a<r.tie)&&(r.value=parseFloat((f*o).toFixed(l)),r.score=s,r.tie=a,r.dec=l));return r},CLASS_NAME:"OpenLayers.Control.ScaleBar"}),OpenLayers.Control.ZoomStatus=OpenLayers.Class(OpenLayers.Control,{autoActivate:!0,element:null,prefix:"",suffix:"",emptyString:null,destroy:function(){this.deactivate(),OpenLayers.Control.prototype.destroy.apply(this,arguments)},activate:function(){return OpenLayers.Control.prototype.activate.apply(this,arguments)?(this.map.events.register("moveend",this,this.redraw),this.redraw(),!0):!1},deactivate:function(){return OpenLayers.Control.prototype.deactivate.apply(this,arguments)?(this.map.events.unregister("moveend",this,this.redraw),this.element.innerHTML="",!0):!1},draw:function(){return OpenLayers.Control.prototype.draw.apply(this,arguments),this.element||(this.div.left="",this.div.top="",this.div.style.fontWeight="bold",this.element=this.div),this.div},redraw:function(){var i=this.map.getZoom(),r=this.formatOutput(i),t;r!=this.element.innerHTML&&(t=this.displayPosition(i),this.element.style.marginLeft=t.margin_left,this.element.style.marginTop=t.margin_top,this.element.innerHTML=r)},reset:function(){this.emptyString!=null&&(this.element.innerHTML=this.emptyString)},formatOutput:function(n){return this.prefix+n+this.suffix},displayPosition:function(n){return IfxStpmapCommon.getZoomStatusPos(n)},CLASS_NAME:"OpenLayers.Control.ZoomStatus"}),multiSort=function(n,t){for(var r,i=0;i<n.length;i++)r=n[i].splice(t,1),n[i].unshift(r);return n.sort()},removeDuplicate=function(n){var t=[],i,u,r,f;n:for(i=0,u=n.length;i<u;i++){for(r=0,f=t.length;r<f;r++)if(t[r]==n[i])continue n;t[t.length]=n[i]}return t},intersection=function(n,t,i){var s,f,e,o,c,h,r,u,l,a;if(i?i.point=!0:i={},s=[],t instanceof OpenLayers.Geometry.LineString&&n.intersects(t))for(f=n.getVertices(),e=t.getVertices(),r=0;r<f.length-1;r++)for(o={x1:f[r].x,y1:f[r].y,x2:f[r+1].x,y2:f[r+1].y},u=0;u<e.length-1;u++)c={x1:e[u].x,y1:e[u].y,x2:e[u+1].x,y2:e[u+1].y},h=OpenLayers.Geometry.segmentsIntersect(o,c,i),h&&(h==!0?(l=new OpenLayers.Geometry.Point(o.x1,o.y1),a=new OpenLayers.Geometry.Point(o.x2,o.y2),s.push(l,a)):s.push(h));return s},LRSMeasure=function(n,t,i){for(var a=i&&i.details,v=i&&i.tolerance?i.tolerance:0,s={},u=0,h=0,f=!1,e=[],o=[],c=n.getLength(),l={},r=0;r<n.components.length-1;r++)s={x1:n.components[r].x,y1:n.components[r].y,x2:n.components[r+1].x,y2:n.components[r+1].y},h=OpenLayers.Geometry.distanceToSegment(t,s).distance,h<v&&!f?(u+=n.components[r].distanceTo(t),f=!0,e.push(n.components[r],t),o.push(t,n.components[r+1])):f?o.push(n.components[r+1]):(u+=n.components[r].distanceTo(n.components[r+1]),e.push(n.components[r]));return a?l={length:u,measure:u/c,subString1:new OpenLayers.Geometry.LineString(e),subString2:new OpenLayers.Geometry.LineString(o)}:u/c},LRSSubstring=function(n,t,i){var a=n.getLength(),h=t*a,c=i*a,u=[],f=0,l=!1,v,r,o,e,s,y;if(reverseFlag=!1,t==0&&i==1)l=n;else if(t>=0&&i<=1&&t!=i){for(t>i&&(v=i,i=t,t=v,reverseFlag=!0),r=0;r<n.components.length;r++)if(o=f,r>0&&(f+=n.components[r].distanceTo(n.components[r-1])),f>h&&f<c)u.length==0&&(e=n.components[r].distanceTo(n.components[r-1]),s=LRSLocatePointOnSegment(n.components[r-1],n.components[r],(h-o)/e),u.push(s)),u.push(n.components[r]);else if(f>=c){e=n.components[r].distanceTo(n.components[r-1]),u.length==0&&(s=LRSLocatePointOnSegment(n.components[r-1],n.components[r],(h-o)/e),u.push(s)),y=LRSLocatePointOnSegment(n.components[r-1],n.components[r],(c-o)/e),u.push(y);break}reverseFlag&&u.reverse(),l=new OpenLayers.Geometry.LineString(u)}return l},LRSSubstringBetweenPoints=function(n,t,i,r){var f=LRSMeasure(n,t,{tolerance:r}),e=LRSMeasure(n,i,{tolerance:r}),u;return f<e?u=LRSSubstring(n,f,e):(u=LRSSubstring(n,e,f),u.components.reverse()),u},LRSLocatePointOnSegment=function(n,t,i){i>1&&i-1<2e-11&&(i=1);var r=!1;return i>=0&&i<=1&&(x1=n.x,y1=n.y,x2=t.x,y2=t.y,x=x1+(x2-x1)*i,y=y1+(y2-y1)*i,r=new OpenLayers.Geometry.Point(x,y)),r},LRSLocatePoint=function(n,t){for(var r=0,u=!1,i=0;i<n.components.length;i++)lastPos=r,r+=n.componets[i].distanceto(n.components[i+1]),r>t&&(u=LRSLocatePointOnSegment(n.componets[i],n.componets[i+1],t-lastPos));return u},Array.prototype.isKey=function(){for(i in this)if(this[i]===arguments[0])return!0;return!1},Array.prototype.getIndexOf=function(){for(i in this)if(this[i]===arguments[0])return i;return!1},createFormat=function(n){return n.toLowerCase()=="geojson"?new OpenLayers.Format.GeoJSON:n.toLowerCase=="gml"?new OpenLayers.Format.GML:null},createProtocol=function(n,t,i,r){return n.toLowerCase()=="http"?new OpenLayers.Protocol.HTTP({url:t,format:i,params:r}):null},createStrategy=function(n){return n.toLowerCase()=="fixed"?new OpenLayers.Strategy.Fixed:n.toLowerCase=="bbox"?new OpenLayers.Strategy.BBOX:null},getStrategyByClassName=function(n,t){if(n.strategies&&n.strategies.length>0)for(var i=0;i<n.strategies.length;i++)if(n.strategies[i].CLASS_NAME==t)return n.strategies[i];return null},clone=function(n){var t,i;if(n==null||typeof n!="object")return n;t=n.constructor();for(i in n)t[i]=clone(n[i]);return t},cloneFeature=function(n){return newFeature=n.clone(),newFeature.fid=n.fid,newFeature.layer=n.layer,newFeature.state=n.state,wktGeometry=n.geometry.toString(),newFeature.geometry=new OpenLayers.Geometry.fromWKT(wktGeometry),newFeature.attributes=clone(n.attributes),newFeature},GeomLib={},GeomLib.offset=function(n,t){var e=GeomLib,o=!1,u,i;if(n instanceof OpenLayers.Geometry.LineString){var s=e.getSegments(n),f=s.length,r=[];for(i=0;i<f;i++)r.push(e.offsetSegment(s[i],t));for(u=[],i=0;i<f-1;i++)u.push(e.segmentLinesIntersection(r[i],r[i+1]));u.unshift(new OpenLayers.Geometry.Point(r[0].x1,r[0].y1)),u.push(new OpenLayers.Geometry.Point(r[f-1].x2,r[f-1].y2)),o=new OpenLayers.Geometry.LineString(u)}return o},GeomLib.getSegments=function(n){for(var u=n.components.length-1,f=new Array(u),i,r,t=0;t<u;++t)i=n.components[t],r=n.components[t+1],f[t]={x1:i.x,y1:i.y,x2:r.x,y2:r.y};return f},GeomLib.offsetSegment=function(n,t){var u=t<0?-1:1,i=n.x2-n.x1,r=n.y2-n.y1,f=Math.sqrt(i*i+r*r),e=u*r/f*t,o=u*i/f*t;return{x1:n.x1-e,y1:n.y1+o,x2:n.x2-e,y2:n.y2+o}},GeomLib.segmentLinesIntersection=function(n,t){var f=GeomLib,i=f._segSlope(n),e=f._segSlope(t),o=f._segLineIntercept(n),s=f._segLineIntercept(t),u,r;return i==Number.POSITIVE_INFINITY&&e==Number.POSITIVE_INFINITY?!1:(i!=Number.POSITIVE_INFINITY&&e!=Number.POSITIVE_INFINITY?(u=(s-o)/(i-e),r=i*u+o):i==Number.POSITIVE_INFINITY?(r=o,u=(r-s)/e):(r=s,u=(r-o)/i),new OpenLayers.Geometry.Point(u,r))},GeomLib._segSlope=function(n){return n.y2-n.y1!=0?(n.y2-n.y1)/(n.x2-n.x1):Number.POSITIVE_INFINITY},GeomLib._segLineIntercept=function(n){return n.y1-GeomLib._segSlope(n)*n.x1},GeomLib.geometryWithDefinition=function(n,t){var i=!1;if(t.shape&&t.shape.process)switch(t.shape.process){case"Buffer":break;case"FixedRectangle":i=GeomLib.rectangleWithDefinition(n,t);break;case"Offset":i=GeomLib.offsetWithDefinition(n,t);break;default:i=!1}return i},GeomLib.offsetWithDefinition=function(n,t){var i;if(t.shape&&t.shape.distanceX&&t.shape.distanceX!=0)i=GeomLib.offset(n,t.shape.distanceX);else if(t.shape.distanceX==0)i=n;else return!1;return i},GeomLib.rectangleWithDefinition=function(n,t){var e,u=[],f,o,s,i,r;return f=n instanceof OpenLayers.Geometry.Point?n:n.getCentroid(),o=t.position&&t.position.deltaX?t.position.deltaX:0,s=t.position&&t.position.deltaY?t.position.deltaY:0,i=f.x+o,r=f.y+s,u.push(new OpenLayers.Geometry.Point(i-t.shape.distanceX,r-t.shape.distanceY)),u.push(new OpenLayers.Geometry.Point(i-t.shape.distanceX,r+t.shape.distanceY)),u.push(new OpenLayers.Geometry.Point(i+t.shape.distanceX,r+t.shape.distanceY)),u.push(new OpenLayers.Geometry.Point(i+t.shape.distanceX,r-t.shape.distanceY)),u.push(new OpenLayers.Geometry.Point(i-t.shape.distanceX,r-t.shape.distanceY)),e=new OpenLayers.Geometry.Polygon(new OpenLayers.Geometry.LinearRing(u)),t.position.rotation&&t.position.rotation!=0&&e.rotate(t.position.rotation,new OpenLayers.Geometry.Point(i,r)),e},$(function(){var n="/Scripts/Common/Openlayers/",t=n+"theme/default/style.css",i=n+"img/";$("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet"}).attr("href",t),OpenLayers.ImgPath=i}),IfxStpmapCommon.getFeatureOfLinkId=function(n,t){for(var i=0;i<n.length;i++)if(n[i].attributes.LINK_ID==t)return n[i];return null},IfxStpmapCommon.getFeatureOfLinkIdFromPathDetails=function(n,t){for(var r,i=0;i<n.routeSegmentList.length;i++)if(n.routeSegmentList[i].offRoadGeometry==null){if(r=IfxStpmapCommon.getFeatureOfLinkId(n.routeSegmentList[i].otherinfo.features,t),r!=null)return r;if(n.routeSegmentList[i].otherinfo.startSegmentfeature&&n.routeSegmentList[i].otherinfo.startSegmentfeature.attributes.LINK_ID==t)return n.routeSegmentList[i].otherinfo.startSegmentfeature;if(n.routeSegmentList[i].otherinfo.endSegmentfeature&&n.routeSegmentList[i].otherinfo.endSegmentfeature.attributes.LINK_ID==t)return n.routeSegmentList[i].otherinfo.endSegmentfeature}return null},IfxStpmapCommon.getRoutePointSegmentFeature=function(n,t,i,r){var s,f,u,e,o;return t==null||i==null?n!=null?(s=[],s.push(new OpenLayers.Geometry.Point(n.sdo_point.X,n.sdo_point.Y)),{feature:new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(s))}):null:(n==null&&(n={},n.sdo_point={},n.sdo_point.X=t.geometry.components[0].x,n.sdo_point.Y=t.geometry.components[0].y),f=LRSMeasure(t.geometry,new OpenLayers.Geometry.Point(n.sdo_point.X,n.sdo_point.Y),{tolerance:.5,details:!0}),t.attributes.REF_IN_ID==i.attributes.NREF_IN_ID||t.attributes.REF_IN_ID==i.attributes.REF_IN_ID?(f.measure!=0?e=f.subString1:(u=[],u.push(t.geometry.components[0]),e=new OpenLayers.Geometry.LineString(u)),o=r=="STARTPOINT"?0:1):(t.attributes.NREF_IN_ID==i.attributes.NREF_IN_ID||t.attributes.NREF_IN_ID==i.attributes.REF_IN_ID)&&(f.measure!=1?e=f.subString2:(u=[],u.push(t.geometry.components[0]),e=new OpenLayers.Geometry.LineString(u)),o=r=="STARTPOINT"?1:0),{feature:new OpenLayers.Feature.Vector(e),direction:o})},IfxStpmapCommon.getCQLFilerFromRouteLinkList=function(n){var u=[],t,r,i;if(n&&n.length>0){for(t="LINK_ID="+n[n.length-1].linkId,r=0,i=n.length-2;i>=0;i--){if(r++,r>=30){u.push(t),r=0,t="LINK_ID="+n[i].linkId;continue}t=t+"%20OR%20LINK_ID="+n[i].linkId}u.push(t)}return u},IfxStpmapCommon.getCQLFilerFromLinkIDs=function(n){var u=[],t,r,i;if(n&&n.length>0){for(t="LINK_ID="+n[n.length-1],r=0,i=n.length-2;i>=0;i--){if(r++,r>=30){u.push(t),r=0,t="LINK_ID="+n[i];continue}t=t+"%20OR%20LINK_ID="+n[i]}u.push(t)}return u},IfxStpmapCommon.orderFeatureByDistance=function(n,t,i){for(var u=new OpenLayers.Geometry.Point(t,i),r=0;r<n.length;r++)n[r].retObject=u.distanceTo(n[r].geometry,{details:!0,edge:!0});n.sort(function(n,t){return n.retObject.distance-t.retObject.distance})},IfxStpmapCommon.findNearestSuitableFeatureIndex=function(n,t,i,r,u){IfxStpmapCommon.orderFeatureByDistance(n,t,i);var e=!1,f,o=-1;for(index=0;index<n.length;index++)if(n[index].attributes.PEDESTRIAN==0&&n[index].attributes.FERRY_TYPE!="B"){if(o==-1&&(f=n[index].retObject,f.index=index,o=index,u==!0)){e=!0;break}if(n[index].attributes.ST_NAME!=null&&n[index].attributes.ST_NAME!=undefined&&r.toUpperCase().indexOf(n[index].attributes.ST_NAME.toUpperCase())>-1){f=n[index].retObject,f.index=index,e=!0;break}}return f},IfxStpmapCommon.findNearestFeatureIndex=function(n,t,i){var f,u,s,o=0,e=new OpenLayers.Geometry.Point(t,i),r;if(u=e.distanceTo(n[0].geometry,{details:!0,edge:!0}),u.index=0,FVPflag==0)for(r=1;r<n.length;r++)f=e.distanceTo(n[r].geometry,{details:!0,edge:!0}),f.index=r,f.distance<u.distance&&(u=f,o=r,u.index=r);else for(r=1;r<n.length;r++)f=e.distanceTo(n[r].geometry,{details:!0,edge:!0}),f.index=r,n[r].attributes.LINK_ID==fvpLinkId&&(u=f,o=r,u.index=r);return u},IfxStpmapCommon.findNearestFeatureIndexLine=function(n,t,i){for(var e,u,h,s=0,o=new OpenLayers.Geometry.Point(t,i),f=0,r=0;r<n.length;r++)n[f].geometry||f++;if(f==n.length)return null;for(u=o.distanceTo(n[f].geometry,{details:!0,edge:!0}),u.index=f,r=f+1;r<n.length;r++)n[r].geometry&&(e=o.distanceTo(n[r].geometry,{details:!0,edge:!0}),e.index=r,e.distance<u.distance&&(u=e,s=r,u.index=r));return u},IfxStpmapCommon.cloneRoutePoint=function(n){var t={};return t.pointType=n.pointType,t.pointDescr=n.pointDescr,t.routePointNo=n.routePointNo,t.direction=n.direction,t.routeContactList=n.routeContactList,t.linkId=n.linkId,t.isAnchorPoint=n.isAnchorPoint,t.pointGeom={sdo_point:{}},t.pointGeom.sdo_point.X=n.pointGeom.sdo_point.X,t.pointGeom.sdo_point.Y=n.pointGeom.sdo_point.Y,t},IfxStpmapCommon.createLineGeometry=function(n){for(var i=[],t=0;t<n.OrdinatesArray.length;t+=2)i.push(new OpenLayers.Geometry.Point(n.OrdinatesArray[t],n.OrdinatesArray[t+1]));return new OpenLayers.Geometry.LineString(i)},IfxStpmapCommon.createFeatureForWaypoints=function(n,t,i){var r,e,u,f;for(n.otherinfo==undefined&&(n.otherinfo={completefeatures:[]}),n.otherinfo.completefeatures==undefined&&(n.otherinfo.completefeatures=[]),(t.otherinfo==undefined||t.otherinfo.completefeatures==undefined)&&(t.otherinfo={completefeatures:[]}),r=0;r<n.routePointList.length;r++)if(n.routePointList[r].pointType>1)if(link=i.searchRouteLinkByLinkID(n.pathNo,t.segmentNo-1,n.routePointList[r].linkId),link!=undefined){if(t.routeLinkList[link.linkNo-1].linkId==n.routePointList[r].linkId||t.routeLinkList[link.linkNo+1].linkId==n.routePointList[r].linkId)break;e=t.routeLinkList.length,link.linkNo<=e-2&&link.linkNo>=1&&(u=IfxStpmapCommon.getFeatureOfLinkId(t.otherinfo.features,t.routeLinkList[link.linkNo-1].linkId),f=IfxStpmapCommon.getFeatureOfLinkId(t.otherinfo.features,t.routeLinkList[link.linkNo+1].linkId),u!=null&&u!=undefined&&f!=null&&f!=undefined&&(u.attributes.NREF_IN_ID==f.attributes.NREF_IN_ID||u.attributes.REF_IN_ID==f.attributes.NREF_IN_ID||u.attributes.NREF_IN_ID==f.attributes.REF_IN_ID)&&(t.routeLinkList[link.linkNo+1]&&link.linkId==t.routeLinkList[link.linkNo+1].linkId||t.routeLinkList[link.linkNo-1]&&link.linkId==t.routeLinkList[link.linkNo-1].linkId)&&(i.removeFeaturesFromRoutePath(n.pathNo,link.linkId),IfxStpmapCommon.getWaypointSegmentFeature(n,t,r,!0)))}else IfxStpmapCommon.getWaypointSegmentFeature(n,t,r,!1)},IfxStpmapCommon.getWaypointSegmentFeature=function(n,t,i,r){var u,f,e,o;n.routePointList[i].otherinfo.pointfeature!=null&&n.routePointList[i].otherinfo.pointfeature!=undefined&&(u=n.routePointList[i].lrs/IfxStpmapCommon.getLengthOfFeature(n.routePointList[i].otherinfo.pointfeature),u<=.5?r==!1?(f=LRSSubstring(n.routePointList[i].otherinfo.pointfeature.geometry,0,u),e=1):(f=LRSSubstring(n.routePointList[i].otherinfo.pointfeature.geometry,u,1),e=0):r==!1?(f=LRSSubstring(n.routePointList[i].otherinfo.pointfeature.geometry,u,1),e=0):(f=LRSSubstring(n.routePointList[i].otherinfo.pointfeature.geometry,0,u),e=1),n.routePointList[i].direction=e,o=new OpenLayers.Feature.Vector(f),o.data="NORMAL",n.otherinfo.completefeatures.push(o),t.otherinfo.completefeatures.push(o))},IfxStpmapCommon.createFeatureForRouteSegment=function(n){var t,i,u,r;if(n.otherinfo==undefined&&(n.otherinfo={completefeatures:[],features:[]}),n.offRoadGeometry!=null){n.otherinfo.completefeatures.push(new OpenLayers.Feature.Vector(IfxStpmapCommon.createLineGeometry(n.offRoadGeometry)));return}for(n.otherinfo.features!=null&&(n.otherinfo.completefeatures=n.otherinfo.features.slice(0)),n.routeLinkList.length>0?(i=IfxStpmapCommon.getFeatureOfLinkId(n.otherinfo.features,n.routeLinkList[0].linkId),i==null&&(i=n.otherinfo.startSegmentfeature),t=IfxStpmapCommon.getRoutePointSegmentFeature(n.startPointGeometry,n.otherinfo.startSegmentfeature,i,"STARTPOINT"),n.startPointDirection=t.direction,t.feature.geometry!=null?(n.otherinfo.startSegmentfeature&&(t.feature.attributes=n.otherinfo.startSegmentfeature.attributes),n.otherinfo.completefeatures.push(t.feature)):n.otherinfo.completefeatures.push(n.otherinfo.startSegmentfeature),i=IfxStpmapCommon.getFeatureOfLinkId(n.otherinfo.features,n.routeLinkList[n.routeLinkList.length-1].linkId),i==null&&(i=n.otherinfo.endSegmentfeature),t=IfxStpmapCommon.getRoutePointSegmentFeature(n.endPointGeometry,n.otherinfo.endSegmentfeature,i,"ENDPOINT"),n.endPointDirection=t.direction,t.feature.geometry!=null?(n.otherinfo.endSegmentfeature&&(t.feature.attributes=n.otherinfo.endSegmentfeature.attributes),n.otherinfo.completefeatures.push(t.feature)):n.otherinfo.completefeatures.push(n.otherinfo.endSegmentfeature)):(t=IfxStpmapCommon.getRoutePointSegmentFeature(n.startPointGeometry,n.otherinfo.startSegmentfeature,n.otherinfo.endSegmentfeature,"STARTPOINT"),n.startPointDirection=t.direction,t.feature.geometry!=null&&n.otherinfo.startSegmentfeature&&(t.feature.attributes=n.otherinfo.startSegmentfeature.attributes),n.otherinfo.completefeatures.push(t.feature),t=IfxStpmapCommon.getRoutePointSegmentFeature(n.endPointGeometry,n.otherinfo.endSegmentfeature,n.otherinfo.startSegmentfeature,"ENDPOINT"),n.endPointDirection=t.direction,t.feature.geometry!=null&&n.otherinfo.endSegmentfeature&&(t.feature.attributes=n.otherinfo.endSegmentfeature.attributes),n.otherinfo.completefeatures.push(t.feature)),u=IfxStpmapCommon.getSegmentTypeName(n.segmentType),r=0;r<n.otherinfo.completefeatures.length;r++)n.otherinfo.completefeatures[r].data=u},IfxStpmapCommon.createPartialFeatureForRouteSegment=function(n,t,i,r,u,f){var s=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(i,r),{tolerance:.5,details:!0}),e,o;return e=t==1?s.subString1:s.subString2,o=new OpenLayers.Feature.Vector(e),f=="STARTPOINT"?u.otherinfo.startSegmentfeature&&(o.attributes=u.otherinfo.startSegmentfeature.attributes):f=="ENDPOINT"&&u.otherinfo.endSegmentfeature&&(o.attributes=u.otherinfo.endSegmentfeature.attributes),u.otherinfo.completefeatures=[],u.otherinfo.completefeatures.push(o),u.otherinfo.completefeatures[0].data="NORMAL",new OpenLayers.Feature.Vector(e)},IfxStpmapCommon.getPartialFeature=function(n,t,i){var r,u,f,e;return i!=1?(r=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(t.startPointGeometry.sdo_point.X,t.startPointGeometry.sdo_point.Y),{tolerance:.5,details:!0}),u=t.startPointDirection):(r=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(t.endPointGeometry.sdo_point.X,t.endPointGeometry.sdo_point.Y),{tolerance:.5,details:!0}),u=!t.endPointDirection),f=u==0?r.subString1:r.subString2,e=new OpenLayers.Feature.Vector(f),e.attributes=n.attributes,e},IfxStpmapCommon.getPointTypeID=function(n){return n=="STARTPOINT"?0:n=="ENDPOINT"?1:n=="WAYPOINT"?2:n=="VIAPOINT"?3:n=="FORCEDVIAPOINT"?7:0},IfxStpmapCommon.getPointTypeName=function(n){switch(n){case 0:case 5:return"STARTPOINT";case 1:case 4:return"ENDPOINT";case 2:return"WAYPOINT";case 3:return"VIAPOINT";case 7:return"FORCEDVIAPOINT"}},IfxStpmapCommon.getPathTypeName=function(){},IfxStpmapCommon.getPathTypeID=function(){},IfxStpmapCommon.getSegmentTypeName=function(n){switch(n){case 1:case"NORMAL":return"NORMAL";case 2:case"OVERRIDE":return"OVERRIDE";case 3:case"OFFROAD":return"OFFROAD";case 4:case"SHUNT":return"SHUNT";case 5:case"UTURN":return"UTURN";case 6:case"BROKEN":return"BROKEN";case 7:case"ASSUMED":return"ASSUMED";default:return"CONFIRMED"}},IfxStpmapCommon.getSegmentTypeID=function(n){switch(n){case"NORMAL":case 1:return 1;case"OVERRIDE":case 2:return 2;case"OFFROAD":case 3:return 3;case"SHUNT":case 4:return 4;case"UTURN":case 5:return 5;case"BROKEN":case 6:return 6;case"ASSUMED":case 7:return 7;default:return 8}},IfxStpmapCommon.getStrokeOpacity=function(n){switch(n.data){case"UNUSABLE":return.3;default:return.7}},IfxStpmapCommon.getStrokeWidth=function(n){switch(n.data){case"UNUSABLE":return 12;default:return 3}},IfxStpmapCommon.getColor=function(n){switch(n.data){case"NORMAL":case 1:case 231001:return"#8000FF";case"OVERRIDE":case 2:case 231002:case"UNUSABLE":return"#FF3535";case"UTURN":case 5:case 231005:return"#4C6160";case"CONFIRMED":case 8:case 231008:return"#A35024";default:return"#6FB9C5"}},IfxStpmapCommon.getMarkerImage=function(n,t){if(n==undefined||n==0){if(t=="STARTPOINT")return"/Content/Images/startmarker.png";if(t=="ENDPOINT")return"/Content/Images/endmarker.png"}else if(n==1){if(t=="STARTPOINT")return"/Content/Images/alt_startmarker.png";if(t=="ENDPOINT")return"/Content/Images/merge.png"}else if(n==2){if(t=="STARTPOINT")return"/Content/Images/diverge.png";if(t=="ENDPOINT")return"/Content/Images/merge.png"}else if(n==3){if(t=="STARTPOINT")return"/Content/Images/diverge.png";if(t=="ENDPOINT")return"/Content/Images/alt_endtmarker.png"}},IfxStpmapCommon.getFinalSuitability=function(n){var t="Default";if(n){if(n=="Unsuitable")return"Unsuitable";n=="Marginally suitable"&&t!="Marginally suitable"&&(t="Marginally suitable")}return t},IfxStpmapCommon.getStructureImage=function(n,t){t=t==null||t==undefined?"":t.toLowerCase();switch(n){case"underbridge":case"overbridge":case"tunnel":case"special":case"roundabout":case"level crossing":case"roundabout":case"tunnel":default:switch(t){case"unsuitable":return"/Content/Images/structure_red.png";case"marginally suitable":return"/Content/Images/structure_yellow.png";default:return"/Content/Images/structure.png"}}},IfxStpmapCommon.getSuitabilityColor=function(n,t){n=n==null||n==undefined?"":n.toLowerCase();switch(t){case 0:switch(n){case"unsuitable":return"#f70012";case"marginally suitable":return"#ffdb17";default:return"#17b6ff"}default:return"#ff0000"}},IfxStpmapCommon.getConstraintTypeDescription=function(n){switch(n){case"253002":return"height";case"253003":return"width";case"253004":return"length";case"253005":return"weight";case"253006":return"oneway";case"253007":return"roadworks";case"253008":return"incline";case"253009":return"tram";case"253010":return"tight bend";case"253011":return"event";case"253012":return"risk of grounding";case"253013":return"unmade";case"253014":return"natural void";case"253015":return"manmade void";case"253016":return"tunnel";case"253017":return"tunnel void";case"253018":return"pipes and ducts";case"retaining wall":case"253019":return"retaining wall";case"253020":return"traffic calming";case"253021":return"overhead building";case"253022":return"overhead pipes and utilities";case"253023":return"adjacent retaining wall";case"253024":return"power cable";case"253025":return"telecomms cable";case"253026":return"gantry road furniture";case"253027":return"cantilever road furniture";case"253028":return"catenary road furniture";case"253029":return"electrification cable";case"253030":return"bollard";case"253031":return"removable bollard";default:return"Generic"}},IfxStpmapCommon.getConstraintImage=function(){return"/Content/Images/constraint_icons/Roadworks_Severe_Current3.gif"},IfxStpmapCommon.getRoutePlanUnit=function(n){switch(n){case"692002":return"imperial";default:return"metric"}},IfxStpmapCommon.getIntersectedFeatures=function(n,t,i){var o=[],u,s,f,h,r,e;if(i=="linear")for(r=0;r<t.length;r++)for(u=0;u<t[r].geometry.components.length-1;u++){for(s=t[r].geometry.components[u].x<t[r].geometry.components[u+1].x?{x1:t[r].geometry.components[u].x,y1:t[r].geometry.components[u].y,x2:t[r].geometry.components[u+1].x,y2:t[r].geometry.components[u+1].y}:{x1:t[r].geometry.components[u+1].x,y1:t[r].geometry.components[u+1].y,x2:t[r].geometry.components[u].x,y2:t[r].geometry.components[u].y},f=0;f<n.geometry.components.length-1;f++)if(h=n.geometry.components[f].x<n.geometry.components[f+1].x?{x1:n.geometry.components[f].x,y1:n.geometry.components[f].y,x2:n.geometry.components[f+1].x,y2:n.geometry.components[f+1].y}:{x1:n.geometry.components[f+1].x,y1:n.geometry.components[f+1].y,x2:n.geometry.components[f].x,y2:n.geometry.components[f].y},e=OpenLayers.Geometry.segmentsIntersect(s,h,{point:!0,tolerance:5}),e){o.push(t[r]);break}if(e)break}else for(r=0;r<t.length;r++)e=n.geometry.intersects(t[r].geometry),e&&o.push(t[r]);return o},IfxStpmapCommon.capitaliseString=function(n){return n.charAt(0).toUpperCase()+n.substring(1)},IfxStpmapCommon.getRouteAppraisalParams=function(n){switch(n){case"ROUTELIBRARY":return{routeType:0,checkAppraisal:!1};default:return{routeType:1,checkAppraisal:!0}}},IfxStpmapCommon.setFeatureDataForRoute=function(n,t){for(var i=0;i<n.length;i++)n[i].data=t;return n},IfxStpmapCommon.getLRSLength=function(n,t){var i=LRSMeasure(n,t,{tolerance:.5,details:!0});return Math.round(i.length)},IfxStpmapCommon.getLengthOfFeature=function(n){return n.geometry.getLength()},IfxStpmapCommon.checkForPedestrianRoad=function(n){return n.attributes.AR_AUTO=="N"&&n.attributes.AR_TRUCKS=="N"?!0:!1},IfxStpmapCommon.findIsNearest=function(n,t,i,r){var f=new OpenLayers.Geometry.Point(n,t),e=new OpenLayers.Geometry.Point(i.x,i.y),o=new OpenLayers.Geometry.Point(r.x,r.y),u=f.distanceTo(e,{details:!0,edge:!0}),s=u.distance;return(u=f.distanceTo(o,{details:!0,edge:!0}),s<u.distance)?!0:!1},IfxStpmapCommon.findIsNearestWithDirection=function(n,t,i,r,u,f){var o=LRSMeasure(i.feature.geometry,new OpenLayers.Geometry.Point(t.x1,t.y1),{tolerance:.5,details:!0}),c=Math.round(o.measure).toFixed(2),h,s,e;return o.measure==1||Math.round(o.measure*1e3)==1e3?r==undefined?!0:IfxStpmapCommon.findIsNearest(t.x1,t.y1,i.point,r.point):(h=IfxStpmapCommon.getDirectionOfRouteLink(n,t,i.feature,u),h==1?(s=LRSMeasure(i.feature.geometry,new OpenLayers.Geometry.Point(i.point.x,i.point.y),{tolerance:.5,details:!0}),f==1&&s.measure<o.measure)?r!=undefined?e=IfxStpmapCommon.findIsNearest(t.x1,t.y1,i.point,r.point):!0:f==2&&s.measure>o.measure?r!=undefined?e=IfxStpmapCommon.findIsNearest(t.x1,t.y1,i.point,r.point):!0:!1:(s=LRSMeasure(i.feature.geometry,new OpenLayers.Geometry.Point(i.point.x,i.point.y),{tolerance:.5,details:!0}),f==1&&s.measure>o.measure)?r!=undefined?e=IfxStpmapCommon.findIsNearest(t.x1,t.y1,i.point,r.point):!0:f==2&&s.measure<o.measure?r!=undefined?e=IfxStpmapCommon.findIsNearest(t.x1,t.y1,i.point,r.point):!0:!1)},IfxStpmapCommon.getDirectionOfRouteLink=function(n,t,i,r,u){var f=1,i,s,o,h,e;return u==undefined&&(u=r.searchRouteLinkByLinkID(t.pathIndex,t.segmentIndex,i.attributes.LINK_ID)),u!=undefined?(i=r.searchFeatureInRouteByLinkId(t.pathIndex,t.segmentIndex,u.linkId),i!=undefined&&(n.routeLinkList.length>1?u.linkNo!=n.routeLinkList.length?(h=n.routeLinkList[u.linkNo],e=r.searchFeatureInRouteByLinkId(t.pathIndex,t.segmentIndex,h.linkId),e!=undefined?f=i.attributes.REF_IN_ID==e.attributes.REF_IN_ID||i.attributes.REF_IN_ID==e.attributes.NREF_IN_ID?0:1:(s=n.routeLinkList[u.linkNo-2],o=r.searchFeatureInRouteByLinkId(t.pathIndex,t.segmentIndex,s.linkId),o!=undefined&&(f=i.attributes.REF_IN_ID==o.attributes.REF_IN_ID||i.attributes.REF_IN_ID==o.attributes.NREF_IN_ID?1:0))):(s=n.routeLinkList[u.linkNo-2],o=r.searchFeatureInRouteByLinkId(t.pathIndex,t.segmentIndex,s.linkId),o!=undefined?f=i.attributes.REF_IN_ID==o.attributes.REF_IN_ID||i.attributes.REF_IN_ID==o.attributes.NREF_IN_ID?1:0:(h=n.routeLinkList[u.linkNo],e=r.searchFeatureInRouteByLinkId(t.pathIndex,t.segmentIndex,h.linkId),e!=undefined&&(f=i.attributes.REF_IN_ID==e.attributes.REF_IN_ID||i.attributes.REF_IN_ID==e.attributes.NREF_IN_ID?0:1))):(e=n.otherinfo.endSegmentfeature,f=i.attributes.REF_IN_ID==e.attributes.REF_IN_ID||i.attributes.REF_IN_ID==e.attributes.NREF_IN_ID?0:1))):i.attributes.LINK_ID==n.startLinkId?f=n.startPointDirection:i.attributes.LINK_ID==n.endLinkId&&(f=n.endPointDirection),f},IfxStpmapCommon.findIfIntersects=function(n,t,i){var r=new OpenLayers.Geometry.Point(t,i),u=r.distanceTo(n.geometry,{details:!0,edge:!0});return u.distance<5?!0:!1},IfxStpmapCommon.getNearestIntersectionPoints=function(n,t,i,r,u){for(var h=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(r,u),{tolerance:.5,details:!0}),o={lrs:0,index:-1},s={lrs:1,index:-1},e,c,f=0;f<i.length;f++)e=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(i[f].x,i[f].y),{tolerance:.5,details:!0}),e.measure>o.lrs&&e.measure<h.measure&&(o.lrs=e.measure,o.index=f),e.measure<s.lrs&&e.measure>h.measure&&(s.lrs=e.measure,s.index=f);return t==0&&(c=o,o=s,s=c),{near1:o,near2:s}},IfxStpmapCommon.compareGeometries=function(n,t,i){return(i==undefined||i==null)&&(i=1),n.x!=undefined&&n.x!=null?t.x!=undefined&&t.x!=null?Math.abs(Math.round(n.x)-Math.round(t.x))<=i&&Math.abs(Math.round(n.y)-Math.round(t.y))<=i?!0:!1:Math.abs(Math.round(n.x)-Math.round(t.X))<=i&&Math.abs(Math.round(n.y)-Math.round(t.Y))<=i?!0:!1:t.x!=undefined&&t.x!=null?Math.abs(Math.round(n.X)-Math.round(t.x))<=i&&Math.abs(Math.round(n.Y)-Math.round(t.y))<=i?!0:!1:Math.abs(Math.round(n.X)-Math.round(t.X))<=i&&Math.abs(Math.round(n.Y)-Math.round(t.Y))<=i?!0:!1},IfxStpmapCommon.checkLinkContinuity=function(n,t,i,r){var u,f,e,o;if(i=="REF_NODE"){for(u=0;u<t.length;u++)if(u!=n&&(t[u].attributes.REF_IN_ID==t[n].attributes.REF_IN_ID||t[u].attributes.NREF_IN_ID==t[n].attributes.REF_IN_ID)){if(t[n].geometry.components.length==2)var s=(t[n].geometry.components[0].x+t[n].geometry.components[1].x)/2,h=(t[n].geometry.components[0].y+t[n].geometry.components[1].y)/2,e=new OpenLayers.Geometry.Point(s,h);else f=Math.floor(t[n].geometry.components.length/2),e=t[n].geometry.components[f];return(o=e.distanceTo(r.geometry),o>5)?!1:!0}}else for(u=0;u<t.length;u++)if(u!=n&&(t[u].attributes.REF_IN_ID==t[n].attributes.NREF_IN_ID||t[u].attributes.NREF_IN_ID==t[n].attributes.NREF_IN_ID)){if(t[n].geometry.components.length==2)var s=(t[n].geometry.components[0].x+t[n].geometry.components[1].x)/2,h=(t[n].geometry.components[0].y+t[n].geometry.components[1].y)/2,e=new OpenLayers.Geometry.Point(s,h);else f=Math.floor(t[n].geometry.components.length/2),e=t[n].geometry.components[f];return(o=e.distanceTo(r.geometry),o>5)?!1:!0}return!1},IfxStpmapCommon.checkRouteContinuity=function(n,t){var i;if(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routePointList[0].pointGeom.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routePointList[0].pointGeom.sdo_point)){for(i=0;i<n.routeSegmentList.length;i++)if(i!=t&&(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routeSegmentList[i].endPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routeSegmentList[i].endPointGeometry.sdo_point)))return!1}else if(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routePointList[1].pointGeom.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routePointList[1].pointGeom.sdo_point)){for(i=0;i<n.routeSegmentList.length;i++)if(i!=t&&(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routeSegmentList[i].startPointGeometry.sdo_point)))return!1}else for(i=0;i<n.routeSegmentList.length;i++)if(i!=t&&(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routeSegmentList[i].endPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routeSegmentList[i].endPointGeometry.sdo_point)))return!1;return!0},IfxStpmapCommon.checkOffRoadExtend=function(n,t){var i;if(n.routeSegmentList[t].segmentNo==1)return 1;if(n.routeSegmentList[t].segmentNo=n.routeSegmentList.length)if(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routePointList[1].pointGeom.sdo_point)){for(i=0;i<n.routeSegmentList.length;i++)if(i!=t&&(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routeSegmentList[i].endPointGeometry.sdo_point)))return 2}else if(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].endPointGeometry.sdo_point,n.routePointList[1].pointGeom.sdo_point))for(i=0;i<n.routeSegmentList.length;i++)if(i!=t&&(IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routeSegmentList[t].startPointGeometry.sdo_point,n.routeSegmentList[i].endPointGeometry.sdo_point)))return 2;return 0},IfxStpmapCommon.getDelegRoadColor=function(n){switch(n.data){case"a":case"owned":case"corridor":return"#1919FF";case"b":case"c":case"unassigned":return"#3F1201";case"mandate":case"linepart":return"#00d3f4";case"corridorselect":return"#000000";case"dsselectown":return objifxStpMap.pageType=="AGRICULTURE"||objifxStpMap.pageType=="LZV"?"#0048ff":"#44FF00";case"dsselectotr":return"#f70012";default:return objifxStpMap.pageType=="AGRICULTURE"||objifxStpMap.pageType=="LZV"?"#0048ff":"#44FF00"}},IfxStpmapCommon.getDelegationMarkerImage=function(n){switch(n){case 0:return"/Content/Images/delegationstart.png";case 1:return"/Content/Images/delegationend.png"}},IfxStpmapCommon.getSdo_gtype=function(n){switch(n){case"POINT":return 2001;case"LINE":return 2002;case"POLYGON":return 2003}},IfxStpmapCommon.getSdo_srid=function(){return 28992},IfxStpmapCommon.getZoomStatusPos=function(n){switch(n){case 12:return{margin_left:"",margin_top:"7.5%"};case 11:return{margin_left:"",margin_top:"8.5%"};case 10:return{margin_left:"",margin_top:"9.5%"};case 9:return{margin_left:"6px",margin_top:"10.5%"};case 8:return{margin_left:"6px",margin_top:"11.5%"};case 7:return{margin_left:"6px",margin_top:"12.5%"};case 6:return{margin_left:"6px",margin_top:"13.5%"};case 5:return{margin_left:"6px",margin_top:"14.5%"};case 4:return{margin_left:"6px",margin_top:"15.5%"};case 3:return{margin_left:"6px",margin_top:"16.5%"};case 2:return{margin_left:"6px",margin_top:"17.5%"};case 1:return{margin_left:"6px",margin_top:"18.5%"};case 0:return{margin_left:"6px",margin_top:"19.5%"}}},IfxStpmapCommon.getDecisionSpaceType=function(n){n=n.toLowerCase();switch(n){case"restrictions":return 902001;case"agriculture":return 902002;case"its":return 902003;case"convoy":return 902004;case"lzv":return 902005;case"lbov":return 902007}};var objifxStpMap,objifxStpmapStructures,objifxStpMapRoadDelegation,objifxStpmapRoadOwnership,pageType,annotPosition,currentMouseOverFeature=null,mapfromroutesmenu=!1,mapcontextMenuOn=!1,timer,popupTimer,returnLeg=!1,showRouteAssessment=!0,drawManouevre=null,notifrouteedit=!1,popUpFlag=0,selProductFlag=0,marginalHeight=0,FVPCount=0,dwoID=0,routeModified=!1,fvpXGeometry=0,fvpYGeometry=0,fvpStructName=null,clearRouteForPlan=!1,fvpAnnotationflag=0,fvpLinkId=0,fvpStructCode=null,fvpAnnotation={annotText:null,annotType:null,annotationContactList:[],direction:1,easting:138288.92120639,geometry:{sdo_point:{X:"",Y:""}},linearRef:0,linkId:0,structureEsrn:null,northing:451720.32615757},ListAnnotation=[],FvpannotationPix={X:"",Y:""},breakruleflag=0,swapflag=0,FVPflag=0,panStartPos=0,panEndPos=0,panPopuppos=0,vectorLayerConstraintsFeatures={cluster:[]};annotationObject=null;var affectedCheckBoxFlag=0,unsuitableCheckBoxFlag=0,planRouteOnly=0;flag=0,$(document).keydown(function(n){n.keyCode==27&&$(document).find("#route_search_popup").length>0&&($(document).find("#route_search_popup").hide(),$(document).find("#Map_View").css("z-index",0),$(document).find("#map").css("z-index",0),$(document).find("#wraper_leftpanel_content").css("overflow","auto"))}),getFeatureForRoads=function(n,t,i){if(n!=null)var r="/DecisionSpace/GetOwnedLinks",u=JSON.stringify({organisationId:$("#hdnORGID").val(),linkIdList:n});$.ajax({url:r,type:"POST",cache:!0,contentType:"application/json; charset=utf-8",data:u,success:function(n){n=="Session timeout"&&(location.reload(),stopAnimation()),n.length>0?$.each(n,function(n,r){var u,f,e,o;r.LinkStatus==1?i&&typeof i=="function"?i():document.getElementById("RtFinal").checked?($("#annotType").prop("disabled",!0),$("#annotText").prop("disabled",!0),$("#noOfConvoy").prop("disabled",!0),$("#InsertAnnot").hide()):($("#annotType").prop("disabled",!1),$("#annotText").prop("disabled",!1),$("#noOfConvoy").prop("disabled",!1),$("#InsertAnnot").show()):t==1?($("#annotType").prop("disabled",!0),$("#annotText").prop("disabled",!0),$("#noOfConvoy").prop("disabled",!0),$("#InsertAnnot").hide(),i&&typeof i=="function"&&i()):t==2||t==3?(u=objifxStpMap.vectorLayerMarkers.getFeaturesByAttribute("name",objifxStpMap.CurFeture.data.name),f=objifxStpMap.CurFeture.data.name.split(" "),objifxStpMap.undoMarkerDrag(u[0],f),objifxStpMap.DragCompFlag=t==3?!1:!0):(e=getCurrentMouseOverFeature(),o=e[0],o=="ANNOTATION"?showNotification(Lang_Key.Notif_Annot_Deletion):showNotification(Lang_Key.WngPopup_Selection_failed))}):(showNotification(Lang_Key.NotifNoRoadFnd),stopAnimation())}})},IfxStpMap.prototype.imageFormat="image/png8",IfxStpMap.prototype.setProjectDetails=function(n){n=="NWK"&&(this.project="NWK",this.mapType!="Q42016"?(this.geoserverUrl=objifxStpMap.configGeoserverUrl,this.geoserverGwcUrl=objifxStpMap.configGeoserverGwcUrl,this.geoserverWfsUrl=objifxStpMap.configGeoserverWfsUrl,this.backgroundLayers="NWKMAP:NWKMapSpatial",this.requestPart1="?request=GetFeature&typeName=NWKMAP:STREETS&propertyName=LINK_ID,ST_NAME,REF_IN_ID&outputFormat=application/json&version=1.0.0&CQL_FILTER=",this.unassignedRoadsLayer="NWKMAP:UnassignedRoads",this.hectoLayer="NWKMAP:HECTOMETERS",this.flyoverLayer="NWKMAP:FLYOVERS",this.LayerRoadName="NWKMAP:STREETS",this.roadOwnershipLayer="NWKMAP:RoadOwnership",this.restrictionLayer="NWKMAP:DS_Restrictions",this.agricultureLayer="NWKMAP:DS_Agriculture",this.lzvLayer="NWKMAP:DS_LZV",this.convoyLayer="NWKMAP:Convoy",this.consultRestrictionLayer="NWKMAP:ConsultRestrictions",this.corridorAnalysisLayer="NWKMAP:CORRIDOR_ANALYSIS",this.decisionspaceAnalysisLayer="NWKMAP:DECISIONSPACE_ANALYSIS",this.historicrouteLayer="NWKMAP:HistoricRoute"):(this.geoserverUrl=objifxStpMap.configGeoserverMU_Url,this.geoserverGwcUrl=objifxStpMap.configGeoserverGwcMU_Url,this.geoserverWfsUrl=objifxStpMap.configGeoserverWfsMU_Url,this.backgroundLayers="NWKMAPUPGRADE:NWKMAPSPATIALMU",this.requestPart1="?request=GetFeature&typeName=NWKMAPUPGRADE:STREETS&propertyName=LINK_ID,ST_NAME,REF_IN_ID&outputFormat=application/json&version=1.0.0&CQL_FILTER=",this.unassignedRoadsLayer="NWKMAPUPGRADE:UnassignedRoads",this.hectoLayer="NWKMAPUPGRADE:HECTOMETERS",this.flyoverLayer="NWKMAPUPGRADE:FLYOVERS",this.LayerRoadName="NWKMAPUPGRADE:STREETS",this.roadOwnershipLayer="NWKMAPUPGRADE:RoadOwnership",this.restrictionLayer="NWKMAPUPGRADE:DS_Restrictions",this.agricultureLayer="NWKMAPUPGRADE:DS_Agriculture",this.lzvLayer="NWKMAPUPGRADE:DS_LZV",this.convoyLayer="NWKMAP:Convoy",this.consultRestrictionLayer="NWKMAP:ConsultRestrictions",this.corridorAnalysisLayer="NWKMAP:CORRIDOR_ANALYSIS",this.decisionspaceAnalysisLayer="NWKMAP:DECISIONSPACE_ANALYSIS",this.historicrouteLayer="NWKMAP:HistoricRoute"),this.defaultZoom={X:137639,Y:452439,zoom:2})},IfxStpMap.prototype.pageType=0,IfxStpMap.prototype.pageState="readyidle",IfxStpMap.prototype.olMap=null,IfxStpMap.prototype.vectorLayerMarkers=null,IfxStpMap.prototype.vectorLayerRoute=null,IfxStpMap.prototype.vectorLayerOffRoad=null,IfxStpMap.prototype.vectorLayerSketcheaoute=null,IfxStpMap.prototype.vectorLayerStructures=null,IfxStpMap.prototype.vectorLayerStructuresLine=null,IfxStpMap.prototype.vectorLayerConstraints=null,IfxStpMap.prototype.vectorLayerDelegRoads=null,IfxStpMap.prototype.routeManager=null,IfxStpMap.prototype.returnLegRoute=null,IfxStpMap.prototype.tempRoutePart=null,IfxStpMap.prototype.RetFeature=null,IfxStpMap.prototype.CurFeture=null,IfxStpMap.prototype.DragCompFlag=!0,IfxStpMap.prototype.currentActiveRoutePathIndex=0,IfxStpMap.prototype.dragMarkerDiff={X:"",Y:""},IfxStpMap.prototype.eventList={},IfxStpMap.prototype.bounds={left:"",bottom:"",right:"",top:""},IfxStpMap.prototype.previousActivity="",IfxStpMap.prototype.boundaryOffset=500,IfxStpMap.prototype.projectTypeITSDetailsPortal="",editRouteModeFlag=0,IfxStpMap.prototype.loadMap=function(n,t,i,r,u,f){var e,o;if(n=="NOMAPDISPLAY"){this.pageState="readyidle",this.pageType=n;return}this.pageState="pageloading",this.pageType=n,u!=undefined&&this.setProjectDetails(u);try{this.createMapObject(),this.addLayers(),this.addScaleBar(i)}catch(s){}this.createVectorLayerObjects();try{this.createClickControl(),this.createControls()}catch(s){}n!="DISPLAYONLY"&&n!="DISPLAYONLY_EDITANNOTATION"&&n!="CONSULTRESTRICTION"&&n!="DELEGATION_VIEWONLY"&&n!="DELEGATION_VIEWANDEDIT"&&n!="ROADOWNERSHIP_VIEWONLY"&&n!="ROADOWNERSHIP_VIEWANDEDIT"&&n!="MAINTAIN_CORRIDOR"&&n!="MAINTAIN_CORRIDOR_EDITMODE"&&n!="LZV"&&n!="AGRICULTURE"&&n!="CONVOY"&&n!="LBOV"&&n!="ITS"&&n!="MIG_ITS"&&n!="DS_ANALYSIS"&&n!="CR_VIEWANDEDIT"&&(this.createOffRoadLineControl(),this.createDragFeature()),this.createToolbar(),this.createRouteAppraisalToolbar(),this.createadv_rtplanCancelToolbar(),this.createManoeuvreCancelToolbar(),(n=="DELEGATION_VIEWANDEDIT"||n=="ROADOWNERSHIP_VIEWANDEDIT"||n=="MAINTAIN_CORRIDOR"||n=="MAINTAIN_CORRIDOR_EDITMODE"||n=="LZV"||n=="AGRICULTURE"||n=="CONVOY"&&n=="LBOV"||n=="ITS"||n=="MIG_ITS"||n=="DS_ANALYSIS"||n=="CR_VIEWANDEDIT")&&(n=="CR_VIEWANDEDIT"&&(objifxStpmapDecisionSpace.createPolygonDrawControl(),objifxStpmapDecisionSpace.createRoadDelegationToolBar()),n=="DELEGATION_VIEWANDEDIT"?(objifxStpMapRoadDelegation.createPolygonDrawControl(),objifxStpMapRoadDelegation.createRoadDelegationToolBar()):n=="ROADOWNERSHIP_VIEWANDEDIT"&&(objifxStpmapRoadOwnership.createPolygonDrawControl(),objifxStpmapRoadOwnership.createRoadDelegationToolBar(),objifxStpmapDecisionSpace.createRoadDelegationToolBar(),objifxStpMap.project=="NWK"&&btnSelectByLink.activate())),this.olMap.updateSize(),n=="STRUCTURES"&&$("#PortalType").val()!="696011"&&(objifxStpmapStructures.createConstraintDrawControl(),objifxStpmapStructures.createConstraintToolBar(),objifxStpmapStructures.constraintbyDescrToolbar()),t==undefined||t==null||t.routePathList[0].routePointList.length==0?r!=undefined&&r!=null?(e=new OpenLayers.Bounds,e.extend(new OpenLayers.LonLat(r.x1,r.y1)),e.extend(new OpenLayers.LonLat(r.x2,r.y2)),this.olMap.zoomToExtent(e,!0)):n=="STRUCTURES"?this.olMap.setCenter([this.defaultZoom.X,this.defaultZoom.Y],2):(o=objifxStpMap.mapType,n!="NWK_STRUCTURES"&&n!="MIG_STRUCTURES"&&(n!="LZV"||n!="AGRICULTURE"||n!="ROADOWNERSHIP_VIEWANDEDIT"||n!="MAINTAIN_CORRIDOR_EDITMODE")&&o!="Q42016"&&this.olMap.setCenter([this.defaultZoom.X,this.defaultZoom.Y],this.defaultZoom.zoom)):this.setRoutePart(t,null),this.pageState="readyidle",f&&typeof f=="function"&&f()},IfxStpMap.prototype.getProject=function(){return this.project},IfxStpMap.prototype.zoomIn=function(){this.olMap.zoomIn()},IfxStpMap.prototype.zoomOut=function(){this.olMap.zoomOut()},IfxStpMap.prototype.setCurrentActiveRoutePath=function(n){this.currentActiveRoutePathIndex=n},IfxStpMap.prototype.setCenter=function(n,t){var i;i=t?new OpenLayers.LonLat(n.x,n.y):this.olMap.getLonLatFromPixel(n),this.olMap.setCenter(i)},IfxStpMap.prototype.setCenterAndZoom=function(n,t){this.setCenter(n,t),this.zoomIn()},IfxStpMap.prototype.setZoomTo=function(n,t,i){var r=parseInt(n),u=parseInt(t);this.olMap.setCenter([r,u],i)},IfxStpMap.prototype.registerEvent=function(n,t){this.eventList[n]=t},IfxStpMap.prototype.createMapObject=function(){var n=this,t=new OpenLayers.Bounds(-124667.92731771,306850.10161508,277963.660551261,833251.026523568),i={resolutions:[1228.8,614.4,307.2,153.6,76.8,38.4,19.2,9.6,4.8,2.4,1.2,.6,.3],maxExtent:t,maxResolution:1228.8,projection:"EPSG:28992",units:"m"};this.olMap=new OpenLayers.Map("map",i),this.olMap.events.register("moveend",this,function(n){panEndPos=n.object.center,this.panChanged()}),this.olMap.events.register("movestart",this,function(n){panStartPos=n.object.center}),this.olMap.events.register("touchmove",this,function(n){panPopuppos=objifxStpMap.olMap.getLonLatFromPixel({x:n.xy.x,y:n.xy.y})});try{$(this.olMap.getViewport()).on({mousedown:function(){},mouseup:function(){},mousemove:function(){},mouseleave:function(){try{var i=n.getControlByIndex("olControlNavigation");i!=-1&&(btnSelectByPolygon.active==!1||btnSelectByPolygon.active==null)&&(btnDeselectByPolygon.active==!1||btnDeselectByPolygon.active==null)&&(n.olMap.controls[i].destroy(),n.createNavigationControl())}catch(r){}}})}catch(r){}},IfxStpMap.prototype.reactivateControls=function(){var n=this.getControlByIndex("olControl");n!=-1&&(this.olMap.controls[n].active=!1,this.olMap.controls[n].active=!0)},IfxStpMap.prototype.zoomChanged=function(){this.eventList.ZOOMCHANGED()},IfxStpMap.prototype.loadEnd=function(){this.eventList.LOADENDMAP()},IfxStpMap.prototype.panChanged=function(){this.eventList.PANCHANGED()},IfxStpMap.prototype.panStart=function(){this.eventList.PANSTART()},IfxStpMap.prototype.touchStart=function(){this.eventList.TOUCHSTART()},IfxStpMap.prototype.touchEnd=function(){this.eventList.TOUCHEND()},IfxStpMap.prototype.addLayers=function(){var n;n=new OpenLayers.Layer.WMS("Geoserver layers",this.geoserverGwcUrl,{layers:this.backgroundLayers,format:this.imageFormat,tiled:!1,tilesorigin:[this.olMap.maxExtent.left,this.olMap.maxExtent.bottom]},{buffer:0}),this.olMap.addLayer(n)},IfxStpMap.prototype.addHectoLayer=function(){for(var t,n=0;n<this.olMap.layers.length;n++)if(this.olMap.layers[n].name=="HectoDVK layer")return;t=new OpenLayers.Layer.WMS("HectoDVK layer",this.geoserverUrl,{layers:[this.flyoverLayer,this.hectoLayer],format:this.imageFormat,transparent:"true",tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom]}),this.olMap.addLayer(t),this.olMap.setLayerIndex(t,1)},IfxStpMap.prototype.deleteMapLayer=function(n){for(var t=0;t<this.olMap.layers.length;t++)if(this.olMap.layers[t].name==n){this.olMap.removeLayer(this.olMap.layers[t]);break}},IfxStpMap.prototype.addScaleBar=function(n){var t=new OpenLayers.Control.ScaleBar;n=="imperial"&&(t.displaySystem="english"),this.olMap.addControl(t)},IfxStpMap.prototype.createVectorLayerObjects=function(){var n=this,r={getColor:function(n){return IfxStpmapCommon.getColor(n)},getOpacity:function(){return.7},getWidth:function(t){var i=n.olMap.getZoom();return IfxStpmapCommon.getStrokeWidth(t,i)}},u={strokeColor:"${getColor}",strokeOpacity:"${getOpacity}",strokeWidth:"${getWidth}"},f=new OpenLayers.Style(u,{context:r}),t,i;this.vectorLayerRoute=new OpenLayers.Layer.Vector("Route",{styleMap:new OpenLayers.StyleMap(f)}),this.vectorLayerMarkers=new OpenLayers.Layer.Vector("Markers",{eventListeners:{featureover:function(t){n.eventList.FEATUREOVER!=undefined&&typeof n.eventList.FEATUREOVER=="function"&&n.eventList.FEATUREOVER(t,"MARKER")},featureout:function(t){n.eventList.FEATUREOUT!=undefined&&typeof n.eventList.FEATUREOUT=="function"&&n.eventList.FEATUREOUT(t,"MARKER")}}}),t=new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({strokeOpacity:.7,strokeColor:"#8000ff",strokeWidth:3},OpenLayers.Feature.Vector.style["default"])),this.vectorLayerSketchedRoute=new OpenLayers.Layer.Vector("SketchedRoute",{styleMap:t}),i=new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({strokeOpacity:.7,strokeColor:"#6FB9C5",strokeWidth:3},OpenLayers.Feature.Vector.style["default"])),this.vectorLayerOffRoad=new OpenLayers.Layer.Vector("OffRoadRoute",{styleMap:i}),this.vectorLayerStructures=new OpenLayers.Layer.Vector("Structures",{eventListeners:{featureover:function(t){n.eventList.FEATUREOVER!=undefined&&typeof n.eventList.FEATUREOVER=="function"&&n.eventList.FEATUREOVER(t,"STRUCTURE")},featureout:function(t){n.eventList.FEATUREOUT!=undefined&&typeof n.eventList.FEATUREOUT=="function"&&n.eventList.FEATUREOUT(t,"STRUCTURE")},featureclick:function(t){n.eventList.FEATURECLICK!=undefined&&typeof n.eventList.FEATURECLICK=="function"&&n.eventList.FEATURECLICK(t,"STRUCTURE")}}});var e={getColorStructure:function(){return"#44FF00"},getWidthStructure:function(){return 6}},o={strokeColor:"${getColorStructure}",strokeOpacity:1,strokeWidth:"${getWidthStructure}"},s=new OpenLayers.Style(o,{context:e});this.vectorLayerEditStructure=new OpenLayers.Layer.Vector("EditStructure",{eventListeners:{featureover:function(t){n.eventList.FEATUREOVER!=undefined&&typeof n.eventList.FEATUREOVER=="function"&&n.eventList.FEATUREOVER(t,"STRUCTURE")},featureout:function(t){n.eventList.FEATUREOUT!=undefined&&typeof n.eventList.FEATUREOUT=="function"&&n.eventList.FEATUREOUT(t,"STRUCTURE")},featureclick:function(n){objifxStpmapStructures.changeStructDisplay(n.feature)}},styleMap:new OpenLayers.StyleMap(s)}),this.vectorLayerStructureMarker=new OpenLayers.Layer.Vector("StructureMarker"),this.vectorLayerConstraints=new OpenLayers.Layer.Vector("Constraints",{eventListeners:{featureover:function(t){n.eventList.FEATUREOVER!=undefined&&typeof n.eventList.FEATUREOVER=="function"&&n.eventList.FEATUREOVER(t,"CONSTRAINT")},featureout:function(t){n.eventList.FEATUREOUT!=undefined&&typeof n.eventList.FEATUREOUT=="function"&&n.eventList.FEATUREOUT(t,"CONSTRAINT")},featureclick:function(t){n.eventList.FEATURECLICK!=undefined&&typeof n.eventList.FEATURECLICK=="function"&&n.eventList.FEATURECLICK(t,"CONSTRAINT")}}});var h={getColorConstraint:function(){return"#44FF00"},getWidthConstraint:function(){return 7},getConstraintLabel:function(n){var t=n.cluster.length;return t==1?"":t}},c={strokeColor:"${getColorConstraint}",strokeOpacity:1,strokeWidth:"${getWidthConstraint}",externalGraphic:"/Content/Images/constraint_icons/Roadworks_Severe_Current3.gif",graphicHeight:30,graphicWidth:30,label:"${getConstraintLabel}",fontColor:"black",labelXOffset:0,labelYOffset:-20,fontSize:"12px",fontFamily:"Arial",fontWeight:"bold"},l=new OpenLayers.Style(c,{context:h});this.vectorLayerConstraintsCluster=new OpenLayers.Layer.Vector("Constraints",{styleMap:new OpenLayers.StyleMap(l),eventListeners:{featureover:function(t){n.eventList.FEATUREOVER!=undefined&&typeof n.eventList.FEATUREOVER=="function"&&n.eventList.FEATUREOVER(t,"CONSTRAINT")},featureout:function(t){n.eventList.FEATUREOUT!=undefined&&typeof n.eventList.FEATUREOUT=="function"&&n.eventList.FEATUREOUT(t,"CONSTRAINT")},featureclick:function(t){n.eventList.FEATURECLICK!=undefined&&typeof n.eventList.FEATURECLICK=="function"&&n.eventList.FEATURECLICK(t,"CONSTRAINT")}},strategies:[new OpenLayers.Strategy.Cluster({distance:45,animationMethod:OpenLayers.Easing.Expo.easeOut,animationDuration:20})]});var a={getColorDeleg:function(n){return IfxStpmapCommon.getDelegRoadColor(n)}},v={strokeColor:"${getColorDeleg}",strokeOpacity:.9,strokeWidth:3},y=new OpenLayers.Style(v,{context:a});this.vectorLayerDelegRoads=new OpenLayers.Layer.Vector("DelegRoads",{styleMap:new OpenLayers.StyleMap(y)}),this.vectorLayerDelegMarkers=new OpenLayers.Layer.Vector("DelegMarkers"),this.addVectorLayers()},IfxStpMap.prototype.addVectorLayers=function(){this.pageType=="NOMAPDISPLAY"||(this.pageType=="STRUCTURES"?this.olMap.addLayers([this.vectorLayerConstraints,this.vectorLayerConstraintsCluster,this.vectorLayerStructures]):this.pageType=="NWK_STRUCTURES"||this.pageType=="MIG_STRUCTURES"?this.olMap.addLayers([this.vectorLayerStructures,this.vectorLayerEditStructure,this.vectorLayerStructureMarker]):this.pageType=="CONSULTRESTRICTION"?this.olMap.addLayers([this.vectorLayerRoute,this.vectorLayerConstraints,this.vectorLayerConstraintsCluster,this.vectorLayerStructures,this.vectorLayerOffRoad,this.vectorLayerMarkers]):this.pageType=="DISPLAYONLY"?this.olMap.addLayers([this.vectorLayerRoute,this.vectorLayerConstraints,this.vectorLayerConstraintsCluster,this.vectorLayerStructures,this.vectorLayerOffRoad,this.vectorLayerMarkers]):this.pageType=="A2BPLANNING"?this.olMap.addLayers([this.vectorLayerRoute,this.vectorLayerConstraints,this.vectorLayerConstraintsCluster,this.vectorLayerStructures,this.vectorLayerOffRoad,this.vectorLayerMarkers]):this.olMap.addLayers([this.vectorLayerRoute,this.vectorLayerMarkers,this.vectorLayerOffRoad]))},IfxStpMap.prototype.createControls=function(){this.olMap.addControl(new OpenLayers.Control.Attribution),this.olMap.addControl(new OpenLayers.Control.MousePosition),this.createNavigationControl();var n=new OpenLayers.Control.Snapping({layer:this.vectorLayerOffRoad,targets:[{layer:this.vectorLayerRoute}]});this.olMap.addControl(n),n.activate()},IfxStpMap.prototype.createNavigationControl=function(){(this.pageType==="A2BPLANNING"||this.pageType==="ROUTELIBRARY"||this.pageType==="STRUCTURES"||this.pageType==="SOAPP"||this.pageType==="DISPLAYONLY"||this.pageType==="DISPLAYONLY_EDITANNOTATION"||this.pageType==="VR1APP"||this.pageType==="DELEGATION_VIEWONLY"||this.pageType==="DELEGATION_VIEWANDEDIT"||this.pageType==="ROADOWNERSHIP_VIEWONLY"||this.pageType==="ROADOWNERSHIP_VIEWANDEDIT"||this.pageType==="MAINTAIN_CORRIDOR"||this.pageType==="MAINTAIN_CORRIDOR_EDITMODE"||this.pageType==="LZV"||this.pageType==="AGRICULTURE"||this.pageType==="LBOV"||this.pageType==="ITS"||this.pageType==="MIG_ITS"||this.pageType==="ViewITSDetails"||this.pageType==="CONSULTRESTRICTION"||this.pageType==="REGEXEMPTION"||this.pageType==="CONSULTRESTRICTION"||this.pageType==="DS_ANALYSIS"||this.pageType==="CR_VIEWANDEDIT"||this.pageType==="NWK_STRUCTURES"||this.pageType==="MIG_STRUCTURES")&&this.olMap.addControl(new OpenLayers.Control.Navigation),this.pageType==="A2BPLANNING"||this.pageType==="ROUTELIBRARY"||this.pageType==="DISPLAYONLY"||this.pageType==="CONSULTRESTRICTION"||this.pageType==="REGEXEMPTION"||this.pageType==="CONSULTRESTRICTION"||this.pageType==="DS_ANALYSIS"||this.pageType==="MIG_STRUCTURES"||this.pageType==="NWK_STRUCTURES"?objIfxNwkMap.addNavigationControl(!0,!0):this.pageType==="CONVOY"&&objIfxNwkMap.addNavigationControl(!0,!1)},toolbarPublic=0,IfxStpMap.prototype.createToolbar=function(){var n=this;toolbarPanel=new OpenLayers.Control.Panel({displayClass:"maptoolbarpanel"}),this.olMap.addControl(toolbarPanel),btnAlternateStartRoute=new OpenLayers.Control.Button({displayClass:"alternateStart",title:"Alternate start point",type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(0,"A2BPLANNING"),n.addRoutePath(1)}}),btnAlternateMiddleRoute=new OpenLayers.Control.Button({displayClass:"alternateMiddle",title:"Alternate middle point",type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(1,"A2BPLANNING"),n.addRoutePath(2)}}),btnAlternateEndRoute=new OpenLayers.Control.Button({displayClass:"alternateEnd",title:"Alternate end point",type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(2,"A2BPLANNING"),n.addRoutePath(3)}}),btnOffRoadRoute=new OpenLayers.Control.Button({displayClass:"offRoad",title:"Off-road route",type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(3,"A2BPLANNING"),offRoadLineControl.activate()},deactivate:function(){offRoadLineControl.deactivate()}}}),btnReverseMnvr=new OpenLayers.Control.Button({displayClass:"reverseMnvr",title:"Reverse manoeuvre",type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(4,"A2BPLANNING")},deactivate:function(){n.updateManoeuvreRouteSegment(n.currentActiveRoutePathIndex)}}}),btnUturnMnvr=new OpenLayers.Control.Button({displayClass:"uturnMnvr",title:"U-turn manoeuvre",type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(5,"A2BPLANNING")},deactivate:function(){n.updateManoeuvreRouteSegment(n.currentActiveRoutePathIndex)}}}),btnConfirmedMnvr=new OpenLayers.Control.Button({displayClass:"confirmedMnvr",title:Lang_Key.Tooltip_Breaking_Rule,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(6,"A2BPLANNING")},deactivate:function(){n.updateManoeuvreRouteSegment(n.currentActiveRoutePathIndex)}}}),btnCutRoute=new OpenLayers.Control.Button({displayClass:"cutRoute",title:"Cut route",type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.DEACTIVATECONTROL!=undefined&&typeof n.eventList.DEACTIVATECONTROL=="function"&&n.eventList.DEACTIVATECONTROL(7,"A2BPLANNING")},deactivate:function(){toolbarPanel4.div.style.display="none"}}}),this.project=="NWK"?toolbarPublic==1&&toolbarPanel.addControls([btnConfirmedMnvr,btnCutRoute]):toolbarPanel.addControls([btnAlternateStartRoute,btnAlternateMiddleRoute,btnAlternateEndRoute,btnOffRoadRoute,btnReverseMnvr,btnUturnMnvr,btnConfirmedMnvr,btnCutRoute]),toolbarPanel.div.style.display="none"},IfxStpMap.prototype.createRouteAppraisalToolbar=function(){var n=this;toolbarPanel2=this.project!="NWK"?new OpenLayers.Control.Panel({displayClass:"RouteAppraisalToolbar"}):new OpenLayers.Control.Panel({displayClass:"NwkRouteAppraisalToolbar"}),this.olMap.addControl(toolbarPanel2),btnAffectedStructures=new OpenLayers.Control.Button({displayClass:"affectedStructures",title:Lang_Key.Tooltip_Affected_Structures,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.TOGGLESTRUCTURES!=undefined&&typeof n.eventList.TOGGLESTRUCTURES=="function"&&n.eventList.TOGGLESTRUCTURES("STRUCTURES",!0)},deactivate:function(){n.eventList.TOGGLESTRUCTURES!=undefined&&typeof n.eventList.TOGGLESTRUCTURES=="function"&&n.eventList.TOGGLESTRUCTURES("STRUCTURES",!1)}}}),btnAffectedConstraints=new OpenLayers.Control.Button({displayClass:"affectedConstraints",title:Lang_Key.Tooltip_Affected_Roadworks,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.TOGGLESTRUCTURES!=undefined&&typeof n.eventList.TOGGLESTRUCTURES=="function"&&n.eventList.TOGGLESTRUCTURES("CONSTRAINTS",!0)},deactivate:function(){n.eventList.TOGGLESTRUCTURES!=undefined&&typeof n.eventList.TOGGLESTRUCTURES=="function"&&n.eventList.TOGGLESTRUCTURES("CONSTRAINTS",!1)}}}),btnAffectedConstraintsList=new OpenLayers.Control.Button({displayClass:"affectedConstraintsList",title:Lang_Key.Tooltip_Affected_Constraints_List,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){n.eventList.TOGGLECONSTRAINTSLIST!=undefined&&typeof n.eventList.TOGGLECONSTRAINTSLIST=="function"&&n.eventList.TOGGLECONSTRAINTSLIST(!0)},deactivate:function(){n.eventList.TOGGLECONSTRAINTSLIST!=undefined&&typeof n.eventList.TOGGLECONSTRAINTSLIST=="function"&&n.eventList.TOGGLECONSTRAINTSLIST(!1)}}}),toolbarPanel2.div.style.display="none"},IfxStpMap.prototype.createManoeuvreCancelToolbar=function(){var n=this;toolbarPanel4=new OpenLayers.Control.Panel({displayClass:"MnvrCancelToolbar"}),this.olMap.addControl(toolbarPanel4),btnManoeuvreCancel=new OpenLayers.Control.Button({displayClass:"manoeuvreCancelToolbar",title:"Cancel",type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){var r,t,i;for($("#intellizenz-ctxmenu").remove(),r=n.routeManager.getRoutePath(n.currentActiveRoutePathIndex),t=n.previousActivity=="ROUTEPATHEXTENDEDATSTART"?0:r.routeSegmentList.length-1,n.deleteAnnotation(n.currentActiveRoutePathIndex,t,0),n.removeRouteSegment(n.currentActiveRoutePathIndex,t),toolbarPanel4.div.style.display="none",i=4;i<7;i++)toolbarPanel.controls[i].deactivate();n.previousActivity=="ROUTEPATHEXTENDEDATSTART"?(n.shortenRoute("STARTPOINT"),n.previousActivity==""):n.previousActivity=="ROUTEPATHEXTENDEDATEND"&&(n.shortenRoute("ENDPOINT"),n.previousActivity=="")}}),toolbarPanel4.addControls([btnManoeuvreCancel]),toolbarPanel4.div.style.display="none"},IfxStpMap.prototype.createadv_rtplanCancelToolbar=function(){var n=this;toolbarPanel3=new OpenLayers.Control.Panel({displayClass:"adv_rtplanCancelToolbar"}),this.olMap.addControl(toolbarPanel3),btnAdv_routeplanCancel=new OpenLayers.Control.Button({displayClass:"adv_routeplanCancel",title:"Cancel",type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){n.eventList.ADVRPCANCEL!=undefined&&typeof n.eventList.ADVRPCANCEL=="function"&&n.eventList.ADVRPCANCEL()}}),toolbarPanel3.addControls([btnAdv_routeplanCancel]),toolbarPanel3.div.style.display="none"},IfxStpMap.prototype.createOffRoadLineControl=function(){var n=this;offRoadLineControl=new OpenLayers.Control.DrawFeature(this.vectorLayerOffRoad,OpenLayers.Handler.Path,{title:"Plan off-road",featureAdded:function(t){$("#intellizenz-ctxmenu").remove(),n.createOffRoadSegment(t),btnOffRoadRoute.deactivate();var i=n.olMap.getPixelFromLonLat(new OpenLayers.LonLat(t.geometry.components[0].x,t.geometry.components[0].y));n.eventList.MANOEUVREADDED(i)}}),this.olMap.addControl(offRoadLineControl)},IfxStpMap.prototype.createOffRoadSegment=function(n){for(var s=[],t,o,r=0,h=0;r<n.geometry.components.length;r++)s[h++]=n.geometry.components[r].x,s[h++]=n.geometry.components[r].y;var i=this.routeManager.getRoutePath(this.currentActiveRoutePathIndex),e=this.routeManager.createRouteSegmentObject(null,null,null,s,1,i.routeSegmentList.length+1,"OFFROAD"),u=this.olMap.getPixelFromLonLat(new OpenLayers.LonLat(n.geometry.components[0].x,n.geometry.components[0].y)),f=this.getNearestPathAndSegment(u.x,u.y,!0);if(e.startLinkId=f.feature!=""?f.feature.attributes.LINK_ID:null,u=this.olMap.getPixelFromLonLat(new OpenLayers.LonLat(n.geometry.components[n.geometry.components.length-1].x,n.geometry.components[n.geometry.components.length-1].y)),f=this.getNearestPathAndSegment(u.x,u.y,!0),e.endLinkId=f.feature!=""?f.feature.attributes.LINK_ID:null,e.otherinfo.completefeatures=[this.vectorLayerOffRoad.features[this.vectorLayerOffRoad.features.length-1]],i.routeSegmentList.push(e),t=this.checkOffRoadExtend(i,n.geometry),t.extended==!0)this.moveMarkerToExtendedRoad(t.index,t.pointType,t.geometry.x,t.geometry.y),this.routeManager.reArrangeRouteSegmentList(this.currentActiveRoutePathIndex),this.previousActivity=t.pointType=="STARTPOINT"?"ROUTEPATHEXTENDEDATSTART":"ROUTEPATHEXTENDEDATEND";else if(o=this.checkOffRoadInCurrentActivePath(i,n.geometry),o.bool){if(o.distance>=1){showNotification("Trying to create an Off-road which is not continuous with the route."),this.removeRouteSegment(this.currentActiveRoutePathIndex,i.routeSegmentList.length-1);return}}else{o.path!=-1&&showNotification("Since this route includes alternate route paths, please select the relevant route path by selecting the related Path number from the left panel before creating the off-road route segment."),this.removeRouteSegment(this.currentActiveRoutePathIndex,i.routeSegmentList.length-1);return}this.routeManager.setRoutePathState(this.currentActiveRoutePathIndex,"routeplanned"),this.eventList.OFFROADADDED!=undefined&&typeof this.eventList.OFFROADADDED=="function"&&this.eventList.OFFROADADDED()},IfxStpMap.prototype.checkOffRoadExtend=function(n,t){var r,i,u,f;return(n==null||n==undefined)&&(n=this.routeManager.getRoutePath(this.currentActiveRoutePathIndex)),r=this.routeManager.findStartAndEndPointsFromRoutePointList(this.currentActiveRoutePathIndex),i={extended:!1,index:-1,pointType:"",geometry:null},IfxStpmapCommon.compareGeometries(t.components[0],n.routePointList[r.startIndex].pointGeom.sdo_point)?i={extended:!0,index:r.startIndex,pointType:"STARTPOINT",geometry:t.components[t.components.length-1]}:IfxStpmapCommon.compareGeometries(t.components[t.components.length-1],n.routePointList[r.startIndex].pointGeom.sdo_point)?i={extended:!0,index:r.startIndex,pointType:"STARTPOINT",geometry:t.components[0]}:IfxStpmapCommon.compareGeometries(t.components[0],n.routePointList[r.endIndex].pointGeom.sdo_point)?i={extended:!0,index:r.endIndex,pointType:"ENDPOINT",geometry:t.components[t.components.length-1]}:IfxStpmapCommon.compareGeometries(t.components[t.components.length-1],n.routePointList[r.endIndex].pointGeom.sdo_point)&&(i={extended:!0,index:r.endIndex,pointType:"ENDPOINT",geometry:t.components[0]}),i.extended&&(u=this.olMap.getPixelFromLonLat(new OpenLayers.LonLat(i.geometry.x,i.geometry.y)),f=this.getNearestPathAndSegment(u.x,u.y,!1),f.pathIndex==this.currentActiveRoutePathIndex&&f.distance<1&&(i.extended=!1)),i},IfxStpMap.prototype.checkOffRoadInCurrentActivePath=function(n,t){var r={bool:!1,path:-1,distance:2500},i=this.getNearestPathAndSegment(t.components[0].x,t.components[0].y,!1,!0);return r=i.pathIndex==this.currentActiveRoutePathIndex?{bool:!0,path:i.pathIndex,distance:i.distance}:{bool:!1,path:i.pathIndex,distance:i.distance},i=this.getNearestPathAndSegment(t.components[t.components.length-1].x,t.components[t.components.length-1].y,!1,!0),r.bool==!1?r=i.pathIndex==this.currentActiveRoutePathIndex?{bool:!0,path:i.pathIndex,distance:i.distance}:{bool:!1,path:i.pathIndex,distance:i.distance}:r.distance>i.distance&&(r={bool:!0,path:i.pathIndex,distance:i.distance}),r},IfxStpMap.prototype.shortenRoute=function(n){var i=this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex],r=this.routeManager.findStartAndEndPointsFromRoutePointList(this.currentActiveRoutePathIndex),t;n=="STARTPOINT"?(t=i.routeSegmentList[0].startPointGeometry,this.moveMarkerToExtendedRoad(r.startIndex,n,t.sdo_point.X,t.sdo_point.Y)):(t=i.routeSegmentList[i.routeSegmentList.length-1].endPointGeometry,this.moveMarkerToExtendedRoad(r.endIndex,n,t.sdo_point.X,t.sdo_point.Y))},IfxStpMap.prototype.moveMarkerToExtendedRoad=function(n,t,i,r){var e=this.routeManager.getRoutePath(this.currentActiveRoutePathIndex),u=e.routePointList[n],f;u.pointGeom.sdo_point={X:i,Y:r},this.deleteRoutePoint(n),f=this.setMarker(t,i,r,0),u.otherinfo.marker=f,this.routeManager.addRoutePoint(this.currentActiveRoutePathIndex,n,u,!1)},IfxStpMap.prototype.resizeMap=function(n,t){if(this.olMap!=null){var i=document.getElementById("map");i.style.width=n,i.style.height=t,this.olMap.updateSize()}},IfxStpMap.prototype.updateMapSize=function(){this.olMap.updateSize()},IfxStpMap.prototype.onDragStartCallback=function(n,t){var i=this.olMap.getPixelFromLonLat(new OpenLayers.LonLat(n.geometry.x,n.geometry.y));return this.dragMarkerDiff.X=i.x-t.x,this.dragMarkerDiff.Y=i.y-t.y,!0},IfxStpMap.prototype.undoMarkerDrag=function(n,t){this.vectorLayerMarkers.removeFeatures(n);var i,r=t[2]>0&&this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex)<2?0:t[2];t[0]=="ANNOTATION"?(i=this.routeManager.RoutePart.routePathList[t[1]].routeSegmentList[t[2]].routeAnnotationsList[t[3]],n=this.setMarker(t[0],i.geometry.sdo_point.X,i.geometry.sdo_point.Y,t[1]+" "+t[2]+" "+t[3])):t[0]=="FVPANNOTATION"?(i=this.routeManager.RoutePart.routePathList[0].routePointList[t[1]],n=this.setMarker(t[0],i.pointGeom.sdo_point.X,i.pointGeom.sdo_point.Y,t[1])):(i=this.routeManager.getRoutePoint(t[1],r),n=this.setMarker(t[0],i.pointGeom.sdo_point.X,i.pointGeom.sdo_point.Y,r)),i.otherinfo.marker=n},IfxStpMap.prototype.onDragCompleteCallback=function(n,t){var u=this.vectorLayerMarkers.getFeaturesByAttribute("name",n.data.name),r=this,i=n.data.name.split(" "),e=t.x+this.dragMarkerDiff.X,o=t.y+this.dragMarkerDiff.Y,s=this.getcurrentSelectedRouteType(),h,f;if(s==1&&i[0]=="ENDPOINT"||s==2&&(i[0]=="STARTPOINT"||i[0]=="ENDPOINT")||s==3&&i[0]=="STARTPOINT"){h=r.getFeaturesOfRoutePath(0);r.onDragCompleteSetPoint(e,o,h,i,u)}else i[0]=="TRIMPOINT"?(this.vectorLayerMarkers.removeFeatures(u[0]),f=this.getNearestPathAndSegment(e,o,!0),this.setMarker("TRIMPOINT",f.x1,f.y1,f.pathIndex+" "+f.segmentIndex)):(i[0]=="STARTPOINT"||i[0]=="ENDPOINT")&&$("#PortalType").val()=="696011"?r.undoMarkerDrag(u[0],i):i[0]=="FORCEDVIAPOINT"||i[0]=="FVPANNOTATION"||i[0]=="ANNOTATION"?r.undoMarkerDrag(u[0],i):this.searchFeaturesByXY(e,o,!1,r.boundaryOffset,function(n){if(n==null||n.length<=0){showNotification(Lang_Key.NotifNoRoadSelected),r.undoMarkerDrag(u[0],i);return}r.onDragCompleteSetPoint(e,o,n,i,u)})},IfxStpMap.prototype.onDragCompleteSetPoint=function(n,t,i,r,u){var o=this,l,s,a,v,h,f,e,c,u;if(r[0]!="ANNOTATION"){if(this.currentActiveRoutePathIndex=r[1],l=this.olMap.getLonLatFromPixel({x:n,y:t}),f=IfxStpmapCommon.findNearestFeatureIndex(i,l.lon,l.lat),IfxStpmapCommon.checkForPedestrianRoad(i[f.index])==!0){alert("You have selected a road which is not accessible for trucks. Select a valid location."),this.undoMarkerDrag(u[0],r);return}s=null,this.currentActiveRoutePathIndex>0&&f.distance>200?this.undoMarkerDrag(u[0],r):(s=this.createRoutePointObject(r[0],i[f.index],f,r[2]),a=this.getcurrentSelectedRouteType(),s.otherinfo.pointfeature.attributes.ROUNDABOUT=="Y"&&a!=0&&showNotification("Diverge/merge route points cannot be placed on a roundabout: please adjust relevant point(s). For assistance call the Helpdesk on 01642 664197."),this.vectorLayerMarkers.removeFeatures(u[0]),u=this.setMarker(r[0],f.x1,f.y1,r[2]),s.otherinfo.marker=u,v=r[2]>0&&this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex)<2?0:r[2],this.routeManager.updateRoutePoint(r[1],v,s)),h=this.getControlByIndex("olControlDragFeature"),h!=-1&&(this.olMap.controls[h].deactivate(),this.olMap.controls[h].activate()),this.setPageState("pointselected"),this.eventList.ONDRAGCOMPLETE!=undefined&&typeof this.eventList.ONDRAGCOMPLETE=="function"&&this.eventList.ONDRAGCOMPLETE(s,r[1],!0)}else f=this.getNearestPathAndSegment(n,t,!0),$("#PortalType").val()=="696011"?getFeatureForRoads([f.feature.attributes.LINK_ID],2,i,function(){var n=o.createAnnotationObject(f.feature,f),t=o.routeManager.getAnnotation(r[1],r[2],r[3]),i;n.annotationContactList=t.annotationContactList,n.annotType=t.annotType,n.annotText=t.annotText,o.deleteAnnotation(r[1],r[2],r[3]),objifxStpMap.addAnnotation(r[1],r[2],r[3],n),i=o.setMarker("ANNOTATION",f.x1,f.y1,r[1]+" "+r[2]+" "+r[3]),n.otherinfo.marker=i,n.otherinfo.pathIndex=f.pathIndex,n.otherinfo.segmentIndex=f.segmentIndex,o.eventList.ONDRAGCOMPLETE!=undefined&&typeof o.eventList.ONDRAGCOMPLETE=="function"&&o.eventList.ONDRAGCOMPLETE(n,r[1],!1)}):(e=this.createAnnotationObject(f.feature,f),c=this.routeManager.getAnnotation(r[1],r[2],r[3]),e.annotationContactList=c.annotationContactList,e.annotType=c.annotType,e.annotText=c.annotText,this.deleteAnnotation(r[0],r[1],r[2],r[3]),objifxStpMap.addAnnotation(r[1],r[2],r[3],e),u=this.setMarker("ANNOTATION",f.x1,f.y1,r[1]+" "+r[2]+" "+r[3]),e.otherinfo.marker=u,e.otherinfo.pathIndex=f.pathIndex,e.otherinfo.segmentIndex=f.segmentIndex,this.eventList.ONDRAGCOMPLETE!=undefined&&typeof this.eventList.ONDRAGCOMPLETE=="function"&&this.eventList.ONDRAGCOMPLETE(e,r[1],!1))},IfxStpMap.prototype.createDragFeature=function(){var n=this,t=new OpenLayers.Control.DragFeature(this.vectorLayerMarkers,{autoActivate:!0,featureCallbacks:{over:function(t){var i=t.data.name.split(" ");if(n.pageType=="DISPLAYONLY_EDITANNOTATION"){if(i[0]=="ANNOTATION")return this.overFeature(t)}else if(i[0]!="FORCEDVIAPOINT")return this.overFeature(t)}},onStart:function(t,i){var f=this,r,u;if(n.CurFeture=t,r=t.data.name.split(" "),$("#PortalType").val()=="696011"&&r[0]=="ANNOTATION")u=n.routeManager.RoutePart.routePathList[r[1]].routeSegmentList[r[2]].routeAnnotationsList[r[3]].linkId,getFeatureForRoads([u],2,function(){n.onDragStartCallback(t,i)});else n.onDragStartCallback(t,i)},onComplete:function(t,i){var u=this,r,f;if(n.CurFeture=t,r=t.data.name.split(" "),$("#PortalType").val()=="696011"&&r[0]=="ANNOTATION")r=t.data.name.split(" "),f=n.routeManager.RoutePart.routePathList[r[1]].routeSegmentList[r[2]].routeAnnotationsList[r[3]].linkId,getFeatureForRoads([f],3,function(){n.onDragCompleteCallback(t,i);u.deactivate(),u.activate()});else{n.onDragCompleteCallback(t,i);this.deactivate(),this.activate()}}});this.olMap.addControl(t)},IfxStpMap.prototype.createCacheReadWriteControls=function(){var t=new OpenLayers.Control.CacheRead,n;this.olMap.addControl(t),n=new OpenLayers.Control.CacheWrite({autoActivate:!0,imageFormat:this.imageFormat}),this.olMap.addControl(n)},IfxStpMap.prototype.showLinkDetails=function(n){var t=this,i=this.olMap.getLonLatFromViewPortPx(n.xy);this.searchFeaturesByXY(n.xy.x,n.xy.y,!1,t.boundaryOffset,function(r){if(r!=null&&!(r.length<=0)){var f=IfxStpmapCommon.findNearestFeatureIndex(r,i.lon,i.lat),u=r[f.index],e="<div style='font-size:1.0em'><table><tr><td><b>LINK DETAILS<\/b><\/td><\/tr><\/table><br>LINK ID: "+u.attributes.LINK_ID+"<br>REF IN ID: "+u.attributes.REF_IN_ID+"<br>NREF IN ID: "+u.attributes.NREF_IN_ID+"<br>PRIVATE: "+u.attributes.PRIVATE+"<br>PAVED: "+u.attributes.PAVED+"<br>PUB_ACCESS: "+u.attributes.PUB_ACCESS+"<br>ST_NAME: "+u.attributes.ST_NAME+"<br>TUNNEL: "+u.attributes.TUNNEL+"<br>AR_AUTO: "+u.attributes.AR_AUTO+"<br>AR_BUS: "+u.attributes.AR_BUS+"<br>AR_MOTOR: "+u.attributes.AR_MOTOR+"<br>AR_PEDEST: "+u.attributes.AR_PEDEST+"<br>AR_TAXIS: "+u.attributes.AR_TAXIS+"<br>AR_TRAFF: "+u.attributes.AR_TRAFF+"<br>AR_TRUCKS: "+u.attributes.AR_TRUCKS+"<br>DIR_TRAVEL: "+u.attributes.DIR_TRAVEL+"<br>FERRY_TYPE: "+u.attributes.FERRY_TYPE+"<br>FUNC_CLASS: "+u.attributes.FUNC_CLASS+"<\/div>";t.olMap.addPopup(new OpenLayers.Popup.FramedCloud("LINK DETAILS",t.olMap.getLonLatFromPixel(n.xy),null,e,null,!0))}})},IfxStpMap.prototype.createClickControl=function(){var n=this;OpenLayers.Control.Click=OpenLayers.Class(OpenLayers.Control,{defaultHandlerOptions:{single:!0,double:!0,pixelTolerance:0,stopSingle:!1,stopDouble:!1},initialize:function(){this.handlerOptions=OpenLayers.Util.extend({},this.defaultHandlerOptions),OpenLayers.Control.prototype.initialize.apply(this,arguments),this.handler=new OpenLayers.Handler.Click(this,{click:this.trigger,dblclick:this.dbClick},this.handlerOptions)},dbClick:function(){$("#intellizenz-ctxmenu").remove()},trigger:function(t){var r,i;if($("#intellizenz-ctxmenu").remove(),objifxStpMap.getProject()=="NWK"){try{objIfxNwkMap.mouseClickTrigger(t)}catch(u){u.message=="btnSelectAndPlan is not defined"&&t.ctrlKey==!0?objIfxNwkMap.showLinkDetails(t):(r=new OpenLayers.Control.Click,n.olMap.addControl(r),r.activate())}return}if(t.ctrlKey==!0&&t.shiftKey==!0){i=n.olMap.getLonLatFromViewPortPx(t.xy),showNotification("X, Y: "+i.lon+", "+i.lat);return}if(t.ctrlKey==!0){n.pageType=="DELEGATION_VIEWANDEDIT"||n.pageType=="ROADOWNERSHIP_VIEWANDEDIT"||n.pageType=="MAINTAIN_CORRIDOR_EDITMODE"||n.pageType=="CR_VIEWANDEDIT"?btnSelectAndPlan.Button&&btnSelectAndPlan.active==!0?n.pageType=="DELEGATION_VIEWANDEDIT"?objifxStpMapRoadDelegation.selectAndPlanLink(t,"ENDPOINT"):n.pageType=="ROADOWNERSHIP_VIEWANDEDIT"?objifxStpmapRoadOwnership.selectAndPlanLink(t,"ENDPOINT"):objifxStpmapDecisionSpace.selectAndPlanLink(t,"ENDPOINT"):n.showLinkDetails(t):n.showLinkDetails(t);return}t.altKey==!0&&t.shiftKey==!0&&n.pageType=="STRUCTURES"&&(constraintbydescToolbar.div.style.display="inline"),$("#intellizenz-ctxmenu").remove(),n.pageType!="DELEGATION_VIEWANDEDIT"&&n.pageType!="ROADOWNERSHIP_VIEWANDEDIT"&&n.pageType!="MAINTAIN_CORRIDOR"&&n.pageType!="MAINTAIN_CORRIDOR_EDITMODE"&&n.pageType!="CR_VIEWANDEDIT"?btnReverseMnvr.active==!0?n.drawManoeuvreSet(t,"OVERRIDE"):btnUturnMnvr.active==!0?n.drawManoeuvreSet(t,"UTURN"):btnConfirmedMnvr.active==!0?n.drawManoeuvreSet(t,"CONFIRMED"):btnCutRoute.active==!0?n.cutRoute(t):btnAffectedStructures.active==!0||btnAffectedConstraints.active==!0:n.pageType!="MAINTAIN_CORRIDOR"&&(btnSelectAndPlan.active==!0?n.pageType=="DELEGATION_VIEWANDEDIT"?objifxStpMapRoadDelegation.selectAndPlanLink(t,"STARTPOINT"):n.pageType=="ROADOWNERSHIP_VIEWANDEDIT"?objifxStpmapRoadOwnership.selectAndPlanLink(t,"STARTPOINT"):objifxStpmapDecisionSpace.selectAndPlanLink(t,"STARTPOINT"):btnSelectByLink.active==!0?n.pageType=="DELEGATION_VIEWANDEDIT"?objifxStpMapRoadDelegation.selectByLink(t):n.pageType=="ROADOWNERSHIP_VIEWANDEDIT"?objifxStpmapRoadOwnership.selectByLink(t):objifxStpmapDecisionSpace.selectByLink(t):btnDeselectLink.active==!0&&(n.pageType=="DELEGATION_VIEWANDEDIT"?objifxStpMapRoadDelegation.deselectLink(t):n.pageType=="ROADOWNERSHIP_VIEWANDEDIT"?objifxStpmapRoadOwnership.deselectLink(t):objifxStpmapDecisionSpace.deselectLink(t)))}}),click=new OpenLayers.Control.Click,this.olMap.addControl(click),click.activate()},IfxStpMap.prototype.reactivateClick=function(){click.deactivate(),click.activate()},IfxStpMap.prototype.test=function(){return this.setMarker("LOCATIONIDICATOR",X,Y)},IfxStpMap.prototype.addAnnotation=function(n,t,i,r){this.routeManager.addAnnotation(n,t,i,r)},IfxStpMap.prototype.deleteAnnotation=function(n,t,i,r,u){var o,e,f;n[0]!="FVPANNOTATION"?(e=this.routeManager.getAnnotation(t,i,r),u==!0?getFeatureForRoads([e.linkId],0,function(){if(e!=undefined){objifxStpMap.vectorLayerMarkers.removeFeatures(e.otherinfo.marker),objifxStpMap.routeManager.deleteAnnotation(t,i,r),objifxStpMap.updateAnnotationMarkers(t,i,r);var n=objifxStpMap.getControlByIndex("olControlDragFeature");n!=-1&&(objifxStpMap.olMap.controls[n].deactivate(),objifxStpMap.olMap.controls[n].activate()),objifxStpMap.setPageState("routeplanned"),$("#btn_updateRoute").show()}}):e!=undefined&&(this.vectorLayerMarkers.removeFeatures(e.otherinfo.marker),this.routeManager.deleteAnnotation(t,i,r),this.updateAnnotationMarkers(t,i,r),f=this.getControlByIndex("olControlDragFeature"),f!=-1&&(this.olMap.controls[f].deactivate(),this.olMap.controls[f].activate()),this.setPageState("routeplanned"),$("#MUflag").val()=="1"&&$("#btn_saveRoute").show())):(o=this.vectorLayerMarkers.getFeaturesByAttribute("name",n[0]+" "+n[1]),e=this.routeManager.getFVPAnnotation(t),this.routeManager.deleteFVPAnnotation(t),f=this.getControlByIndex("olControlDragFeature"),f!=-1&&(this.olMap.controls[f].deactivate(),this.olMap.controls[f].activate()),this.vectorLayerMarkers.removeFeatures(o))},IfxStpMap.prototype.clearAnnotationsofRoutePath=function(n){for(var i,t=this.vectorLayerMarkers.features.length-1;t>=0;t--)i=this.vectorLayerMarkers.features[t].data.name.split(" "),i[0]=="ANNOTATION"&&i[1]==n&&this.vectorLayerMarkers.removeFeatures(this.vectorLayerMarkers.features[t])},IfxStpMap.prototype.deleteAnnotationsofRouteSegment=function(n,t){for(var r=this.routeManager.RoutePart.routePathList[n].routeSegmentList[t],i=0;i<r.routeAnnotationsList.length;i++)this.deleteAnnotation(n,t,0)},IfxStpMap.prototype.setRoutePointAtXY=function(n,t){var i,r,u;n.pointType!="ANNOTATION"&&(n.pointPos==-1&&(n.pointType=="WAYPOINT"||n.pointType=="FORCEDVIAPOINT"?clearRouteForPlan=!0:(this.clearRoutePath(0),this.eventList.ROUTEPOINTSELECTED!=undefined&&typeof this.eventList.ROUTEPOINTSELECTED=="function"&&this.eventList.ROUTEPOINTSELECTED(this.currentActiveRoutePathIndex)),this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex].otherinfo.state=this.routeManager.getRoutePathState(this.currentActiveRoutePathIndex,!0)),n.pointType=="STARTPOINT"||n.pointType=="ENDPOINT"?this.deleteRoutePointByType(n.pointType):this.deleteRoutePoint(n.pointPos)),i=this,r=this.getcurrentSelectedRouteType(),n.pointType=="ANNOTATION"?i.setRoutePoint({pointType:n.pointType,pointPos:-1,X:n.X,Y:n.Y,setMarker:!0,bLonLat:!1,features:null},t):r==1&&n.pointType=="ENDPOINT"||r==2&&(n.pointType=="STARTPOINT"||n.pointType=="ENDPOINT")||r==3&&n.pointType=="STARTPOINT"?(u=i.getFeaturesOfRoutePath(0),i.setRoutePoint({pointType:n.pointType,pointPos:-1,X:n.X,Y:n.Y,setMarker:!0,bLonLat:!1,features:u},t)):n.isBorderCrossing?this.searchFeaturesByLinkID([n.linkId],function(r){i.pageState="planninginprogress";var u=i.setRoutePoint({pointType:n.pointType,pointPos:n.pointPos,X:n.X,Y:n.Y,setMarker:!0,bLonLat:n.searchInBbox,features:r,locationDesc:n.locationDesc,isBorderCrossing:n.isBorderCrossing},t);u!=null&&i.pageType!="NOMAPDISPLAY"&&n.Zoomin==!0&&i.olMap.zoomToExtent(i.vectorLayerMarkers.getDataExtent())}):this.searchFeaturesByXY(n.X,n.Y,n.searchInBbox,i.boundaryOffset,function(r){if(i.pageState="planninginprogress",r==null||r.length<=0)i.searchFeaturesByXY(n.X,n.Y,n.searchInBbox,1e3,function(r){if(r==null||r.length<=0)showNotification(Lang_Key.NotifNoRoadSelected),t&&typeof t=="function"&&t();else{var u=i.setRoutePoint({pointType:n.pointType,pointPos:n.pointPos,X:n.X,Y:n.Y,setMarker:!0,bLonLat:n.searchInBbox,features:r,locationDesc:n.locationDesc},t);u!=null&&i.pageType!="NOMAPDISPLAY"&&n.Zoomin==!0&&i.olMap.zoomToExtent(i.vectorLayerMarkers.getDataExtent())}});else{var u=i.setRoutePoint({pointType:n.pointType,pointPos:n.pointPos,X:n.X,Y:n.Y,setMarker:!0,bLonLat:n.searchInBbox,features:r,locationDesc:n.locationDesc,isBorderCrossing:n.isBorderCrossing,linkId:n.linkId},t);u!=null&&i.pageType!="NOMAPDISPLAY"&&n.Zoomin==!0&&i.olMap.zoomToExtent(i.vectorLayerMarkers.getDataExtent())}})},IfxStpMap.prototype.setRoutePoint=function(n,t){var o=this,f,u,i,r,e;if(f=n.bLonLat||n.setMarker==!1?new OpenLayers.LonLat(n.X,n.Y):this.olMap.getLonLatFromPixel({x:n.X,y:n.Y}),u=n.pointType=="ANNOTATION"?0:n.pointPos!=-1?n.pointPos:this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex),n.pointType=="ANNOTATION"){if(i=this.getNearestPathAndSegment(n.X,n.Y,!0),i.pathIndex==-1||i.segmentIndex==-1)return t&&typeof t=="function"&&t(null),null}else{if(i=n.locationDesc!=undefined&&n.locationDesc!=null?IfxStpmapCommon.findNearestSuitableFeatureIndex(n.features,f.lon,f.lat,n.locationDesc,n.isBorderCrossing):IfxStpmapCommon.findNearestFeatureIndex(n.features,f.lon,f.lat),i==undefined||i==null)return t&&typeof t=="function"&&t(null),null;if(IfxStpmapCommon.checkForPedestrianRoad(n.features[i.index])==!0)return alert("You have selected a road which is not accessible for trucks. Select a valid location."),t&&typeof t=="function"&&t(null),null}return r=null,n.pointType!="ANNOTATION"?(r=this.createRoutePointObject(n.pointType,n.features[i.index],i,u,n.locationDesc),this.pageType!="NOMAPDISPLAY"&&n.setMarker==!0&&(e=this.setMarker(n.pointType,i.x1,i.y1,u),r.otherinfo.marker=e),this.routeManager.addRoutePoint(this.currentActiveRoutePathIndex,u,r,!0),(n.pointType=="WAYPOINT"||n.pointType=="VIAPOINT"||n.pointType=="FORCEDVIAPOINT")&&u<this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex)&&this.updateRoutePointMarkers(this.currentActiveRoutePathIndex,u,this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex)-1)):(r=this.createAnnotationObject(i.feature,i),n.setMarker==!0&&(e=this.setMarker(n.pointType,i.x1,i.y1,i.pathIndex+" "+i.segmentIndex+" "+this.routeManager.getAnnotationCount(i.pathIndex,i.segmentIndex))),r.otherinfo.marker=e,r.otherinfo.pathIndex=i.pathIndex,r.otherinfo.segmentIndex=i.segmentIndex),t&&typeof t=="function"&&t(r),r},IfxStpMap.prototype.getLocationDescription=function(n){var t="";return n.attributes.ST_NAME&&(t=n.attributes.ST_NAME),t==""&&n.attributes.ST_NM_BASE&&(t=n.attributes.ST_NM_BASE),t},IfxStpMap.prototype.createAnnotationObject=function(n,t){var r=this.routeManager.RoutePart.routePathList[t.pathIndex].routeSegmentList[t.segmentIndex],i={geometry:{sdo_point:{}},annotationContactList:[],otherinfo:{}};return i.geometry.sdo_point.X=t.x1,i.geometry.sdo_point.Y=t.y1,i.easting=t.x1,i.northing=t.y1,i.linkId=n.attributes.LINK_ID!=undefined?n.attributes.LINK_ID:r.startLinkId,i.linearRef=IfxStpmapCommon.getLRSLength(n.geometry,new OpenLayers.Geometry.Point(t.x1,t.y1)),i.direction=IfxStpmapCommon.getDirectionOfRouteLink(r,t,n,this),i},mHeight=0,IfxStpMap.prototype.createRoutePointObject=function(n,t,i,r,u){var f={},e=IfxStpmapCommon.getPointTypeID(n),h=this.getLocationDescription(t),o=0,s;return o=e==0||e==1?parseInt(e)+1:parseInt(r)-1,f.pointType=e,f.otherinfo={},u?(f.pointDescr=u,f.otherinfo.isFullAddress=!0):h?(f.pointDescr=h+", "+t.attributes.L_POSTCODE,f.otherinfo.isFullAddress=!1):(f.pointDescr=Math.round(i.x1)+","+Math.round(i.y1)+", "+t.attributes.L_POSTCODE,f.otherinfo.isFullAddress=!1),f.routePointNo=o,e==7&&(f.pointDescr=fvpStructName[1]),f.direction=null,f.routeContactList=[],f.linkId=t.attributes.LINK_ID,f.isAnchorPoint=e==4?1:0,f.pointGeom={sdo_point:{X:"",Y:""}},f.pointGeom.sdo_point.X=i.x1,f.pointGeom.sdo_point.Y=i.y1,s=LRSMeasure(t.geometry,new OpenLayers.Geometry.Point(i.x1,i.y1),{tolerance:.5,details:!0}),f.lrs=Math.round(s.length),f.showRoutePoint=1,f.otherinfo.pointfeature=t,f.otherinfo.dir_travel=t.attributes.DIR_TRAVEL,t.attributes.DIR_TRAVEL=="B"?n=="FORCEDVIAPOINT"?(f.otherinfo.beginNodeId=t.attributes.REF_IN_ID,f.otherinfo.linkId=t.attributes.LINK_ID,f.otherinfo.endNodeId=t.attributes.NREF_IN_ID,document.getElementById("txtMarginalHeight")&&(f.segmentId=$("#txtMarginalHeight").val())):s.measure<=.5?(f.otherinfo.beginNodeId=t.attributes.REF_IN_ID,f.otherinfo.linkId=t.attributes.LINK_ID,f.otherinfo.endNodeId=t.attributes.NREF_IN_ID):(f.otherinfo.beginNodeId=t.attributes.NREF_IN_ID,f.otherinfo.linkId=t.attributes.LINK_ID,f.otherinfo.endNodeId=t.attributes.REF_IN_ID):(n=="STARTPOINT"&&t.attributes.DIR_TRAVEL=="F"||n=="ENDPOINT"&&t.attributes.DIR_TRAVEL=="T"?(f.otherinfo.beginNodeId=t.attributes.NREF_IN_ID,f.otherinfo.linkId=t.attributes.LINK_ID,f.otherinfo.endNodeId=t.attributes.REF_IN_ID):n=="FORCEDVIAPOINT"&&(t.attributes.DIR_TRAVEL=="F"||t.attributes.DIR_TRAVEL=="T")?(f.otherinfo.beginNodeId=t.attributes.REF_IN_ID,f.otherinfo.linkId=t.attributes.LINK_ID,f.otherinfo.endNodeId=t.attributes.NREF_IN_ID,document.getElementById("txtMarginalHeight")&&(f.segmentId=$("#txtMarginalHeight").val())):(f.otherinfo.beginNodeId=t.attributes.REF_IN_ID,f.otherinfo.linkId=t.attributes.LINK_ID,f.otherinfo.endNodeId=t.attributes.NREF_IN_ID),this.updateNodeInfo(e,o,f,t)),f.routeAnnotationList=[],f},IfxStpMap.prototype.setMarker=function(n,t,i,r){var u,f,e,o,s;return n=="STARTPOINT"?(f="STARTPOINT "+this.currentActiveRoutePathIndex+" 0",e=IfxStpmapCommon.getMarkerImage(this.getcurrentSelectedRouteType(),n),u=e=="/Content/Images/startmarker.png"||e=="/Content/Images/alt_startmarker.png"?{externalGraphic:e,graphicHeight:60,graphicWidth:60,graphicXOffset:-60,graphicYOffset:-60}:{externalGraphic:e,graphicHeight:20,graphicWidth:20}):n=="ENDPOINT"?(f="ENDPOINT "+this.currentActiveRoutePathIndex+" 1",e=IfxStpmapCommon.getMarkerImage(this.getcurrentSelectedRouteType(),n),u=e=="/Content/Images/endmarker.png"||e=="/Content/Images/alt_endtmarker.png"?{externalGraphic:e,graphicHeight:60,graphicWidth:60,graphicXOffset:-60,graphicYOffset:-60}:{externalGraphic:e,graphicHeight:20,graphicWidth:20}):n=="WAYPOINT"?(f="WAYPOINT "+this.currentActiveRoutePathIndex+" "+r,u={externalGraphic:"/Content/Images/waymarker.png",graphicHeight:20,graphicWidth:20,label:(r-1).toString(),labelXOffset:0,labelYOffset:-2,fontColor:"white",fontSize:"12px",fontFamily:"Arial",fontWeight:"bold",labelAlign:"cm"}):n=="VIAPOINT"?(f="VIAPOINT "+this.currentActiveRoutePathIndex+" "+r,u={externalGraphic:"/Content/Images/anchorpoint.png",graphicHeight:20,graphicWidth:20,label:(r-1).toString(),labelXOffset:0,labelYOffset:-2,fontColor:"white",fontSize:"12px",fontFamily:"Arial",fontWeight:"bold",labelAlign:"cm"}):n=="LOCATIONIDICATOR"?(f="LOCATIONIDICATOR "+this.currentActiveRoutePathIndex,u={externalGraphic:"/Content/Images/location.png",graphicHeight:40,graphicWidth:40,fontColor:"white",fontSize:"12px",fontFamily:"Arial",fontWeight:"bold",labelAlign:"cm"}):n=="ANNOTATION"?(f="ANNOTATION "+r,u={externalGraphic:"/Content/Images/annotindicator.png",graphicHeight:40,graphicWidth:37,graphicXOffset:-30,graphicYOffset:-40,labelXOffset:0,labelYOffset:-2,fontColor:"white",fontSize:"12px",fontFamily:"Arial",fontWeight:"bold",labelAlign:"cm"}):n=="TRIMPOINT"?(f="TRIMPOINT "+t+" "+i+" "+r,u={externalGraphic:"/Content/Images/trimpoint.png",graphicHeight:20,graphicWidth:20}):n=="FORCEDVIAPOINT"?(f="FORCEDVIAPOINT "+this.currentActiveRoutePathIndex+" "+r,u={externalGraphic:"/Content/Images/structure_orange.png",graphicHeight:20,graphicWidth:20,label:(r-1).toString(),labelXOffset:0,labelYOffset:-2,fontColor:"darkblue",fontSize:"12px",fontFamily:"Arial",fontWeight:"bold",labelAlign:"cm"}):n=="FVPANNOTATION"&&(f="FVPANNOTATION "+r,u={externalGraphic:"/Content/Images/annotindicator.png",graphicHeight:40,graphicWidth:37,graphicXOffset:-30,graphicYOffset:-40,labelXOffset:0,labelYOffset:-2,fontColor:"white",fontSize:"12px",fontFamily:"Arial",fontWeight:"bold",labelAlign:"cm"}),o=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(t,i),{name:f},u),n=="LOCATIONIDICATOR"?(this.vectorLayerMarkers.addFeatures(o),s=this,this.olMap.setCenter([t,i],9)):this.vectorLayerMarkers.addFeatures(o),o},IfxStpMap.prototype.highlightFeatures=function(n,t){this.vectorLayerRoute.addFeatures(n),t?this.olMap.zoomToExtent(this.vectorLayerRoute.getDataExtent()):this.olMap.zoomToExtent(n[0].geometry.getBounds())},IfxStpMap.prototype.clearAllFeaturesFromLayer=function(n){n.removeFeatures(n.features)},IfxStpMap.prototype.searchFeaturesInBBox=function(n,t,i,r){var u=[];u.push("BBOX(GEOM,"+(Number(n)-i).toString()+","+(Number(t)+i).toString()+","+(Number(n)+i).toString()+","+(Number(t)-i).toString()+")"),this.searchFeaturesByCQL(u,r)},IfxStpMap.prototype.searchFeaturesByXY=function(n,t,i,r,u,f){var e,h,o,s;if(i!=undefined&&i==!0){this.searchFeaturesInBBox(n,t,r,u);return}e=objifxStpMap.getPageType(),e=="ITS"||e=="ViewITSDetails"?(h=window.location.href,this.LayerRoadName=e!="ViewITSDetails"?"NWKMAP:STREETS":"NWKMAP:NWK_ITS_SHOWDETAILS"):e=="MIG_ITS"&&(this.LayerRoadName="NWKMAPUPGRADE:STREETS"),o={REQUEST:"GetFeatureInfo",EXCEPTIONS:"application/vnd.ogc.se_xml",BBOX:this.olMap.getExtent().toBBOX(),VERSION:"1.1.1",SERVICE:"WMS",INFO_FORMAT:"application/json",QUERY_LAYERS:this.LayerRoadName,FEATURE_COUNT:50,Layers:this.LayerRoadName,WIDTH:this.olMap.size.w,HEIGHT:this.olMap.size.h,format:this.imageFormat,styles:this.olMap.layers[0].params.STYLES,srs:this.olMap.layers[0].params.SRS},o.x=parseInt(n),o.y=parseInt(t),s=this.geoserverWfsUrl,f==1&&(s=objifxStpMap.configGeoserverWfsUrl),OpenLayers.Request.GET({url:s,params:o,headers:{Accept:"application/json"},success:function(n){var t,i;if(u&&typeof u=="function")try{i=new OpenLayers.Format.GeoJSON,t=i.read(n.responseText),u(t)}catch(r){u(null)}},failure:function(){u&&typeof u=="function"&&u(null)}})},IfxStpMap.prototype.searchFeaturesByCQL=function(n,t){var i=n.length,u=[],o=objifxStpMap.pageType,r,f,e;if(i>0)for(r=n.length-1;r>=0;r--)f=this.geoserverWfsUrl+this.requestPart1+n[r],e=OpenLayers.Request.GET({url:f,headers:{Accept:"application/json"},async:!0,success:function(n){if(i--,n.responseText.length>0){var f=new OpenLayers.Format.GeoJSON,r;try{r=f.read(n.responseText),r.splice(r.length/2,r.length/2),Array.prototype.push.apply(u,r)}catch(e){i==0&&t&&typeof t=="function"&&t()}}i==0&&t&&typeof t=="function"&&t(u)},failure:function(){i==0&&t&&typeof t=="function"&&t()}});else t&&typeof t=="function"&&t()},IfxStpMap.prototype.searchFeaturesByLinkID=function(n,t){var i=IfxStpmapCommon.getCQLFilerFromLinkIDs(n);this.searchFeaturesByCQL(i,t)},IfxStpMap.prototype.searchFeaturesOfRouteLinkList=function(n,t){var i=IfxStpmapCommon.getCQLFilerFromRouteLinkList(n);this.searchFeaturesByCQL(i,t)},IfxStpMap.prototype.swapStartEndRoutePoints=function(n){var t=jQuery.extend(!0,{},this.routeManager.RoutePart.routePathList[n].routePointList[0]),i=jQuery.extend(!0,{},this.routeManager.RoutePart.routePathList[n].routePointList[1]);this.deleteRoutePointByType("STARTPOINT"),this.deleteRoutePointByType("ENDPOINT"),this.setRoutePoint({pointType:"STARTPOINT",pointPos:-1,X:i.pointGeom.sdo_point.X,Y:i.pointGeom.sdo_point.Y,locationDesc:i.pointDescr,setMarker:!0,bLonLat:!0,features:[i.otherinfo.pointfeature]},null),this.setRoutePoint({pointType:"ENDPOINT",pointPos:-1,X:t.pointGeom.sdo_point.X,Y:t.pointGeom.sdo_point.Y,locationDesc:t.pointDescr,setMarker:!0,bLonLat:!0,features:[t.otherinfo.pointfeature]},null)},IfxStpMap.prototype.swapRoutePoint=function(){var i=this.currentActiveRoutePathIndex,r=this.routeManager.getStateFromPointList(i);return r=="firstpointselected"||r=="idle"?(showWarningPopDialogBootsstrap("Het ingevoerde adres kan niet worden gevonden. Voer een geldig adres in","Ok","","WarningCancelBtn","",1,"error"),!1):(this.swapStartEndRoutePoints(i),this.vectorLayerMarkers.redraw(),this.eventList.ONDRAGCOMPLETE!=undefined&&typeof this.eventList.ONDRAGCOMPLETE=="function"&&this.eventList.ONDRAGCOMPLETE(null,i,!0),!0)},IfxStpMap.prototype.updateRoutePointMarkers=function(n,t,i){for(var f,u,r=t;r<=i;r++){if(f=this.routeManager.getRoutePoint(n,r),f.pointType==7&&(f.pointDescr=fvpStructName[1]),u=f.otherinfo.marker,u!=undefined){var o=(r-1).toString(),s=u.attributes.name,e=s.split(" ");e[2]=r,u.data.name=u.attributes.name=e[0]+" "+e[1]+" "+e[2],u.style.label=o}f.routePointNo=r-1}this.vectorLayerMarkers.redraw()},IfxStpMap.prototype.updateFVPRoutePointMarkers=function(n,t,i){for(var r,u,f=t;f<=i;f++)if(r=this.routeManager.getRoutePoint(n,f),r.pointType==7){if(u=r.otherinfo.marker,u!=undefined){var o=(r.routePointNo-1).toString(),s=u.attributes.name,e=s.split(" ");e[2]=r.routePointNo,u.data.name=u.attributes.name=e[0]+" "+e[1]+" "+e[2],u.style.label=o}r.routePointNo=r.routePointNo-1}this.vectorLayerMarkers.redraw()},IfxStpMap.prototype.updateAnnotationMarkers=function(n,t,i){for(var s=this.routeManager.getAnnotationCount(n,t)-1,e,u,o,f,r=i;r<=s;r++)e=this.routeManager.getAnnotation(n,t,r),u=e.otherinfo.marker,u!=undefined&&(o=u.attributes.name,f=o.split(" "),u.data.name=u.attributes.name=f[0]+" "+f[1]+" "+f[2]+" "+r);this.vectorLayerMarkers.redraw()},IfxStpMap.prototype.deleteRoutePointByType=function(n){var i=this.currentActiveRoutePathIndex,t,r;n=IfxStpmapCommon.getPointTypeID(n),n==0||n==1?(t=this.routeManager.getRoutePoint(i,0),t!=null&&t.pointType==n?this.deleteRoutePoint(0,i):(t=this.routeManager.getRoutePoint(i,1),t!=null&&t.pointType==n&&this.deleteRoutePoint(1,i))):n==7&&(r=this.routeManager.RoutePart.routePathList[i].routePointList)},IfxStpMap.prototype.deleteFVPRoutePointByType=function(n,t){var f=[],e=0,o=this.currentActiveRoutePathIndex,i,u,s,r;for(n=IfxStpmapCommon.getPointTypeID(n),i=this.routeManager.RoutePart.routePathList[o].routePointList,u=2;u<i.length;u++)i[u].pointType==7&&f.push(i[u]);for($(f).sort(function(n,t){return parseInt(n.routePointNo)>parseInt(t.routePointNo)}).each(function(n,i){var r=parseInt(t)-1;n==r&&(e=i.linkId)}),s=parseInt(e),r=0;r<i.length;r++)if(i[r].linkId==s&&i[r].pointType==7&&i[r].routePointNo==t){this.deleteRoutePoint(r,o);break}},IfxStpMap.prototype.deleteWPRoutePointByType=function(n,t){var f=[],e=0,o=this.currentActiveRoutePathIndex,i,u,s,r;for(n=IfxStpmapCommon.getPointTypeID(n),i=this.routeManager.RoutePart.routePathList[o].routePointList,u=2;u<i.length;u++)i[u].pointType==2&&f.push(i[u]);for($(f).sort(function(n,t){return parseInt(n.routePointNo)>parseInt(t.routePointNo)}).each(function(n,i){var r=parseInt(t)-1;n==r&&(e=i.linkId)}),s=parseInt(e),r=0;r<i.length;r++)if(i[r].linkId==s&&i[r].pointType==2&&i[r].routePointNo==t){this.deleteRoutePoint(r,o);break}},IfxStpMap.prototype.deleteRoutePoint=function(n,t,i){var r,f,u;(t==null||t==undefined)&&(t=this.currentActiveRoutePathIndex),r=this.routeManager.getRoutePoint(t,n),r!=undefined&&(f=r.otherinfo.marker,this.vectorLayerMarkers.removeFeatures(f),this.routeManager.removeRoutePoint(t,n),r.pointType>1&&this.updateRoutePointMarkers(t,n,this.routeManager.getRoutePointCount(t)-1)),i&&typeof i=="function"&&(u=this.getControlByIndex("olControlDragFeature"),u!=-1&&(this.olMap.controls[u].deactivate(),this.olMap.controls[u].activate()),this.setPageState("secondpointselected"),i())},IfxStpMap.prototype.moveRoutePointPos=function(n,t){pathIndex=this.currentActiveRoutePathIndex;var i=n<t?n:t,r=n<t?t:n;this.routeManager.moveRoutePointPos(pathIndex,n+1,t+1),this.updateRoutePointMarkers(pathIndex,i+1,r+1)},isPreferredRouteFlag=0,IfxStpMap.prototype.planRoute=function(n,t,i){this.clearRoutePath(0),this.clearAllRoutes(!1),this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex].routePathType!=0&&(n=!1),n==!0&&this.initialiseReturnRoutePart();var r=this;this.getVehicleDetails(this.getRouteId(),function(u){var e,f;$("#txtMarginalHeight")&&$("#txtMarginalHeight").val()!=undefined&&u.Height>0&&u.Height>$("#txtMarginalHeight").val()&&(u.Height-=$("#txtMarginalHeight").val()),isPreferredRouteFlag==1&&(u.Height=0,u.Gross_Weight=0,u.Length=0,u.Width=0),e=r.routeManager.formatRouteRequest(r.currentActiveRoutePathIndex,u,t),r.routeManager.setRoutePathState(r.currentActiveRoutePathIndex,"routeplanninginprogress"),f=r.pageType=="CONSULTRESTRICTION"?!0:!1,r.routeManager.doProcessPlanRouteRequest(e,f,function(u){r.drawPlannedRoute(u,n,f,t,i)})})},IfxStpMap.prototype.removeExistingLink=function(){this.vectorLayerRoute.removeFeatures(this.vectorLayerRoute.features),objifxStpMap.vectorLayerRoute.redraw()},IfxStpMap.prototype.drawPlannedRoute=function(n,t,i,r,u){var o,c,h,e,s,f;if(n!=null&&n.length>0){var v=n.length,l=jQuery.extend(!0,{},this.routeManager.getRoutePoint(this.currentActiveRoutePathIndex,0)),a=jQuery.extend(!0,{},this.routeManager.getRoutePoint(this.currentActiveRoutePathIndex,1));if(this.removeExistingLink(),o=this.routeManager.getRoutePath(this.currentActiveRoutePathIndex),o.routeSegmentList.length>0&&(o.routeSegmentList[0].segmentNo==1?l.pointGeom=IfxStpmapCommon.compareGeometries(o.routePointList[0].pointGeom.sdo_point,o.routeSegmentList[0].startPointGeometry.sdo_point)?jQuery.extend(!0,{},o.routeSegmentList[0].endPointGeometry):jQuery.extend(!0,{},o.routeSegmentList[0].startPointGeometry):a.pointGeom=IfxStpmapCommon.compareGeometries(o.routePointList[1].pointGeom.sdo_point,o.routeSegmentList[0].startPointGeometry.sdo_point)?jQuery.extend(!0,{},o.routeSegmentList[0].endPointGeometry):jQuery.extend(!0,{},o.routeSegmentList[0].startPointGeometry)),i)for(c=[],h=[],e=0;e<n.length;e++)c.push(n[e].ulSegmentId),selProductFlag==0?(n[e].byUsable&1)==1&&h.push(n[e].ulSegmentId):selProductFlag==1?((n[e].byUsable&4)==4||(n[e].byUsable&8)==8||n[e].byUsable==0)&&h.push(n[e].ulSegmentId):selProductFlag==2?((n[e].byUsable&32)==32||(n[e].byUsable&64)==64||n[e].byUsable==0)&&h.push(n[e].ulSegmentId):selProductFlag==3&&((n[e].byUsable&128)==128||h.push(n[e].ulSegmentId));else c=n;s=this.routeManager.createRouteSegmentObject(c,l,a,null,1,o.routeSegmentList.length+1,"NORMAL"),o.routeSegmentList.push(s),f=this,this.searchFeaturesOfRouteLinkList(s.routeLinkList,function(n){v>0?(s.otherinfo.features=n,IfxStpmapCommon.createFeatureForRouteSegment(s),f.routeManager.updateRoutePointField(f.currentActiveRoutePathIndex,0,"direction",s.startPointDirection),f.routeManager.updateRoutePointField(f.currentActiveRoutePathIndex,1,"direction",s.endPointDirection),IfxStpmapCommon.createFeatureForWaypoints(o,s,f),f.updateDirectionOfRouteLinks(f.currentActiveRoutePathIndex,o.routeSegmentList.length-1),f.pageType!="NOMAPDISPLAY"&&t==!1?i&&r&&h.length>0?f.searchFeaturesByLinkID(h,function(n){for(var t=0;t<n.length;t++)n[t].data="UNUSABLE";f.vectorLayerRoute.addFeatures(n),f.drawRoute(f.currentActiveRoutePathIndex,!1),f.routeManager.getSegmentCount(f.currentActiveRoutePathIndex)>1&&f.routeManager.reArrangeRouteSegmentList(f.currentActiveRoutePathIndex),f.routeManager.setRoutePathState(f.currentActiveRoutePathIndex,"routeplanned"),objifxStpMap.pageType=="CONSULTRESTRICTION"&&$("#cbUnusable").is(":checked")==!1&&($(".popup1 .message1").css({height:"180px"}),$(".popup1").css({height:"210px"}),showWarningPopDialogBootsstrap(Lang_Key.WngPopup_Fixed_Notif_Unknown,"Ok","","WarningCancelBtn","",1,"info")),u&&typeof u=="function"&&u(!0),f.olMap.zoomToExtent(f.vectorLayerRoute.getDataExtent())}):(f.drawRoute(f.currentActiveRoutePathIndex,!1),f.routeManager.getSegmentCount(f.currentActiveRoutePathIndex)>1&&f.routeManager.reArrangeRouteSegmentList(f.currentActiveRoutePathIndex),f.routeManager.setRoutePathState(f.currentActiveRoutePathIndex,"routeplanned"),u&&typeof u=="function"&&u(!0),f.olMap.zoomToExtent(f.vectorLayerRoute.getDataExtent())):t==!0&&(f.setReturnRoutePart(),u&&typeof u=="function"&&u(!0))):(u&&typeof u=="function"&&u(!1),f.routeManager.setRoutePathState(f.currentActiveRoutePathIndex,"secondpointselected"))})}else u&&typeof u=="function"&&u(!1),this.routeManager.setRoutePathState(this.currentActiveRoutePathIndex,"secondpointselected")},IfxStpMap.prototype.setSegmentTypeToFeatures=function(n,t){for(var r=n.routeSegmentList[t].segmentType,i=0;i<n.routeSegmentList[t].otherinfo.completefeatures.length;i++)n.routeSegmentList[t].otherinfo.completefeatures[i].data=r;return r},IfxStpMap.prototype.doProcessDrawRoute=function(n,t){for(var r,i=0;i<n.routeSegmentList.length;i++)r=this.setSegmentTypeToFeatures(n,i),n.routeSegmentList[i].otherinfo.completefeatures!=undefined&&(r!=3?this.vectorLayerRoute.addFeatures(n.routeSegmentList[i].otherinfo.completefeatures):this.vectorLayerOffRoad.addFeatures(n.routeSegmentList[i].otherinfo.completefeatures));n.otherinfo&&n.otherinfo.completefeatures.length>0&&this.vectorLayerRoute.addFeatures(n.otherinfo.completefeatures),t==!0&&this.drawMarkers(n)},IfxStpMap.prototype.drawMarkers=function(n){for(var t,r,i=0;i<n.routePointList.length;i++)t=n.routePointList[i],t.pointGeom!=null&&t.showRoutePoint==1&&(r=this.setMarker(IfxStpmapCommon.getPointTypeName(t.pointType),t.pointGeom.sdo_point.X,t.pointGeom.sdo_point.Y,t.routePointNo+1),t.otherinfo==undefined&&(t.otherinfo={completefeatures:[],features:[]}),t.otherinfo.marker=r)},IfxStpMap.prototype.drawRoute=function(n,t){var i,r;if(breakruleflag==1)breakruleflag=0;else if(n==-1)for(i=0;i<this.routeManager.getRoutePathCount();i++)r=this.routeManager.getRoutePath(i),this.currentActiveRoutePathIndex=i,this.doProcessDrawRoute(r,t);else r=this.routeManager.getRoutePath(n),this.doProcessDrawRoute(r,t)},IfxStpMap.prototype.addRoutePath=function(n){this.getCurrentPathState()!="idle"&&(this.currentActiveRoutePathIndex=this.routeManager.addRoutePath(n)-1,addtoselect("Path"+Number(this.currentActiveRoutePathIndex+1)),this.eventList.ADDPATH!=undefined&&typeof this.eventList.ADDPATH=="function"&&this.eventList.ADDPATH(null))},IfxStpMap.prototype.clearAnnotations=function(n){if(n!=null)for(var t=0;t<n.length;t++)this.vectorLayerMarkers.removeFeatures(n[t].otherinfo.marker);n=[]},IfxStpMap.prototype.clearRoutePart=function(){this.routeManager.clearRoutePart(!0)},IfxStpMap.prototype.removeRouteSegment=function(n,t){var i=this.routeManager.RoutePart.routePathList[n].routeSegmentList[t];this.deleteAnnotationsofRouteSegment(n,t),IfxStpmapCommon.getSegmentTypeName(i.segmentType)!="OFFROAD"?this.vectorLayerRoute.removeFeatures(i.otherinfo.completefeatures):this.vectorLayerOffRoad.removeFeatures(i.otherinfo.completefeatures),this.routeManager.removeRouteSegment(n,t)},IfxStpMap.prototype.removeAllRouteSegment=function(n){var t=this.routeManager.RoutePart.routePathList[n].routeSegmentList[segmentIndex];this.deleteAnnotationsofRouteSegment(n,segmentIndex),IfxStpmapCommon.getSegmentTypeName(t.segmentType)!="OFFROAD"?this.vectorLayerRoute.removeFeatures(t.otherinfo.completefeatures):this.vectorLayerOffRoad.removeFeatures(t.otherinfo.completefeatures),this.routeManager.removeRouteSegment(n,segmentIndex)},IfxStpMap.prototype.insertRouteSegment=function(n,t,i,r){this.routeManager.insertRouteSegment(n,t,i,r)},IfxStpMap.prototype.clearSpecificRouteSegment=function(n){this.vectorLayerRoute.removeFeatures(n.otherinfo.completefeatures)},IfxStpMap.prototype.clearAllRouteSegmentsInPath=function(n){for(var t=0;t<n.routeSegmentList.length;t++){if(IfxStpmapCommon.getSegmentTypeName(n.routeSegmentList[t].segmentType)!="OFFROAD"?this.vectorLayerRoute.removeFeatures(n.routeSegmentList[t].otherinfo.completefeatures):this.vectorLayerOffRoad.removeFeatures(n.routeSegmentList[t].otherinfo.completefeatures),IfxStpmapCommon.getSegmentTypeName(n.routeSegmentList[t].segmentType)=="OFFROAD")if(n.routeSegmentList[t].segmentNo==1&&(IfxStpmapCommon.compareGeometries(n.routePointList[0].pointGeom.sdo_point,n.routeSegmentList[t].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routePointList[0].pointGeom.sdo_point,n.routeSegmentList[t].endPointGeometry.sdo_point)))continue;else if(n.routeSegmentList[t].segmentNo==n.routeSegmentList.length&&(IfxStpmapCommon.compareGeometries(n.routePointList[1].pointGeom.sdo_point,n.routeSegmentList[t].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(n.routePointList[1].pointGeom.sdo_point,n.routeSegmentList[t].endPointGeometry.sdo_point)))continue;n.routeSegmentList[t].otherinfo.completefeatures=[],n.routeSegmentList[t].otherinfo.features=[],this.clearAnnotations(n.routeSegmentList[t].routeAnnotationsList)}},IfxStpMap.prototype.clearRoutePath=function(n){var t,r,i;if((n==undefined||n==null)&&(n=this.currentActiveRoutePathIndex),this.routeManager.getRoutePathState(n)=="routeplanned"||this.routeManager.getRoutePathState(n)=="routedisplayed"||clearRouteForPlan){for(clearRouteForPlan=!1,t=this.routeManager.getRoutePath(n),this.clearAllRouteSegmentsInPath(t),r=t.routeSegmentList.length,i=r-1;i>=0;i--){if(IfxStpmapCommon.getSegmentTypeName(t.routeSegmentList[i].segmentType)=="OFFROAD")if(t.routeSegmentList[i].segmentNo==1&&(IfxStpmapCommon.compareGeometries(t.routePointList[0].pointGeom.sdo_point,t.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(t.routePointList[0].pointGeom.sdo_point,t.routeSegmentList[i].endPointGeometry.sdo_point)))continue;else if(t.routeSegmentList[i].segmentNo==r&&(IfxStpmapCommon.compareGeometries(t.routePointList[1].pointGeom.sdo_point,t.routeSegmentList[i].startPointGeometry.sdo_point)||IfxStpmapCommon.compareGeometries(t.routePointList[1].pointGeom.sdo_point,t.routeSegmentList[i].endPointGeometry.sdo_point)))continue;this.routeManager.removeRouteSegment(n,i)}this.routeManager.setRoutePathState(n,"secondpointselected"),t.otherinfo.completefeatures=[]}},IfxStpMap.prototype.removeRoutePath=function(n){var i,t;for(this.clearRoutePath(n),i=this.routeManager.getRoutePath(n),t=0;t<i.routePointList.length;t++)i.routePointList[t].showRoutePoint==1&&this.vectorLayerMarkers.removeFeatures([i.routePointList[t].otherinfo.marker]);this.routeManager.removeRoutePath(n),this.currentActiveRoutePathIndex=0},IfxStpMap.prototype.getPathCount=function(){return this.routeManager.getRoutePathCount()},IfxStpMap.prototype.clearAllRoutes=function(n){var i,r,t;for(n==!0&&this.removeReturnLeg(),i=jQuery.extend(!0,{},this.routeManager.RoutePart.routePartDetails),r=n==!0?0:1,t=this.routeManager.getRoutePathCount()-1;t>=r;t--)this.removeRoutePath(t);this.clearRestrictedLinks(),this.routeManager.clearRoutePart(n),n==!0?this.routeManager.setRoutePathState(this.currentActiveRoutePathIndex,"idle"):(this.clearRoutePath(0),this.routeManager.setRoutePathState(this.currentActiveRoutePathIndex,"secondpointselected")),this.routeManager.RoutePart.routePartDetails=i,this.pageState="readyidle"},IfxStpMap.prototype.getPageType=function(){return this.pageType},IfxStpMap.prototype.setPageType=function(n){this.pageType=n},IfxStpMap.prototype.getPageState=function(){return this.pageState},IfxStpMap.prototype.setPageState=function(n){this.pageState=n},IfxStpMap.prototype.changePageType=function(n){this.pageType=n;var t=this.getControlByIndex("olControlDragFeature");n=="DISPLAYONLY"?t!=-1&&(this.olMap.controls[t].deactivate(),this.olMap.controls.splice(t,1)):t==-1&&this.createDragFeature(),this.pageState="readyidle"},IfxStpMap.prototype.getCurrentPathState=function(){return this.routeManager.getRoutePathState(this.currentActiveRoutePathIndex)},IfxStpMap.prototype.setCurrentRoutePathState=function(){this.routeManager.setCurrentRoutePathState()},IfxStpMap.prototype.getcurrentSelectedRouteType=function(){return this.routeManager.getRoutePath(this.currentActiveRoutePathIndex).routePathType},IfxStpMap.prototype.getFeaturesOfRoutePath=function(n){for(var r=[],i,t=0;t<this.routeManager.RoutePart.routePathList[n].routeSegmentList.length;t++)for(i=0;i<this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures.length;i++)r.push(this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures[i]);return r},IfxStpMap.prototype.getFeaturesOfRouteSegment=function(n,t){return this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures},IfxStpMap.prototype.getNearestPathAndSegment=function(n,t,i,r){var l,s,o,h,u,f,e,c;for(r!=!0?(l={x:n,y:t},s=this.olMap.getLonLatFromPixel(l)):s=new OpenLayers.LonLat(n,t),u={distance:2500,pathIndex:-1,segmentIndex:-1,feature:""},f=0;f<this.routeManager.RoutePart.routePathList.length;f++)for(e=0;e<this.routeManager.RoutePart.routePathList[f].routeSegmentList.length;e++){if(c=IfxStpmapCommon.getSegmentTypeName(this.routeManager.RoutePart.routePathList[f].routeSegmentList[e].segmentType),$("#PortalType").val()=="696011"){if(i==!1&&c!="NORMAL"&&c!="CONFIRMED")continue}else if(i==!1&&c!="NORMAL")continue;o=[],o=this.getFeaturesOfRouteSegment(f,e),o.length>0&&(h=IfxStpmapCommon.findNearestFeatureIndex(o,s.lon,s.lat),h.distance<u.distance&&(u=h,u.pathIndex=f,u.segmentIndex=e,u.feature=o[h.index]))}return u},IfxStpMap.prototype.divideRouteSegment=function(n,t,i,r,u){var l=this.routeManager.getRoutePath(n),p=this.searchFeaturesBetweenLinkNo(0,i.linkNo-2,n,t),w=this.searchFeaturesBetweenLinkNo(r.linkNo,l.routeSegmentList[t].routeLinkList.length-1,n,t),f=jQuery.extend(!0,{},l.routeSegmentList[t]),b=l.routeSegmentList[t].routeLinkList.length,s=[],a=[],c=[],v,h,o,y,e;if(IfxStpmapCommon.compareGeometries(f.startPointGeometry.sdo_point,i.pointGeom.sdo_point))this.removeRouteSegment(n,t);else{for(this.clearSpecificRouteSegment(l.routeSegmentList[t]),e=0;e<i.linkNo-1;e++)s[e]=f.routeLinkList[e].linkId,a[e]=f.routeLinkList[e].direction;if(f.routeAnnotationsList!=null)for(e=0;e<f.routeAnnotationsList.length;e++)for(f.startLinkId==f.routeAnnotationsList[e].linkId&&c.push(f.routeAnnotationsList[e]),h=0;h<s.length;h++)s[h]==f.routeAnnotationsList[e].linkId&&c.push(f.routeAnnotationsList[e]);for(rpStart={linkId:f.startLinkId,pointGeom:f.startPointGeometry,lrs:f.startLrs,direction:f.startPointDirection,otherinfo:{pointfeature:f.otherinfo.startSegmentfeature}},(i.lrs==0||i.lrs==1)&&s.length>0&&(i.linkId=s[s.length-1]),i.lrs=IfxStpmapCommon.getLRSLength(i.otherinfo.pointfeature.geometry,new OpenLayers.Geometry.Point(i.pointGeom.sdo_point.X,i.pointGeom.sdo_point.Y)),rpEnd=i,o=this.routeManager.createRouteSegmentObject(s,rpStart,rpEnd,null,1,f.segmentNo,IfxStpmapCommon.getSegmentTypeName(f.segmentType),a),o.otherinfo.features=p,this.insertRouteSegment(n,t,o,!0),o.routeLinkList.length!=0||i.linkNo==1?(IfxStpmapCommon.createFeatureForRouteSegment(o),this.vectorLayerRoute.addFeatures(o.otherinfo.completefeatures)):(o.endPointDirection=rpStart.direction,v=IfxStpmapCommon.getPartialFeature(o.otherinfo.startSegmentfeature,o),IfxStpmapCommon.createPartialFeatureForRouteSegment(v,rpStart.direction,rpEnd.pointGeom.sdo_point.X,rpEnd.pointGeom.sdo_point.Y,o,"STARTPOINT"),this.vectorLayerRoute.addFeatures(o.otherinfo.completefeatures)),e=0;e<c.length;e++)this.addAnnotation(n,t,-1,c[e])}if(!IfxStpmapCommon.compareGeometries(f.endPointGeometry.sdo_point,r.pointGeom.sdo_point)){for(s=[],a=[],c=[],e=r.linkNo,h=0;e<f.routeLinkList.length;e++)s[h]=f.routeLinkList[e].linkId,a[h++]=f.routeLinkList[e].direction;if(f.routeAnnotationsList!=null)for(e=0;e<f.routeAnnotationsList.length;e++)for(f.endLinkId==f.routeAnnotationsList[e].linkId&&c.push(f.routeAnnotationsList[e]),h=0;h<s.length;h++)s[h]==f.routeAnnotationsList[e].linkId&&c.push(f.routeAnnotationsList[e]);for((r.lrs==0||r.lrs==1)&&s.length>0&&(r.linkId=s[0]),r.lrs=IfxStpmapCommon.getLRSLength(r.otherinfo.pointfeature.geometry,new OpenLayers.Geometry.Point(r.pointGeom.sdo_point.X,r.pointGeom.sdo_point.Y)),rpStart=r,rpEnd={linkId:f.endLinkId,pointGeom:f.endPointGeometry,lrs:f.endLrs,direction:f.endPointDirection,otherinfo:{pointfeature:f.otherinfo.endSegmentfeature}},o=this.routeManager.createRouteSegmentObject(s,rpStart,rpEnd,null,1,u+2,IfxStpmapCommon.getSegmentTypeName(f.segmentType),a),o.otherinfo.features=w,this.insertRouteSegment(n,u+1,o,!1),o.routeLinkList.length!=0||r.linkNo==b?(IfxStpmapCommon.createFeatureForRouteSegment(o),this.vectorLayerRoute.addFeatures(o.otherinfo.completefeatures)):(o.startPointDirection=rpEnd.direction,y=IfxStpmapCommon.getPartialFeature(o.otherinfo.startSegmentfeature,o),IfxStpmapCommon.createPartialFeatureForRouteSegment(y,rpEnd.direction,rpEnd.pointGeom.sdo_point.X,rpEnd.pointGeom.sdo_point.Y,o,"ENDPOINT"),this.vectorLayerRoute.addFeatures(o.otherinfo.completefeatures)),e=0;e<c.length;e++)this.addAnnotation(n,l.routeSegmentList.length-1,-1,c[e])}this.routeManager.reArrangeRouteSegmentList(n),this.clearAnnotationsofRoutePath(n),this.drawAnnotations(l,n),breakruleflag=1,this.routeManager.getRoutePathState(n)=="routedisplayed"&&(this.routeManager.setRoutePathState(this.currentActiveRoutePathIndex,"routeplanned"),this.eventList.PATHSTATECHANGED!=undefined&&typeof this.eventList.PATHSTATECHANGED=="function"&&this.eventList.PATHSTATECHANGED())},IfxStpMap.prototype.searchRouteLinkByLinkID=function(n,t,i){for(var r=0;r<this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].routeLinkList.length;r++)if(this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].routeLinkList[r].linkId==i)return this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].routeLinkList[r]},IfxStpMap.prototype.searchFeatureInRouteByLinkId=function(n,t,i){for(var r=0;r<this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures.length;r++)if(this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures[r].attributes.LINK_ID==i)return this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures[r]},IfxStpMap.prototype.searchFeaturesBetweenLinkNo=function(n,t,i,r){for(var f=this.routeManager.RoutePart.routePathList[i].routeSegmentList[r],o=[],u,e=n;e<=t;e++)for(u=0;u<f.otherinfo.completefeatures.length;u++)f.routeLinkList[e].linkId==f.otherinfo.completefeatures[u].attributes.LINK_ID&&o.push(f.otherinfo.completefeatures[u]);return o},IfxStpMap.prototype.drawManoeuvreSet=function(n,t){var i=this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex],r;i.routeSegmentList[i.routeSegmentList.length-1].direction==1&&i.routeSegmentList[i.routeSegmentList.length-1].otherinfo.isComplete==!1?this.drawManoeuvre(n,t):(r=this,this.eventList.MANOEUVRESELECT!=undefined&&typeof this.eventList.MANOEUVRESELECT=="function"&&this.eventList.MANOEUVRESELECT(n,function(){r.drawManoeuvre(n,t)}))},IfxStpMap.prototype.drawManoeuvre=function(n,t){var i=this;i.searchFeaturesByXY(n.xy.x,n.xy.y,!1,i.boundaryOffset,function(r){r==null||r.length<=0||i.setManoeuvreSegment(i.currentActiveRoutePathIndex,r,n.xy.x,n.xy.y,t)})},IfxStpMap.prototype.setManoeuvreSegment=function(n,t,i,r,u){var f=this.routeManager.RoutePart.routePathList[n],o=this.olMap.getLonLatFromPixel({x:i,y:r}),l=IfxStpmapCommon.findNearestFeatureIndex(t,o.lon,o.lat),e=t[l.index],h,c,s;IfxStpmapCommon.getSegmentTypeName(f.routeSegmentList[f.routeSegmentList.length-1].segmentType)!="NORMAL"&&IfxStpmapCommon.getSegmentTypeName(f.routeSegmentList[f.routeSegmentList.length-1].segmentType)!="OFFROAD"&&f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.isComplete==!1||(h=this.routeManager.createRouteSegmentObject(null,null,null,null,1,f.routeSegmentList.length+1,u),f.routeSegmentList.push(h),this.eventList.MANOEUVREADDED!=undefined&&typeof this.eventList.MANOEUVREADDED=="function"&&(c=this.olMap.getPixelFromLonLat(o),this.eventList.MANOEUVREADDED(c))),f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.completefeatures.length>0&&(s=this.checkContinuity(e,f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.completefeatures,f.routeSegmentList[f.routeSegmentList.length-1].segmentType,f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.endnode)),f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.completefeatures.length==0||s!=!1?(e.data=u,this.vectorLayerRoute.addFeatures(e),f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.startfrom=e,f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.endnode=s,f.routeSegmentList[f.routeSegmentList.length-1].otherinfo.completefeatures.push(e)):showNotification("Select a continuous road.")},IfxStpMap.prototype.checkContinuity=function(n,t,i,r){if(IfxStpmapCommon.getSegmentTypeName(i)=="OVERRIDE"){for(var u=0;u<t.length;u++)if(t[u].attributes.REF_IN_ID==n.attributes.REF_IN_ID||t[u].attributes.REF_IN_ID==n.attributes.NREF_IN_ID||t[u].attributes.NREF_IN_ID==n.attributes.REF_IN_ID||t[u].attributes.NREF_IN_ID==n.attributes.NREF_IN_ID)return!0}else if(r=="REF_NODE"){if(t[t.length-1].attributes.REF_IN_ID==n.attributes.REF_IN_ID)return"NREF_NODE";if(t[t.length-1].attributes.REF_IN_ID==n.attributes.NREF_IN_ID)return"REF_NODE"}else if(r=="NREF_NODE"){if(t[t.length-1].attributes.NREF_IN_ID==n.attributes.REF_IN_ID)return"NREF_NODE";if(t[t.length-1].attributes.NREF_IN_ID==n.attributes.NREF_IN_ID)return"REF_NODE"}else{if(t[t.length-1].attributes.REF_IN_ID==n.attributes.REF_IN_ID||t[t.length-1].attributes.NREF_IN_ID==n.attributes.REF_IN_ID)return"NREF_NODE";if(t[t.length-1].attributes.REF_IN_ID==n.attributes.NREF_IN_ID||t[t.length-1].attributes.NREF_IN_ID==n.attributes.NREF_IN_ID)return"REF_NODE"}return!1},IfxStpMap.prototype.updateManoeuvreRouteSegment=function(n){var e,t,r,u,i,f,o;if(toolbarPanel4.div.style.display="none",e=this.routeManager.RoutePart.routePathList[n].routeSegmentList.length-1,t=this.routeManager.RoutePart.routePathList[n].routeSegmentList[e],t.otherinfo.isAdded&&!t.otherinfo.isComplete){for(t.otherinfo.isComplete=!0,r=[],u=0;u<t.otherinfo.completefeatures.length;u++)r[u]=t.otherinfo.completefeatures[u].attributes.LINK_ID;t.routeLinkList=this.routeManager.createRouteLinkList(r,1),t.otherinfo.isComplete=!0,t.startLinkId=r[0],t.endLinkId=r[r.length-1],i=this.findEndGeometriesOfManoeuvre(t),t.startPointGeometry.sdo_point={X:i.startGeom.x,Y:i.startGeom.y},t.endPointGeometry.sdo_point={X:i.endGeom.x,Y:i.endGeom.y},t.otherinfo.startSegmentfeature=jQuery.extend(!0,{},t.otherinfo.completefeatures[0]),t.otherinfo.endSegmentfeature=jQuery.extend(!0,{},t.otherinfo.completefeatures[t.otherinfo.completefeatures.length-1]),this.updateDirectionOfRouteLinks(n,e),t.startPointDirection=t.routeLinkList[0].direction,t.endPointDirection=t.routeLinkList[t.routeLinkList.length-1].direction,f=LRSMeasure(t.otherinfo.startSegmentfeature.geometry,new OpenLayers.Geometry.Point(t.startPointGeometry.sdo_point.X,t.startPointGeometry.sdo_point.Y),{tolerance:.5,details:!0}),t.startLrs=Math.round(f.length),f=LRSMeasure(t.otherinfo.endSegmentfeature.geometry,new OpenLayers.Geometry.Point(t.endPointGeometry.sdo_point.X,t.endPointGeometry.sdo_point.Y),{tolerance:.5,details:!0}),t.endLrs=Math.round(f.length),IfxStpmapCommon.getSegmentTypeName(t.segmentType)=="OVERRIDE"&&(o={xy:{x:i.startGeom.x,y:i.startGeom.y}},this.cutRoute(o,!0,i.startGeom,!1))}},IfxStpMap.prototype.findEndGeometriesOfManoeuvre=function(n){var i=n.otherinfo.completefeatures,r,f,e,h,o,s,t,u;if(IfxStpmapCommon.getSegmentTypeName(n.segmentType)!="OVERRIDE"){if(r=[n.otherinfo.completefeatures[0],n.otherinfo.completefeatures[n.otherinfo.completefeatures.length-1]],r[0].attributes.LINK_ID==r[1].attributes.LINK_ID)f=jQuery.extend(!0,{},r[0].geometry.components[0]),e=jQuery.extend(!0,{},r[0].geometry.components[r[0].geometry.components.length-1]);else{for(h=endNodeFlag=0,t=0;t<i.length;t++)if(r[0]!=i[t]&&(r[0].attributes.REF_IN_ID==i[t].attributes.REF_IN_ID||r[0].attributes.REF_IN_ID==i[t].attributes.NREF_IN_ID)){h=1;break}for(t=0;t<i.length;t++)if(r[1]!=i[t]&&(r[1].attributes.REF_IN_ID==i[t].attributes.REF_IN_ID||r[1].attributes.REF_IN_ID==i[t].attributes.NREF_IN_ID)){endNodeFlag=1;break}f=h==0?jQuery.extend(!0,{},r[0].geometry.components[0]):jQuery.extend(!0,{},r[0].geometry.components[r[0].geometry.components.length-1]),e=endNodeFlag==0?jQuery.extend(!0,{},r[1].geometry.components[0]):jQuery.extend(!0,{},r[1].geometry.components[r[1].geometry.components.length-1])}return{startGeom:f,endGeom:e}}for(s=this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex],t=0;t<i.length;t++)for(u=0;u<s.routeSegmentList.length-1;u++){if(o=IfxStpmapCommon.findNearestFeatureIndex(s.routeSegmentList[u].otherinfo.completefeatures,i[t].geometry.components[0].x,i[t].geometry.components[0].y),o.distance==0)return{startGeom:i[t].geometry.components[0],endGeom:i[t].geometry.components[0]};if(o=IfxStpmapCommon.findNearestFeatureIndex(s.routeSegmentList[u].otherinfo.completefeatures,i[t].geometry.components[i[t].geometry.components.length-1].x,i[t].geometry.components[i[t].geometry.components.length-1].y),o.distance==0)return{startGeom:i[t].geometry.components[i[t].geometry.components.length-1],endGeom:i[t].geometry.components[i[t].geometry.components.length-1]}}},IfxStpMap.prototype.removeFeaturesFromRoutePath=function(n,t){for(var u=[],r,i=0;i<this.routeManager.RoutePart.routePathList[n].routeSegmentList.length;i++)for(r=0;r<this.routeManager.RoutePart.routePathList[n].routeSegmentList[i].otherinfo.completefeatures.length;r++)this.routeManager.RoutePart.routePathList[n].routeSegmentList[i].otherinfo.completefeatures[r].attributes.LINK_ID==t&&(this.rearrangeFeaturesOfRouteSegment(n,i,r),r--)},IfxStpMap.prototype.rearrangeFeaturesOfRouteSegment=function(n,t,i){for(var r=i;r<this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures.length;r++)this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures[r]=this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures[r+1];this.routeManager.RoutePart.routePathList[n].routeSegmentList[t].otherinfo.completefeatures.length--},IfxStpMap.prototype.removeFeaturesFromRoute=function(n){this.vectorLayerRoute.removeFeatures(n)},IfxStpMap.prototype.getTerminalPoints=function(n,t){for(var u=[],r=this.routeManager.RoutePart.routePathList[n],i=0;i<r.routeSegmentList.length;i++)i!=t&&(IfxStpmapCommon.getSegmentTypeName(r.routeSegmentList[i].segmentType)=="OFFROAD"?(u.push(new OpenLayers.Geometry.Point(r.routeSegmentList[i].offRoadGeometry.OrdinatesArray[0],r.routeSegmentList[i].offRoadGeometry.OrdinatesArray[1])),u.push(new OpenLayers.Geometry.Point(r.routeSegmentList[i].offRoadGeometry.OrdinatesArray[r.routeSegmentList[i].offRoadGeometry.OrdinatesArray.length-2],r.routeSegmentList[i].offRoadGeometry.OrdinatesArray[r.routeSegmentList[i].offRoadGeometry.OrdinatesArray.length-1]))):(u.push(new OpenLayers.Geometry.Point(r.routeSegmentList[i].startPointGeometry.sdo_point.X,r.routeSegmentList[i].startPointGeometry.sdo_point.Y)),u.push(new OpenLayers.Geometry.Point(r.routeSegmentList[i].endPointGeometry.sdo_point.X,r.routeSegmentList[i].endPointGeometry.sdo_point.Y))));return u},IfxStpMap.prototype.getIntersectionFeatures=function(n,t,i){for(var r=[],e=this.routeManager.RoutePart.routePathList[n],u,o,f=0;f<e.routeSegmentList[t].otherinfo.completefeatures.length;f++)for(u=0;u<i.length;u++)o=IfxStpmapCommon.findNearestFeatureIndex([e.routeSegmentList[t].otherinfo.completefeatures[f]],i[u].x,i[u].y),o.distance<1&&(r[r.length]={feature:"",point:"",terminal:""},r[r.length-1].feature=e.routeSegmentList[t].otherinfo.completefeatures[f],r[r.length-1].point=i[u],r[r.length-1].terminal=u);return r},IfxStpMap.prototype.getNextIntersectionLink=function(n,t,i){for(var r=0;r<t.length;r++)if(link=this.searchRouteLinkByLinkID(i.pathIndex,i.segmentIndex,t[r].feature.attributes.LINK_ID),link.linkNo==n+1)return{linkNo:link.linkNo,index:r};return{linkNo:n,index:-2}},IfxStpMap.prototype.getPreviousIntersectionLink=function(n,t,i){for(var r=0;r<t.length;r++)if(link=this.searchRouteLinkByLinkID(i.pathIndex,i.segmentIndex,t[r].feature.attributes.LINK_ID),link.linkNo==n-1)return{linkNo:link.linkNo,index:r};return{linkNo:n,index:-2}},IfxStpMap.prototype.getNearestIntersectionLinks=function(n,t){var e=this.routeManager.RoutePart.routePathList[n.pathIndex].routeSegmentList[n.segmentIndex],h=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,n.feature.attributes.LINK_ID),f,r={linkNo:0,index:-2},u={linkNo:e.routeLinkList.length+1,index:-2},s={linkNo:-1,index:-2},a=this.routeManager.RoutePart.routePathList[n.pathIndex].routeSegmentList[this.routeManager.RoutePart.routePathList[n.pathIndex].routeSegmentList.length-1],c,l,i,o;if(t.length==2&&a!=undefined&&IfxStpmapCommon.getSegmentTypeName(a.segmentType)=="OVERRIDE")return c=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,t[0].feature.attributes.LINK_ID),l=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,t[1].feature.attributes.LINK_ID),c.linkNo<l.linkNo?(r.linkNo=c.linkNo,r.index=0,u.linkNo=l.linkNo,u.index=1):(r.linkNo=l.linkNo,r.index=1,u.linkNo=c.linkNo,u.index=0),{near1:r,near2:u};if(h==undefined)if(n.feature.attributes.LINK_ID==e.startLinkId)h={linkNo:0};else if(n.feature.attributes.LINK_ID==e.endLinkId)h={linkNo:e.routeLinkList.length+1};else return null;for(i=0;i<t.length;i++)f=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,t[i].feature.attributes.LINK_ID),f==undefined||f==null?t[i].feature.attributes.LINK_ID==e.startLinkId&&r.linkNo==0&&h.linkNo>=0?(o=IfxStpmapCommon.findIsNearestWithDirection(e,n,t[i],t[r.index],this,1),o&&(r.linkNo=0,r.index=i)):t[i].feature.attributes.LINK_ID==e.endLinkId&&h.linkNo==e.routeLinkList.length+1&&(o=IfxStpmapCommon.findIsNearestWithDirection(e,n,t[i],t[r.index],this,1),o&&(r.linkNo=e.routeLinkList.length+1,r.index=i)):f.linkNo>=r.linkNo&&(f.linkNo==h.linkNo&&(o=IfxStpmapCommon.findIsNearestWithDirection(e,n,t[i],t[s.index],this,1),o&&(s.linkNo=f.linkNo,s.index=i)),f.linkNo==r.linkNo?(o=IfxStpmapCommon.findIsNearest(n.x1,n.y1,t[i].point,t[r.index].point),o&&(r.linkNo=f.linkNo,r.index=i)):f.linkNo<h.linkNo&&(r.linkNo=f.linkNo,r.index=i));for(r.linkNo<s.linkNo&&s.linkNo<=h.linkNo&&(r=jQuery.extend(!0,{},s)),s.linkNo=-2,s.index=-2,i=0;i<t.length;i++)f=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,t[i].feature.attributes.LINK_ID),f==undefined||f==null?t[i].feature.attributes.LINK_ID==e.endLinkId&&u.linkNo==e.routeLinkList.length+1&&h.linkNo<=e.routeLinkList.length+1?(o=IfxStpmapCommon.findIsNearestWithDirection(e,n,t[i],t[u.index],this,2),o&&(u.linkNo=e.routeLinkList.length+1,u.index=i)):t[i].feature.attributes.LINK_ID==e.startLinkId&&h.linkNo==0&&(o=IfxStpmapCommon.findIsNearestWithDirection(e,n,t[i],t[u.index],this,2),o&&(u.linkNo=0,u.index=i)):f.linkNo<=u.linkNo&&(f.linkNo==h.linkNo&&(o=IfxStpmapCommon.findIsNearestWithDirection(e,n,t[i],t[s.index],this,2),o&&(s.linkNo=f.linkNo,s.index=i)),f.linkNo==u.linkNo?(o=IfxStpmapCommon.findIsNearest(n.x1,n.y1,t[i].point,t[u.index].point),o&&(u.linkNo=f.linkNo,u.index=i)):f.linkNo>h.linkNo&&(u.linkNo=f.linkNo,u.index=i));return u.linkNo>s.linkNo&&s.linkNo>=h.linkNo&&(u=s),{near1:r,near2:u}},IfxStpMap.prototype.checkParallelSegmentsContinuity=function(n,t,i,r,u,f,e,o){var c=this.routeManager.getRoutePath(n),s,l,h;for((e==null||e==undefined||o==null||o==undefined)&&(i!=null?(e=jQuery.extend(!0,{},i[u].point),o=jQuery.extend(!0,{},i[f].point)):r!=null&&(e=jQuery.extend(!0,{},r[u]),o=jQuery.extend(!0,{},r[f]))),s=0;s<c.routeSegmentList.length;s++)if(s!=t&&(l=0,IfxStpmapCommon.compareGeometries(c.routeSegmentList[s].startPointGeometry.sdo_point,e)?(e.x=c.routeSegmentList[s].endPointGeometry.sdo_point.X,e.y=c.routeSegmentList[s].endPointGeometry.sdo_point.Y,l=1):IfxStpmapCommon.compareGeometries(c.routeSegmentList[s].endPointGeometry.sdo_point,e)&&(e.x=c.routeSegmentList[s].startPointGeometry.sdo_point.X,e.y=c.routeSegmentList[s].startPointGeometry.sdo_point.Y,l=1),l==1)){if(IfxStpmapCommon.compareGeometries(e,o))return!0;if(i!=null){for(h=0;h<i.length;h++)if(IfxStpmapCommon.compareGeometries(i[h],e))return!1;return this.checkParallelSegmentsContinuity(n,s,jQuery.extend(!0,[],i),null,null,null,e,o)}if(r!=null){for(h=0;h<r.length;h++)if(IfxStpmapCommon.compareGeometries(r[h],e))return!1;return this.checkParallelSegmentsContinuity(n,s,null,jQuery.extend(!0,[],r),null,null,e,o)}}return!1},IfxStpMap.prototype.findSegmentHavingEndPoint=function(n,t,i){for(var u=this.routeManager.getRoutePath(n),f,r=0;r<u.routeSegmentList.length;r++)if(f=new OpenLayers.Geometry.Point(t,i),IfxStpmapCommon.compareGeometries(u.routeSegmentList[r].startPointGeometry,f)||IfxStpmapCommon.compareGeometries(u.routeSegmentList[r].endPointGeometry,f))return r},IfxStpMap.prototype.getIntersectionPointsInFeature=function(n,t){for(var r=[],i=0;i<t.length;i++)IfxStpmapCommon.findIfIntersects(n,t[i].x,t[i].y)&&r.push(t[i]);return r},IfxStpMap.prototype.cutALink=function(n,t,i,r){var e=this.routeManager.RoutePart.routePathList[n.pathIndex].routeSegmentList[n.segmentIndex],o=IfxStpmapCommon.getDirectionOfRouteLink(e,n,t.feature,this),u=this.getIntersectionPointsInFeature(t.feature,i),f=IfxStpmapCommon.getNearestIntersectionPoints(t.feature,o,u,n.x1,n.y1),s=this.checkParallelSegmentsContinuity(n.pathIndex,n.segmentIndex,null,jQuery.extend(!0,[],u),f.near1.index,f.near2.index);if(s){this.setDivideRouteSegment(n.pathIndex,n.segmentIndex,f,t.feature,u,r);return}showNotification("Route segment cannot be cut.")},IfxStpMap.prototype.setDivideRouteSegment=function(n,t,i,r,u,f){var o,e,s;u==null||u==undefined?(o={linkId:r[i.near1.index].feature.attributes.LINK_ID,linkNo:i.near1.linkNo,pointGeom:{sdo_point:{X:r[i.near1.index].point.x,Y:r[i.near1.index].point.y}},lrs:IfxStpmapCommon.getLRSLength(r[i.near1.index].feature.geometry,new OpenLayers.Geometry.Point(r[i.near1.index].point.x,r[i.near1.index].point.y)),otherinfo:{pointfeature:r[i.near1.index].feature}},e={linkId:r[i.near2.index].feature.attributes.LINK_ID,linkNo:i.near2.linkNo,pointGeom:{sdo_point:{X:r[i.near2.index].point.x,Y:r[i.near2.index].point.y}},lrs:IfxStpmapCommon.getLRSLength(r[i.near2.index].feature.geometry,new OpenLayers.Geometry.Point(r[i.near2.index].point.x,r[i.near2.index].point.y)),otherinfo:{pointfeature:r[i.near2.index].feature}}):(o={linkId:r.attributes.LINK_ID,linkNo:f,pointGeom:{sdo_point:{X:u[i.near1.index].x,Y:u[i.near1.index].y}},lrs:i.near1.lrs,otherinfo:{pointfeature:r}},e={linkId:r.attributes.LINK_ID,linkNo:f,pointGeom:{sdo_point:{X:u[i.near2.index].x,Y:u[i.near2.index].y}},lrs:i.near2.lrs,otherinfo:{pointfeature:r}}),s=this.findSegmentHavingEndPoint(n,e.pointGeom.sdo_point.X,e.pointGeom.sdo_point.Y),this.divideRouteSegment(n,t,o,e,s)},IfxStpMap.prototype.checkIfWaypointIsBypassed=function(n,t,i){var u=this.routeManager.RoutePart.routePathList[n.pathIndex],r,f;if(u.routePointList.length<3||(r=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,u.routePointList[2].linkId),r==undefined||r.linkNo>i)||(r=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,u.routePointList[u.routePointList.length-1].linkId),r==undefined||r.linkNo<t))return!0;for(f=2;f<u.routePointList.length;f++)if(r=this.searchRouteLinkByLinkID(n.pathIndex,n.segmentIndex,u.routePointList[f].linkId),r.linkNo>t&&r.linkNo<i)return!1;return!0},IfxStpMap.prototype.cutRoute=function(n,t,i,r){var r,f,o,s,e,u,h,c;if(r==undefined&&(r=!0),f=this.getNearestPathAndSegment(n.xy.x,n.xy.y,r,t),o=this.routeManager.getRoutePath(f.pathIndex),IfxStpmapCommon.getSegmentTypeName(o.routeSegmentList[f.segmentIndex].segmentType)!="NORMAL"){this.deleteRouteSegment(f,o);return}if(s=i==undefined?this.getTerminalPoints(f.pathIndex,f.segmentIndex):[i],s.length>0){if(e=this.getIntersectionFeatures(f.pathIndex,f.segmentIndex,s),e.length>0&&(u=this.getNearestIntersectionLinks(f,e),IfxStpmapCommon.getSegmentTypeName(o.routeSegmentList[o.routeSegmentList.length-1].segmentType)=="OVERRIDE"&&(u.near1.index!=-2&&u.near2.index==-2?u.near2=this.getNextIntersectionLink(u.near1.linkNo,e,f):u.near1.index==-2&&u.near2.index!=-2&&(u.near1=this.getPreviousIntersectionLink(u.near2.linkNo,e,f))),u!=null&&u.near1.index!=-2&&u.near2.index!=-2)){if(u.near1.index!=u.near2.index){h=this.checkIfWaypointIsBypassed(f,u.near1.linkNo,u.near2.linkNo),h?(c=this.checkParallelSegmentsContinuity(f.pathIndex,f.segmentIndex,jQuery.extend(!0,[],e),null,u.near1.index,u.near2.index),c?this.setDivideRouteSegment(f.pathIndex,f.segmentIndex,u,e):showNotification("Route segment cannot be cut since it is not continuous.")):showNotification("Cannot bypass a waypoint.");return}this.cutALink(f,e[u.near1.index],s,u.near1.linkNo);return}this.routeManager.getRoutePathCount()>1?showNotification("Route segment cannot be removed since it is part of the main route of the clicked route path."):showNotification("Route segment cannot be removed since it is part of the main route.");return}this.routeManager.getRoutePathCount()>1?showNotification("Route segment cannot be cut since no alternate segments are found related to the clicked route path."):showNotification("Route segment cannot be cut since no alternate segments are found.");return},IfxStpMap.prototype.getRoutePart=function(n){return n==!0&&(this.returnLegRoute==null||this.returnLegRoute==undefined)?null:this.routeManager.getRoutePart(n,this.returnLegRoute)},IfxStpMap.prototype.setSegmentFeatureInternal=function(n,t,i,r){var u=this;this.searchFeaturesByLinkID([i.startLinkId,i.endLinkId],function(u){var e,f;u!=undefined&&(i.otherinfo={},i.otherinfo.startSegmentfeature=IfxStpmapCommon.getFeatureOfLinkId(u,i.startLinkId),i.otherinfo.endSegmentfeature=IfxStpmapCommon.getFeatureOfLinkId(u,i.endLinkId),i.otherinfo.features=t==null?[]:t,i.otherinfo.completefeatures=i.otherinfo.features,t!=null?IfxStpmapCommon.createFeatureForRouteSegment(i):i.otherinfo.startSegmentfeature&&i.otherinfo.endSegmentfeature&&i.otherinfo.startSegmentfeature!=i.otherinfo.endSegmentfeature?(f=IfxStpmapCommon.getPartialFeature(i.otherinfo.startSegmentfeature,i),e=IfxStpmapCommon.getPartialFeature(i.otherinfo.endSegmentfeature,i,1),i.otherinfo.features.push(f),i.otherinfo.features.push(e),i.otherinfo.completefeatures=i.otherinfo.features,IfxStpmapCommon.createFeatureForRouteSegment(i)):i.otherinfo.startSegmentfeature&&(f=IfxStpmapCommon.getPartialFeature(i.otherinfo.startSegmentfeature,i,"STARTPOINT"),IfxStpmapCommon.createPartialFeatureForRouteSegment(f,i.startPointDirection,i.endPointGeometry.sdo_point.X,i.endPointGeometry.sdo_point.Y,i)),n&&typeof n=="function"&&n(!0,r))})},IfxStpMap.prototype.setSegmentFeature=function(n,t,i){var u,r;if(n.otherinfo={completefeatures:[],features:[]},n.offRoadGeometry!=null){IfxStpmapCommon.createFeatureForRouteSegment(n),i&&typeof i=="function"&&i(!0,t);return}if(u=this,n.routeLinkList.length!=0&&(n.startLinkId==0&&(n.startLinkId=n.routeLinkList[0].linkId),n.endLinkId==0&&(n.endLinkId=n.routeLinkList[n.routeLinkList.length-1].linkId),n.routeLinkList.length>=1))if(IfxStpmapCommon.getSegmentTypeName(n.segmentType)=="NORMAL")n.routeLinkList[0].linkId==n.startLinkId&&n.routeLinkList.splice(0,1),n.routeLinkList.length!=0&&n.routeLinkList[n.routeLinkList.length-1].linkId==n.endLinkId&&n.routeLinkList.splice(n.routeLinkList.length-1,1);else for(r=0;r<n.routeLinkList.length;r++)n.routeLinkList[r].linkNo=r+1;this.searchFeaturesOfRouteLinkList(n.routeLinkList,function(r){r==null||r==undefined||r.length<=0?u.setSegmentFeatureInternal(i,null,n,t):u.setSegmentFeatureInternal(i,r,n,t)})},IfxStpMap.prototype.drawAnnotations=function(n,t){for(var e,f,r,i,o,u=0;u<n.routeSegmentList.length;u++)if(e=n.routeSegmentList[u],e.routeAnnotationsList!=null)for(r=0;r<e.routeAnnotationsList.length;r++)i=e.routeAnnotationsList[r],i.otherinfo={},o=this.setMarker("ANNOTATION",i.geometry.sdo_point.X,i.geometry.sdo_point.Y,t+" "+u+" "+r),i.otherinfo.marker=o,i.otherinfo.pathIndex=t,i.otherinfo.segmentIndex=u;for(f=0,r=0;r<n.routePointList.length;r++)f=n.routePointList[r],f.routeAnnotationList!=null&&f.routeAnnotationList.length!=0&&(i=f.routeAnnotationList[0],o=this.setMarker("FVPANNOTATION",i.geometry.sdo_point.X,i.geometry.sdo_point.Y,i.assocType))},IfxStpMap.prototype.drawAnnotationsForSegment=function(n,t,i){var f=n.routeSegmentList[i],u,r,e;if(f.routeAnnotationsList!=null)for(u=0;u<f.routeAnnotationsList.length;u++)r=f.routeAnnotationsList[u],r.otherinfo={},e=this.setMarker("ANNOTATION",r.geometry.sdo_point.X,r.geometry.sdo_point.Y,t+" "+i+" "+u),r.otherinfo.marker=e,r.otherinfo.pathIndex=t,r.otherinfo.segmentIndex=i},IfxStpMap.prototype.setPathFeature=function(n,t){for(var r=0,u=[],f=this,i=0;i<n.routeSegmentList.length;i++)this.setSegmentFeature(n.routeSegmentList[i],i,function(i,e){i==!1&&u.push(e),r++,r==n.routeSegmentList.length&&f.setRoutePathWaypointFeatures(n,function(i){if(i==!0)for(var r=u.length-1;r>=0;r--)n.routeSegmentList.splice(r,1);t(i)})});n.routeSegmentList.length<=0&&t(null)},IfxStpMap.prototype.setRoutePointDetails=function(n,t){for(var u=this,f=[],r,o,e,s,i=0;i<n.routePointList.length;i++)n.routePointList[i].otherinfo==undefined&&(n.routePointList[i].otherinfo={completefeatures:[],features:[]}),r=IfxStpmapCommon.getFeatureOfLinkIdFromPathDetails(n,n.routePointList[i].linkId),o=LRSMeasure(r.geometry,new OpenLayers.Geometry.Point(n.routePointList[i].pointGeom.sdo_point.X,n.routePointList[i].pointGeom.sdo_point.Y),{tolerance:.5,details:!0}),r!=null?(r.attributes.DIR_TRAVEL=="B"?o.measure<=.5?(n.routePointList[i].otherinfo.beginNodeId=r.attributes.REF_IN_ID,n.routePointList[i].otherinfo.endNodeId=r.attributes.NREF_IN_ID):(n.routePointList[i].otherinfo.beginNodeId=r.attributes.NREF_IN_ID,n.routePointList[i].otherinfo.endNodeId=r.attributes.REF_IN_ID):n.routePointList[i].pointType==0&&r.attributes.DIR_TRAVEL=="F"||n.routePointList[i].pointType==1&&r.attributes.DIR_TRAVEL=="T"?(n.routePointList[i].otherinfo.beginNodeId=r.attributes.NREF_IN_ID,n.routePointList[i].otherinfo.endNodeId=r.attributes.REF_IN_ID):(n.routePointList[i].otherinfo.beginNodeId=r.attributes.REF_IN_ID,n.routePointList[i].otherinfo.endNodeId=r.attributes.NREF_IN_ID),n.routePointList[i].otherinfo.linkId=r.attributes.LINK_ID,n.routePointList[i].otherinfo.pointfeature=r,n.routePointList[i].otherinfo.isFullAddress=!0):t!="planned"&&(this.olMap.setCenter([n.routePointList[i].pointGeom.sdo_point.X,n.routePointList[i].pointGeom.sdo_point.Y],10),e=this.olMap.getPixelFromLonLat(new OpenLayers.LonLat(n.routePointList[i].pointGeom.sdo_point.X,n.routePointList[i].pointGeom.sdo_point.Y)),s=n.routePointList[i].pointType,f.push(i),this.setRoutePointAtXY({pointType:IfxStpmapCommon.getPointTypeName(s),pointPos:-1,X:e.x,Y:e.y,searchInBbox:!1,Zoomin:!1},function(n){u.olMap.zoomToExtent(u.vectorLayerMarkers.getDataExtent()),u.pageType!="DISPLAYONLY"&&u.eventList.ROUTEPOINTADDED!=undefined&&typeof u.eventList.ROUTEPOINTADDED=="function"&&u.eventList.ROUTEPOINTADDED(n)}));if(f.length>0)for(i=f.length-1;i>=0;i--)this.deleteRoutePoint(f[i],this.currentActiveRoutePathIndex)},IfxStpMap.prototype.setRoutePathWaypointFeatures=function(n,t){for(var r=[],i=2;i<n.routePointList.length;i++)r.push(n.routePointList[i].linkId);r.length>0?this.searchFeaturesByLinkID(r,function(i){for(var r=2;r<n.routePointList.length;r++)n.routePointList[r].otherinfo==undefined&&(n.routePointList[r].otherinfo={}),n.routePointList[r].otherinfo.pointfeature=IfxStpmapCommon.getFeatureOfLinkId(i,n.routePointList[r].linkId);t(!0)}):t(!1)},IfxStpMap.prototype.setRoutePart=function(n){var u,i,r;if(n.routePathList[0].routeSegmentList!=null&&n.routePathList[0].routeSegmentList.length>0&&n.routePathList[0].routeSegmentList[0].routeAnnotationsList!=null&&n.routePathList[0].routeSegmentList[0].routeAnnotationsList.length>0)for(r=0;r<n.routePathList[0].routeSegmentList[0].routeAnnotationsList.length;r++)n.routePathList[0].routeSegmentList[0].routeAnnotationsList[r].annotType==250004&&n.routePathList[0].routeSegmentList[0].routeAnnotationsList.splice(r,1);for(this.routeManager.setRoutePart(n),u=0,i=this,r=0;r<n.routePathList.length;r++)this.setPathFeature(n.routePathList[r],function(){if(u++,u==n.routePathList.length){for(var r=0;r<n.routePathList.length;r++)i.setRoutePointDetails(n.routePathList[r],n.routePartDetails.routeType),i.routeManager.setPathNo(r,r),n.routePathList[r].routeSegmentList[0]!=null&&n.routePathList[r].routeSegmentList[0]!=undefined&&(IfxStpmapCommon.createFeatureForWaypoints(n.routePathList[r],n.routePathList[r].routeSegmentList[0],i),i.routeManager.setRoutePathState(r,"routedisplayed"),i.drawAnnotations(n.routePathList[r],r));i.drawRoute(-1,!0),i.vectorLayerRoute.features.length!=0&&editRouteModeFlag!=1?i.olMap.zoomToExtent(i.vectorLayerRoute.getDataExtent()):editRouteModeFlag==1?editRouteModeFlag=0:i.olMap.zoomToExtent(i.vectorLayerMarkers.getDataExtent()),$("#PortalType").val()=="696009"&&window.location.href.indexOf("/RegisterExemptionRoute")>-1&&$("#BrokenFlag").val()==1&&(document.getElementById("Affected").checked=!1,document.getElementById("Affected").disabled=!0,document.getElementById("Constraints").checked=!1),i.currentActiveRoutePathIndex=0,i.eventList.ROUTELOADED!=undefined&&typeof i.eventList.ROUTELOADED=="function"&&i.eventList.ROUTELOADED(null)}})},IfxStpMap.prototype.drawSketchedRoute=function(n){var t,i=[],r,u,f,e,o;for(this.routeManager.setRoutePart(n,null),t=0;t<this.routeManager.getRoutePathCount();t++)r=this.routeManager.getRoutePath(t),this.currentActiveRoutePathIndex=t,this.drawMarkers(r);if(this.olMap.zoomToExtent(this.vectorLayerMarkers.getDataExtent()),u=this.routeManager.RoutePart.routePartDetails.partGeometry,u!=null){for(f=this.routeManager.RoutePart.routePartDetails.partGeometry.OrdinatesArray,t=0;t<f.length/2;t+=2)e=new OpenLayers.Geometry.Point(n.routePartDetails.partGeometry.OrdinatesArray[t],n.routePartDetails.partGeometry.OrdinatesArray[t+1]),i.push(e);o=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(i)),this.vectorLayerRoute.addFeatures(o),this.olMap.zoomToExtent(this.vectorLayerRoute.getDataExtent())}},IfxStpMap.prototype.initialiseReturnRoutePart=function(){var t,n;for(this.tempRoutePart=jQuery.extend(!0,{},this.routeManager),this.routeManager.clearRoutePart(!0),t=this.tempRoutePart.RoutePart.routePathList[0].routePointList,n=0;n<t.length;n++)t[n].pointType==0?this.setRoutePoint({pointType:"ENDPOINT",pointPos:-1,X:t[n].pointGeom.sdo_point.X,Y:t[n].pointGeom.sdo_point.Y,locationDesc:t[n].pointDescr,setMarker:!1,bLonLat:null,features:[t[n].otherinfo.pointfeature]},null):t[n].pointType==1&&this.setRoutePoint({pointType:"STARTPOINT",pointPos:-1,X:t[n].pointGeom.sdo_point.X,Y:t[n].pointGeom.sdo_point.Y,locationDesc:t[n].pointDescr,setMarker:!1,bLonLat:null,features:[t[n].otherinfo.pointfeature]},null)},IfxStpMap.prototype.setReturnRoutePart=function(){this.returnLegRoute=jQuery.extend(!0,{},this.routeManager),this.routeManager=jQuery.extend(!0,{},this.tempRoutePart)},IfxStpMap.prototype.removeReturnLeg=function(){if(this.returnLegRoute!=null){var n=this.returnLegRoute.RoutePart.routePathList[0];this.clearAllRouteSegmentsInPath(n),this.returnLegRoute=null}},IfxStpMap.prototype.getCurrentBoundsAndZoom=function(){return{bounds:this.olMap.getExtent(),zoom:this.olMap.getZoom()}},IfxStpMap.prototype.setBounds=function(n){this.bounds=n},IfxStpMap.prototype.getBounds=function(){return this.bounds},IfxStpMap.prototype.getRouteId=function(){return this.routeManager.getRouteId()},IfxStpMap.prototype.flashRoutePath=function(n,t){var r=this.routeManager.getRoutePath(n),i;if(t%2==0)for(i=0;i<r.routeSegmentList.length;i++)this.vectorLayerRoute.removeFeatures(r.routeSegmentList[i].otherinfo.completefeatures);else for(i=0;i<r.routeSegmentList.length;i++)this.vectorLayerRoute.addFeatures(r.routeSegmentList[i].otherinfo.completefeatures)},IfxStpMap.prototype.flashSelectedLink=function(n,t){t%2==0?this.vectorLayerRoute.removeFeatures(n):this.vectorLayerRoute.addFeatures(n)},IfxStpMap.prototype.deleteRouteSegment=function(n,t){var i=0,r;IfxStpmapCommon.getSegmentTypeName(t.routeSegmentList[n.segmentIndex].segmentType)=="OFFROAD"&&(i=IfxStpmapCommon.checkOffRoadExtend(t,n.segmentIndex)),r=IfxStpmapCommon.checkRouteContinuity(t,n.segmentIndex),r?(this.removeRouteSegment(n.pathIndex,n.segmentIndex),i==1?this.shortenRoute("STARTPOINT"):i==2&&this.shortenRoute("ENDPOINT")):showNotification("Route segment cannot be removed since it is part of the main route or it is connected to other segments.")},IfxStpMap.prototype.updateDirectionOfRouteLinks=function(n,t){for(var r=this.routeManager.RoutePart.routePathList[n].routeSegmentList[t],u,i=0;i<r.routeLinkList.length;i++)u=IfxStpmapCommon.getDirectionOfRouteLink(r,{pathIndex:n,segmentIndex:t},null,this,r.routeLinkList[i]),r.routeLinkList[i].direction=u},IfxStpMap.prototype.getControlByIndex=function(n){for(var t=0;t<this.olMap.controls.length;t++)if(this.olMap.controls[t].displayClass==n)return t;return-1},IfxStpMap.prototype.setRoutePointDescription=function(n,t,i,r){n=this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex)==1?0:n;var u=this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex].routePointList[n];u.pointDescr=t;try{u.city=r.City,u.street=r.Street,u.houseNumber=r.HouseNumber}catch(f){}u.otherinfo.isFullAddress=!0},IfxStpMap.prototype.isRoutePointAddressValid=function(n,t){var i=this.routeManager.RoutePart.routePathList[n].routePointList[t];return i.otherinfo.isFullAddress},IfxStpMap.prototype.validateRoutePoints=function(){for(var r="",n,t,u,i=0;i<this.routeManager.RoutePart.routePathList.length;i++){for(n="",t=0;t<this.routeManager.RoutePart.routePathList[i].routePointList.length;t++)this.routeManager.RoutePart.routePathList[i].routePointList[t].pointType!=2&&(u=this.isRoutePointAddressValid(i,t),u||(n==""?this.routeManager.RoutePart.routePathList.length>1&&(n="Path"+(i+1)+" - "):n+=", ",n+=t==0?"Start point":t==1?"End point":"Viapoint"+(t-1)));r!=""&&(r+=", "),r+=n}return r},IfxStpMap.prototype.updateFullAddress=function(n,t,i){var r=this.routeManager.RoutePart.routePathList[n].routePointList[t];r.otherinfo.isFullAddress=!0,r.pointDescr=i},IfxStpMap.prototype.updateNodeInfo=function(n,t,i,r){var o=this.routeManager.getRoutePointCount(this.currentActiveRoutePathIndex),e,u,f;if(o!=0){u=this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex];switch(n){case 0:o>2?e=u.routePointList[2]:o>1?e=u.routePointList[1]:o==1&&(e=u.routePointList[0]),this.changeNodeDetails(i,e,r);break;case 1:o>2?e=u.routePointList[u.routePointList.length-1]:o>=1&&(e=u.routePointList[0]),this.changeNodeDetails(i,e,r);break;case 2:case 3:t==1?(e=u.routePointList[0],f=o==2?u.routePointList[1]:u.routePointList[t+1]):(e=u.routePointList[t],o==3?f=u.routePointList[1]:o>3&&(f=u.routePointList[t+1]),f==null&&(f=u.routePointList[1])),e.otherinfo.beginNodeId==i.otherinfo.beginNodeId&&this.changeNodeDetails(i,e,r),(f.linkId==i.linkId||f.otherinfo.pointfeature.attributes.REF_IN_ID==i.otherinfo.pointfeature.attributes.NREF_IN_ID||f.otherinfo.pointfeature.attributes.NREF_IN_ID==i.otherinfo.pointfeature.attributes.REF_IN_ID)&&(f.otherinfo.dir_travel=="F"&&i.otherinfo.dir_travel=="F"||f.otherinfo.dir_travel=="T"&&i.otherinfo.dir_travel=="T")&&this.swapNodeDetails(f)}}},IfxStpMap.prototype.changeNodeDetails=function(n,t){t.linkId==n.linkId?(this.swapNodeDetails(n),this.swapNodeDetails(t)):(t.otherinfo.pointfeature.attributes.REF_IN_ID==n.otherinfo.pointfeature.attributes.NREF_IN_ID||t.otherinfo.pointfeature.attributes.NREF_IN_ID==n.otherinfo.pointfeature.attributes.REF_IN_ID)&&(t.otherinfo.dir_travel=="F"&&n.otherinfo.dir_travel=="F"||t.otherinfo.dir_travel=="T"&&n.otherinfo.dir_travel=="T")&&(this.swapNodeDetails(n),this.swapNodeDetails(t))},IfxStpMap.prototype.swapNodeDetails=function(n){var t=n.otherinfo.beginNodeId;n.otherinfo.beginNodeId=n.otherinfo.endNodeId,n.otherinfo.endNodeId=t},IfxStpMap.prototype.doProcessPlanRouteRequest=function(n,t,i){this.routeManager.doProcessPlanRouteRequest(n,t,i)},IfxStpMap.prototype.clearRouteForReplan=function(){if(this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex].routePointList.length!=0){this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex].routePointList[1].routePointNo==2&&this.routeManager.setRoutePathState(this.currentActiveRoutePathIndex,"secondpointselected");for(var n=this.routeManager.RoutePart.routePathList.length-1;n>0;n--)this.removeRoutePath(n);this.clearRestrictedLinks(),this.clearAllRouteSegmentsInPath(this.routeManager.RoutePart.routePathList[0]),this.routeManager.RoutePart.routePathList[0].routeSegmentList=[]}},IfxStpMap.prototype.getITSShowDetailPortal=function(n,t,i){t!=null&&t!=0&&t!=undefined&&$.ajax({type:"POST",datatype:"json",url:"/Exemption/getITSShowDetailsPortal",contentType:"application/json; charset=utf-8",data:JSON.stringify({projectType:n,linkId:t}),success:function(n){n!=""?i(n):i(null)},error:function(){i(null)}})},IfxStpMap.prototype.getVehicleDetails=function(n,t){if(objifxStpMap.getProject()!="NWK")n!=null&&n!=0&&n!=undefined&&$.ajax({type:"POST",datatype:"json",url:"/Routes/GetVehicleDetails",contentType:"application/json; charset=utf-8",data:JSON.stringify({routeId:n!=null&&n!=undefined?n:0}),success:function(n){n!=""?t&&typeof t=="function"&&t(n.vehicleDetails):t&&typeof t=="function"&&t(null)},error:function(){t&&typeof t=="function"&&t(null)}});else if(this.eventList.VEHICLEDETAILS!=undefined&&typeof this.eventList.VEHICLEDETAILS=="function"){var i=this.eventList.VEHICLEDETAILS();t(i)}},IfxStpMap.prototype.clearRestrictedLinks=function(){for(var n=this.vectorLayerRoute.features.length-1;n>=0;n--)this.vectorLayerRoute.features[n].data=="UNUSABLE"&&this.vectorLayerRoute.removeFeatures(this.vectorLayerRoute.features[n])},IfxStpMap.prototype.setRtStartAddress=function(n){this.routeManager.RoutePart.routePathList[0].routePointList[0].city=n.city,this.routeManager.RoutePart.routePathList[0].routePointList[0].street=n.street},IfxStpMap.prototype.GetBoundingBoxGeom=function(){var n=this.getCurrentBoundsAndZoom();return{OrdinatesArray:[n.bounds.left,n.bounds.top,n.bounds.right,n.bounds.top,n.bounds.right,n.bounds.bottom,n.bounds.left,n.bounds.bottom,n.bounds.left,n.bounds.top],ElemArray:[1,1003,1],sdo_gtype:IfxNwkMapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxNwkMapCommon.getSdo_srid()}},IfxStpMap.prototype.setGeoRegion=function(n){var t=new OpenLayers.Bounds;t.extend(new OpenLayers.LonLat(n.x1,n.y1)),t.extend(new OpenLayers.LonLat(n.x2,n.y2)),this.olMap.zoomToExtent(t,!1)},IfxStpMap.prototype.getFVPCount=function(){for(var t=0,i,n=2;n<this.routeManager.RoutePart.routePathList[this.currentActiveRoutePathIndex].routePointList.length;n++)i=this.routeManager.getRoutePoint(this.currentActiveRoutePathIndex,n),i.pointType==7&&t++;return t},IfxStpMap.prototype.sortRoutePointsByType=function(n){for(var t=this.routeManager.RoutePart.routePathList[n],i,e,u,r,f=0;f<t.routePointList.length;f++)for(i=0;i<t.routePointList.length-f-1;i++)t.routePointList[i].pointType>t.routePointList[i+1].pointType&&(e=jQuery.extend(!0,{},t.routePointList[i]),t.routePointList[i]=jQuery.extend(!0,{},t.routePointList[i+1]),t.routePointList[i+1]=e);if(u=[],u.push(0,1,2),t.routePointList.length>2){for(currentElem=t.routePointList[2].pointType,r=3;r<t.routePointList.length;r++)t.routePointList[r].pointType!=currentElem&&(u.push(r),currentElem=t.routePointList[r].pointType);u.push(t.routePointList.length)}return u},IfxStpMap.prototype.sortRoutePointsByNumber=function(n,t){for(var u=this.routeManager.RoutePart.routePathList[n],f,i,e,r=2;r<t.length-1;r++)for(f=t[r];f<t[r+1];f++)for(i=t[r];i<t[r+1]-1;i++)u.routePointList[i].routePointNo>u.routePointList[i+1].routePointNo&&(e=jQuery.extend(!0,{},u.routePointList[i]),u.routePointList[i]=jQuery.extend(!0,{},u.routePointList[i+1]),u.routePointList[i+1]=e)},IfxStpMap.prototype.HighlightLink=function(n){objifxStpMap.deleteMapLayer("HighlightLink");var t="link_id:"+n,i=new OpenLayers.Layer.WMS("HighlightLink",objifxStpMap.configGeoserverUrl,{layers:"NWKMAP:HighlightLink",format:objifxStpMap.imageFormat,transparent:"true",viewparams:t,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(i)},IfxStpMap.prototype.showHistoricRouteMap=function(n){objifxStpMap.deleteMapLayer("HistoricRoute");var t="route_id:"+n,i=new OpenLayers.Layer.WMS("HistoricRoute",objifxStpMap.geoserverUrl,{layers:objifxStpMap.historicrouteLayer,format:objifxStpMap.imageFormat,transparent:"true",viewparams:t,tiled:!1,tilesorigin:[objifxStpMap.olMap.maxExtent.left,objifxStpMap.olMap.maxExtent.bottom],data:Math.random()});objifxStpMap.olMap.addLayer(i)},IfxStpMap.prototype.configGeoserverUrl="/geoserver/NWKMAP/wms",IfxStpMap.prototype.configGeoserverGwcUrl="/geoserver/gwc/service/wms",IfxStpMap.prototype.configGeoserverWfsUrl="/geoserver/NWKMAP/wfs",IfxStpMap.prototype.configGeoserverMU_Url="/geoserver/NWKMAPUPGRADE/wms",IfxStpMap.prototype.configGeoserverGwcMU_Url="/geoserver/gwc/service/wms",IfxStpMap.prototype.configGeoserverWfsMU_Url="/geoserver/NWKMAPUPGRADE/wfs",IfxStpmapStructures.prototype.showStructures=function(n,t,i,r){var f,u,e;if(n.length!=0){if((r==undefined||r==null)&&(r=objifxStpMap.olMap.getZoom()),f=[],this.clearStructureClassList(),this.clearAllStructures(),this.clearStructures(t),objifxStpMap.pageType!="STRUCTURES"||!(r<5))for(u=0;u<n.length;u++){if(f[u]=[],f[u][0]=this.setMarkerStructure(n[u].structureID,n[u].structureName,n[u].structureCode,n[u].structureClass,"point",n[u].pointGeometry.OrdinatesArray?n[u].pointGeometry.OrdinatesArray[0]:n[u].easting,n[u].pointGeometry.OrdinatesArray?n[u].pointGeometry.OrdinatesArray[1]:n[u].northing,null,n[u].suitability,n[u].sHeight,n[u].sWidth,n[u].sLength,n[u].sWeight,n[u].sPhyWeight,n[u].organisationName,t,r,n[u].sectionNO,n[u].redTimeExtension,n[u].linkId),f[u][1]=this.drawStructuresLine(n[u],r,t),objifxStpMap.vectorLayerStructures.addFeatures(f[u][0]),objifxStpMap.vectorLayerStructures.addFeatures(f[u][1]),f[u][0].data.displayClass=="point")for(e=0;e<f[u][1].length;e++)f[u][1][e].style.display="none";else f[u][0].style.display="none";if(checkboxValue(n[u].structureClass,i,t)==!1)for(f[u][0].style.display="none",e=0;e<f[u][1].length;e++)f[u][1][e].style.display="none";this.setFilterList(n[u].structureClass,u)}return objifxStpMap.vectorLayerStructures.redraw(),this.clearAllMarkers(t),t==!1||t==0?this.markerStructure=f:t==!0||t==1?this.markerStructureOther=f:this.markerStructureUnusitable=f,this.addVectorLayers("Structures"),this.structureClassList}},IfxStpmapStructures.prototype.drawStructuresLine=function(n,t,i){for(var e=[],o,u,s=0,f,r=0;r*3<n.lineGeometry.ElemArray.length;r++){for(o=n.lineGeometry.ElemArray[r*3]-1,u=r*3+3<n.lineGeometry.ElemArray.length?n.lineGeometry.ElemArray[r*3+3]-1:n.lineGeometry.OrdinatesArray.length,f=[],j=o;j<u;j+=2)f.push(new OpenLayers.Geometry.Point(n.lineGeometry.OrdinatesArray[j],n.lineGeometry.OrdinatesArray[j+1]));e[s]=this.setMarkerStructure(n.structureID,n.structureName,n.structureCode,n.structureClass,"line",0,0,f,n.suitability,n.sHeight,n.sWidth,n.sLength,n.sWeight,n.organisationName,i,t,n.sectionNO,n.redTimeExtension,n.linkId),s++}return e},IfxStpmapStructures.prototype.clearStructures=function(n){var t,i;if(n==0||n==!1||n==undefined)for(t=0;t<this.markerStructure.length;t++)if(this.markerStructure[t].length>0)for(i=0;i<this.markerStructure[t].length;i++)objifxStpMap.vectorLayerStructures.removeFeatures(this.markerStructure[t][i]);else objifxStpMap.vectorLayerStructures.removeFeatures(this.markerStructure[t]);if(n==1||n==!0||n==undefined)for(t=0;t<this.markerStructureOther.length;t++)if(this.markerStructureOther[t].length>0)for(i=0;i<this.markerStructureOther[t].length;i++)objifxStpMap.vectorLayerStructures.removeFeatures(this.markerStructureOther[t][i]);else objifxStpMap.vectorLayerStructures.removeFeatures(this.markerStructureOther[t]);if(n==2||n==undefined)for(t=0;t<this.markerStructureUnusitable.length;t++)if(this.markerStructureUnusitable[t].length>0)for(i=0;i<this.markerStructureUnusitable[t].length;i++)objifxStpMap.vectorLayerStructures.removeFeatures(this.markerStructureUnusitable[t][i]);else objifxStpMap.vectorLayerStructures.removeFeatures(this.markerStructureUnusitable[t])},IfxStpmapStructures.prototype.clearAllStructures=function(){objifxStpMap.vectorLayerStructures.removeFeatures(objifxStpMap.vectorLayerStructures.features),this.markerStructure=[],this.markerStructureOther=[],this.markerStructureUnusitable=[]},IfxStpmapStructures.prototype.filterStructures=function(n,t,i,r){var f,o,e,u;if(n!=undefined){if(f=i==!1||i==0?this.markerStructure:i==!0||i==1?this.markerStructureOther:this.markerStructureUnusitable,o=t==!0?"":"none",r>=this.defaultLineStructZoom){for(u=0;u<n.length;u++)if(f[n[u]])for(e=0;e<f[n[u]][1].length;e++)f[n[u]][1][e].style.strokeWidth=r-5,f[n[u]][1][e].style.display=o}else for(u=0;u<n.length;u++)f[n[u]]&&(f[n[u]][0].style.display=o);objifxStpMap.vectorLayerStructures.redraw()}},IfxStpmapStructures.prototype.showOrHideAffectedStructures=function(n){for(var r,i=n==!0?"":"none",t=0;t<this.markerStructure.length;t++)for(this.markerStructure[t][0].style.display=i,r=0;r<this.markerStructure[t][1].length;r++)this.markerStructure[t][1][r].style.display=i;objifxStpMap.vectorLayerStructures.redraw()},IfxStpmapStructures.prototype.clearStructureClassList=function(){this.structureClassList={underBridge:[],overBridge:[],levelCrossing:[],roundAbout:[],tunnel:[],special:[]}},IfxStpmapStructures.prototype.setMarkerStructure=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d){var rt=this,g=IfxStpmapCommon.getFinalSuitability(s),tt="STRUCTURE "+n+" NAME "+t+" CODE "+i+" SUITABILITY "+g+" HEIGHT "+h+" WIDTH "+c+" LENGTH "+l+" WEIGHT "+a+" PHYSICAL_WEIGHT "+v+" ORGNAME "+y+" OTHERORG "+p+" CROSSINGNUMBER "+b+" REDTIMEEXT "+k+" TYPE "+r+" LINKID "+d,nt,it;if(u=="point")var ut=IfxStpmapCommon.getStructureImage(r,g),nt={externalGraphic:ut,graphicHeight:25,graphicWidth:25,title:t},it=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(f,e),{name:tt,displayClass:rt.getPreviousDisplayClass(n)},nt);else nt={strokeColor:IfxStpmapCommon.getSuitabilityColor(g,0),strokeWidth:w-5,title:t},it=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(o),{name:tt},nt);return it},IfxStpmapStructures.prototype.setFilterList=function(n,t){switch(n.toLowerCase()){case"underbridge":this.structureClassList.underBridge.push(t);break;case"overbridge":this.structureClassList.overBridge.push(t);break;case"level crossing":this.structureClassList.levelCrossing.push(t);break;case"roundabout":this.structureClassList.roundAbout.push(t);break;case"tunnel":this.structureClassList.tunnel.push(t);break;default:this.structureClassList.special.push(t)}},IfxStpmapStructures.prototype.showConstraints=function(n,t){for(var r=[],i=0,u=0;i<n.length;i++)n[i].constDesc=n[i].constDesc.replace(/\r\n/g,"").replace(/[\r\n]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),r[u]=this.addConstraint(n[i].constId,n[i].consName,n[i].constCode,n[i].constType,n[i].topologyType,n[i].constSuitability,n[i].constDesc,n[i].constGeom.OrdinatesArray,t,n[i].constGeom,n[i].organisationId,n[i].StartDate,n[i].EndDate,n[i].constraintValue.maxWidth),r[u]==undefined||r[u]==null?r.length--:u++;t==!1?this.markerConstraint=r:this.markerConstraintOther=r,objifxStpMap.vectorLayerConstraints.redraw(),this.addVectorLayers("Constraints")},IfxStpmapStructures.prototype.showRoadWorksConstraints=function(n,t,i){var u=[],o,r,f,e;this.featuresConstraints=[];try{if(clearManuallyAddedConstraint(),clearNDWConstraint(),clearConstraints(),o=n.length,document.getElementById("NDW").checked==!0&&document.getElementById("ManuallyAdded").checked==!0){for(r=0,f=0;r<o;r++)n[r].constDesc=n[r].constDesc.replace(/\r\n/g,"").replace(/[\r\n]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),i>9?n[r].constGeom!=null&&(n[r].topologyType=="point"?(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth)):u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++):n[r].fromEasting!=null&&n[r].fromNorthing!=null&&n[r].fromEasting!=0&&n[r].fromNorthing!=0?(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,"point",n[r].constSuitability,n[r].constDesc,e,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++):(e=[],e.push(n[r].constGeom.OrdinatesArray[0]),e.push(n[r].constGeom.OrdinatesArray[1]),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,"point",n[r].constSuitability,n[r].constDesc,e,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++);t==!1?this.markerConstraint=u:this.markerConstraintOther=u,i>9?(objifxStpMap.vectorLayerConstraints.redraw(),objifxStpMap.vectorLayerConstraints.addFeatures(u)):(objifxStpMap.vectorLayerConstraintsCluster.redraw(),objifxStpMap.vectorLayerConstraintsCluster.addFeatures(this.featuresConstraints)),this.addVectorLayers("Constraints")}}catch(s){}},IfxStpmapStructures.prototype.showPortalRoadWorksConstraints=function(n,t,i){var u,o,r,f,e;(i==undefined||i==null)&&(i=objifxStpMap.olMap.getZoom()),u=[],this.featuresConstraints=[];try{for(this.clearManuallyAddedConstraint(),this.clearNDWConstraint(),objifxStpMap.vectorLayerConstraints.removeFeatures(objifxStpMap.vectorLayerConstraints.features),objifxStpMap.vectorLayerConstraintsCluster.removeFeatures(objifxStpMap.vectorLayerConstraintsCluster.features),o=n.length,r=0,f=0;r<o;r++)n[r].constDesc=n[r].constDesc.replace(/\r\n/g,"").replace(/[\r\n]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),i>9?n[r].constGeom!=null&&(u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++):n[r].fromEasting!=null&&n[r].fromNorthing!=null&&n[r].fromEasting!=0&&n[r].fromNorthing!=0?(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,"point",n[r].constSuitability,n[r].constDesc,e,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++):(e=[],e.push(n[r].constGeom.OrdinatesArray[0]),e.push(n[r].constGeom.OrdinatesArray[1]),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,"point",n[r].constSuitability,n[r].constDesc,e,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++);t==!1?this.markerConstraint=u:this.markerConstraintOther=u,i>9?(objifxStpMap.vectorLayerConstraints.redraw(),objifxStpMap.vectorLayerConstraints.addFeatures(u)):(objifxStpMap.vectorLayerConstraintsCluster.redraw(),objifxStpMap.vectorLayerConstraintsCluster.addFeatures(this.featuresConstraints)),this.addVectorLayers("Constraints")}catch(s){}},IfxStpmapStructures.prototype.showNDWRoadWorks=function(n,t,i){var u,o,r,f,e;try{if(document.getElementById("NDW").checked==!0){for(u=[],this.featuresConstraints=[],clearNDWConstraint(),o=n.length,r=0,f=0;r<o;r++)n[r].constDesc=n[r].constDesc.replace(/\r\n/g,"").replace(/[\r\n]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),i>9?n[r].constGeom!=null&&n[r].organisationId==3020&&(n[r].topologyType=="point"?(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth)):u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++):n[r].fromEasting!=null&&n[r].fromNorthing!=null&&n[r].organisationId==3020&&(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,"point",n[r].constSuitability,n[r].constDesc,e,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++);t==!1?this.markerConstraint=u:this.markerConstraintOther=u,i>9?(objifxStpMap.vectorLayerConstraints.redraw(),objifxStpMap.vectorLayerConstraints.addFeatures(u)):(objifxStpMap.vectorLayerConstraintsCluster.redraw(),objifxStpMap.vectorLayerConstraintsCluster.addFeatures(this.featuresConstraints)),this.addVectorLayers("Constraints")}}catch(s){}},IfxStpmapStructures.prototype.showManuallyAddedRoadWorks=function(n,t,i){var u,o,r,f,e;try{if(document.getElementById("ManuallyAdded").checked==!0){for(u=[],this.featuresConstraints=[],clearManuallyAddedConstraint(),o=n.length,r=0,f=0;r<o;r++)n[r].constDesc=n[r].constDesc.replace(/\r\n/g,"").replace(/[\r\n]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),i>9?n[r].constGeom!=null&&n[r].organisationId!=3020&&(n[r].topologyType=="point"?(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth)):u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,n[r].topologyType,n[r].constSuitability,n[r].constDesc,n[r].constGeom.OrdinatesArray,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++):n[r].fromEasting!=null&&n[r].fromNorthing!=null&&n[r].organisationId!=3020&&(e=[],e.push(n[r].fromEasting),e.push(n[r].fromNorthing),u[f]=this.addConstraint(n[r].constId,n[r].consName,n[r].constCode,n[r].constType,"point",n[r].constSuitability,n[r].constDesc,e,t,n[r].constGeom,n[r].organisationId,n[r].StartDate,n[r].EndDate,n[r].constraintValue.maxWidth),u[f]==undefined||u[f]==null?u.length--:f++);t==!1?this.markerConstraint=u:this.markerConstraintOther=u,i>9?(objifxStpMap.vectorLayerConstraints.redraw(),objifxStpMap.vectorLayerConstraints.addFeatures(u)):(objifxStpMap.vectorLayerConstraintsCluster.redraw(),objifxStpMap.vectorLayerConstraintsCluster.addFeatures(this.featuresConstraints)),this.addVectorLayers("Constraints")}}catch(s){}},IfxStpmapStructures.prototype.showNWKConstraints=function(n,t){for(var r=[],f=n.length,i=0,u=0;i<f;i++)n[i].constDesc=n[i].constDesc.replace(/\r\n/g,"").replace(/[\r\n]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),n[i].constGeom!=null&&n[i].topologyType=="area"&&(r[u]=this.addConstraint(n[i].constId,n[i].consName,n[i].constCode,n[i].constType,n[i].topologyType,n[i].constSuitability,n[i].constDesc,n[i].constGeom.OrdinatesArray,t,n[i].constGeom,n[i].organisationId,n[i].constraintValue.maxWidth),r[u]==undefined||r[u]==null?r.length--:u++);t==!1?this.markerConstraint=r:this.markerConstraintOther=r,objifxStpMap.vectorLayerConstraints.redraw(),this.addVectorLayers("Constraints")},IfxStpmapStructures.prototype.clearManuallyAddedConstraint=function(){for(var i=this.markerConstraint.length,t,n=0;n<i;n++)this.markerConstraint[n][0]==null&&(t=this.markerConstraint[n].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n]))),this.markerConstraint[n][0]!=null&&this.markerConstraint[n][0][0]==null&&(t=this.markerConstraint[n][0].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n]))),this.markerConstraint[n][0]!=null&&this.markerConstraint[n][0][0]!=null&&(t=this.markerConstraint[n][0][0].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n])));for(i=this.markerConstraintOther.length,n=0;n<i;n++)this.markerConstraintOther[n][0]==null&&(t=this.markerConstraintOther[n].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraintOther[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n]))),this.markerConstraintOther[n][0]!=null&&this.markerConstraintOther[n][0][0]==null&&(t=this.markerConstraintOther[n][0].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraintOther[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n]))),this.markerConstraintOther[n][0]!=null&&this.markerConstraintOther[n][0][0]!=null&&(t=this.markerConstraintOther[n][0][0].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraintOther[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n]))),this.markerConstraintOther[n][0]!=null&&this.markerConstraintOther[n][0][0]==null&&(t=this.markerConstraintOther[n][0].data.name,t.indexOf("ORGANISATIONID 3020")==-1&&(this.markerConstraintOther[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n])));objifxStpMap.vectorLayerConstraints.removeFeatures(objifxStpMap.vectorLayerConstraints.features),objifxStpMap.vectorLayerConstraintsCluster.removeFeatures(objifxStpMap.vectorLayerConstraintsCluster.features)},IfxStpmapStructures.prototype.clearNDWConstraint=function(){for(var i=this.markerConstraint.length,t,n=0;n<i;n++)this.markerConstraint[n][0]!=null&&this.markerConstraint[n][0][0]!=null&&this.markerConstraint[n][0][0].data!=null&&this.markerConstraint[n][0][0].data.name!=null&&(t=this.markerConstraint[n][0][0].data.name,t.indexOf("ORGANISATIONID 3020")!=-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n]))),this.markerConstraint[n][0]!=null&&this.markerConstraint[n][0][0]==null&&this.markerConstraint[n][0].data!=null&&this.markerConstraint[n][0].data.name!=null&&(t=this.markerConstraint[n][0].data.name,t.indexOf("ORGANISATIONID 3020")!=-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n]))),this.markerConstraint[n]!=null&&this.markerConstraint[n][0]==null&&this.markerConstraint[n].data!=null&&this.markerConstraint[n].data.name!=null&&(t=this.markerConstraint[n].data.name,t.indexOf("ORGANISATIONID 3020")!=-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n])));for(i=this.markerConstraintOther.length,n=0;n<i;n++)this.markerConstraintOther[n][0]!=null&&this.markerConstraintOther[n][0][0]!=null&&(t=this.markerConstraintOther[n][0][0].data.name,t.indexOf("ORGANISATIONID 3020")!=-1&&(this.markerConstraintOther[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n]))),this.markerConstraintOther[n]!=null&&this.markerConstraintOther[n][0]==null&&(t=this.markerConstraintOther[n].data.name,t.indexOf("ORGANISATIONID 3020")!=-1&&(this.markerConstraintOther[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[n])));objifxStpMap.vectorLayerConstraints.removeFeatures(objifxStpMap.vectorLayerConstraints.features),objifxStpMap.vectorLayerConstraintsCluster.removeFeatures(objifxStpMap.vectorLayerConstraintsCluster.features)},IfxStpmapStructures.prototype.clearConstraintDetails=function(){for(var i=this.markerConstraint.length,t,n=0;n<i;n++)t=this.markerConstraint[n][0][0].data.name,t.indexOf("ORGANISATIONID 3020")!=-1&&(this.markerConstraint[n].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[n]));this.markerStructure=[]},IfxStpmapStructures.prototype.createLineConstraint=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v){var b=[],k,p,d=0,y,w;if(h.ElemArray!=null&&h.ElemArray!=undefined)for(y=0;y*3<h.ElemArray.length;y++){for(k=h.ElemArray[y*3]-1,p=y*3+3<h.ElemArray.length?h.ElemArray[y*3+3]-1:h.OrdinatesArray.length,w=[],j=k;j<p;j+=2)w.push(new OpenLayers.Geometry.Point(h.OrdinatesArray[j],h.OrdinatesArray[j+1]));b[d]=this.setMarkerConstraint(n,t,i,r,u,f,e,0,0,w,null,s,c,l,a,v),d++}return b},IfxStpmapStructures.prototype.addConstraint=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v){var g=objifxStpMap.olMap.getZoom(),y,w,b,p,d,k;if(u=="point")w=Math.floor((o.length-o.length/2%2)/2)/2,y=this.setMarkerConstraint(n,t,i,r,u,f,e,o[0],o[1],null,null,s,c,l,a,v),this.featuresConstraints.push(y);else if(u=="linear"||u=="area"){if(y=[],u=="linear")y[0]=this.createLineConstraint(n,t,i,r,u,f,e,null,s,h,c,l,a,v),w=Math.floor((o.length-o.length/2%2)/2)/2,y[1]=this.setMarkerConstraint(n,t,i,r,"point",f,e,o[w],o[w+1],null,null,s,c,l,a,v);else{for(b=[],p=0;p<o.length;p+=2)b.push(new OpenLayers.Geometry.Point(parseFloat(o[p]),parseFloat(o[p+1])));d=new OpenLayers.Geometry.LinearRing(b),y[0]=this.createLineConstraint(n,t,i,r,u,f,e,null,s,h,c,l,a,v),k=d.getCentroid(),y[1]=this.setMarkerConstraint(n,t,i,r,"point",f,e,k.x,k.y,null,null,s,c,l,a,v)}g<=9?this.featuresConstraints.push(y[1]):objifxStpMap.vectorLayerConstraints.addFeatures(y[0])}return y},IfxStpmapStructures.prototype.deleteConstraint=function(n){for(var i,t=0;t<this.markerConstraint.length;t++)if(i=this.markerConstraint[t].length==2?this.markerConstraint[t][0]:this.markerConstraint[t],parseInt(i.data.name.split(" ")[1])==n){objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[t]),this.reArrangeConstraints(t,!1);return}for(t=0;t<this.markerConstraintOther.length;t++)if(i=this.markerConstraintOther[t].length==2?this.markerConstraintOther[t][0]:this.markerConstraintOther[t],parseInt(i.data.name.split(" ")[1])==n){objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[t]),this.reArrangeConstraints(t,!0);return}},IfxStpmapStructures.prototype.clearConstraints=function(n){var t;if(n!=1){for(t=0;t<this.markerConstraint.length;t++)this.markerConstraint[t].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[t][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[t][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraint[t]);objifxStpMap.vectorLayerConstraintsCluster.removeFeatures(objifxStpMap.vectorLayerConstraintsCluster.features)}if(n!=0){for(t=0;t<this.markerConstraintOther.length;t++)this.markerConstraintOther[t].length==2?(objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[t][0]),objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[t][1])):objifxStpMap.vectorLayerConstraints.removeFeatures(this.markerConstraintOther[t]);objifxStpMap.vectorLayerConstraintsCluster.removeFeatures(objifxStpMap.vectorLayerConstraintsCluster.features)}},IfxStpmapStructures.prototype.reArrangeConstraints=function(n,t){for(var i=t==!1?this.markerConstraint:this.markerConstraintOther,r=n;r<i.length-1;r++)i[r]=i[r+1];i.length--,objifxStpMap.vectorLayerConstraints.redraw()},IfxStpmapStructures.prototype.filterConstraints=function(n,t){var r,f,i,u;if(r=t==!1?this.markerConstraint:this.markerConstraintOther,n==!1)for(i=0;i<r.length;i++)if(r[i].length==2){for(u=0;u<r[i][0].length;u++)r[i][0][u].style.display="none";r[i][1].style.display="none"}else r[i].style.display="none";else for(f=objifxStpMap.olMap.getZoom(),i=0;i<r.length;i++)if(r[i].length==2){if(f>=this.defaultLineStructZoom)for(r[i][1].style.display="none",u=0;u<r[i][0].length;u++)r[i][0][u].style.strokeWidth=f-5,r[i][0][u].style.display="";else if(f>=this.defaultPointStructZoom){for(u=0;u<r[i][0].length;u++)r[i][0][u].style.display="none";r[i][1].style.display=""}else if(t==!1){for(u=0;u<r[i][0].length;u++)r[i][0][u].style.display="none";r[i][1].style.display=""}}else r[i].style.display="";objifxStpMap.vectorLayerConstraints.redraw()},IfxStpmapStructures.prototype.setMarkerConstraint=function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p){var b="CONSTRAINT "+n+" NAME "+t+" CODE "+i+" ORGANISATIONID "+a+" SUITABILITY "+f+" OTHERORG "+l+" TYPE "+r+" DESCRIPTION "+e+" SDATE "+v+" EDATE "+y+" WIDTH "+p,d=objifxStpMap.olMap.getZoom(),w,g;if(u=="point")if(d<=9)var k=IfxStpmapCommon.getConstraintImage(r,f),w={externalGraphic:k,graphicHeight:30,graphicWidth:30,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(o,s),{name:b},w);else if(h==null)var k=IfxStpmapCommon.getConstraintImage(r,f),w={externalGraphic:k,graphicHeight:30,graphicWidth:30,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(o,s),{name:b},w);else w={strokeColor:IfxStpmapCommon.getSuitabilityColor(f,1),strokeWidth:objifxStpMap.olMap.getZoom()-5,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(h),{name:b},w);else if(u=="linear"||u=="area")if(d<=9)var k=IfxStpmapCommon.getConstraintImage(r,f),w={externalGraphic:k,graphicHeight:30,graphicWidth:30,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(o,s),{name:b},w);else w={strokeColor:IfxStpmapCommon.getSuitabilityColor(f,1),strokeWidth:objifxStpMap.olMap.getZoom()-5,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(h),{name:b},w);else if(u=="area")if(d<=9)var k=IfxStpmapCommon.getConstraintImage(r,f),w={externalGraphic:k,graphicHeight:30,graphicWidth:30,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(o,s),{name:b},w);else var nt=IfxStpmapCommon.getSuitabilityColor(f,1),w={strokeColor:nt,strokeWidth:1,fillColor:nt,fillOpacity:.4,title:t},g=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([c]),{name:b},w);return g},IfxStpmapStructures.prototype.checkZoomForConstraints=function(n){var i,t;if(this.clearConstraints(1),i=objifxStpMap.olMap.getZoom(),i>=this.defaultLineConstraintZoom+1)n[0].style.display="none";else for(t=0;t<n[0].length;t++)n[1][t].style.display="none"},IfxStpmapStructures.prototype.createConstraintDrawControl=function(){var t=this,n=new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({strokeOpacity:.7,strokeColor:"#6a6c95",strokeWidth:3},OpenLayers.Feature.Vector.style["default"]));this.pointLayer=new OpenLayers.Layer.Vector("Point Layer",{styleMap:n}),this.lineLayer=new OpenLayers.Layer.Vector("Line Layer",{styleMap:n}),this.polygonLayer=new OpenLayers.Layer.Vector("Polygon Layer",{styleMap:n}),objifxStpMap.olMap.addLayers([this.pointLayer,this.lineLayer,this.polygonLayer]),createPointConstraint=new OpenLayers.Control.DrawFeature(this.pointLayer,OpenLayers.Handler.Point,{title:Lang_Key.Tooltip_Create_point_constraint,featureAdded:function(n){btnPointConstraint.deactivate(),t.addFeatureForConstraints(n,"point")}}),createLinearConstraint=new OpenLayers.Control.Button({title:Lang_Key.Tooltip_Create_linear_constraint,eventListeners:{activate:function(){},deactivate:function(){createLinearConstraint.deactivate()}}}),createAreaConstraint=new OpenLayers.Control.DrawFeature(this.polygonLayer,OpenLayers.Handler.Polygon,{title:Lang_Key.Tooltip_Create_area_constraint,featureAdded:function(n){btnAreaConstraint.deactivate(),t.addFeatureForConstraints(n,"area")}}),objifxStpMap.olMap.addControl(createPointConstraint),objifxStpMap.olMap.addControl(createLinearConstraint),objifxStpMap.olMap.addControl(createAreaConstraint)},IfxStpmapStructures.prototype.createConstraintToolBar=function(){var n=this;constraintToolbarPanel=new OpenLayers.Control.Panel({displayClass:"mapconstrainttoolbarpanel"}),objifxStpMap.olMap.addControl(constraintToolbarPanel),btnPointConstraint=new OpenLayers.Control.Button({displayClass:"pointConstraint",title:Lang_Key.Tooltip_Create_point_constraint,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){createPointConstraint.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(0,"STRUCTURES")},deactivate:function(){createPointConstraint.deactivate()}}}),btnLinearConstraint=new OpenLayers.Control.Button({displayClass:"lineConstraint",title:Lang_Key.Tooltip_Create_linear_constraint,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){createLinearConstraint.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(1,"STRUCTURES")},deactivate:function(){createLinearConstraint.deactivate()}}}),btnAreaConstraint=new OpenLayers.Control.Button({displayClass:"areaConstraint",title:Lang_Key.Tooltip_Create_area_constraint,type:OpenLayers.Control.TYPE_TOGGLE,eventListeners:{activate:function(){createAreaConstraint.activate(),objifxStpMap.eventList.DEACTIVATECONTROL!=undefined&&typeof objifxStpMap.eventList.DEACTIVATECONTROL=="function"&&objifxStpMap.eventList.DEACTIVATECONTROL(2,"STRUCTURES")},deactivate:function(){createAreaConstraint.deactivate()}}}),constraintToolbarPanel.addControls([btnPointConstraint,btnLinearConstraint,btnAreaConstraint])},IfxStpmapStructures.prototype.constraintbyDescrToolbar=function(){constraintbydescToolbar=new OpenLayers.Control.Panel({displayClass:"mapconstrainttoolbarbydesc"}),objifxStpMap.olMap.addControl(constraintbydescToolbar),btnDescConstraint=new OpenLayers.Control.Button({displayClass:"descConstraint",title:"Create constraint by geometric description",type:OpenLayers.Control.TYPE_BUTTON,trigger:function(){objifxStpMap.setPageState("constraintbydescription"),objifxStpMap.eventList.CONSTRAINTBYDESCRIPTION!=undefined&&typeof objifxStpMap.eventList.CONSTRAINTBYDESCRIPTION=="function"&&objifxStpMap.eventList.CONSTRAINTBYDESCRIPTION()}}),constraintbydescToolbar.addControls([btnDescConstraint]),constraintbydescToolbar.div.style.display="none"},IfxStpmapStructures.prototype.checkLinkOwnerShip=function(n,t){var i;return $.ajax({url:"/Constraint/CheckLinkOwnerShip",type:"POST",cache:!0,async:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({constRefrences:n,allLinks:t}),success:function(n){n=="Session timeout"&&location.reload(),i=n.Success},complete:function(){objifxStpmapDecisionSpace.clearAllRoads()}}),i},IfxStpmapStructures.prototype.createConstraint=function(n,t,i,r){this.constraintDetails.topologyType=n,this.constraintDetails.geometry=t,this.constraintDetails.ConstraintReferences=i;var u;if("bydescription"==n){$.ajax({url:"/Constraint/SaveLinkDetails",type:"POST",cache:!0,async:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify({CONSTRAINT_ID:r,constRefrences:i}),success:function(n){n=="Session timeout"&&location.reload(),u=n.Success},complete:function(){alert("success"),stopAnimation()}});return}u=n=="area"?!0:this.checkLinkOwnerShip(i,!0),u==!0?(objifxStpMap.setPageState("constraintadded"),objifxStpMap.eventList.CONSTRAINTADDED!=undefined&&typeof objifxStpMap.eventList.CONSTRAINTADDED=="function"&&objifxStpMap.eventList.CONSTRAINTADDED(null,n)):(stopAnimation(),showWarningPopDialog(Lang_Key.WngPopup_Constraint_Staus,"Ok","","close_alert","",1,"info"),objifxStpmapStructures.clearMarkerConstriants())},IfxStpmapStructures.prototype.constraintFillDetails=function(n,t,i,r){var e,u,f,o;if(i!="area"){if(e=this.createConstraintReference(n,t,i),e==null)return showWarningPopDialog(Lang_Key.WngPopup_Constraint_Status1,"Ok","","close_alert","",1,"error"),objifxStpmapStructures.clearMarkerConstriants(),!1}else if(t.length==0)return objifxStpmapStructures.clearMarkerConstriants(),!1;if(u=this.createConstraintGeometry(),i=="point")u.OrdinatesArray[0]=n.geometry.x,u.OrdinatesArray[1]=n.geometry.y;else if(i=="area")for(f=0,o=0;f<n.geometry.components[0].components.length;f++)u.OrdinatesArray[o++]=n.geometry.components[0].components[f].x,u.OrdinatesArray[o++]=n.geometry.components[0].components[f].y;return this.createConstraint(i,u,e,r),!0},IfxStpmapStructures.prototype.createConstraintReference=function(n,t,i){var o=[],s,h,c,l,a=[],v,f,e,r,u;if(i=="point"&&(v=!0,f=IfxStpmapCommon.findNearestFeatureIndex(t,n.geometry.x,n.geometry.y),s=c=f.x1,h=l=f.y1,a.push(t[f.index])),i!="area"){for(e=0,r=0;r<t.length;r++)u=this.getLinearRefForConstraints(t[r],a,s,h,c,l),(u.fromLinearRef!=null||u.toLinearRef!=null)&&e++,t.length==1&&u.fromLinearRef!=null&&u.toLinearRef!=null&&(e=2),o[r]={constLink:t[r].attributes.LINK_ID,direction:null,easting:Math.round(t[r].geometry.components[0].x),fromEasting:Math.round(t[r].geometry.components[0].x),fromLinearRef:u.fromLinearRef,fromNorthing:Math.round(t[r].geometry.components[0].y),isPoint:v,linearRef:u.fromLinearRef,northing:Math.round(t[r].geometry.components[0].y),toEasting:Math.round(t[r].geometry.components[t[r].geometry.components.length-1].x),toLinearRef:u.toLinearRef,toNorthing:Math.round(t[r].geometry.components[t[r].geometry.components.length-1].y)};return o}},IfxStpmapStructures.prototype.getLinearRefForConstraints=function(n,t,i,r,u,f){for(var e,s,h,o=0;o<t.length;o++)if(n==t[o])return e=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(i,r),{tolerance:.5,details:!0}),s=e==undefined||e==null||e.measure==1?null:Math.round(e.length),e=LRSMeasure(n.geometry,new OpenLayers.Geometry.Point(u,f),{tolerance:.5,details:!0}),h=e==undefined||e==null||e.measure==1?null:Math.round(e.length),{fromLinearRef:s,toLinearRef:h};return{fromLinearRef:null,toLinearRef:null}},IfxStpmapStructures.prototype.createConstraintGeometry=function(){return{OrdinatesArray:[]}},IfxStpmapStructures.prototype.getConstraintDetails=function(){return this.constraintDetails},IfxStpmapStructures.prototype.redrawConstraints=function(){this.clearMarkerConstriants(),objifxStpMap.vectorLayerConstraints.redraw()},IfxStpmapStructures.prototype.clearMarkerConstriants=function(){this.pointLayer.removeFeatures(this.pointLayer.features),this.lineLayer.removeFeatures(this.lineLayer.features),this.polygonLayer.removeFeatures(this.polygonLayer.features)},IfxStpmapStructures.prototype.addFeatureForConstraints=function(n,t,i){startAnimation(),this.getFeatureForConstraints(n,t,i,function(){stopAnimation()})},IfxStpmapStructures.prototype.filterContinuousLinks=function(n,t){var r,e,h,o,s,c,i;if(t.length==1)return t;r=IfxStpmapCommon.findNearestFeatureIndex(t,n.geometry.components[0].x,n.geometry.components[0].y),r.index!=0&&(e=jQuery.extend(!0,{},t[0]),t[0]=jQuery.extend(!0,{},t[r.index]),t[r.index]=e),r=IfxStpmapCommon.findNearestFeatureIndex(t,n.geometry.components[n.geometry.components.length-1].x,n.geometry.components[n.geometry.components.length-1].y),r.index==0?t.push(t[0]):r.index!=t.length-1&&(e=jQuery.extend(!0,{},t[t.length-1]),t[t.length-1]=jQuery.extend(!0,{},t[r.index]),t[r.index]=e);var u=jQuery.extend(!0,{},t[0]),l=jQuery.extend(!0,{},t[t.length-1]),f=[];for(i=1;i<t.length;i++){for(h=!1,o=0;o<f.length;o++)if(i==f[o]){h=!0;break}if(h==!1&&(t[i].attributes.REF_IN_ID==u.attributes.REF_IN_ID||t[i].attributes.REF_IN_ID==u.attributes.NREF_IN_ID?(s=IfxStpmapCommon.checkLinkContinuity(i,t,"NREF_NODE",n),(s||i==t.length-1)&&(u=jQuery.extend(!0,{},t[i]),f.push(i),i=0)):(t[i].attributes.NREF_IN_ID==u.attributes.REF_IN_ID||t[i].attributes.NREF_IN_ID==u.attributes.NREF_IN_ID)&&(s=IfxStpmapCommon.checkLinkContinuity(i,t,"REF_NODE",n),(s||i==t.length-1)&&(u=jQuery.extend(!0,{},t[i]),f.push(i),i=0)),f.length>0&&u.attributes.LINK_ID==l.attributes.LINK_ID)){for(c=[t[0]],i=0;i<f.length;i++)c.push(t[f[i]]);return c}}return[]},IfxStpmapStructures.prototype.getFeatureForConstraints=function(n,t,i,r){var s=this,e,h,f,u,o;if(t=="point"?bounds=(Number(n.geometry.x)-100).toString()+","+(Number(n.geometry.y)-100).toString()+","+(Number(n.geometry.x)+100).toString()+","+(Number(n.geometry.y)+100).toString():(bounds=n.geometry.getBounds(),bounds.left-=50,bounds.bottom-=50,bounds.right+=50,bounds.top+=50),e=[],e.push("BBOX(GEOM,"+bounds+")"),t!="area")objifxStpMap.searchFeaturesByCQL(e,function(u){var e,f;u!=null?(e=[],t=="point"&&(f=IfxStpmapCommon.findNearestFeatureIndex(u,n.geometry.x,n.geometry.y),n.geometry.x=f.x1,n.geometry.y=f.y1,e[0]=u[f.index]),s.constraintFillDetails(n,e,t,i)==!1&&r&&typeof r=="function"&&r()):r&&typeof r=="function"&&r()});else{for(f={OrdinatesArray:[],ElemArray:[1,1003,1],sdo_gtype:IfxStpmapCommon.getSdo_gtype("POLYGON"),sdo_srid:IfxStpmapCommon.getSdo_srid()},u=0,o=0;u<n.geometry.components[0].components.length;u++)f.OrdinatesArray[o++]=n.geometry.components[0].components[u].x,f.OrdinatesArray[o++]=n.geometry.components[0].components[u].y;s.createConstraint(t,f,null,i)}},IfxStpmapStructures.prototype.showAffectedStructures=function(n,t,i,r){var u="0",e,f;$("#RtLoaded").is(":checked")&&(u="true"),$("#RtUnLoaded").is(":checked")&&(u="false"),e=this,f=IfxStpmapCommon.getRouteAppraisalParams(t),$.ajax({url:"/Routes/GetAffectedStructureInfoList",type:"POST",dataType:"json",cache:!0,data:{RouteID:n,routeType:f.routeType,CheckAppAppraisal:f.checkAppraisal,SortFlag:i,Isloaded:u},success:function(n){structureList=n.result;var t=e.showStructures(structureList,!1,"AFFECTED");stopAnimation(),r&&typeof r=="function"&&r(t)},complete:function(n){var t="<div>"+n.responseText+"<\/div>",i=$(t).find("#isloginPage").val();i==1&&(location.href="../Account/Login"),stopAnimation()}})},IfxStpmapStructures.prototype.showAffectedConstraints=function(n,t,i,r,u,f){var e=this,s="",h,o=IfxStpmapCommon.getRouteAppraisalParams(t),i=!1;$.ajax({url:"/Routes/GetAffectedConstraintInfoList",type:"POST",dataType:"json",data:{RouteID:n,routeType:o.routeType,BsortFlag:i,StartDate:r,EndDate:u,width:f},success:function(n){var t=n.result;e.showPortalRoadWorksConstraints(t,!1),stopAnimation()},complete:function(n){var t="<div>"+n.responseText+"<\/div>",i=$(t).find("#isloginPage").val();i==1&&(location.href="../Account/Login"),stopAnimation()}})},IfxStpmapStructures.prototype.createConstraintByDescription=function(n,t,i){var u,r,f,e;switch(t){case"area":for(u=[],r=0;r<n.length;r+=2)u.push(new OpenLayers.Geometry.Point(parseFloat(n[r]),parseFloat(n[r+1])));f=new OpenLayers.Geometry.LinearRing(u),e=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([f])),this.addFeatureForConstraints(e,"bydescription",i)}},IfxStpmapStructures.prototype.addVectorLayers=function(n){for(var t=0;t<objifxStpMap.olMap.layers.length;t++)if(objifxStpMap.olMap.layers[t].name==n)return;n=="Structures"?objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerStructures]):(objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerConstraints]),objifxStpMap.olMap.addLayers([objifxStpMap.vectorLayerConstraintsCluster]))},IfxStpmapStructures.prototype.structuresOnZoomChange=function(n,t,i){var r,f,u;if(!(n<=this.defaultPointStructZoom)||t!="AFFECTED"||i!=!1){if(n>=this.defaultLineStructZoom)var e=n-5,h=0,c=0,o="none",s="";else if(n>=this.defaultPointStructZoom)var e=0,h=n+13,c=n+13,o="",s="none";else var e=0,h=0,c=0,o="none",s="none";if(i==!1||i==0){for(r=0;r<this.markerStructure.length;r++)if(f=this.markerStructure[r][0].data.name.split("TYPE ").pop(),checkboxValue(f,t,!1)==!0)for(this.markerStructure[r][0].style.display=o,u=0;u<this.markerStructure[r][1].length;u++)this.markerStructure[r][1][u].style.strokeWidth=e,this.markerStructure[r][1][u].style.display=s}else if(i==!0||i==1){for(r=0;r<this.markerStructureOther.length;r++)if(f=this.markerStructureOther[r][0].data.name.split("TYPE ").pop(),checkboxValue(f,t,!0)==!0)for(this.markerStructureOther[r][0].style.display=o,u=0;u<this.markerStructureOther[r][1].length;u++)this.markerStructureOther[r][1][u].style.strokeWidth=e,this.markerStructureOther[r][1][u].style.display=s}else for(r=0;r<this.markerStructureUnusitable.length;r++)if(f=this.markerStructureUnusitable[r][0].data.name.split("TYPE ").pop(),checkboxValue(f,t,!0)==!0)for(this.markerStructureUnusitable[r][0].style.display=o,u=0;u<this.markerStructureUnusitable[r][1].length;u++)this.markerStructureUnusitable[r][1][u].style.strokeWidth=e,this.markerStructureUnusitable[r][1][u].style.display=s;objifxStpMap.vectorLayerStructures.redraw()}},IfxStpmapStructures.prototype.constraintsOnZoomChange=function(n,t,i){var r,u;if(!(n<=this.defaultPointStructZoom)||t!="AFFECTED"||i!=!1){if(n>=this.defaultLineStructZoom)var f=n-5,e=40,o=40,s="none",h="";else if(n>=this.defaultPointStructZoom)var f=0,e=30,o=30,s="",h="none";else var f=0,e=0,o=0,s="none",h="none";if(i==!1){for(r=0;r<this.markerConstraint.length;r++)if(checkboxValue("CONSTRAINT",t,!1)==!0)if(this.markerConstraint[r].length==2){for(u=0;u<this.markerConstraint[r][0].length;u++)this.markerConstraint[r][0][u].style.strokeWidth=f,this.markerConstraint[r][0][u].style.display=h;this.markerConstraint[r][1].style.display=s}else this.markerConstraint[r].style.graphicHeight=e,this.markerConstraint[r].style.graphicWidth=o}else for(r=0;r<this.markerConstraintOther.length;r++)if(checkboxValue("CONSTRAINT",t,!0)==!0)if(this.markerConstraintOther[r].length==2){for(u=0;u<this.markerConstraintOther[r][0].length;u++)this.markerConstraintOther[r][0][u].style.strokeWidth=f,this.markerConstraintOther[r][0][u].style.display=h;this.markerConstraintOther[r][1].style.display=s}else this.markerConstraintOther[r].style.graphicHeight=e,this.markerConstraintOther[r].style.graphicWidth=o;objifxStpMap.vectorLayerConstraints.redraw()}},IfxStpmapStructures.prototype.showAllStructures=function(n,t,i){var f=this,u=!1,r=objifxStpMap.getCurrentBoundsAndZoom();if(r.zoom<this.defaultPointStructZoom){showNotification(Lang_Key.Notif_Zoom_View_struct_const);return}height=$("#Height").val(),weight=$("#Weight").val(),length=$("#Length").val(),width=$("#Width").val(),$.ajax({type:"POST",dataType:"json",url:"../Structures/MyStructureInfoList",data:{otherOrg:-1,page:0,left:Math.floor(r.bounds.left),right:Math.ceil(r.bounds.right),bottom:Math.floor(r.bounds.bottom),top:Math.ceil(r.bounds.top),Height:t.height,Weight:t.weight,Length:t.length,Width:t.width},beforeSend:function(){n!=null&&startAnimation(n)},complete:function(){u==!1&&(stopAnimation(),window.location.href="../Account/Login")},success:function(n){var t,e;for(u=!0,length=n.result,t=[],e=0;e<=length/1e3;e++)$.ajax({type:"POST",dataType:"json",cache:!0,url:"../Structures/MyStructureInfoList",data:{otherOrg:-1,page:e+1,left:Math.floor(r.bounds.left),right:Math.ceil(r.bounds.right),bottom:Math.floor(r.bounds.bottom),top:Math.ceil(r.bounds.top),Height:height,Weight:weight,Length:length,Width:width},beforeSend:function(){},success:function(n){if(t=t.concat(n.result),document.getElementById("Structs")&&document.getElementById("Structs").checked==!0){var u=f.showStructures(t,!0,"AFFECTED",r.zoom);i&&typeof i=="function"&&i(u)}stopAnimation()},complete:function(){stopAnimation()}})}})},IfxStpmapStructures.prototype.showAllConstraints=function(n,t,i,r){var h=this,u=objifxStpMap.getCurrentBoundsAndZoom();if(u.zoom<this.defaultPointStructZoom){showNotification(Lang_Key.Notif_Zoom_View_struct_const);return}var f=Math.floor(u.bounds.left),e=Math.ceil(u.bounds.right),o=Math.floor(u.bounds.bottom),s=Math.ceil(u.bounds.top);f=f-500,e=e+500,o=o-500,s=s+500,$.ajax({type:"POST",dataType:"json",url:"../Constraint/GetAllConstraintInfoList",data:{left:f,right:e,bottom:o,top:s,StartDate:t,EndDate:i,Width:r},beforeSend:function(){},success:function(n){n.Success==!1?window.location.href="../Account/Login":document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!0&&h.showPortalRoadWorksConstraints(n.result,!1),stopAnimation()},complete:function(){stopAnimation()}})},IfxStpmapStructures.prototype.getInstantAnalysis=function(n,t,i,r,u,f){var o="0",e=0,s,h;$("#RtLoaded").is(":checked")&&(e=parseInt($("#LHeight").text()),o="true"),$("#RtUnLoaded").is(":checked")&&(e=parseInt($("#ULHeight").text()),o="false"),document.getElementById("chkMargin")&&document.getElementById("chkMargin").checked==!0&&(e=parseInt(marginalHeight)+parseInt(e)),s=this,h=objifxStpMap.getRoutePart(),$.ajax({url:"/Routes/GetInstantAnalysis",type:"POST",dataType:"json",cache:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify({routePartId:n,routePart:h,CheckFor:t,Isloaded:o,marginalHeight:0,StartDate:r,EndDate:u,width:f}),success:function(n){var r,u;t==0?(structureList=n.result,document.getElementById("Structs")&&document.getElementById("Structs").checked==!0&&(r=s.showStructures(structureList,!1,"AFFECTED"),i&&typeof i=="function"&&i(r))):(u=n.result,document.getElementById("Constraints")&&document.getElementById("Constraints").checked==!0&&s.showPortalRoadWorksConstraints(u,!1))},complete:function(n){var t="<div>"+n.responseText+"<\/div>",i=$(t).find("#isloginPage").val();i==1&&(location.href="../Account/Login")}})},IfxStpmapStructures.prototype.changeStructDisplay=function(n){for(var u=n.data.name.match("STRUCTURE (.*) NAME")[1],r,i,t=0;t<this.markerStructure.length;t++)if(r=this.markerStructure[t][0].data.name.match("STRUCTURE (.*) NAME")[1],u==r){if(this.markerStructure[t][0].data.displayClass=="point"){for(this.markerStructure[t][0].style.display="none",i=0;i<this.markerStructure[t][1].length;i++)this.markerStructure[t][1][i].style.display="";this.markerStructure[t][0].data.displayClass="line"}else{for(this.markerStructure[t][0].style.display="",i=0;i<this.markerStructure[t][1].length;i++)this.markerStructure[t][1][i].style.display="none";this.markerStructure[t][0].data.displayClass="point"}break}for(t=0;t<this.markerStructureOther.length;t++)if(r=this.markerStructureOther[t][0].data.name.match("STRUCTURE (.*) NAME")[1],u==r){if(this.markerStructureOther[t][0].data.displayClass=="point"){for(this.markerStructureOther[t][0].style.display="none",i=0;i<this.markerStructureOther[t][1].length;i++)this.markerStructureOther[t][1][i].style.display="";this.markerStructureOther[t][0].data.displayClass="line"}else{for(this.markerStructureOther[t][0].style.display="",i=0;i<this.markerStructureOther[t][1].length;i++)this.markerStructureOther[t][1][i].style.display="none";this.markerStructureOther[t][0].data.displayClass="point"}break}for(t=0;t<this.markerStructureUnusitable.length;t++)if(r=this.markerStructureUnusitable[t][0].data.name.match("STRUCTURE (.*) NAME")[1],u==r){if(this.markerStructureUnusitable[t][0].data.displayClass=="point"){for(this.markerStructureUnusitable[t][0].style.display="none",i=0;i<this.markerStructureUnusitable[t][1].length;i++)this.markerStructureUnusitable[t][1][i].style.display="";this.markerStructureUnusitable[t][0].data.displayClass="line"}else{for(this.markerStructureUnusitable[t][0].style.display="",i=0;i<this.markerStructureUnusitable[t][1].length;i++)this.markerStructureUnusitable[t][1][i].style.display="none";this.markerStructureUnusitable[t][0].data.displayClass="point"}break}objifxStpMap.vectorLayerStructures.redraw()},IfxStpmapStructures.prototype.getPreviousDisplayClass=function(n){for(var i,t=0;t<this.markerStructure.length;t++)if(i=this.markerStructure[t][0].data.name.match("STRUCTURE (.*) NAME")[1],n==i)return this.markerStructure[t][0].data.displayClass;for(t=0;t<this.markerStructureOther.length;t++)if(i=this.markerStructureOther[t][0].data.name.match("STRUCTURE (.*) NAME")[1],n==i)return this.markerStructureOther[t][0].data.displayClass;for(t=0;t<this.markerStructureUnusitable.length;t++)if(i=this.markerStructureUnusitable[t][0].data.name.match("STRUCTURE (.*) NAME")[1],n==i)return this.markerStructureUnusitable[t][0].data.displayClass;return"point"},IfxStpmapStructures.prototype.clearAllMarkers=function(n){(n==0||n==!1)&&(this.markerStructure=[]),(n==1||n==!0)&&(this.markerStructureOther=[]),n==2&&(this.markerStructureUnusitable=[])},IfxStpmapContainers.prototype.showContainers=function(n){var i,t,r,u,f;if(n.length!=0){for(objifxStpmapStructures.clearStructureClassList(),objifxStpmapStructures.clearAllStructures(),objifxStpmapStructures.clearStructures(0),t=0;t<n.length;t++)i=[],n[t].Lastlocationlong&&n[t].Lastlocationlat&&(r=CommonJS.ConvertToEastingNorthing(n[t].Lastlocationlat,n[t].Lastlocationlong),u=r[0],f=r[1]),i[t]=this.setMarkerContainer(n[t].Containerid,n[t].Containercode,n[t].Containertypecode,"point",u,f,null,7,n[t].Wastetypecode,n[t].streetName,n[t].Region),objifxStpMap.vectorLayerStructures.addFeatures(i[t]),objifxStpmapStructures.setFilterList(n[t].structureClass,t);return objifxStpMap.vectorLayerStructures.redraw(),objifxStpmapStructures.clearAllMarkers(0),this.markerStructureUnusitable=i,objifxStpmapStructures.addVectorLayers("Structures"),this.structureClassList}},IfxStpmapContainers.prototype.setMarkerContainer=function(n,t,i,r,u,f,e,o,s,h,c){var l=this,k=IfxStpmapCommon.getFinalSuitability(0),a="CONTAINERCODE "+t+" STREETNAME "+h+" REGION "+c+" TYPE";if(r=="point")var v=l.getimage(s),y=l.getHeightWidth(s,1),p=l.getHeightWidth(s,0),w={externalGraphic:v,graphicHeight:y,graphicWidth:p,title:t},b=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(u,f),{name:a,displayClass:objifxStpmapStructures.getPreviousDisplayClass(n)},w);return b},IfxStpmapContainers.prototype.getimage=function(n){return n==200201?markersrc=WebApplicationUrl+"/Content/images/rst_icon.PNG":n==200202?markersrc=WebApplicationUrl+"/Content/images/gft_icon.PNG":n==200203?markersrc=WebApplicationUrl+"/Content/images/plastic_icon.PNG":n==200204?markersrc=WebApplicationUrl+"/Content/images/glass_icon.PNG":n==200205?markersrc=WebApplicationUrl+"/Content/images/paper_icon.PNG":n==200206?markersrc=WebApplicationUrl+"/Content/images/textile_icon.PNG":n.WasteType==200207&&(markersrc=WebApplicationUrl+"/Content/images/bigwaste_icon.PNG"),markersrc},IfxStpmapContainers.prototype.getHeightWidth=function(n,t){return n==200201?markerresolution=t==0?13:18:n==200202?markerresolution=t==0?12:20:n==200203?markerresolution=t==0?9:17:n==200204?markerresolution=t==0?18:18:n==200205?markerresolution=t==0?12:16:n==200206?markerresolution=t==0?20:18:n.WasteType==200207&&(markerresolution=t==0?21:19),markerresolution},IfxStpmapContainers.prototype.showtimeWindowArea=function(n,t){var u,f,e,i,r,o;for(this.RemoveAreaConstraint(),u=[],u=n.Geom._shell._points.Coordinates,f=[],i=0;i<u.length;i++)f.push(CommonJS.ConvertToEastingNorthing(u[i].Y,u[i].X));for(e=[],i=0;i<f.length;i++)e.push(f[i][0]),e.push(f[i][1]);r=[],o=0,e!=null&&(r[o]=this.addConstraint("","","","generic","area",null,e,!1),r[o]==undefined||r[o]==null?r.length--:o++),t==!1?this.markerConstraint=r:this.markerConstraintOther=r,objifxStpMap.vectorLayerConstraints.redraw(),objifxStpmapStructures.addVectorLayers("Constraints"),objifxStpMap.olMap.zoomToExtent(objifxStpMap.vectorLayerConstraints.getDataExtent())},IfxStpmapContainers.prototype.addConstraint=function(n,t,i,r,u,f,e,o){var s,c,h,a,v,y,l;if(u=="point")s=this.setMarkerConstraint(n,t,i,r,u,f,e[0],e[1],null,null,o),objifxStpMap.vectorLayerConstraints.addFeatures(s);else if(u=="linear"||u=="area"){for(s=[],c=[],h=0;h<e.length;h+=2)c.push(new OpenLayers.Geometry.Point(e[h],e[h+1]));for(u=="linear"?(s[0]=this.setMarkerConstraint(n,t,i,r,u,f,0,0,c,null,o),a=Math.floor((e.length-e.length/2%2)/2),s[1]=this.setMarkerConstraint(n,t,i,r,"point",f,e[a],e[a+1],null,null,o)):(v=new OpenLayers.Geometry.LinearRing(c),s[0]=this.setMarkerConstraint(n,t,i,r,u,f,0,0,null,v,o),y=v.getCentroid(),s[1]=this.setMarkerConstraint(n,t,i,r,"point",f,y.x,y.y,null,null,o)),l=0;l<2;l++)objifxStpMap.vectorLayerConstraints.addFeatures(s[l])}return s},IfxStpmapContainers.prototype.setMarkerConstraint=function(n,t,i,r,u,f,e,o,s,h,c){var a="CONSTRAINT "+n+" NAME "+t+" CODE "+i+" SUITABILITY "+f+" OTHERORG "+c+" TYPE "+r,l,y;if(u=="point")var p=IfxStpmapCommon.getConstraintImage(r,f),l={externalGraphic:p,graphicHeight:30,graphicWidth:30,title:t},y=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(e,o),{name:a},l);else if(u=="linear")l={strokeColor:IfxStpmapCommon.getSuitabilityColor(f,1),strokeWidth:objifxStpMap.olMap.getZoom()-5,title:t},y=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(s),{name:a},l);else if(u=="area")var v=IfxStpmapCommon.getSuitabilityColor(f,1),l={strokeColor:v,strokeWidth:1,fillColor:v,fillOpacity:.4,title:t},y=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([h]),{name:a},l);return y},IfxStpmapContainers.prototype.checkZoomForConstraints=function(n){var t=objifxStpMap.olMap.getZoom();t>=9?n[1].style.display="none":n[0].style.display="none"},IfxStpmapContainers.prototype.RemoveAreaConstraint=function(){objifxStpMap.vectorLayerConstraints.removeFeatures(objifxStpMap.vectorLayerConstraints.features),objifxStpMap.vectorLayerConstraintsCluster.removeFeatures(objifxStpMap.vectorLayerConstraintsCluster.features)}