function FBFSGeoCookie(){var v="FBFSGeo=",h=null,s=!1,t=null,i=null,r=null,u=null,f=null,n=null,e=null,o=null,c=function(){return{IpAddress:h,SetByZip:s,CountryCode:t,CountryName:i,State:r,StateAbbreviation:u,City:f,ZipCode:n,Latitude:e,Longitude:o}},l,a;this.toJSON=c;l=function(){t=null;i=null;r=null;u=null;f=null;n=null;e=null;o=null};this.Load=function(c){h=c.IpAddress;s=c.SetByZip;t=c.CountryCode;i=c.CountryName;r=c.State;u=c.StateAbbreviation;f=c.City;n=c.ZipCode;e=c.Latitude;o=c.Longitude};this.GetIP=function(){return h};this.GetSetByZip=function(){return s};this.GetCountryCode=function(){return t};this.GetCountryName=function(){return i};this.GetState=function(){return r};this.GetStateAbbrev=function(){return u};this.GetCity=function(){return f};this.GetZip=function(){return n};this.GetLat=function(){return e};this.GetLong=function(){return o};this.SetGeoByZip=function(h,c){var v=new google.maps.Geocoder;v.geocode({address:h,componentRestrictions:{country:"US"}},function(v,y){var w,b,p;if(y===google.maps.GeocoderStatus.OK){for(l(),w=v[0].address_components,b=v[0].geometry,p=0;p<w.length;p++)switch(w[p].types[0]){case"country":i=w[p].long_name;t=w[p].short_name;break;case"administrative_area_level_1":r=w[p].long_name;u=w[p].short_name;break;case"locality":f=w[p].long_name;break;case"postal_code":n=w[p].short_name}e=b.location.lat();o=b.location.lng();n=h.trim()==""?null:h.trim();s=!0;a();c!=null&&c()}})};a=function(){var n=c();document.cookie=v+JSON.stringify(n)+"; path=/; domain=.fbfs.com"}}function IsJsonString(n){try{JSON.parse(n)}catch(t){return!1}return!0}function doSearch(){window.location.href=encodeURI("/search?s="+document.getElementById("txtSiteSearchText").value)}function initFBFSGeoCookie(n){$.ajax({type:"GET",url:"/Pages/Location.aspx",cache:!1}).done(function(t){FBFSGeoCookie.Load(t);n()}).fail(function(n,t,i){console.log(i.toString())})}function getZipCode(){$("#zipcode").html(FBFSGeoCookie.GetZip());$("#mobilezipcode").html(FBFSGeoCookie.GetZip())}function setCookie(n,t){document.cookie=n+"="+t+"; path=/"}function readCookie(n){for(var r=n+"=",u=document.cookie.split(";"),t,i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return null}function getParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t==null?"":decodeURIComponent(t[1].replace(/\+/g," "))}function openZipCodeChange(){$("#changeZip").show()}function openMobileZipCodeChange(){$("#mobileChangeZip").show()}function changeZip(){var t=new RegExp("^([0-9]{5})$"),n=$("#txtZip").val();t.test(n)?(FBFSGeoCookie.SetGeoByZip(n,function(){$("#zipcode").html(FBFSGeoCookie.GetZip());$("#mobilezipcode").html(FBFSGeoCookie.GetZip());location.reload(!0)}),$("#txtZip").val(""),$("#changeZip").hide()):alert("Please enter a five digit zip code")}function changeMobileZip(){var t=new RegExp("^([0-9]{5})$"),n=$("#txtMobileZip").val();t.test(n)?(FBFSGeoCookie.SetGeoByZip(n,function(){$("#zipcode").html(FBFSGeoCookie.GetZip());$("#mobilezipcode").html(FBFSGeoCookie.GetZip());location.reload(!0)}),$("#txtMobileZip").val("")):alert("Please enter a five digit zip code")}function cancelZip(){$("#txtZip").val("");$("#changeZip").hide()}function cancelMobileZip(){$("#txtMobileZip").val("")}function GetMembershipStateLink(){var t=FBFSGeoCookie.GetStateAbbrev(),n="http://www.fb.org/statefbs/";switch(t){case"IA":n="http://www.iowafarmbureau.com/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"MN":n="http://www.fbmn.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"NE":n="http://www.nefb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"KS":n="http://www.kfb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"SD":n="http://www.sdfbf.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"UT":n="http://utfb.fb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"AZ":n="http://www.azfb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"MT":n="http://www.mfbf.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"WY":n="http://www.wyfb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"NM":n="http://www.nmflb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"ND":n="http://www.ndfb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"OK":n="http://www.okfarmbureau.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"ID":n="http://www.idahofb.org/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"WI":n="http://www.wfbf.com/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral";break;case"CO":n="http://coloradofarmbureau.com/?utm_campaign=membership&utm_source=fbfs.com&utm_medium=referral"}$("#membershipStateLink").attr("href",n);$("#membershipStateLink").attr("target","_blank");$("#membershipStateLink").attr("OnClick","return confirmOutboundLink();")}function triggerLifeAgentPopup(){var t=$.cookie("FBFSReferringAgent"),n;t!=null&&(n=JSON.parse(t),n!=null&&(injectLifeAgentPopup(),$("#lifeAgentPhoto").attr("src","/Resources/Images/Agents/"+n.AgentId+".jpg"),$("#lifeAgentName").html(n.DisplayName),isMobile.any()?$("#lifeAgentPhone").html(" at <a href='tel:"+n.Phone.replace(/\D+/g,"")+"' onclick='lifeAgentViewed();'>"+n.Phone+"<\/a>"):$("#lifeAgentPhone").text(" at "+n.Phone),$("#lifeAgentEmail").attr("href","/contact?agentId="+n.AgentId+"&contact=question"),$("#lifeAgentModal").foundation("reveal","open")))}function triggerLifeOnlyPopup(){injectLifeOnlyPopup();$("#lifeOnlyModal").foundation("reveal","open")}function lifeOnlyViewed(){setCookie("FBFSReadPopup","life-only");$("#lifeOnlyModal").foundation("reveal","close")}function lifeAgentViewed(){setCookie("FBFSReadPopup","life-agent");$("#lifeAgentModal").foundation("reveal","close")}function injectLifeOnlyPopup(){$("#lifeOnlyModal").length||$("body").append('<div class="reveal-modal small" id="lifeOnlyModal"><h4>Thanks for visiting our site.<\/h4><p>It looks like you&apos;re about to view a page that includes products we don&apos;t offer in your state.You&apos;re welcome to <a onclick="lifeOnlyViewed(); return false;" href="#">continue on the site<\/a> anyway, or&nbsp;<a onclick="navigateToAgent(); return false;" href="/find-an-agent/search">find a local agent<\/a> to learn more about products and services available in your state and how an annual review can check to ensure your coverage is keeping up with your busy life.<\/p><a class=\'close-reveal-modal\' aria-label=\'Close\' onclick=\'lifeOnlyViewed();\'>x<\/a><\/div>')}function injectLifeAgentPopup(){$("#lifeAgentModal").length||$("body").append('<div class="reveal-modal color-modal" id="lifeAgentModal"><div class="color-wrapper"><img width="150" height="188" class="agent-photo" id="lifeAgentPhoto" onerror="javascript:this.src = \'/Resources/Images/Agents/NoPhoto.png\';" alt="Farm Bureau Financial Services Agent" src="/Resources/Images/Agents/NoPhoto.png"><div class="agent-name" id="lifeAgentName"><\/div><\/div><div class="message-wrapper"><h4>Thanks for your interest!<\/h4><p>I want to help you protect your auto, home, farm or business. Give me a call <span id="lifeAgentPhone"><\/span> or <a id="lifeAgentEmail" onclick="lifeAgentViewed();" href="#">send me a message<\/a> to set up a time to talk.<\/p><\/div><a class="close-reveal-modal" aria-label="Close" onclick="lifeAgentViewed();">x<\/a><\/div>')}function navigateToAgent(){lifeOnlyViewed();window.location="//"+window.location.hostname+"/find-an-agent/search"}function goToNewsletterFooter(){var n=$("#footerEmailAddr").val();window.location.href="/newsletter-signup?email="+n}function goToSignUp(){var n=$("#emailAddr").val();window.location.href="/newsletter-signup?email="+n}function findAnAgentZip(){window.location="//"+window.location.hostname+"/find-an-agent/Search?s="+$("#txtFindAnAgentSidebar").val()+"&t=zip"}function openlinks_newWindow(n){if(n.indexOf("http:")>-1||n.indexOf("https:")>-1)if(n.indexOf(window.location.host)>-1||n.indexOf("calcxml")>-1)trackExternalLinks(n),window.open(n);else{var t=confirm('You are now leaving the Farm Bureau Financial Services website. To proceed, please click "OK" below. Or click "Cancel" to return to the Farm Bureau Financial Services website.');t&&(trackExternalLinks(n),window.open(n))}else trackExternalLinks(n),window.open(n)}function openlinks_location(n){if(n.indexOf("http:")>-1||n.indexOf("https:")>-1)if(n.indexOf(window.location.host)>-1||n.indexOf("calcxml")>-1)trackExternalLinks(n),window.location.href=n;else{var t=confirm('You are now leaving the Farm Bureau Financial Services website. To proceed, please click "OK" below. Or click "Cancel" to return to the Farm Bureau Financial Services website.');t&&(trackExternalLinks(n),window.location.href=n)}else trackExternalLinks(n),window.location.href=n}function trackExternalLinks(n){ga("send","event","Click",n)}function confirmOutboundLink(n){return n=typeof n=="undefined"?'You are now leaving the Farm Bureau Financial Services website. To proceed, please click "OK" below. Or click "Cancel" to return to the Farm Bureau Financial Services website.':n,confirm(n)}function flipTable(n){document.getElementById(n).style.display=document.getElementById(n).style.display=="none"?"":"none"}function checkObjectFit(){try{Modernizr.objectfit||$(".fbfs-object-fit").each(function(){var n=$(this),t=n.find("img").prop("src");t&&n.css("background-image","url('"+t+"')").addClass("compat")})}catch(n){console.log(n.message)}}var FBFSGeoCookie,isMobile;$(document).ready(function(){var n,t;initFBFSGeoCookie(getZipCode);checkObjectFit();$("#nav-toggle").on("click",function(n){$("#nav").slideToggle("fast",function(){$("#nav").is(":visible")?$("#nav-toggle span").html("&#9650;"):$("#nav-toggle span").html("&#9660;")});n.preventDefault()});$("#nav").on("click",".has-subnav a",function(){$(window).width()<767&&($(this).next("ul").is(":visible")?($(this).next("ul").slideUp("fast"),$(this).removeClass("active")):($(this).closest("ul").find(".active").next("ul").slideUp("fast"),$(this).closest("ul").find(".active").removeClass("active"),$(this).next().slideToggle("fast"),$(this).addClass("active")))});$(".nav-title-mb").on("click",function(n){$("#nav-sidebar-mb").slideToggle("fast",function(){$("#nav-sidebar-mb").is(":visible")?$("#nav-toggle-sidebar-mb span").html("&#9650;"):$("#nav-toggle-sidebar-mb span").html("&#9660;")});n.preventDefault()});$("#nav-sidebar-mb.learning-home").css("display","block");$("#nav-sidebar-mb.careers-icon").css("display","block");$("#nav .level1 > li.has-subnav:last").after('<li class="has-subnav show-for-small"><a href="/career-center">Career Center<\/a><ul class="level-2"><\/ul><\/li>');$(".privacy--toggle").on("click",function(){$(this).toggleClass("active")});n=document.getElementById("has-subnav parent-101");n!=null&&$(n).remove();$(".sub-nav dd:last-child").addClass("last");t=$(".hcard-panels .panel");t.mouseenter(function(){$(this).find(".hover").addClass("on")}).mouseleave(function(){$(this).find(".hover").removeClass("on")});$(window).width()<767&&$(".section-container section p.title").click(function(n){n.preventDefault();var t=$(".section-container").offset(),i=t.top;$("html, body").animate({scrollTop:i},500,"easeOutSine")});$("#search-link").on("click",function(){$("#search-link").attr("href","/Search?s="+$("#search-textbox").val())});$("#m-search-link").on("click",function(){$("#m-search-link").attr("href","/Search?s="+$("#m-search-textbox").val())});$("input[id$='txtSiteSearchText']").keyup(function(n){n.keyCode==13&&doSearch()});$("input[id$='txtAgentSearch']").keyup(function(n){n.keyCode==13&&$("#btnAgentZipSearch").click()});$("input[id$='footerEmailAddr']").keyup(function(n){n.keyCode==13&&goToNewsletterFooter()});$("#txtZip").keyup(function(n){n.keyCode==13&&changeZip()});$("a").on("click",function(){var n=this.href,t,i;n!==undefined&&n.toLowerCase().indexOf("fbfsagents.com")>=0&&(t=n.split("/")[2],t!==undefined&&(i=t.split(".")[0],dataLayer.push({event:"AgentWebsiteClick",eventAction:"Agent Website View",eventLabel:i})))});$(".fbfs-accordion-header").click(function(){$(this).toggleClass("expanded");$(this).parent().find(".fbfs-accordion-content").slideToggle(400)})});FBFSGeoCookie=new FBFSGeoCookie;isMobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},any:function(){return isMobile.Android()||isMobile.BlackBerry()||isMobile.iOS()||isMobile.Opera()||isMobile.Windows()}}