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