function showMoreOrLess(n,t){var i=n.innerHTML;i=="...read more"?(document.getElementById(t).style.display="inline",n.innerHTML="...read less"):(document.getElementById(t).style.display="none",n.innerHTML="...read more")}function copyStringToClipboard(n){var t=document.createElement("textarea");t.value=n;t.setAttribute("readonly","");t.style={position:"absolute",left:"-9999px"};document.body.appendChild(t);t.select();document.execCommand("copy");document.body.removeChild(t);console.log(n+" copied to clip")}var myApp=angular.module("sbApp",["ngFileUpload","angular-bacon"]);myApp.controller("SearchController",["$scope","$http","$timeout","$attrs","$q",function(n,t,i,r,u){var f={Stolen_Start:0,Stolen_Frame_Asset_No:1,Stolen_Property_Vault_ID:2,Stolen_Make_Plus:3,Stolen_PV_No:4,Owner_Wanted_Start:5,Owner_Wanted_Make_Plus:6,Owner_Wanted_PV_No:7,For_Sale_Start:8,For_Sale_Frame_Asset_No:9,For_Sale_Vault_ID:10,For_Sale_Make_Plus:11,For_Sale_PV_No:12},e={Stolen:0,Owner_Wanted:1,For_Sale:2},o,s;n.searchTypeOption=f;n.superTypeOption=e;n.searchModel={searchType:null,showInstructions:!0,lookup:null,showLookup:!1,lookupLocked:!1,keywords:null,makePluses:[],keywordPlaceholder:null,location:null,locationLocked:!1,colour:"#fddf08",assetNoInstruct:r.assetNoInstruct};n.init=function(){if(r.searchType){var i=f[r.searchType];i>=f.Stolen_Start&&i<=f.Stolen_PV_No?n.searchModel.superType=e.Stolen:i>=f.Owner_Wanted_Start&&i<=f.Owner_Wanted_PV_No?n.searchModel.superType=e.Owner_Wanted:i>=f.For_Sale_Start&&i<=f.For_Sale_PV_No&&(n.searchModel.superType=e.For_Sale);n.setSearchType(f[r.searchType]);n.searchModel.isFull=r.vault=="Police";n.searchModel.pathPrefix=n.searchModel.isFull?"/Police":"";n.searchModel.isFull&&t({method:"GET",url:"/search/vaultsearchconfigs/"}).then(function(t){n.searchModel.vaults=t.data},function(){console.log("api cancel or failure - /search/vaultsearchconfigs/")})}};n.getVaults=function(){if(!n.searchModel.vaults)return[];switch(n.searchModel.superType){case e.Stolen:return n.searchModel.vaults.filter(function(n){return n.HasStolen});case e.Owner_Wanted:return n.searchModel.vaults.filter(function(n){return n.HasRecovered});case e.For_Sale:return n.searchModel.vaults.filter(function(n){return n.HasForSale})}};n.setVaultType=function(t){n.searchModel.vault=t;n.searchModel.isFull=!1};n.resetToFull=function(){n.searchModel.vault=null;n.searchModel.isFull=!0};n.hasIdent=function(){return n.searchModel.vault?n.searchModel.vault.HasIdentPack:!0};n.getCopy=function(t,i){return n.searchModel.vault?n.searchModel.vault.Copy[t]:i};n.setSearchType=function(t){n.searchModel.searchType=t;n.searchModel.showInstructions=!1;n.searchModel.showLookup=!1;n.searchModel.showKeywords=!1;switch(n.searchModel.searchType){case null:n.searchModel.showInstructions=!0;n.colour="#fddf08";break;case f.Stolen_Start:case f.Owner_Wanted_Start:case f.For_Sale_Start:n.searchModel.showInstructions=!0;break;case f.Stolen_Frame_Asset_No:case f.For_Sale_Frame_Asset_No:n.searchModel.showKeywords=!0;n.searchModel.keywordPlaceholder=n.getCopy("SuperSearch_AssetNo_Instructions",n.searchModel.assetNoInstruct);break;case f.Stolen_Property_Vault_ID:case f.For_Sale_Vault_ID:n.searchModel.showKeywords=!0;n.searchModel.keywordPlaceholder="Enter Property Vault ID - E.g. AA123";break;case f.Stolen_Make_Plus:case f.Owner_Wanted_Make_Plus:case f.For_Sale_Make_Plus:n.searchModel.showLookup=!0;n.searchModel.showKeywords=!0;n.searchModel.keywordPlaceholder="Optional Model / Key Word";break;case f.Stolen_PV_No:case f.Owner_Wanted_PV_No:case f.For_Sale_PV_No:n.searchModel.showKeywords=!0;n.searchModel.keywordPlaceholder="Enter PV No."}switch(n.searchModel.searchType){case null:n.searchModel.colour="#f4d00a";break;case f.Stolen_Start:case f.Stolen_Frame_Asset_No:case f.Stolen_Property_Vault_ID:case f.Stolen_Make_Plus:case f.Stolen_PV_No:n.searchModel.colour="#ed1111";break;case f.For_Sale_Start:case f.For_Sale_Frame_Asset_No:case f.For_Sale_Vault_ID:case f.For_Sale_Make_Plus:case f.For_Sale_PV_No:n.searchModel.colour="#8fc400";break;case f.Owner_Wanted_Start:case f.Owner_Wanted_Make_Plus:case f.Owner_Wanted_PV_No:n.searchModel.colour="#244d7b"}$(".optionspin .collapse").removeClass("show")};o=n.$watchAsProperty("searchModel.lookup");o.filter(function(n){return!n||n.length<=1}).throttle(1e3).onValue(function(){n.makePluses=[];n.canceller&&n.canceller.resolve()});o.filter(function(n){return n&&n.length>1}).throttle(1e3).onValue(function(i){n.searchModel.lookupLocked||(n.canceller&&n.canceller.resolve(),n.canceller=u.defer(),t({method:"POST",url:"/search/makeplussearch/",timeout:n.canceller.promise,data:{search:i,superTypeOption:n.searchModel.superType,vaultType:n.searchModel.vault?n.searchModel.vault.Vault:null}}).then(function(t){n.searchModel.makePluses=t.data},function(){console.log("api cancel or failure - /search/makeplussearch/")}))});n.selectMakePlus=function(t){n.searchModel.lookupLocked=!0;n.searchModel.selectedMakePlus=t;n.searchModel.makePluses=[];n.searchModel.lookup=t.MakeName+" - "+t.TypeName;console.log(n.searchModel.selectedMakePlus)};n.clearLookup=function(){n.searchModel.selectedMakePlus=null;n.searchModel.lookup="";n.searchModel.lookupLocked=!1};s=n.$watchAsProperty("searchModel.location");s.filter(function(n){return!n||n.length<=1}).throttle(250).onValue(function(){n.locations=[];n.canceller&&n.canceller.resolve()});s.filter(function(n){return n&&n.length>1}).throttle(250).onValue(function(i){n.searchModel.locationLocked||(n.canceller&&n.canceller.resolve(),n.canceller=u.defer(),t({method:"POST",url:"/search/locationsearch/",timeout:n.canceller.promise,data:{search:i}}).then(function(t){n.searchModel.locations=t.data},function(){console.log("api cancel or failure - /search/locationsearch/")}))});n.selectLocation=function(t){n.searchModel.locationLocked=!0;n.searchModel.selectedLocation=t;n.searchModel.locations=[];n.searchModel.location=t.state+(t.postcode?" - "+t.suburb+" - "+t.postcode:"");console.log(n.searchModel.selectedMakePlus)};n.clearLocation=function(){n.searchModel.selectedLocation=null;n.searchModel.location="";n.searchModel.locationLocked=!1};n.showSupertype=function(t){return n.searchModel.isFull?!1:n.searchModel.superType==t};n.runSearch=function(){var t={SearchType:n.searchModel.searchType,Keywords:n.searchModel.keywords},i;n.searchModel.selectedLocation&&(t.Postcode=n.searchModel.selectedLocation.postcode,t.Suburb=n.searchModel.selectedLocation.suburb,t.State=n.searchModel.selectedLocation.ID>0?n.searchModel.selectedLocation.state:n.searchModel.selectedLocation.state.split(" ")[0],t.Postcode==null&&(t.Postcode=""),t.Suburb==null&&(t.Suburb=""),t.State==null&&(t.State=""));n.searchModel.selectedMakePlus&&(t.MakeID=n.searchModel.selectedMakePlus.MakeID,t.PropertyTypeID=n.searchModel.selectedMakePlus.PropertyTypeID);n.searchModel.vault&&(t.VaultType=n.searchModel.vault.Vault);i=n.searchModel.pathPrefix+"/"+(n.searchModel.superType==this.superTypeOption.Stolen?"Stolen":n.searchModel.superType==this.superTypeOption.Owner_Wanted?"Recovered":"ForSale");window.location=i+"?"+n.serialize(t)};n.serialize=function(n){var i=[],t;for(t in n)n.hasOwnProperty(t)&&i.push(encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return i.join("&")};n.init()}]);jQuery(document).ready(function(n){var i=300,r=12e3,u=700,t=n(".cd-top");n(window).scroll(function(){n(this).scrollTop()>i?t.addClass("cd-is-visible"):t.removeClass("cd-is-visible cd-fade-out");n(this).scrollTop()>r&&t.addClass("cd-fade-out")});t.on("click",function(t){t.preventDefault();n("body,html").animate({scrollTop:0},u)});n(".print a").click(function(){return window.print(),fakse});n(".pagination li").addClass("page-item");n(".pagination a, .pagination span").addClass("page-link");n(".pagination .active").addClass("current");n(".copytag").click(function(){copyStringToClipboard(n(this).attr("data-original-title"))})});$(function(){$(".lko").each(function(){var n,t;$(this).wrap("<a href='"+$(this).attr("data-lko-outurl")+"' target='_blank'><\/a>");n={Slot:$(this).attr("data-lko-slot"),Device:$(this).attr("data-lko-device"),Client:$(this).attr("data-lko-client"),FileName:$(this).attr("src"),OutUrl:$(this).attr("data-lko-outurl")};$(this).parent()[0].lko=n;$(this).parent().click(function(){var t=this.lko.OutUrl,n=JSON.stringify(this.lko);return $.ajax({type:"POST",url:"/Lko/SaveEvent/",data:n,contentType:"application/json; charset=utf-8",success:function(){},error:function(){},returnObj:null}),!0});$(this).css("display")!="none"&&(t=JSON.stringify($.extend({},n,{Type:1})),$.ajax({type:"POST",url:"/Lko/SaveEvent/",data:t,contentType:"application/json; charset=utf-8",success:function(){},error:function(){},returnObj:null}))})});location.protocol!="https:"&&(location.href="https:"+window.location.href.substring(window.location.protocol.length))