var NADAjs=NADAjs||{};NADAjs.Incentive=function(){function n(){function n(){var n=$(".js-incentive-category-list > option:selected").attr("value"),t;n&&n!=="Select Body Style"||(n=""),t=$(".js-incentive-zipcode").val(),t?$.getJSON("/Cars/Ajax/GetZipInfo",{zipCode:t},function(i){i.City&&i.State?(NADAjs.CookieHelper.setSessionCookie("zipcode",t),window.open("/Cars/"+i.City.replace(/ /g,"-")+"-"+i.State+"-Deals"+(n!==""?"?categoryID="+n:""),"_self")):alert("Please enter a valid zip code.")}):alert("Please enter a valid zip code.")}$(".js-incentive-search").on("click",function(){n()});$("#incentive-zip").keyup(function(t){t.which==13&&n()})}return{init:n}}(),NADAjs.Incentive.Map=function(){function t(t){function s(n,t){for(var r,u,i=0;i<n.length;i++)r=n[i].replace("Bmw","BMW").replace("Gmc","GMC").replace("Mini","MINI").replace("Fiat","FIAT"),u=t[i],h(r,u)}function h(n,t){e.geocode({address:t,region:"USA",partialmatch:!0},function(e,o){var h,c;if(o==="OK"&&e.length>0){var l="https://cdn.jdpower.com/redesign/partners/map_pin.png",a='<div class="geoContent"><p class="p1"><b>'+n+'</b></p><p class="p2">'+t+"</p></div>",s=new google.maps.Marker({map:r,position:e[0].geometry.location,title:n,icon:l,animation:google.maps.Animation.DROP});i.extend(e[0].geometry.location),f<=1&&(h=new google.maps.LatLng(i.getNorthEast().lat()+.01,i.getNorthEast().lng()+.01),c=new google.maps.LatLng(i.getNorthEast().lat()-.01,i.getNorthEast().lng()-.01),i.extend(h),i.extend(c)),google.maps.event.addListener(s,"click",function(){u&&u.close(),u=new google.maps.InfoWindow({content:a,noCloseOnClick:!1,disableAutoPan:!1}),u.open(r,s)}),r.fitBounds(i)}})}n=$.extend(n,t);var r,u,f,i,e,o=function(t,u){var o=t.split("|"),c=u.split("|"),h;f=o.length,i=new google.maps.LatLngBounds,e=new google.maps.Geocoder,h={center:new google.maps.LatLng(0,0),zoom:8,mapTypeId:google.maps.MapTypeId.ROADMAP},r=new google.maps.Map(document.getElementById(n.mapCanvas),h),s(o,c)};setTimeout(function(){o(n.geoName,n.geoAddress)},400)}var n={geoName:null,geoAddress:null,mapCanvas:"map_canvas"};return{init:t}}()