function JTongToolBarButton_init(){var $toolbarbuttons=$(".jtongui-toolbarbutton");$toolbarbuttons.each(function(){var menuID=$(this).attr("menu");var iconClass=$(this).attr("icon");var text=$(this).html();var $span_icon=$("<span class='icon "+iconClass+"'>&nbsp;</span>");var $span_text=$("<span class='text'>"+text+"</span>");var $span_arrow=$("<span class='arrow'>&nbsp;</span>");var $container=$("<span class='container'></span>");$container.append($span_icon).append($span_text);if(menuID!=undefined){$container.append($span_arrow)};$container.mouseover(function(){$(this).addClass("mouseover");if(menuID!=undefined){var $menu=$("#"+menuID+"");var offset=$(this).offset();var top=0;var left=0;top=offset.top+$(this).outerHeight();left=offset.left+2;JTongToolBarButton_initToolBarButtonMenu($menu);$menu.show();$menu.offset({top:top,left:left});$menu.mouseover(function(){$menu.show()});$menu.mouseout(function(){$menu.hide()})}});$container.mouseout(function(){$(this).removeClass("mouseover");$(".jtongui-toolbarbutton-menu").hide()});$(this).html("");$(this).append($container)})};function JTongToolBarButton_initToolBarButtonMenu($menu){var $container=null;$container=$menu.find(".container");if($container.length==0){$container=$("<div class='container'></div>")};var $menuItems=$menu.find("a");$menuItems.each(function(){if($(this).find(".text").length==0){var text=$(this).html();var iconClass=$(this).attr("icon");var $span_icon=$("<span class='icon "+iconClass+"'>&nbsp;</span>");var $span_text=$("<span class='text'>"+text+"</span>");$(this).html("");$(this).append($span_icon).append($span_text)};var $anode=$(this).detach();$container.append($anode)});if($menu.find(".container").length==0){$menu.append($container)}}