var f2_inputid="",f2_frienddata=[],f2_seluid=0,f2_word1="",f2_word2="",f2_pars="",f2_maxnum=0;
function friendSuggest2(a,c,d,b){f2_inputid=a;f2_word1=c;f2_word2=d;var e=$j("#"+f2_inputid);if($j("#f2_suggest").length>0)if(e.next("#f2_suggest").length)return;else $j("#f2_suggest").remove();a=getpos(e[0]);a='<div class="fsg_nl" id="f2_suggest" style="display:none;border-width: 1px 1px 1px 1px; z-index:99999;width:'+(a.right-a.left-5)+'px;"></div><div id="f2_emptysuggest" class="fsg_nl" style="z-index:99999;display:none;font-size:12px;padding-left:7px;background:#eeeeee;color:#666666;width:'+(a.right-
a.left-9+32)+'px;border-width:1px 1px 1px 1px;"></div>';b&&b.append_to_body?$j("body").append(a):e.after(a);f2_adjustPos();b=e.nextAll("span");b.length&&b.click(function(){var f=e.val();document.location=f.length>0&&f!="\u67e5\u627e\u597d\u53cb..."?"/find/search.php?open=other&real_name="+encodeURIComponent(f):"/friend/search.php"})}
function f2_adjustPos(){var a=getpos($j("#"+f2_inputid)[0]);try{$j("#f2_suggest").css("left",parseInt(a.left)).css("top",parseInt(a.bottom+1)).css("width",parseInt(a.right-a.left-5+12));$j("#f2_emptysuggest").css("left",parseInt(a.left)).css("top",parseInt(a.bottom+1)).css("width",parseInt(a.right-a.left-9+32))}catch(c){}}function f2_inputOnfocus(a,c){if(c.value==""){f2_adjustPos();$j("#f2_emptysuggest").html(f2_word1).css("display","block")}}
function f2_inputOnkeydown(a,c){var d=$j("#f2_suggest");$j("#"+f2_inputid);var b=$j("#f2_emptysuggest");if(a.keyCode==13){if(b.is(":visible"))document.location=c.value==""?"/friend/search.php":"/find/search.php?open=other&real_name="+encodeURIComponent(c.value);return false}var e=f2_getHotNum();b=e.hotnum;e=e.totalnum;if(a.keyCode==40)if($j("#f2_suggest_0").length&&d.is(":visible")){if(b==-1)$j("#f2_suggest_0").attr("class","sgt_on");else{d=b==e-1?0:b+1;$j("#f2_suggest_"+b).attr("class","sgt_of");
$j("#f2_suggest_"+d).attr("class","sgt_on")}return false}if(a.keyCode==38)if($j("#f2_suggest_0").length&&d.is(":visible"))if(b==-1)$j("#f2_suggest_"+(e-1)).attr("class","sgt_on");else{d=b==0?e-1:b-1;$j("#f2_suggest_"+b).attr("class","sgt_of");$j("#f2_suggest_"+d).attr("class","sgt_on")}}
function f2_inputOnkeyup(a){var c=$j("#f2_suggest"),d=$j("#"+f2_inputid);$j("#f2_emptysuggest");for(var b=false,e=0;e<f2_frienddata.length;e++)if(f2_frienddata[e].real_name==d.val())b=true;if(b==false)f2_seluid=0;if(a.keyCode==13){b=f2_getHotNum();a=b.hotnum;b=b.totalnum;if(c.is(":visible")&&a!=-1&&b>0){d.val(f2_frienddata[a].real_name_unsafe);f2_seluid=f2_frienddata[a].uid;"function"==typeof f2_gotouser&&f2_gotouser(f2_seluid);c.hide()}}else a.keyCode==38||a.keyCode==40||f2_ajax_submit()}
function f2_ajax_submit(){var a=$j("#"+f2_inputid).val();$j.ajax({type:"post",url:"/interface/suggestfriend.php",dataType:"json",success:function(c){f2_ajax_show(c,a)},data:{text:a,pars:f2_pars,maxnum:f2_maxnum}})}
function f2_ajax_show(a,c){f2_frienddata=a;var d=$j("#f2_suggest"),b=$j("#"+f2_inputid),e=$j("#f2_emptysuggest");if(a.length==0){d.hide();if(b.val()==""){e.html(f2_word1);e.show()}else{f2_word2="\u4f60\u7684\u597d\u53cb\u91cc\u9762\u6ca1\u6709"+c+"\uff0c\u8bf7\u6309\u56de\u8f66\u641c\u7d22";if(f2_word2=="")e.hide();else{e.html(f2_word2);e.show()}}}else{b="";for(var f=0;f<a.length;f++)b+="<div id=f2_suggest_"+f+' class="sgt_of" style="border-width: 1px 1px 1px 1px;font-size:12px;width:'+(parseInt(d.css("width"))-
10)+'px;" onmouseover="f2_suggestOnmouseover(this)" onmousedown="f2_suggestOnmousedown(this);">'+a[f].real_name+"&nbsp;&nbsp;"+f2_logo20(a[f])+"</div>";d.html(b);d.show();e.hide();f2_adjustPos();$j("#f2_suggest_0").length&&d.is(":visible")&&$j("#f2_suggest_0").attr("class","sgt_on")}}function f2_getHotNum(){for(var a,c=0,d=-1;a=$j("#f2_suggest_"+c)[0];){if(a.className=="sgt_on")d=c;c++}return{hotnum:d,totalnum:c}}
function f2_suggestOnmouseover(a){a=a.id.split("_")[2];for(var c,d=0;c=$j("#f2_suggest_"+d)[0];){c.className=a==d?"sgt_on":"sgt_of";d++}}function f2_suggestOnmousedown(a){a=a.id.split("_")[2];$j("#"+f2_inputid).val(f2_frienddata[a].real_name_unsafe);f2_seluid=f2_frienddata[a].uid;"function"==typeof f2_gotouser&&f2_gotouser(f2_seluid);$j("#f2_suggest").hide()}function f2_inputOnblur(){$j("#f2_suggest").hide();$j("#f2_emptysuggest").hide()}
function f2_logo20(a){var c="";if(typeof a.logo20!="undefined")c="<img src='"+a.logo20+"'  align=absmiddle width=15  />";return c};
