var liveSearchReq=false;var t=null;var liveSearchLast="";var isIE=false;if(window.XMLHttpRequest){liveSearchReq=new XMLHttpRequest()}function liveSearchInit(){if(navigator.userAgent.indexOf("Safari")>0){document.getElementById("livesearch").addEventListener("keydown",liveSearchKeyPress,false)}else{if(navigator.product=="Gecko"){document.getElementById("livesearch").addEventListener("keypress",liveSearchKeyPress,false);document.getElementById("livesearch").addEventListener("blur",liveSearchHideDelayed,false)}else{document.getElementById("livesearch").attachEvent("onkeydown",liveSearchKeyPress);isIE=true}}document.getElementById("livesearch").setAttribute("autocomplete","off")}function liveSearchHideDelayed(){window.setTimeout("liveSearchHide()",400)}function liveSearchHide(){document.getElementById("LSResult").style.display="none";var a=document.getElementById("LSHighlight");if(a){a.removeAttribute("id")}}function liveSearchKeyPress(a){if(a.keyCode==40){highlight=document.getElementById("LSHighlight");if(!highlight){highlight=document.getElementById("LSShadow").firstChild}else{highlight.removeAttribute("id");highlight=highlight.nextSibling}if(highlight){highlight.setAttribute("id","LSHighlight")}if(!isIE){a.preventDefault()}}else{if(a.keyCode==38){highlight=document.getElementById("LSHighlight");if(!highlight){highlight=document.getElementById("LSShadow").lastChild}else{highlight.removeAttribute("id");highlight=highlight.previousSibling}if(highlight){highlight.setAttribute("id","LSHighlight")}if(!isIE){a.preventDefault()}}else{if(a.keyCode==27){highlight=document.getElementById("LSHighlight");if(highlight){highlight.removeAttribute("id")}document.getElementById("LSResult").style.display="none"}else{if(a.keyCode==8&&isIE){liveSearchStart()}}}}}function liveSearchStart(){if(t){window.clearTimeout(t)}t=window.setTimeout("liveSearchDoSearch()",200)}function liveSearchDoSearch(){if(typeof liveSearchRoot=="undefined"){liveSearchRoot=""}if(typeof liveSearchRootSubDir=="undefined"){liveSearchRootSubDir=""}if(typeof liveSearchParams=="undefined"){liveSearchParams2=""}else{liveSearchParams2="&"+liveSearchParams}if(liveSearchLast!=document.forms.searchform.keywords.value){if(liveSearchReq&&liveSearchReq.readyState<4){liveSearchReq.abort()}if(document.forms.searchform.keywords.value==""){liveSearchHide();liveSearchLast="";return false}if(window.XMLHttpRequest){}else{if(window.ActiveXObject){liveSearchReq=new ActiveXObject("Microsoft.XMLHTTP")}}liveSearchReq.onreadystatechange=liveSearchProcessReqChange;liveSearchReq.open("GET",liveSearchRoot+"livesearch/"+document.forms.searchform.keywords.value);liveSearchLast=document.forms.searchform.keywords.value;liveSearchReq.send(null)}}function liveSearchProcessReqChange(){if(liveSearchReq.readyState==4){var b=document.getElementById("LSResult");b.style.display="block";var a=document.getElementById("LSShadow");a.innerHTML=liveSearchReq.responseText}}function liveSearchSubmit(){var a=document.getElementById("LSHighlight");if(a&&a.firstChild){window.location=a.firstChild.getAttribute("href");return false}else{return true}}function preview(c){var a=$("previewComment");if(!a){var b=$("bx_foo");var a=document.createElement("div");a.id="previewComment";a.className="post_content";a=b.parentNode.insertBefore(a,b.nextSibling)}a.innerHTML=c.responseText}function previewSubmit(h){var b=document.getElementById("name").value;var a=document.getElementById("email").value;var c=document.getElementById("openid_url").value;var e=document.forms.bx_foo["comments"].value;var d=document.forms.commentForm;if(typeof g=="undefined"){var g="/"}body="mail="+encodeURIComponent(a)+"&uri="+encodeURIComponent(c)+"&text="+encodeURIComponent(e)+"&name="+encodeURIComponent(b);new ajax(g+"inc/bx/php/preview.php",{postBody:body,method:"post",onComplete:preview});return false}function prepareCommentSubmit(){var b=document.getElementById("bx_plugins_blog_all");var a=document.getElementById("bx_plugins_hidden_submit_replacement");b.name="foo";b.disabled=true;b.value="Sending ...";a.name="bx[plugins][blog][_all]";return true};
