text: var mix_Suggest=function(a){that=this;that.opt=a||{};that.operator=that.opt.operator||".keyword";that.ajaxUrl=that.opt.ajaxUrl||"h5ajax.php";that.mix_initInput()};
  mix_Suggest.prototype={mix_initInput:function(){var a=document.getElementById("keyword");a.autocomplete="off";a.addEventListener("input",function(){var b=a.value.replace(/(^\s+)|(\s+$)/g,"");that.mix_ajax(b)})},mix_ajax:function(a){if(""==a.replace(/(^\s*)|(\s*$)/g,""))that.getElemByClassName(".mix_search_list")[0].innerHTML="",that.getElemByClassName(".mix_search_list")[0].style.display="none",that.getElemByClassName(".mix_recently_search")[0].style.display="block";else{var b=document.getElementsByName("sid")[0].value;
  $.ajax({type:"POST",url:searchUrl+that.ajaxUrl,data:{keyword:a,sid:b},dataType:"json",success:function(a){that.mix_updateList(a)},error:function(a,b,e){console.log(e)}})}},mix_updateList:function(a){var b=[],c=[],d="";that.getElemByClassName(".mix_search_list")[0].innerHTML="";that.getElemByClassName(".mix_search_list")[0].style.display="block";that.getElemByClassName(".mix_recently_search")[0].style.display="none";if(0==a.errorCode){if(""!=a.category){for(var e=0;e<a.category.length;e++)d="",1==
  a.category[e][3]&&(d=a.category[e][2]),0==a.category[e][3]&&(d=a.category[e][0]),c.push("<a class='child'><span class='value'>\u5728<span class='c_32dcdc'>"+a.category[e][1]+"</span>\u4e2d\u641c</span><input type='hidden' value='"+d+"'/></a>");d=c.join("")}a=a.word;c=a.length;10<c&&(c=10);for(var f="has_tj",e=0;e<c;e++)0!=e&&(f=d=""),b.push("<li class='"+f+"'><a><span class='value'>"+a[e].key+"</span><span class='num'></span></a>"+d+"</li>");a="<ul>"+b.join("")+"</ul>";that.getElemByClassName(".mix_search_list")[0].innerHTML=
  a;that.effect()}else that.getElemByClassName(".mix_search_list")[0].innerHTML="",that.getElemByClassName(".mix_search_list")[0].style.display="none"},effect:function(){for(var a=that.getElemByClassName(".mix_search_list")[0].firstChild.children,b=0;b<a.length;b++)(function(){var c=b;if(0==b){var d=a[0].children;2<=d.length&&(d[1].onclick=function(){that.changeVal(a[c].firstChild.firstChild.innerHTML,a[c].children[1].children[1].value)});3<=d.length&&(d[2].onclick=function(){that.changeVal(a[c].firstChild.firstChild.innerHTML,
  a[c].children[2].children[1].value)})}a[b].firstChild.onclick=function(){that.changeVal(a[c].firstChild.children[0].innerHTML,0)}})()},changeVal:function(a,b){document.getElementById("keyword").value=a;document.getElementById("cid").value=b;that.getElemByClassName(".mix_search_list")[0].innerHTML="";that.getElemByClassName(".mix_search_list")[0].style.display="none";document.getElementById("index_search_form").onsubmit();document.getElementById("index_search_form").submit()},getElemByClassName:function(a){var b=
  a.match(/\.\S*/),c=(a=a.match(/\s\S[\S]*/ig))?a.length:0,d=null;0<b.length&&(d=document.querySelectorAll(b[0]));if(d&&0<d.length)return a&&0<c?d[0].getElementsByTagName(a[0].replace(/^\s+/,"").replace(/\s+$/,"")):d}};var ready=function(a){document.addEventListener&&document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,!1);a()},!1)};
  ready(function(){new mix_Suggest({ajaxUrl:"suggest.php"});document.getElementById("keyword").focus();showRecently();document.getElementById("keyword").onfocus=function(){document.getElementById("clear_input").style.display="block"};document.getElementById("clear_input").onclick=function(){document.getElementById("keyword").value="";that.getElemByClassName(".mix_search_list")[0].innerHTML="";that.getElemByClassName(".mix_search_list")[0].style.display="none";that.getElemByClassName(".mix_recently_search")[0].style.display=
  "block";document.getElementById("clear_input").style.display="none"}});function mix_submit_search(){var a=document.getElementById("keyword").value;if(""==a.replace(/(^\s*)|(\s*$)/g,""))return document.getElementById("keyword").focus(),!1;setRecently(a);return!0}
  function recently_click(a){document.getElementById("keyword").value=a;var b=getStorage("recently_search"),c=[];if(""!=b)for(c=b.split("|"),b=c.length-1;0<=b;b--)c[b]==encodeURI(a)&&c.splice(b,1);c.unshift(encodeURI(a));recently_str=c.join("|");setStorage("recently_search",recently_str);document.getElementById("index_search_form").submit()}
  function setRecently(a){var b=getStorage("recently_search"),c=[];if(""!=b)for(c=b.split("|"),b=c.length-1;0<=b;b--)c[b]==encodeURI(a)&&c.splice(b,1);20<=c.length&&c.pop();c.unshift(encodeURI(a));recently_str=c.join("|");setStorage("recently_search",recently_str)}
  function delOneRecently(a,b){that.getElemByClassName(".mix_recently_search")[0].getElementsByTagName("li")[b].style.display="none";var c=getStorage("recently_search"),d=[];if(""!=c)for(d=c.split("|"),c=d.length-1;0<=c;c--)d[c]==encodeURI(a)&&d.splice(c,1);recently_str=d.join("|");setStorage("recently_search",recently_str)}
  function clearRecently(){that.getElemByClassName(".mix_recently_search")[0].innerHTML='<h3>\u641c\u7d22\u5386\u53f2</h3><div class="recently_search_null">\u6ca1\u6709\u641c\u7d22\u8bb0\u5f55</div>';setStorage("recently_search","")}
  function showRecently(){var a=getStorage("recently_search"),b="<h3>\u641c\u7d22\u5386\u53f2</h3>";if(""!=a){for(var a=a.split("|"),b=b+"<ul>",c=0;c<a.length;c++)var d=decodeURI(a[c]),b=b+("<li><a  onclick=\"recently_click('"+d+"')\" href='javascript:void(0)'>"+d+"</a><span onclick=\"delOneRecently('"+d+"',"+c+')"></span></li>');b=b+"</ul>"+("<a href='javascript:void(0)' onclick='clearRecently()' class='clear_recently_search'><img src='"+proxyAssets+"images/delete_icon.png' alt='' width='15' height='15'>&nbsp;\u6e05\u7a7a\u5386\u53f2\u8bb0\u5f55</a>")}else b+=
  '<div class="recently_search_null">\u6ca1\u6709\u641c\u7d22\u8bb0\u5f55</div>';that.getElemByClassName(".mix_recently_search")[0].innerHTML=b};
  