$log=log=function(B){};var getElementPosition=elementPosition=function(D,E){var M=MochiKit.DOM;var F=MochiKit.DOM;D=F.getElement(D);if(!D||(!(D.x&&D.y)&&(!D.parentNode==null||M.computedStyle(D,"display")=="none"))){return undefined}var I=new M.Coordinates(0,0);var G=null;var L=null;var H=MochiKit.DOM._document;var K=H.documentElement;var J=H.body;if(!D.parentNode&&D.x&&D.y){I.x+=D.x||0;I.y+=D.y||0}else{if(D.getBoundingClientRect){G=D.getBoundingClientRect();I.x+=G.left+(K.scrollLeft||J.scrollLeft)-(K.clientLeft||0);I.y+=G.top+(K.scrollTop||J.scrollTop)-(K.clientTop||0)}else{if(D.offsetParent){I.x+=D.offsetLeft;I.y+=D.offsetTop;L=D.offsetParent;if(L!=D){while(L){I.x+=L.offsetLeft;I.y+=L.offsetTop;L=L.offsetParent}}var B=navigator.userAgent.toLowerCase();if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(B.indexOf("safari")!=-1&&M.computedStyle(D,"position")=="absolute")){I.x-=J.offsetLeft;I.y-=J.offsetTop}}}}if(typeof (E)!="undefined"){E=arguments.callee(E);if(E){I.x-=(E.x||0);I.y-=(E.y||0)}}if(D.parentNode){L=D.parentNode}else{L=null}while(L){var C=L.tagName.toUpperCase();if(C==="BODY"||C==="HTML"){break}I.x-=L.scrollLeft;I.y-=L.scrollTop;if(L.parentNode){L=L.parentNode}else{L=null}}return I};Targeo.SearchResult=function(D,C){this.Map=D;this.containerResult=partial($,C);this.searchItems={};this.resultData={};this.djson1=new Targeo.DJSON(),this.djson1.setCallback(this._____,this);this.djson2=new Targeo.DJSON(),this.djson2.setCallback(this.__1,this);this.____=null;this.___={};this._;this.__1_=2;var B=this.Map;this.l_=new Bounds(B.coordsCenter.x,B.coordsCenter.y,B.coordsCenter.x,B.coordsCenter.y);this.UOCurrentStreet;this.itemListCurrentElement;this.CopyLinkMod=new CopyLinkMod(D);this.icons=[{imageUrl:"images/braktrafienia.png",coordsAnchor:{x:8,y:8},w:16,h:15},{imageUrl:"images/braktrafienia.png",coordsAnchor:{x:8,y:8},w:16,h:15},{imageUrl:"images/braktrafienia.png",coordsAnchor:{x:8,y:8},w:16,h:15},{imageUrl:"images/bankomat_bph.png",coordsAnchor:{x:16,y:16},w:16,h:16},{imageUrl:"http://mapa.targeo.pl/i/poi/pekao.png",coordsAnchor:{x:8,y:8},w:16,h:16},{imageUrl:"http://mapa.targeo.pl/i/poi/euronet.png",coordsAnchor:{x:8,y:8},w:16,h:16}];this.drawStyle={strokeWeight:"7px",strokeColor:"#0061cf",strokeOpacity:"1"};bindMethods(this);connect(this.Map,"onSearchResultComplete",this,"refreshSearchList");connect(this.Map.elementMapDragable,"onmousedown",this,"____I");connect(document.body,"onmousedown",this,"____I");connect(window,"onresize",this,"____I");connect(this.Map,"onRefresh",this,"____I");this.sig=[];this.sig.push(connect(this.Map,"onDragEnd",this,"_1"));this.sig.push(connect(this.Map,"onRefresh",this,"_1"));this.timeout=null;connect(this.Map,"onZoomChange",this,"_1_");this.Map.elementMap.appendChild(DIV({id:"bph_poi_zoom_info",style:"background:#000;font-family:Verdana,sans-serif;font-size: 9px;padding:2px;color:#fff;position:absolute;left:0;bottom:0;letter-spacing:-0.1ex;"},"Aby zobaczyć lokalizacje bankomatów, przybliż wybrany fragment mapy."));this._1_()};Targeo.SearchResult.prototype={_1_:function(){var D=this.sig;var C=this.___;if(this.Map.zoomCurrent>this.__1_){forEach(D,disconnect);this.sig=[];for(var B in C){this.Map.UOHide(B)}showElement("bph_poi_zoom_info")}else{hideElement("bph_poi_zoom_info");if(D.length===0){this.sig.push(connect(this.Map,"onDragEnd",this,"_1"));this.sig.push(connect(this.Map,"onRefresh",this,"_1"))}var B=null;for(var B in C){C[B].visible=true}if(B!==null){this.Map.UOShowHidden()}}},_1:function(){var B=this.Map;if(B.zoomCurrent>this.__1_){return false}var D={};var C=B.boundsTo1992(B.boundsMapVisible);D.rpc="BPHBankomatyLoad";D.b1=serializeJSON(this.l_);D.b2=serializeJSON(C);this.l_.extend({x:C.minX,y:C.minY});this.l_.extend({x:C.maxX,y:C.maxY});this.djson2.request(_TARGEO_GLOBALS.url+"service.php",D)},__1:function(D){var F=D.items.length;var E=D.items;var C=0;var G;for(var B=0;B<F;B++){G=E[B];C+=this._ll(G,{x:G.x,y:G.y})?1:0}$log("Loaded: "+F+", Showed: "+C)},______:function(C){this.____=this.containerResult().appendChild(SPAN({id:"bph_bankomat_result"}));this.____.innerHTML='<div class="bph_search_header" style="text-align:center;"><img src="'+_TARGEO_GLOBALS.url+'i/process_32.gif" width="32" height="32" /><br />Szukam bankomatów w pobliżu.</div>';this._=C;var B={};B.x=this._.x;B.y=this._.y;B.rpc="BPHBankomatySearch";this.djson1.requestAbort(_TARGEO_GLOBALS.url+"service.php",B)},_ll:function(C,D){var B="BPH"+C.id;if(!isUndefinedOrNull(this.___[B])){return false}mapPoint=new Targeo.Point(D,C.type=='Euronet'?this.icons[5]:this.icons[4],B);mapPoint.element.style.cursor="help";mapPoint.name=C.name;mapPoint.type=C.type;mapPoint.description=C.street+"<br />"+C.godziny;this.___[mapPoint.id]=mapPoint;this.Map.UOAdd(mapPoint);mapPoint.visible=true;connect(mapPoint,"onMouseDown",this,partial(this.__,mapPoint.id,D));connect(mapPoint,"onMouseOver",this,"__I");return true},_____:function(K){var G=K.items.length;var E=K.items;var C;var F;var I;var B=new Bounds(this._.x,this._.y,this._.x,this._.y);this._1();this.____.innerHTML="";var D=false;if(E[0].odleglosc>10000){B.extend(E[0])}else{if(E[G-1].odleglosc>10000){this.____.appendChild(DIV({"class":"bph_search_item",style:"border-bottom:1px solid #fff;padding-bottom:3px;"},STRONG(null,"bliżej niż 10km")))}}for(var H=0;H<G;H++){C=E[H];I={x:parseInt(C.x),y:parseInt(C.y)};this._ll(C,I);if(C.odleglosc>10000){if(!D){this.____.appendChild(DIV({"class":"bph_search_item",style:"border-bottom:1px solid #fff;padding-bottom:3px;"},STRONG(null,"oddalone pow. 10km")));D=true}F=DIV({"class":"bph_search_item"},STRONG(null,C.city),", "+C.street);B.extend(C)}else{F=DIV({"class":"bph_search_item bph_smod_"+(H%2)},C.name+", "+C.street);B.extend(C)}F.onmouseover=partial(this.__I,mapPoint.id);F.onclick=partial(this.__,mapPoint.id,I);this.____.appendChild(F)}var J=B.maxX-B.minX;B.minX-=J;B.maxX+=J;this.Map.zoomToBounds(B,false)},__:function(B,C){this.Map.zoomAndCenter(C,0);this.__I(B)},refreshSearchList:function(B){this.removeBPHResult();if(B.captcha){$("bph_results_info").innerHTML="<strong>Wymagana autoryzacja.</strong>";return }this.resultData=B;switch(this.resultData.type){case"street":bounds=this.showStreetList();break;case"city":bounds=this.showCityList();break;case"address":bounds=this.showAddressList();break}var D;var F;var E=getElementsByTagAndClassName("div","searchlist_element",this.containerResult());for(var C=0;C<E.length;C++){D=E[C];D.style.cursor="pointer";D.onclick=partial(this.onItemClick,D,C);if(this.resultData.type!="street"){F=D.getAttribute("pointid");if(F&&this.searchItems[F]){this.searchItems[F].element.onclick=partial(this.onItemClick,D,C)}D.onmouseover=partial(this.__I,D.getAttribute("pointid"))}}if(this.resultData.items.length==1){this.onItemClick(E[0],0)}else{this.Map.zoomToBounds(bounds,false)}},onItemClick:function(D,C){this.____I();if(this.itemListCurrentElement&&this.itemListCurrentElement!=D){removeElementClass(this.itemListCurrentElement,"searchlist_element_selected")}addElementClass(D,"searchlist_element_selected");this.itemListCurrentElement=D;if(!isUndefinedOrNull(this.resultData.items)&&!isUndefinedOrNull(this.resultData.items[C])){var F;var G;var E=this.resultData.items[C];this.currentItem=E;if(!isUndefinedOrNull(E.x1)){this.removeUOCurrentStreet();this.UOCurrentStreet=new Targeo.Polyline([E.x1+","+E.y2+" "+E.x2+","+E.y2+" "+E.x2+","+E.y1+" "+E.x1+","+E.y1+" "+E.x1+","+E.y2]);this.UOCurrentStreet.element.style.cursor="help";this.UOCurrentStreet.name=E.name;this.UOCurrentStreet.description=E.description;this.UOCurrentStreet.population="";connect(this.UOCurrentStreet,"onMouseOver",this,"__I");connect(this.UOCurrentStreet,"onMouseOut",this,"____I");this.searchItems[this.UOCurrentStreet.id]=this.UOCurrentStreet;this.Map.UOAdd(this.UOCurrentStreet);this.Map.modSearchSetCity(E.city_id,true,E.name);var B=new Bounds(E.x1,E.y2,E.x2,E.y1);var G=B.center()}else{if(!isUndefinedOrNull(E.x)){this.Map.modSearchSetCity(E.id,E.has_street);var F=E.zoom;var G={x:E.x,y:E.y}}}this.removePreviousResult(D.getAttribute("pointid"));$("bph_results_info").innerHTML="<strong>"+E.name+"</strong>, wyniki:";this.______(G)}},removeUOCurrentStreet:function(){if(this.UOCurrentStreet){delete (this.searchItems[this.UOCurrentStreet.id]);this.Map.UORemove(this.UOCurrentStreet.id);this.UOCurrentStreet=null}},showAddressList:function(){var B=this.resultData.items.length;var F="";var D=this.Map.boundsMap;if(B==0){$("bph_results_info").innerHTML="Nie znaleziono podanego adresu."}else{var E;var C;_______=this.resultData.items[0];D=new Bounds(_______.x,_______.y,_______.x,_______.y);$("bph_results_info").innerHTML="<strong>Ilość pasujących adresów: "+B+".</strong>";forEach(this.resultData.items,function(G){G.zoom=0;E=new Targeo.Point({x:G.x,y:G.y},this.icons[2]);E.element.style.cursor="help";E.name=G.name+" "+G.house+", "+G.city;E.description="";E.population="";this.searchItems[E.id]=E;connect(E,"onMouseOver",this,"__I");F+='<div class="searchlist_element" pointid="'+E.id+'"><strong>'+G.name+" "+G.house+"</strong>, "+G.city+"</div>";this.Map.UOAdd(E);D.extend(G)},this)}this.containerResult().innerHTML='<span id="bph_search_result" '+((B===1)?'style="display:none"':"")+">"+F+"</span>";return D},showCityList:function(){var C=this.resultData.items.length;var H="";var E=this.Map.boundsMap;if(C==0){$("bph_results_info").innerHTML="Nie znaleziono miasta w którego nazwie występuje słowo <strong>"+(this.resultData.city_name)+"</strong>."}else{var G;var F;var D;$("bph_results_info").innerHTML="<strong>Znaleziono "+C+" miejscowoś"+((C==1)?"ć":"ci")+".</strong>";G=this.resultData.items[0];E=new Bounds(G.x,G.y,G.x,G.y);for(var B=0;B<C;B++){G=this.resultData.items[B];this.resultData.items[B].zoom=(G.city_type=="1")?2:1;F=new Targeo.Point({x:G.x,y:G.y},((G.city_type==1)?this.icons[0]:this.icons[1]));F.element.style.cursor="help";F.name=G.name;F.description=G.description;F.population=G.population;this.searchItems[F.id]=F;connect(F,"onMouseOver",this,"__I");H+='<div class="searchlist_element" pointid="'+F.id+'"><strong>'+G.name+"</strong>, "+G.description+"</div>";this.Map.UOAdd(F);E.extend(G)}}this.containerResult().innerHTML='<span id="bph_search_result" '+((C===1)?'style="display:none"':"")+">"+H+"</span>";return E},showStreetList:function(){var C=this.resultData.items.length;var F="";var D=this.Map.boundsMap;if(C==0){if(this.currentCityId>0||this.resultData.city_id){$("bph_results_info").innerHTML="Nie znaleziono ulic zawierających słowo <strong>"+this.resultData.street_name+"</strong> w nazwie."}else{$("bph_results_info").innerHTML="Nie znaleziono miast ze słowem <strong>"+this.resultData.city_name+"</strong> w nazwie, które mają ulice zawieraje słowo <strong>"+this.resultData.street_name+"</strong>."}}else{if(!isUndefinedOrNull(this.resultData.city_id)){this.Map.modSearchSetCity(this.resultData.city_id,true)}var E;$("bph_results_info").innerHTML="<strong>Wyniki: "+C;if(!isUndefinedOrNull(this.resultData.city_name)){$("bph_results_info").innerHTML+=" (<em>"+this.resultData.city_name+"</em>)"}$("bph_results_info").innerHTML+=".</strong>";E=this.resultData.items[0];D=new Bounds(E.x1,E.y2,E.x2,E.y1);for(var B=0;B<C;B++){E=this.resultData.items[B];F+='<div class="searchlist_element"><strong>'+E.name+"</strong><br />"+E.description+"</div>";E.x1=parseInt(E.x1);E.x2=parseInt(E.x2);E.y1=parseInt(E.y1);E.y2=parseInt(E.y2);D.extend({x:E.x1,y:E.y2});D.extend({x:E.x2,y:E.y1})}}this.containerResult().innerHTML='<span id="bph_search_result" '+((C===1)?'style="display:none"':"")+">"+F+"</span>";return D},removePreviousResult:function(B){this.removeUOCurrentStreet();for(var C in this.searchItems){if(B!=C){this.Map.UORemove(C);delete (this.searchItems[C])}}if(isUndefined(B)){this.searchItems={}}this.containerResult().innerHTML="";this.Map.modSearchSetCity(-1,false);this.resultData={}},removeBPHResult:function(){var B=this.Map;for(var C in this.___){B.UORemove(C);delete (this.___[C])}this.___={};this.l_=new Bounds(B.coordsCenter.x,B.coordsCenter.y,B.coordsCenter.x,B.coordsCenter.y);this.removePreviousResult()},__I:function(E,C){this.____I();var I;var B=this.searchItems[E]||this.___[E];if(!B||!this.Map.boundsMapVisible.containsPoint(this.Map.toPx(B.coords))){return }var K="<strong>"+B.name+"</strong><br />"+B.description;this._______I=DIV({"class":"bph_baloon_info",style:"left:-2048px;overflow:visible;"});if(this.___[E]){this._______I.innerHTML='<table><tr><td style="width:29px;"><img src="images/ikonka_bakomaty_big.jpg" /></td><td>'+K+"</td></tr></table>"}else{this._______I.innerHTML="<div>"+K+"</div>"}var G,H;this._______I.appendChild(Targeo.Base.png24("images/balloon_t.png",{style:"position:absolute;left:0;top:0;"}));this._______I.appendChild(Targeo.Base.png24("images/balloon_b_01.png",{style:"position:absolute;left:0;bottom:23px;"}));this._______I.appendChild(H=Targeo.Base.png24("images/balloon_b_02.png",{style:"position:absolute;left:0;bottom:0;"}));this._______I.appendChild(G=Targeo.Base.png24(_TARGEO_GLOBALS.url+"i/close.png",{style:"position:absolute;right:5px;top:5px;cursor:pointer;"}));G.onmouseover=partial(Targeo.Base.png24Change,G,_TARGEO_GLOBALS.url+"i/close-on.png");G.onmouseout=partial(Targeo.Base.png24Change,G,_TARGEO_GLOBALS.url+"i/close.png");G.onclick=this.____I;document.body.appendChild(this._______I);var F=elementDimensions(this._______I);F.h+=24;setElementDimensions(this._______I,F);coords=elementPosition(B.element);coords.y-=F.h-8;var J=elementPosition("bph_search_window");var L=(coords.x+F.w)-J.x;if(L<F.w){coords.x-=Math.max(0,L);var D=Math.max(0,L);H.style.left=Math.min(230,D)+"px";coords.x+=Math.max(D-230,0);setElementPosition(this._______I,coords)}else{removeElement(this._______I)}},____I:function(){try{forEach(getElementsByTagAndClassName("div","bph_baloon_info"),removeElement)}catch(B){}}};MochiKit.Base.update(Targeo.Map.prototype,{modSearchEnable:function(B){if(!this.TargeoSearch.initialized){this.TargeoSearch.initialize()}this.modeEnable(B)},modSearchCreateWindow:function(){var C=DIV({style:"position:absolute;left:0;top:0;z-index:10;"});var D=DIV({id:"targeomap_search_result",style:"clear:both;overflow:auto;"});var E="";E+='<div id="bph_search_form"><h1>Znajdź bankomat</h1>';E+='Miejscowość: <span id="suggest_city_indicator" style="display:none;"><img src="'+_TARGEO_GLOBALS.urlIndicator01+'" width="12" height="12" style="vertical-align:top;" /></span><br /><input autocomplete="off" id="suggest_city_name" type="text" value="" style="width:176px;height:16px;padding:0 2px;" />';E+="<br />";E+='Ulica/Plac/Aleja:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Nr:<span id="suggest_street_indicator" style="display:none;"><img src="'+_TARGEO_GLOBALS.urlIndicator01+'" width="12" height="12" style="vertical-align:top;" /></span><br /><input autocomplete="off" id="suggest_street_name" type="text" value="" style="width:136px;margin-right:10px;height:16px;padding:0 2px;" /><input autocomplete="off" id="suggest_street_house" type="text" value="" style="width:26px;height:16px;padding:0 2px;" />';E+='<div id="suggest_street_name_info">Wybierz miejscowość</div>';E+='<div style="margin-top:5px;"><img src="images/szukaj.png" title="Szukaj" alt="Szukaj" id="suggest_search_button" /> <img id="suggest_search_indicator" style="display:none;vertical-align:bottom;" src="'+_TARGEO_GLOBALS.urlIndicator01+'" width="20" height="20" /></div>';E+='<div id="bph_results_info">&#160;</div></div>';C.innerHTML=E;D._TargeoWindowAutoResize=true;C.appendChild(D);var B=A({style:"width:222px;height:34px;position:absolute;left:0;top:292px;display:block;z-index:10;",href:"/lista.html"}," ");this.modSearchWindow=DIV({id:"bph_search_window"},B,Targeo.Base.png24("images/window.png",{style:"position:absolute;left:0;top:0;z-index:1;height:326px;width:222px;"}),C);this.elementMap.appendChild(this.modSearchWindow);this.elementControls.push(this.modSearchWindow.element);this.modSearchResizeWindow();$("suggest_city_name").focus();hideElement("suggest_street_name_info")},modSearchResizeWindow:function(B){var C=Targeo.Base.getBRPos(this.modSearchWindow);var D=elementDimensions("bph_search_form");$("targeomap_search_result").style.height="136px"}});MochiKit.Base.update(Targeo.Map.prototype,{controlDisclaimerInit:function(){var B=this.elementMap.appendChild(DIV({style:"position: absolute; right: 23px; bottom: 0px; -moz-user-select: none; z-index: "+this.zIndexControl}));B.innerHTML='<a href="http://www.targeo.pl" target="_blank"><img src="'+_TARGEO_GLOBALS.url+'i/targeo-AM_logos.png" border="0" class="png24fix" width="196" height="30"></a>';this.elementControls.push(B);Targeo.Base.png24fix(B)}});MochiKit.Base.update(Targeo.Map.prototype,{modZoomSliderCreate:function(){this.zoomSlider={minPos:149,maxPos:167+149-49,stepCount:null,stepLength:null,currPos:null,srcDragEvent:document.documentElement,K:[],elem1:null,elem2:SPAN()};var H=DIV({style:"position: absolute; left: 0; top: 0;z-index: "+this.zIndexControl});this.elementMap.appendChild(H);this.zoomSlider.stepCount=this.zoomMax-this.zoomMin;this.zoomSlider.stepLength=Math.round((this.zoomSlider.maxPos-this.zoomSlider.minPos)/this.zoomSlider.stepCount);this.zoomSlider.currPos=this.zoomSlider.minPos+this.zoomSlider.stepLength*(this.zoomSlider.stepCount-this.zoomCurrent+this.zoomMin);var E=Targeo.Base.png24("images/suwak.png",{style:"position: absolute; left: 10px; top: 10px; -moz-user-select: none; z-index: "+this.zIndexControl});var B=Targeo.Base.png24("images/suwak,front.png",{style:"position: absolute; left: 23px; top: "+this.zoomSlider.currPos+"px; -moz-user-select: none; z-index: "+this.zIndexControl});connect(B,"onmousedown",this,"zoomSliderMouseDown");this.zoomSlider.srcDragEvent=(B.setCapture)?B:document.documentElement;this.zoomSlider.elem1=B;appendChildNodes(H,E,B);var C=DIV({style:"width:21px;height:23px;cursor:pointer;position: absolute; left: 20px; top: 123px; cursor: pointer; -moz-user-select: none; z-index: "+this.zIndexControl});var G=DIV({style:"width:21px;height:23px;cursor:pointer;position: absolute; left: 20px; top: 328px; cursor: pointer; -moz-user-select: none; z-index: "+this.zIndexControl});connect(G,"onclick",this,partial(this.zoomIn,1));connect(C,"onclick",this,partial(this.zoomOut,1));appendChildNodes(H,G,C);var D={};D.drag=Targeo.Base.png24("images/tool,drag.png",{style:"width:41px;height:25px;position:absolute;left:10px;top:27px;cursor:pointer;-moz-user-select: none; z-index: "+this.zIndexControl});D["zoom-select"]=Targeo.Base.png24("images/tool,zoom-select.png",{style:"width:41px;height:25px;position:absolute;left:10px;top:57px;cursor:pointer;-moz-user-select: none; z-index: "+this.zIndexControl});D["print-map"]=Targeo.Base.png24("images/tool,print-map.png",{style:"width:41px;height:25px;position:absolute;left:10px;top:88px;cursor:pointer;-moz-user-select: none; z-index: "+this.zIndexControl});for(var F in D){D[F].onclick=bind(this.modeEnable,this,F);D[F].onmouseover=bind(this.modeHover,this,F);D[F].onmouseout=bind(this.modeOut,this,F);D[F].onmousedown=bind(this.modeDown,this,F);this.mapModeSupported[F]["element"]=D[F];this.mapModeSupported[F]["iconUrl"]={normal:"images/tool,"+F+".png",hover:"images/tool,"+F+",on.png",down:"images/tool,"+F+".png",selected:"images/tool,"+F+",on.png"};H.appendChild(D[F])}connect(this,"onZoomAnimUpdate",this,"modZoomSliderUpdatePos");connect(this,"onRefresh",this,"modZoomSliderUpdatePos");this.elementControls.push(H)},modZoomSliderUpdatePos:function(C){C=parseFloat(C)||1;var D=(isUndefinedOrNull(this.zoomAnimTarget))?this.zoomCurrent:this.zoomAnimTarget;var B=this.zoomSlider.minPos+this.zoomSlider.stepLength*(this.zoomSlider.stepCount-D+this.zoomMin);this.zoomSlider.currPos=Math.round(this.zoomSlider.currPos+(B-this.zoomSlider.currPos)*C);this.zoomSlider.elem1.style.top=this.zoomSlider.currPos+"px"}});
