str_page_url="";function positionElement(tmp_element,tmp_v_element){if(window.innerWidth<tmp_element.clientWidth){tmp_element.style.left=0+"px";}else{tmp_element.style.left=(window.innerWidth-tmp_element.clientWidth-40)+"px";}
var tmp=findPos(tmp_v_element);tmp_element.style.top=tmp[1]+tmp_v_element.clientHeight+10+"px";}
function showShim(boxoverObject){}
function hideShim(boxoverObject){}
function makeChoice(evt){var thisDiv=(evt)?evt.target:window.event.srcElement;if(thisDiv.tagName!='DIV'){thisDiv=findParent(thisDiv,'DIV');}
document.getElementById("company_search").value=thisDiv.getAttribute('company');document.getElementById("company_submit").focus();if(!str_page_url){str_page_url='/0002/company-browse.php';}
window.location=str_page_url+'?cik='+thisDiv.getAttribute('cik');}
function hideSuggestions(evt){document.getElementById("suggestionWin").style.visibility='hidden';hideShim(document.getElementById("suggestionWin"));}
function showSuggestions(evt){document.getElementById("suggestionWin").style.visibility='visible';showShim(document.getElementById("suggestionWin"));}
function ResponseObj(n_name,n_cik,n_ticker,n_s_name,n_s_cik,n_s_ticker){this.name=(n_name)?n_name.nodeValue:'';this.cik=n_cik.nodeValue;this.ticker=(n_ticker)?n_ticker.nodeValue:'';this.s_name=(n_s_name)?n_s_name.nodeValue:'';this.s_cik=n_s_cik.nodeValue;this.s_ticker=(n_s_ticker)?n_s_ticker.nodeValue:'';}
function searchSuggest(a_items){var comp_search=document.getElementById("company_search");var sugg=document.getElementById("suggestionWin");var str=comp_search.value;comp_search.className="";if(str!==''){removeAllChildNodes(sugg);sugg.style.visibility='visible';for(var i=0;i<a_items.length;i++){var tmp=a_items[i];var temp_div=document.createElement("div");temp_div.setAttribute('company',tmp.name);temp_div.setAttribute('cik',tmp.cik);temp_div.setAttribute('ticker',tmp.ticker);var txt=tmp.s_name+'-'+tmp.s_cik+'-'+tmp.s_ticker;var temp_table=document.createElement("table");var temp_tbody=document.createElement("tbody");var temp_tr=document.createElement("tr");var temp_td=document.createElement("td");temp_td.className="ticker";temp_td.innerHTML=tmp.s_ticker;temp_tr.appendChild(temp_td);temp_td=document.createElement("td");temp_td.innerHTML=tmp.s_name;temp_tr.appendChild(temp_td);temp_td=document.createElement("td");temp_td.className="cik";temp_td.innerHTML=tmp.s_cik;temp_tr.appendChild(temp_td);temp_tbody.appendChild(temp_tr);temp_table.appendChild(temp_tbody);temp_div.appendChild(temp_table);temp_div.onclick=makeChoice;temp_div.className="suggestions";sugg.appendChild(temp_div);}
var ct=sugg.childNodes.length;if(ct===0){comp_search.className="error";}
if(ct===1){}}else{removeAllChildNodes(sugg);}
positionElement(sugg,comp_search);showShim(sugg);sec_link=null;a_items=null;comp_search=null;sugg=null;}
function setResponseArray(){if(xhr.readyState==4){if(xhr.status==200){if(xhr.responseXML){var response_items=xhr.responseXML.getElementsByTagName("company");var a_items=new Array();for(var i=0;i<response_items.length;i++){var tmp_response=response_items[i];var tmp_name=tmp_response.getElementsByTagName("name")[0].firstChild;var tmp_cik=tmp_response.getElementsByTagName("cik")[0].firstChild;var tmp_ticker=tmp_response.getElementsByTagName("ticker")[0].firstChild;var s_name=tmp_response.getElementsByTagName("s_name")[0].firstChild;var s_cik=tmp_response.getElementsByTagName("s_cik")[0].firstChild;var s_ticker=tmp_response.getElementsByTagName("s_ticker")[0].firstChild;a_items[i]=new ResponseObj(tmp_name,tmp_cik,tmp_ticker,s_name,s_cik,s_ticker);}
tmp_response=null;tmp_name=null;tmp_cik=null;tmp_ticker=null;searchSuggest(a_items);}}else{alert("There was a problem with the request "+xhr.status);}}}
function buildRequest(){var frm=findParent(this,'FORM');var ajax_url="/ajx/company-search.php";makeRequest(frm,ajax_url,setResponseArray);}
function initAll(){var comp_search=document.getElementById("company_search");comp_search.onkeyup=buildRequest;document.onclick=hideSuggestions;comp_search=null;}