(function(a){a.bhTabNav=a.fn.bhTabNav=function(j){var d=a.extend({childMenuBoundrySelector:".shellContentWrapper:eq(0)",isIe6:false,tabWidth:0,tabContentWidth:0,hash:"",iWatchInterval:null,getApi:false},j);var h=function(){if(a.browser.msie&&a.browser.version<7){d.isIe6=true}d.hash=window.location.hash;d.tabWidth=a(".centersTab:eq(0)").outerWidth();i();f()};var i=function(){if(d.hash.contains("#tabContent")&&d.hash!=""){var k=g(d.hash);setTimeout(function(){b(k,false,false);a(".centersTabConnect").show()},1)}else{b(0,false,false);a(".centersTabConnect").show()}};var f=function(){a(".centersTabs a").click(function(k){k.preventDefault()});a(".centersTabs a").hover(function(l){var k=g(a(this).attr("href"));b(k,true,true)})};var c=function(){clearInterval(d.iWatchInterval);return setInterval(function(){if(d.hash!=window.location.hash){if(window.location.hash.contains("#tabContent")){clearInterval(d.iWatchInterval);var k=g(window.location.hash);b(k,false,true)}}},100)};var g=function(k){var l=0;a(".centersTabs").find("a").each(function(){if(a(this).attr("href")==k){return false}l++});return l};var b=function(n,o,m){if(typeof(m)=="undefined"){m=true}var p='[href="#tabContent'+(n+1)+'"]';a(".centersTab").each(function(){var v=a(this).find("a:eq(0)");var u=a(this).find("img:eq(0)");var x=a(u).attr("src");var r="";var t="";var s=x.substring(x.length-4,x.length);var w=x.substring(0,x.length-4);if(typeof(a(u).attr("src_on"))=="undefined"){a(u).attr("src_on",x);t=x}else{t=a(u).attr("src_on")}if(typeof(a(u).attr("src_off"))=="undefined"){if(w.endsWith("_on")){r=w.substring(0,w.length-3)+s}else{r=w+s}a(u).attr("src_off",r)}else{r=a(u).attr("src_off")}if(a(v).is(p)){if(t!=""){a(u).attr("src",t)}}else{if(r!=""){a(u).attr("src",r)}}});var l=(n*d.tabWidth)+(n*11)-9;if(o){a(".centersTabConnect").stop();a(".centersTabConnect").animate({left:l+"px"},"fast")}else{a(".centersTabConnect").css("left",l+"px")}var k=a("#tabContent"+(n+1)).get(0);var q="#tabContent"+(n+1);if(o){a(".centersPositionWrapper").stop();a(".centersPositionWrapper").scrollTo(q,{axis:"x",offset:{left:-1},duration:"medium",onAfter:function(){if(m){e(k)}d.iWatchInterval=c()}})}else{a(".centersPositionWrapper").scrollTo(q,{axis:"x",offset:{left:-1},onAfter:function(){if(m){e(k)}d.iWatchInterval=c()}})}};var e=function(m){var l=a(m).attr("id")||a(m).attr("name");if(isDefined(l)&&l!=""){var k=a("<a> </a>").attr("id",l);a(k).css({position:"absolute",top:a(window).scrollTop(),left:a(window).scrollLeft()});a(l+"eq(0)").attr("id","");a("body").prepend(k);window.location.hash="#"+l;d.hash=window.location.hash;a(k).remove();a(l+"eq(0)").attr("id",l)}};h();return a}})(jQuery);
