!function(){var e=this,i=e.jQuery,s=e.DDC,a={ajaxNavigationElement:".ajax-navigation-element",locationsGroupNav:".locations-group-nav",pageBd:".page-bd",widget:".franchiseList",franchise:".franchiseList .franchise",franchiseLink:".franchiseList .franchiseLink",franchiseLogo:".franchiseList .franchiseLogo",customImage:".franchiseList .customImage",linkToggles:".franchiseList .linkToggles li",location:".franchiseList .childList li",childList:".childList",vcard:".vcard"},t={$locationsGroupNav:i(a.locationsGroupNav)},n={slideTime:750},r={hover:"hover",selected:"selected",toggled:"toggled"},l={page:{select:"franchiseSelect",toggle:"linkToggle",over:"franchiseOver",out:"franchiseOut",redirect:"redirect"},user:{toggleClick:"click",locationClick:"click",vcardClick:"click",franchiseOver:"mouseenter",franchiseOut:"mouseleave",locationOver:"mouseenter",locationOut:"mouseleave"}},c={user:{live:{toggleClick:a.linkToggles,locationClick:a.location,vcardClick:a.vcard,franchiseOver:a.franchise,franchiseOut:a.franchise,locationOver:a.location,locationOut:a.location},traditional:{}}},o=function(e){var i=t.$locationsGroupNav.find(".franchiseList"),s=i.width(),a=i.find(".franchise:first").width(),n=Math.floor(s/a),r=Math.ceil((e.index()+1)/n)*n;return r-=1,t.$locationsGroupNav.find(t.$locationsGroupNav.find(".franchise:eq("+r+")").size()>0?".franchise:eq("+r+")":".franchise:last")},d=function(e,s){var a=s.find("li").size(),t=i('
');t.append(s),e.after(t)},h=function(e){var s=t.$locationsGroupNav;if(e.hasClass("selected"))s.find(".childRow").slideUp(n.slideTime,function(){i(this).remove()});else{{e.find(".franchiseLink span").text()}s.find(".childRow").slideUp(n.slideTime,function(){i(this).remove(),d(o(e),e.find(".childList").clone().removeClass("childList")),s.find(".childRow").slideDown(n.slideTime)}),0==s.find(".childRow").size()&&(d(o(e),e.find(".childList").clone().removeClass("childList")),s.find(".childRow").slideDown(n.slideTime))}},f={page:{select:function(e,s){i(a.franchise+"."+r.selected+s.franchiseClass?":not(."+s.franchiseClass+")":"").removeClass(r.selected),s&&s.franchiseClass&&(i(a.franchise+"."+s.franchiseClass).toggleClass(r.selected),i(a.widget+" "+a.franchise+"."+s.franchiseClass).hasClass(r.selected)&&i(document).trigger("trackEvent",[{widgetName:"GroupNav",eventName:"franchise select",data:s.franchiseClass}]),setTimeout(function(){var e=i(a.pageBd),t=i(a.franchise+"."+s.franchiseClass).find(a.childList),n=e.offset().left+e.width(),r=t.length>0?t.offset().left+t.width():0,l=r-n,c=t.size()>0?Number(t.css("marginLeft").replace(/[^-\d\.]/g,"")):0;l>0&&t.css({marginLeft:-l+c}),e=null,t=null},1))},toggle:function(e,s){i(a.linkToggles+"."+r.selected+":not(."+s.linkClass+")").removeClass(r.selected),s&&s.linkClass&&(i(a.linkToggles+"."+s.linkClass).toggleClass(r.selected),i(a.linkToggles+"."+s.linkClass).hasClass(r.selected)?(i(a.location+":has(a."+s.linkClass+")").each(function(){i(this).data("defaultUrl")||i(this).data("defaultUrl",i("a.url",this).attr("href")),i("a.url",this).attr("href",i("a."+s.linkClass,this).attr("href"))}),i(a.widget+" .widgetWrap").addClass(r.toggled)):(i(a.location+":has(a."+s.linkClass+")").each(function(){i(this).data("defaultUrl")&&i("a.url",this).attr("href",i(this).data("defaultUrl"))}),i(a.widget+" .widgetWrap").removeClass(r.toggled)))},redirect:function(i,a){if(a&&a.url){if(s.hasOwnProperty("groupNav")&&s.groupNav.hasOwnProperty("newWindow")&&s.groupNav.newWindow.enabled)return e.open(a.url,"_blank",""),!1;e.top.open(a.url,"_self")}}},user:{toggleClick:function(){var e={linkClass:i.trim(i(this).attr("class").replace(r.selected,"").replace("firstToggle","").replace("lastToggle",""))};return i(document).trigger(l.page.toggle,[e]),!1},locationClick:function(e){var s;return i(e.target).is("a")||i(e.target).parents("a").size()?void 0:(s={url:i(e.target).parents(a.widget+" "+a.location).find("a.url").attr("href")},i(document).trigger(l.page.redirect,[s]),!1)},vcardClick:function(e){var s={url:i(".fn.org",e.currentTarget).data("vcardlink")};i(document).trigger(l.page.redirect,[s])},select:function(){var e={};return s.client.isDesktop&&s.groupNav.showChildrenInRow.enabled&&h(i(this).parents(".franchise")),i(this).parents(a.franchise).size()&&(e.franchiseClass=i.trim(i(this).parents(a.franchise).attr("class").replace(r.hover,"").replace(r.selected,"").replace(/franchise/g,"")),e.navIndex=i(this).parents(a.widget).index(a.widget),e.franchiseIndex=i(this).parents(a.franchise).index(a.widget+":eq("+e.navIndex+") "+a.franchise)),i(document).trigger(l.page.select,[e]),!1},franchiseOver:function(){var e={franchiseName:i.trim(i(".franchiseLink",this).text()),franchiseClass:i.trim(i(this).attr("class").replace(r.hover,"").replace(r.selected,"").replace(/franchise/g,"")),navIndex:i(this).parents(a.widget).index(a.widget)};i(this).hasClass(r.selected)||(i(".slab",this).css({opacity:.01}).animate({opacity:.99}),i(this).addClass(r.hover)),e.franchiseIndex=i(this).index(a.widget+":eq("+e.navIndex+") "+a.franchise),i(document).trigger(l.page.over,[e])},franchiseOut:function(){var e={franchiseName:i.trim(i(".franchiseLink",this).text()),franchiseClass:i.trim(i(this).attr("class").replace(r.hover,"").replace(r.selected,"").replace(/franchise/g,"")),navIndex:i(this).parents(a.widget).index(a.widget)};i(".slab",this).stop().css({opacity:.99}),i(this).removeClass(r.hover),e.franchiseIndex=i(this).index(a.widget+":eq("+e.navIndex+") "+a.franchise),i(document).trigger(l.page.out,[e])},locationOver:function(){i(this).hasClass(r.selected)||(i(".slab",this).css({opacity:.01}).animate({opacity:.99}),i(this).addClass(r.hover))},locationOut:function(){i(".slab",this).stop().css({opacity:.99}),i(this).removeClass(r.hover)}}},u={eventModel:function(){var e=i(a.widget).attr("title"),s=e.split(" ");i(a.widget).removeAttr("title"),"click"===s[0]?i(".ajax-navigation-element").add(a.locationsGroupNav).off("click",a.franchiseLink,f.user.select).on("click",a.franchiseLink,f.user.select):"over"===s[0]&&(i(a.franchiseLink).die(l.user.franchiseOver,f.user.select).live(l.user.franchiseOver,f.user.select),i(a.widget).live(l.user.franchiseOut,f.user.select))}};i(function(){var e=i(a.ajaxNavigationElement).find(a.locationsGroupNav);0!=i(a.widget).length&&(i.each(l.page,function(e){i(document).bind(l.page[e],f.page[e])}),i.each(c.user.live,function(s){i(c.user.live[s]).die(l.user[s]).live(l.user[s],f.user[s]),e.off(l.user[s],c.user.live[s]).on(l.user[s],c.user.live[s],f.user[s])}),i.each(c.user.traditional,function(e){i(c.user.traditional[e]).unbind(l.user[e]).bind(l.user[e],f.user[e])}),i.each(u,function(e){i.isFunction(u[e])&&u[e]()}))})}();