(function(){var b=Flavors.Global.namespace("Flavors.Layout.Simple"),d=Flavors.Logger.getLogger(b.__name__),g=false;Flavors.Layout=b;b.selectors={service_link:"#profile_navigation",description:"#profile_description",service_name:".navigation_service_{{{service_id}}} a"};b.init=function(){$("#profile_navigation a").live("click",function(a){d("nav click handler");a.preventDefault();g||$(this).closest("li").each(function(){var c=this.id.replace("navigation_service_","");if(c){d("serviceAnchor="+c);(c=
Flavors.TemplateGroup.preparePanel(c))&&i(c)}})});e=$(window).height();$(window).resize(function(){e=$(window).height();h()});h();setTimeout(h,1E3);$(window).scroll(function(){if($("#profile").height()>e){var a=50;if($(window).scrollTop()+e>$("#profile").height()+100)a=$(window).scrollTop()+e-$("#profile").height()-50;$("#profile").css({top:a+"px"})}});Flavors.Page.Fonts.updateHeader({align:"left",max_width:450})};b.removeService=function(a){$("#service_"+a+", .navigation_service_"+a).fadeOut(250,
function(){$(this).remove()})};b.switchToService=function(a){d("switchToService() serviceAnchor="+a);if(a=="_")b.closeAllServices();else(a=Flavors.TemplateGroup.preparePanel(a))&&i(a)};b.replaceService=function(a){d("replaceService()");$("#service_"+a.id).html(a.html);Flavors.TemplateGroup.registerPanel(a.anchor);b.switchToService(a.anchor)};var k=function(a){var c={};$("#profile_navigation li").each(function(){c[parseInt($(this).attr("class").replace("navigation_service_","").replace("navigation_service ",
""))]=this;$(this).remove()});$.each(a,function(l,j){d("new order item......");$("#profile_navigation").append(c[j])})};b.reorderServices=function(a){d("reorderServices()");k(a)};b.addService=function(a){$("#profile_navigation").append($.LI({"class":"navigation_service navigation_service_"+a.id,id:"navigation_service_"+a.anchor},$.A({"class":"color_5",href:"#"},a.title)));var c=$.DIV({"class":"panel-box background_2",id:"service_"+a.id});$(c).html(a.html).appendTo($("#services"));Flavors.TemplateGroup.registerPanel(a.anchor);
b.switchToService(a.anchor)};b.closeAllServices=function(a){a&&a.preventDefault();if(f){$(f.element).fadeOut();f=null}$.address.value("_")};var f=null,i=function(a){g=true;d("transitionToPanel() panel.serviceAnchor="+a.serviceAnchor);var c=function(){$(a.element).fadeIn(500,function(){if(navigator.platform=="iPad"||navigator.platform=="iPhone"||navigator.platform=="iPod"){servicesScroll instanceof iScroll&&servicesScroll.refresh();profileScroll instanceof iScroll&&profileScroll.refresh()}});$.address.value(a.serviceAnchor.replace("-",
"/"));g=false};if(f){$(f.element).fadeOut(500,function(){if(navigator.platform=="iPad"||navigator.platform=="iPhone"||navigator.platform=="iPod")servicesScroll instanceof iScroll&&servicesScroll.scrollTo(0,0,"0ms")});setTimeout(c,500)}else c();f=a},e=$(window).height(),h=function(){$("#profile").height()+100>e?$("#profile").css({position:"absolute"}):$("#profile").css({position:"fixed"})}})();

