var field = 'search'; var iframeMLeft = 0; var iframeMTop = 0; // var searchfield=document.getElementById("search"); var sugbox=document.getElementById("searchsuggestions"); var sugboxmouseover = false; var adHiders=[false,false,false,false]; var queries=new Array(); var suggestions=new Array(); var searchValue; var hoveredSuggestion=-1; function buildSearch(E,f){ var searchfield = new Array(); if(f) { for(var i = 0; i < f.length; i ++) { searchfield[i] = document.getElementById(f[i]); } } else { searchfield[0] = document.getElementById('search'); } window.addEvent('domready', function () { for(var i = 0; i < document.getElementsByTagName('input').length; i++) { var tempId = document.getElementsByTagName('input')[i].id; if(tempId) { var normal = true; for(var j = 0; j < f.length; j++) { if(f[j] == tempId) { normal = false; } } $(tempId).addEvent('keydown', function(e) { if(e.key == 'enter') { for(var i = 0; i <= sugbox.getElementsByTagName("a").length; i++) { if(sugbox.getElementsByTagName("a")[i] && sugbox.getElementsByTagName("a")[i].className=="hovered") { return false; } } return true; } }); } } }); if(document.cookie.indexOf("lastsearches=")!=-1) { var A=document.cookie.substring(document.cookie.indexOf("lastsearches=")+13)+";"; var C=A.substring(0,A.indexOf(";")); cookieQueries=C.split("|") } else { cookieQueries=new Array() } for(var B=0;B0) { suggestions.push(q[A]) } } // for(var A=0;A0) { // suggestions.push(q[A]) // } // } sugbox.innerHTML=""; sugbox.style.height = ""; tmpsuggestions = suggestions; for(var A=0;A'+suggestions[A]+"" } if(suggestions.length==0){ hideSugbox(); } else{ showSugbox(searchfield) } } function linkvalue(t,searchfield) { searchfield.value=t.innerHTML; searchfield.focus(); } var g_PopupIFrame; function IsIE() { return (navigator.appName == "Microsoft Internet Explorer"); } function showSugbox(searchfield){ var curleft = curtop = 0; var obj = sugbox; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } var tempdiv = sugbox; sugbox.parentNode.removeChild(sugbox); searchfield.parentNode.appendChild(tempdiv); sugbox = tempdiv; sugbox.left = (curleft)+ 'px'; sugbox.top = (curtop) + 'px'; sugbox.style.backgroundColor = "white"; sugbox.style.zIndex = "99"; // sugbox.style.top=(realOffset(searchfield,"offsetTop")+searchfield.offsetHeight-1)+"px"; // sugbox.style.left=realOffset(searchfield,"offsetLeft")+"px"; sugbox.style.width=(searchfield.offsetWidth-2)+"px"; adHiders[0]=true; updateAd(); sugbox.style.display="block" if((sugbox.offsetHeight) >= 200) { sugbox.style.height="200px"; sugbox.style.overflowY = "scroll"; sugbox.style.overflowX = "hidden"; } else { sugbox.style.height=sugbox.offsetHeight; sugbox.style.overflowX = "hidden"; sugbox.style.overflowY = "hidden"; } sugbox.onmouseover = function () {sugboxmouseover = true;}; sugbox.onmouseout = function () {sugboxmouseover = false;searchfield.focus();}; if(IsIE()) { var iFrame = document.createElement("IFRAME"); iFrame.setAttribute("src", "/js/sugess_blank.html"); iFrame.setAttribute("border", "0"); iFrame.style.position="absolute"; iFrame.left = (curleft)+ 'px'; iFrame.top = (curtop) + 'px'; iFrame.style.backgroundColor = "white"; iFrame.style.zIndex = sugbox.style.zIndex; iFrame.style.width=(sugbox.offsetWidth-2)+"px"; iFrame.style.height=(sugbox.offsetHeight-5) + 'px'; iFrame.style.padding="0px 2px;"; iFrame.style.marginTop=iframeMTop+"px"; iFrame.style.marginLeft=iframeMLeft+"px"; sugbox.style.zIndex = sugbox.style.zIndex +1; if(g_PopupIFrame && g_PopupIFrame.parentNode) g_PopupIFrame.parentNode.removeChild(g_PopupIFrame); searchfield.parentNode.appendChild(iFrame); g_PopupIFrame = iFrame; } } // function ShowPopupDiv(divPopup,searchfield) { // if(!IsIE()) { // // divPopup.style.visibility = "visible"; // return; // } // //Increase default zIndex of div by 1, so that DIV appears before IFrame // divPopup.style.zIndex=divPopup.style.zIndex+1; // // if(g_PopupIFrame != null) { // document.body.removeChild(g_PopupIFrame); // } // // var iFrame = document.createElement("IFRAME"); // iFrame.setAttribute("src", "/sugess_blank.html"); // // //Match IFrame position with divPopup // // iFrame.style.border="1px solid"; // iFrame.style.position="absolute"; // iFrame.style.left =divPopup.offsetLeft + 'px'; // iFrame.style.top =divPopup.offsetTop + 'px'; // iFrame.style.width =divPopup.offsetWidth + 'px'; // iFrame.style.height =divPopup.offsetHeight + 'px'; // iFrame.style.margin="0px"; // iFrame.style.padding="0px"; // iFrame.style.clear="none"; // // divPopup.style.border = '0px'; // // if(searchfield) { // searchfield.parentNode.appendChild(iFrame); // // document.body.appendChild(iFrame); // //Store iFrame in global variable, so it can get removed when divPopup is hidden // g_PopupIFrame=iFrame; // } // // divPopup.style.visibility ="visible"; // // } function realOffset(B,A) { var C=0; while(B) { C+=B[A]; B=B.offsetParent } return C } function updateAd() { var A=document.getElementById("adspot-a"); if(A!=null) { if(adHiders[0]||adHiders[1]||adHiders[2]||adHiders[3]||adHiders[4]) { A.style.visibility="hidden" } else { A.style.visibility="visible" } } } var sugboxmouseover = false; function hideSugbox() { if(sugboxmouseover === false) { sugbox.onmouseover = function () {}; sugbox.onmouseout = function () {}; if(IsIE()) { if(g_PopupIFrame && g_PopupIFrame.parentNode) g_PopupIFrame.parentNode.removeChild(g_PopupIFrame); } sugbox.style.display="none"; adHiders[0]=false; updateAd() for(var i = 0; i <= sugbox.getElementsByTagName("a").length; i++) { if(sugbox.getElementsByTagName("a")[i]) { sugbox.getElementsByTagName("a")[i].className=""; } } } };