jQuery.fn.highlight=function(b){function a(e,j){var l=0;if(e.nodeType==3){var k=e.data.toUpperCase().indexOf(j);if(k>=0){var h=document.createElement("span");h.className="highlight";var f=e.splitText(k);var c=f.splitText(j.length);var d=f.cloneNode(true);h.appendChild(d);f.parentNode.replaceChild(h,f);l=1}}else{if(e.nodeType==1&&e.childNodes&&!/(script|style)/i.test(e.tagName)){for(var g=0;g<e.childNodes.length;++g){g+=a(e.childNodes[g],j)}}}return l}return this.each(function(){a(this,b.toUpperCase())})};jQuery.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;with(this.parentNode){replaceChild(this.firstChild,this);normalize()}}).end()};

function clsNieuws(){this.oTimer=0;this.oTarget=0;this.aInputOriginalValue={};this.vFocus=function(field){if(typeof this.aInputOriginalValue[field.id]=='undefined')this.aInputOriginalValue[field.id]=field.value;field.value=''};this.vBlur=function(field){if(field.value=='')field.value=this.aInputOriginalValue[field.id]};this.vShowTyping=function(){oNieuws.oTarget=this;if(oNieuws.oTimer)clearTimeout(oNieuws.oTimer);oNieuws.oTimer=setTimeout("oNieuws.vSearchByKeyword()",1000)};this.vSearchByKeyword=function(){$(oNieuws.oTarget).addClass('is-zoekende');var sUrl=$(oNieuws.oTarget).val();sUrl=sUrl.replace(/\s/g,'%20');$('#content').load('/ajax/nieuws/keyword/'+sUrl,'',oNieuws.vShowDone)};this.vShowDone=function(oResponse){$(oNieuws.oTarget).removeClass('is-zoekende');var keywords=$(oNieuws.oTarget).val().split(" ");for(i=0;i<keywords.length;i++)if(keywords[i].length>3)$('#content').highlight(keywords[i]);addTooltip('#content');keywordIndex=this.url.indexOf("/keyword/");url='?cat=nieuws&q='+this.url.substr(keywordIndex+9);_gaq.push(['_trackPageview',url])}};$(function(){oNieuws=new clsNieuws();$('#sidebar-sleutelwoorden').keyup(oNieuws.vShowTyping).focus(function(){oNieuws.vFocus(this)}).blur(function(){oNieuws.vBlur(this)});var keyword=window.location.href.indexOf('/keyword/');if(keyword!=-1){keyword=window.location.href.substring(keyword+9);$('#content').highlight(keyword)}})

$(function(){$('#sidebar_et a.eettafel').live('click',function(){sUrl=this.href.substr(this.href.lastIndexOf("/"));$('#sidebar_et').load('/ajax/eettafel/dag'+sUrl);_gaq.push(['_trackPageview','/eettafel/'+sUrl]);return false})})
