var initSearchFlag=false;orderID=0;searchType=1;var formAction;function formOpen(A){formAction=A;var B=document.getElementById("_form_window_open_");B.setAttribute("action",formAction);B.submit()}function openForm(){if(document.getElementById("KeyWordInput").value==""){currentLI_Index=-1;return false}if(searchType!=1&&currentLI_ElementList.length<1){return false}var A=null;if(searchType!=1&&currentLI_Index>=0){A=currentLI_ElementList[currentLI_Index].getAttribute("code")}this.SelectNowFalg=false;if(searchType==1){formAction="http://quotes.money.163.com/query_result.jsp?code="+escape(document.getElementById("KeyWordInput").value)}else{if(searchType==3){formAction="http://quotes.money.163.com/"+A+".html"}else{if(searchType==4){if(A!=null&&A.substring(0,1)=="0"){formAction="http://guba.money.163.com/bbs/list.jsp?boardid=sh"+A.substring(1,A.length)}else{if(A!=null){formAction="http://guba.money.163.com/bbs/list.jsp?boardid=sz"+A.substring(1,A.length)}}}else{if(searchType==2){formAction="http://quotes.fund.163.com/fundDetail.html?code="+A}else{if(searchType==5){formAction="http://fund8.money.163.com/bbs/list.jsp?boardid="+A}}}}}var B=document.getElementById("_form_window_open_");B.setAttribute("action",formAction);return true}function setSearchType(A){searchType=A;if(searchType!=1){document.getElementById("KeyWordInput").value="名称/拼音/代码"}else{document.getElementById("KeyWordInput").value='名称/拼音/代码  同时查询多只用","隔开'}}function SelectFrame(){this.SelectNowFalg=true}SelectFrame.prototype.getResult=function(){var C=document.getElementById("KeyWordInput").value;if(C==""||C=="名称/拼音/代码"){this.hideFrame();return }switch(searchType){case 1:return ;break;case 3:case 4:url_s="http://quotes.money.163.com/query_list_result.jsp?key="+C;break;case 2:url_s="http://quotes.fund.163.com/fund_ajax.jsp?t=of&q="+C;break;case 5:url_s="http://quotes.fund.163.com/fund_ajax.jsp?q="+C;break;default:}var A=document.getElementById("data_ajax_search");if(A){A.parentNode.removeChild(A)}var B=document.createElement("script");B.type="text/javascript";B.src=url_s;B.id="data_ajax_search";document.body.appendChild(B)};function loadDataFinish(A){var C='<ul class="c_ul">';orderID=0;switch(searchType){case 1:case 3:case 4:for(var B=0;B<__SearchArrayData__.length;B++){if(__SearchArrayData__[B]!=null){C+='<li class="c_ul_li" id="_li_element_'+orderID+'" code="'+__SearchArrayData__[B][2]+'" onmouseover=serachUtil.focus(this); onmouseout=serachUtil.blur(this);><div class="leftDiv"><input type="checkBox" value="'+__SearchArrayData__[B][2]+'" name="selectOne" id="selectThisID_'+orderID+'" /></div><div class="centerDiv" onclick="serachUtil.select(\''+__SearchArrayData__[B][2]+'\');"><a href="javascript:void(0)" target="_self">'+__SearchArrayData__[B][1]+'</a></div><div class="rightDiv" onclick="serachUtil.select(\''+__SearchArrayData__[B][2]+'\');"><a href="javascript:void(0)" target="_self">'+__SearchArrayData__[B][0]+'</a></div><div class="clear"></div></li>';orderID++}}break;case 2:case 5:for(var B=0;B<__SearchArrayData__.length;B++){if(__SearchArrayData__[B]!=null){C+='<li class="c_ul_li" id="_li_element_'+orderID+'" code="'+__SearchArrayData__[B][0]+'" onmouseover=serachUtil.focus(this); onmouseout=serachUtil.blur(this);><div class="leftDiv"><input type="checkBox" value="'+__SearchArrayData__[B][0]+'" name="selectOne" id="selectThisID_'+orderID+'" /></div><div class="centerDiv" onclick="serachUtil.select(\''+__SearchArrayData__[B][0]+'\');"><a href="javascript:void(0)" target="_self">'+__SearchArrayData__[B][1]+'</a></div><div class="rightDiv" onclick="serachUtil.select(\''+__SearchArrayData__[B][0]+'\');"><a href="javascript:void(0)" target="_self">'+__SearchArrayData__[B][0]+'</a></div><div class="clear"></div></li>';orderID++}}break;default:}C+="</ul>";document.getElementById("resultListDiv").innerHTML=C;document.getElementById("resultListDiv").style.display="block"}function openFund(A){formOpen("http://quotes.fund.163.com/fundDetail.html?code="+A)}function openFundBBS(A){formOpen("http://fund8.money.163.com/bbs/list.jsp?boardid="+A)}function openQuote(A){formOpen("http://quotes.money.163.com/"+A+".html")}function openQuoteBBS(A){if(A!=null&&A.substring(0,1)=="0"){formOpen("http://guba.money.163.com/bbs/list.jsp?boardid=sh"+A.substring(1,A.length))}else{if(A!=null){formOpen("http://guba.money.163.com/bbs/list.jsp?boardid=sz"+A.substring(1,A.length))}}}SelectFrame.prototype.select=function(A){this.SelectNowFalg=false;switch(searchType){case 1:case 3:openQuote(A);break;case 4:openQuoteBBS(A);break;case 2:openFund(A);break;case 5:openFundBBS(A);break;default:}};SelectFrame.prototype.FrameFocus=function(){if(document.getElementById("KeyWordInput").value=="名称/拼音/代码"||document.getElementById("KeyWordInput").value=='名称/拼音/代码  同时查询多只用","隔开'){document.getElementById("KeyWordInput").value=""}if(initSearchFlag==false){initSearch()}};SelectFrame.prototype.FrameBlur=function(){if(document.getElementById("KeyWordInput").value==""){if(searchType!=1){document.getElementById("KeyWordInput").value="名称/拼音/代码"}else{document.getElementById("KeyWordInput").value='名称/拼音/代码  同时查询多只用","隔开'}}};SelectFrame.prototype.focus=function(A){this.SelectNowFalg=true;A.style.background="#D18BD0"};SelectFrame.prototype.blur=function(A){A.style.background="#EDF6FE";this.SelectNowFalg=false};SelectFrame.prototype.hideFrame=function(){if(this.SelectNowFalg==true){}else{document.getElementById("resultListDiv").style.display="none"}};submitAllSelect=function(){if(searchType==1){formOpen("http://quotes.money.163.com/query_result.jsp?code="+escape(document.getElementById("KeyWordInput").value))}else{for(var A=0;A<orderID;A++){var B=document.getElementById("selectThisID_"+A);if(B){if(B.checked==true){switch(searchType){case 3:openQuote(B.value);break;case 4:openQuoteBBS(B.value);break;case 2:openFund(B.value);break;case 5:openFundBBS(B.value);break;default:}}}}}};var serachUtil=new SelectFrame();function getLeft(A){var B=A.offsetLeft;if(A.offsetParent!=null){B+=getLeft(A.offsetParent)}return B}function getTop(A){var B=A.offsetTop;if(A.offsetParent!=null){B+=getTop(A.offsetParent)}return B}var currentLI_Index=-1;var currentLI_ElementList=null;function initSearch(){if(initSearchFlag==false){initSearchFlag=true}else{return }var A=document.createElement("div");A.id="resultListDiv";A.style.position="absolute";A.style.top=(getTop(document.getElementById("KeyWordInput"))+22)+"px";A.style.left=getLeft(document.getElementById("KeyWordInput"))+"px";A.style.width=220;A.style.background="url(http://data.money.163.com/dataimg/bg.gif)";A.style.zIndex=90001;A.style.display="none";document.body.appendChild(A);document.body.onmousedown=function(){serachUtil.hideFrame()};document.getElementById("KeyWordInput").onkeyup=function(D){if(document.getElementById("KeyWordInput").value==""){currentLI_Index=-1;return }var B=window.event?window.event:D;if(B.keyCode!=13&&B.keyCode!=38&&B.keyCode!=40){serachUtil.getResult()}currentLI_ElementList=new Array();for(var C=0;C<orderID;C++){currentLI_ElementList.push(document.getElementById("_li_element_"+C))}if(searchType!=1&&currentLI_ElementList.length<1){return }switch(B.keyCode){case 13:if(searchType==1){formOpen("http://quotes.money.163.com/query_result.jsp?code="+escape(document.getElementById("KeyWordInput").value))}else{serachUtil.select(currentLI_ElementList[currentLI_Index].getAttribute("code"))}break;case 33:break;case 34:break;case 16:break;case 17:break;case 38:if(currentLI_Index>0){currentLI_Index--;currentLI_ElementList[currentLI_Index+1].style.background="#EDF6FE";currentLI_ElementList[currentLI_Index].style.background="#D18BD0"}break;case 40:if(currentLI_Index<currentLI_ElementList.length-1){currentLI_Index++;if(currentLI_Index-1>=0){currentLI_ElementList[currentLI_Index-1].style.background="#EDF6FE"}currentLI_ElementList[currentLI_Index].style.background="#D18BD0"}break;default:if(currentLI_ElementList[currentLI_Index]!=null){currentLI_ElementList[currentLI_Index].style.background="#EDF6FE"}if(currentLI_Index<0||currentLI_Index>=currentLI_ElementList.length){currentLI_Index=0;if(currentLI_ElementList[0]){currentLI_ElementList[0].style.background="#D18BD0"}}}}};