var postnrSearchTimer=0;var postnrIndex=0;var lastPostnrIndex=0;var postnrs="";var blockHide=false;function postnrOnFocus(){setTimeout("clearPostnrTimer()",50);if(_gaq){_gaq.push(["_trackPageview","/tracked_gataSokFokuserad"])}if(el("opGata")){if(el("opGata").value==""||el("opGata").value==opGataDef){showLayerBlock("postnrSearchHelp");postnrIndex=0;postnrs="";clearPostnrSelection();updatePostnrSelection()}if(el("opGata").value==opGataDef){el("opGata").value=""}}postnrSearch()}function postnrOnClick(){setTimeout("clearPostnrTimer()",50)}function clearPostnrTimer(){clearTimeout(postnrSearchTimer)}function postnrOnBlur(){postnrSearchTimer=setTimeout("hidePostnrSearchInfo()",200)}function hidePostnrSearchInfo(){hideLayer("postnrSearchInfo");hideLayer("postnrSearchHelp");if(el("opGata")){if(el("opGata").value==""){el("opGata").value=opGataDef}}}function postnrSearch(){if(el("opGata").value==""){hideLayer("postnrSearchInfo");el("postnrSearchInfo").innerHTML="";hideLayer("searchTicker")}else{showLayer("searchTicker");clearTimeout(postnrSearchTO);postnrSearchTO=setTimeout("makePostnrSearch()",500)}}function makePostnrSearch(){ajax(domain+"actions/action_sokPostnr?opGata="+urlencode(el("opGata").value),null,printPostnrSearchResult)}function printPostnrSearchResult(a){hideLayer("searchTicker");if(el("opGata").value==""){hideLayer("postnrSearchInfo");showLayerBlock("postnrSearchHelp")}else{hideLayer("postnrSearchHelp");showLayerBlock("postnrSearchInfo");setInnerHtml(a,"postnrSearchInfo")}}function postnrOnKeyDown(g,d){var b=d.keyCode;if(d.modifiers){var f=false;var e=(evt.modifiers&Event.CONTROL_MASK);var a=(evt.modifiers&Event.SHIFT_MASK)}else{var f=(d.altKey||d.altLeft||d.charCode==18||d.charCode==57388);var e=(d.ctrlKey||d.ctrlLeft||d.charCode==17||d.charCode==57391);var a=(d.shiftKey||d.shiftLeft||d.charCode==16||d.charCode==57390)}if((f||e)&&b!=86&&b!=88&&b!=89&&b!=90){return}switch(b){case 27:break;case 10:case 13:if(el("searchTicker").style.display=="none"){if(_gaq){if(g.value==""){_gaq.push(["_trackPageview","/tracked_platserForslagAnvand"])}else{_gaq.push(["_trackPageview","/tracked_gataSokAnvand"])}}var c=postnrs[postnrIndex];if(!c){}else{if(c==parseInt(c)){loadPage(domain+"postnummer/"+c,"_self")}else{if(c){if(c.indexOf(thisdomain)==-1){loadPage(_gat._getTrackerByName()._getLinkerUrl(c),"_self")}else{loadPage(c,"_self")}}}}}break;case 38:lastPostnrIndex=postnrIndex;postnrIndex=Math.max(0,postnrIndex-1);updatePostnrSelection();break;case 40:lastPostnrIndex=postnrIndex;postnrIndex=Math.min(postnrs.length-1,postnrIndex+1);updatePostnrSelection();break;case 37:case 39:break;default:break}}var postnrSearchTO=0;function postnrOnKeyUp(f,c){if(f.value.length==1&&!gataTracked){if(_gaq){_gaq.push(["_trackPageview","/tracked_gataSokBorjatSkriva"]);gataTracked=true}}var b=c.keyCode;if(c.modifiers){var e=false;var d=(evt.modifiers&Event.CONTROL_MASK);var a=(evt.modifiers&Event.SHIFT_MASK)}else{var e=(c.altKey||c.altLeft||c.charCode==18||c.charCode==57388);var d=(c.ctrlKey||c.ctrlLeft||c.charCode==17||c.charCode==57391);var a=(c.shiftKey||c.shiftLeft||c.charCode==16||c.charCode==57390)}if((e||d)&&b!=86&&b!=88&&b!=89&&b!=90){return}switch(b){case 27:f.value="";break;case 10:case 13:case 38:case 40:case 37:case 39:return;break;default:break}if(f.value==""){showLayerBlock("postnrSearchHelp");postnrIndex=0;postnrs="";clearPostnrSelection();updatePostnrSelection()}postnrSearch()}function updatePostnrSelection(){if(el("postnrRow"+lastPostnrIndex)){el("postnrRow"+lastPostnrIndex).style.backgroundColor="#DDFFDD"}if(el("postnrRow"+postnrIndex)){el("postnrRow"+postnrIndex).style.backgroundColor="#CCCCCC"}if(el("platserRow"+lastPostnrIndex)){el("platserRow"+lastPostnrIndex).style.backgroundColor="#DDFFDD"}if(el("platserRow"+postnrIndex)){el("platserRow"+postnrIndex).style.backgroundColor="#CCCCCC"}}function clearPostnrSelection(){var b=postnrs.length-1;for(var a=1;a<=b;a++){if(el("postnrRow"+a)){el("postnrRow"+a).style.backgroundColor="#DDFFDD"}if(el("platserRow"+a)){el("platserRow"+a).style.backgroundColor="#DDFFDD"}}};
