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