var J5w={};var N={};var BAID={};var UP=38;var DOWN=40;var LEFT=37;var RIGHT=39;$(document).ready(function(){$('<div id="suggest_box"><div>').appendTo("body");taobaoready();});function taobaoready(){N.lastKey="";N.suggestBox=$("#suggest_box");N.kwf=$("input[id=q]");N.kwf.keyup(function(d){switch(d.keyCode){case LEFT:case RIGHT:return false;break;case DOWN:if(!N.suggestBox.is(":hidden")){var a=$("tr",N.suggestBox);var c=null;if(a.filter(".hover").length>0){c=a.filter(".hover").next();a.removeClass("hover");c.addClass("hover")}else{c=a.eq(0).addClass("hover")}N.kwf.val($(".suggest_keyword",c).text())}return false;break;case UP:if(!N.suggestBox.is(":hidden")){var a=$("tr",N.suggestBox);var c=null;if(a.filter(".hover").length>0){c=a.filter(".hover").prev();a.removeClass("hover");c.addClass("hover")}else{c=a.eq(a.length-1).addClass("hover")}N.kwf.val($(".suggest_keyword",c).text())}return false;break}var b=$.trim(this.value);if(b!=""&&b.length>0){if(b==N.lastKey){return false}N.lastKey=b;loadJS("http://suggest.taobao.com/sug?code=utf-8&callback=TB.Suggest.callback&q="+encodeURIComponent(b)+"&t="+Math.random());}else{N.suggestBox.hide()}});BAID.lastKey="";BAID.suggestBox=$("#suggest_box");BAID.kwb=$("input[id=kw]");BAID.kwb.keyup(function(d){switch(d.keyCode){case LEFT:case RIGHT:return false;break;case DOWN:if(!BAID.suggestBox.is(":hidden")){var a=$("tr",BAID.suggestBox);var c=null;if(a.filter(".hover").length>0){c=a.filter(".hover").next();a.removeClass("hover");c.addClass("hover")}else{c=a.eq(0).addClass("hover")}BAID.kwb.val($(".suggest_keyword",c).text())}return false;break;case UP:if(!BAID.suggestBox.is(":hidden")){var a=$("tr",BAID.suggestBox);var c=null;if(a.filter(".hover").length>0){c=a.filter(".hover").prev();a.removeClass("hover");c.addClass("hover")}else{c=a.eq(a.length-1).addClass("hover")}BAID.kwb.val($(".suggest_keyword",c).text())}return false;break}var b=$.trim(this.value);if(b!=""&&b.length>0){if(b==BAID.lastKey){return false}BAID.lastKey=b;loadJS("http://suggestion.baidu.com/su?wd="+encodeURIComponent(b)+"&ie=utf-8&cb=BD.Suggest.callback&t="+Math.random());}else{BAID.suggestBox.hide()}});$(document).click(function(b){var a=$(b.target);if(a.parents("#suggest_box").length==0){N.suggestBox.hide()}})}function loadJS(a,d){var c="tbsuggent";if($("#"+c)){$("#"+c).remove()}var b=document.body.appendChild(document.createElement("script"));d="utf-8"||d;b.language="javascript";b.id=c;b.charset=d;b.src=a}var TB={};TB.Suggest={};TB.Suggest.callback=function(b){suggestCallback(b,"条结果")};var BD={};BD.Suggest={};BD.Suggest.callback=function(b){suggestCallbackB(b,"")};function suggestCallback(c,f){var e="<table cellspacing='0' cellpadding='0'>";result=c.result;var b=result.length;if(b>0){for(var d=0;d<b;d++){e+="<tr><td class='suggest_keyword'>"+result[d][0]+"</td><td class='suggest_num'>"+result[d][1]+f+"</td></tr>";}e+="</table>";var g=N.kwf.offset();N.suggestBox.html(e).css({left:g.left,top:g.top+N.kwf.outerHeight()});if(N.suggestBox.width()<N.kwf.outerWidth()){$("table",N.suggestBox).width(N.kwf.outerWidth())}N.suggestBox.show();$("tr",N.suggestBox).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).click(function(){N.kwf.val($(".suggest_keyword",this).text());N.suggestBox.hide()})}else{N.suggestBox.hide()}};function suggestCallbackB(c,f){var e="<table cellspacing='0' cellpadding='0'>";result=c.s;var b=result.length;if(b>0){for(var d=0;d<b;d++){e+="<tr><td class='suggest_keyword'>"+result[d]+"</td></tr>";}e+="</table>";var g=BAID.kwb.offset();BAID.suggestBox.html(e).css({left:g.left,top:g.top+BAID.kwb.outerHeight()});if(BAID.suggestBox.width()<BAID.kwb.outerWidth()){$("table",BAID.suggestBox).width(BAID.kwb.outerWidth())}BAID.suggestBox.show();$("tr",BAID.suggestBox).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).click(function(){BAID.kwb.val($(".suggest_keyword",this).text());BAID.suggestBox.hide()})}else{BAID.suggestBox.hide()}};