var JTongTabsSearchBox_currentTooltipText="";function JTongTabsSearchBox_init(){$(".jtongui-tabssearchbox").each(function(){var $keywords=$(this).find("input.keywords").eq(0);var $searchButton=$(this).find(".searchbtn input").eq(0);var currTabIndex=0;var $liList=$(this).find(".header li");$liList.click(function(){$liList.removeClass("tabheader-selected");$(this).addClass("tabheader-selected");var tooltipText=$(this).attr("tooltipText");if(tooltipText!=undefined){JTongTabsSearchBox_currentTooltipText=tooltipText;if(!$keywords.hasClass("focus")){$keywords.val(tooltipText);$keywords.removeClass("focus")}};var index=$(this).index();currTabIndex=index;JTongTabsSearchBox_onSelectIndexChanged(index)});$liList.each(function(){var tooltipText=$(this).attr("tooltipText");var className=$(this).attr("class");if(className=="tabheader-selected"){if(tooltipText!=undefined){$keywords.val(tooltipText);JTongTabsSearchBox_currentTooltipText=tooltipText}}});$keywords.focus(function(){var keywords=$(this).val();if(keywords==JTongTabsSearchBox_currentTooltipText){$(this).val("");$(this).addClass("focus")}});$keywords.focusout(function(){var keywords=$(this).val();if(keywords==""){$(this).val(JTongTabsSearchBox_currentTooltipText);$(this).removeClass("focus")}});$keywords.keydown(function(event){if(event.keyCode==13){JTongTabsSearchBox_onSearch(currTabIndex,$(this).val())}});$searchButton.click(function(){try{JTongTabsSearchBox_onSearch(currTabIndex,$keywords.val())}catch(e){}})});JTongTabsSearchBox_resize();$(window).resize(function(){try{JTongTabsSearchBox_resize()}catch(e){}})};function JTongTabsSearchBox_resize(){$(".jtongui-tabssearchbox").each(function(){var controlWidth=$(this).outerWidth();var searchbtnWidth=$(this).find(".searchbtn").eq(0).outerWidth();var advsearchWdith=0;var $advsearchObj=$(this).find(".advsearch");if($advsearchObj.length>0){advsearchWdith=$advsearchObj[0].scrollWidth};var searchBoxWidth=controlWidth-advsearchWdith-searchbtnWidth-45;$(this).find(".searchbox").width(searchBoxWidth)})}