function createXMLHttp(){var ret=null;try{ret=new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{ret=new ActiveXObject('Microsoft.XMLHTTP')}catch(ee){ret=null}}if(!ret&&typeof XMLHttpRequest!='undefined'){ret=new XMLHttpRequest()}return ret}var xmlHttp;var bShow=false;var iLen=0;var iIndex=0;var sKey="";


function fnGetResult(){if($("kw").value==""){return}if($("kw").value==sKey){return}sKey=$("kw").value;xmlHttp=createXMLHttp();xmlHttp.onreadystatechange=fnHandle;xmlHttp.open("post","/admin/searc/search.asp",true);xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');xmlHttp.send("s=1&key="+escape(sKey))}

function fnHandle(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){fnInitData(xmlHttp.responseText)}}}

function fnInitData(data){iIndex=0;if(eval(data)=='undefined'){return false}var oData=eval(data);try{iLen=oData.length}catch(e){}if(iLen==0){$("suggest").style.display="none";bShow=false}else{var sRet="<ul>";for(var i=0;i<iLen;i++){sRet+="<li onclick=\"fnGoTo("+oData[i].id+")\" onmouseover=\"this.className=\'on\'\" onmouseout=\"this.className=''\">"+oData[i].status+oData[i].title+"</li>"}sRet+="</ul>";sRet+="<div><a href='javascript:void(0);' onclick='fnClose()'>×关闭</a></div>";$("suggest").innerHTML=sRet;$("suggest").style.display="block";bShow=true}}

function fnGoTo(id){window.location.href="/manhua/"+id}

function fnKeyup(e){var iKey=(window.event)?e.keyCode:((e.which)?e.which:0);if(iKey==40||iKey==38){iIndex=(iKey==40)?((iIndex>=iLen)?0:++iIndex):((iIndex<=0)?iLen:--iIndex);fnToogle(iIndex)}else{window.setTimeout(fnGetResult,300)}}

function searchSend(){if(iIndex>0){$("suggest").getElementsByTagName("li")[iIndex-1].onclick()}else{if($('kw').value==''){window.alert('请输入您要查找的漫画！');$('kw').focus();return false}window.location.href='/admin/searc/search.asp?key='+$("kw").value}}

function fnKeydown(e){var iKey=(window.event)?e.keyCode:((e.which)?e.which:0);if(iKey==13){(iIndex>0)?$("suggest").getElementsByTagName("li")[iIndex-1].onclick():searchSend()}}

function fnToogle(p){var oSuggest=$("suggest").getElementsByTagName("li");for(var i=0;i<iLen;i++){oSuggest[i].className=""}if(p>0){oSuggest[p-1].className="on";$('kw').value=oSuggest[p-1].getElementsByTagName("p")[0].innerText}}

function fnFocus(){setTimeout(fnGetResult,500);if(bShow){$("suggest").style.display="block"}}

function fnBlur(){setTimeout(fnClose,500)}

function fnClose(){$("suggest").style.display="none"}window.onerror=function(){return true}
