function goToByScroll(n){$("html,body").animate({scrollTop:$("#"+n).offset().top},"slow")}function SaveJob(n){if(docID=$("#ControlNumber").val(),n.attr("data-state")=="is-unsaved"){var t=encodeURI("/Search/QuickSave/")+docID;jQuery.ajax({type:"GET",contentType:"html",dataType:"html",url:t,async:!0,success:function(n){checkResult(n,docID)},error:function(){},cache:!1})}else $.post("/Applicant/ProfileDashboard/DeleteSavedJob",{job:docID}).done(function(){checkResult("Job deleted",docID)})}function checkResult(n,t){if(n=="logged-out"){var i=encodeURI("/Applicant/SavedJobs/Save/")+t;window.location=i}else n=="Job successfully saved."?($(".saveJobButton").text("Saved"),$(".saveJobButton").attr("data-state","is-saved")):n=="Job deleted"?($(".saveJobButton").text("Save"),$(".saveJobButton").attr("data-state","is-unsaved")):alert(n)}function getMapCoordinates(n,t,i,r){var u="createBingMap("+n+","+t+",'"+i+"','"+r+"' );";window.setTimeout(u,1)}function createBingMap(n,t,i,r){var e={credentials:"Aq2HseksGy7yVZIw7TqmI6AQrgSsye0gPEVVGauJnnP1Zz9aGAgnVFjBERPX5otI",mapTypeId:Microsoft.Maps.MapTypeId.road,center:new Microsoft.Maps.Location(n,t),zoom:10,enableClickableLogo:!1,enableSearchLogo:!1,showCopyright:!1,showDashboard:!0,showMapTypeSelector:!1,showLogo:!0},f,u;map=new Microsoft.Maps.Map(document.getElementById("mapDivContent"),e);f=map.getCenter();u=new Microsoft.Maps.Pushpin(f,{text:"1"});pinInfobox=new Microsoft.Maps.Infobox(u.getLocation(),{title:i,description:r,visible:!1,offset:new Microsoft.Maps.Point(0,15),showCloseButton:!1,height:195});Microsoft.Maps.Events.addHandler(u,"mouseover",displayInfobox);Microsoft.Maps.Events.addHandler(map,"viewchange",hideInfobox);map.entities.push(u);map.entities.push(pinInfobox)}function displayInfobox(){pinInfobox.setOptions({visible:!0})}function hideInfobox(){pinInfobox.setOptions({visible:!1})}function termHighlighter(n,t){var i=new RegExp("("+$.ui.autocomplete.escapeRegex(t)+")","ig");return n.replace(i,"<strong>$1<\/strong>")}function initAutoComplete(){$("#Location,#NavLocationTerm").autocomplete({source:usajSrc,minLength:3,select:function(n,t){var i=t.item,r=$(this).attr("id");return r=="NavLocationTerm"?$("#NavLocationTerm").val(i.label):$("#Location").val(i.label),$("#AutoCompleteSelected").val("true"),!1},search:function(){return $("#AutoCompleteSelected").val("false"),$("#Location").validate(),$("#Location").valid()?void 0:($("#Location").autocomplete("close"),!1)},open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top");$("ul.ui-menu").width($(this).innerWidth())},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all")}});$("#nav-location, #search-location").autocomplete({source:usajSrc,minLength:3,select:function(n,t){var i=t.item,r=$(this).attr("id");return $("#nav-location, #search-location").val(i.label),$("#AutoCompleteSelected").val("true"),!1},search:function(){return $("#AutoCompleteSelected").val("false"),$("#nav-location, #search-location").validate(),$("#nav-location").length&&!$("#nav-location").valid()||$("#search-location").length&&!$("#search-location").valid()?($("#nav-location, #search-location").autocomplete("close"),!1):void 0},open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top");$("ul.ui-menu").width($(this).innerWidth())},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all")}})}var map=null,pinInfobox=null,controlnum="",announcementnum="",usajSrc,usajSrcHighlighter;$(document).ready(function(){controlnum=$("#ControlNumber").val();announcementnum=$("#AnnoucementID").val();$("#lnk-agency-contact").bind("click",function(){return goToByScroll("agencycontact"),!1});$(".viewmap").click(function(){var n=$(this).data("coord-lat"),t=$(this).data("coord-long"),i=$.trim($("#jobtitle").text()),r=$(this).data("name");getMapCoordinates(n,t,i,r)});$(".saveJobButton").bind("click",function(n){n.preventDefault();SaveJob($(this))});$("#show-all-locations").click(function(){return goToByScroll("btn-more-locations"),!1});document.referrer&&document.referrer.toLowerCase().indexOf("/search")!==-1?$("#backtoresults").show():$("#backtoresults").hide()});usajSrc=function(n,t){$.ajax({url:acHostUrl,dataType:"jsonp",crossdomain:!0,cache:!0,jsonpCallback:"usaj151067976",data:{t:n.term},success:function(n){t(n)}})};usajSrcHighlighter=function(n,t){$.ajax({url:acHostUrl,dataType:"jsonp",crossdomain:!0,cache:!0,jsonpCallback:"usaj151067976",data:{t:n.term},success:function(i){t($.map(i,function(t){return{value:t,label:termHighlighter(t,n.term)}}))}})};$(function(){initAutoComplete()})