$(document).ready(function(){var o=-1;var r;var j;var l;var q=$("#keywords");var k=q.offset();var n=$("#search_suggest");n.hide().css("border","1px solid #999999").css("position","absolute").css("top",k.top+q.height()+8+"px").css("left",k.left+"px").width(q.width()+6).css("color","#aaaaaa").css("z-index","1000").css("background-color","#FFFFFF");q.keyup(function(b){var a=b||window.event;var e=a.keyCode;if(e!=38&&e!=40&&e!=13){var c=q.val();if(c!=""){window.clearTimeout(l);l=window.setTimeout(function(){$.post("ajax.php?do=search",{keywords:c},function(f){n.html("");j=$(f).find("text");j.each(function(){var g=$(this).text();if(g!=null){$("<div>").css("font-size","13px").css("height","18px").css("padding-top","1px").html(g).appendTo(n)}});if(j.length>0){r=n.children("div");n.mouseover(function(){if(o!=-1){r.eq(o).css("background-color","white").css("color","#aaaaaa");o=-1}});r.each(function(){var g=$(this);g.css("cursor","pointer").mouseover(function(){g.css("background-color","#7EC0EE").css("color","#000000")}).mouseout(function(){g.css("background-color","white").css("color","#aaaaaa")}).click(function(){q.val(g.text());n.hide()})});o=-1;n.show()}else{o=-1;n.hide()}},"xml")},300)}}else{if(e==38||e==40||e==13){if(e==40){if(o!=-1){r.eq(o).css("background-color","white").css("color","#aaaaaa")}o++;if(o==r.length){o=0}r.eq(o).css("background-color","#7EC0EE").css("color","#000000")}if(e==38){if(o!=-1){r.eq(o).css("background-color","white").css("color","#aaaaaa");o--}if(o==-1){o=r.length}r.eq(o).css("background-color","#7EC0EE").css("color","#000000")}if(e==13){if(o!=-1){var d=r.eq(o).text();q.val(d);o=-1;n.hide()}else{m();q.get(0).blur();n.hide()}}}}});var p=$("#commit");p.click(m);function m(){var a=q.val();window.location.href="search.php?keywords="+a}});
