// Copyright (c) 2006-2007  Position s.r.o.
// All rights reserved.
COUNT_SEARCH_ITEM=10;MAP_COUNTRY='CZ';DEFAULT_LANGUAGE='';ID_LOCATEPT_ICON='LOCATEPTIcon';HOTELIMG_WIDTH=82;HOTELIMG_HEIGHT=56;function ClearForms(){var obj_search=document.getElementById('edt_search');var obj_begin=document.getElementById('edt_routing_begin');var obj_end=document.getElementById('edt_routing_end');if(obj_search)obj_search.value='';if(obj_begin)obj_begin.value='';if(obj_end)obj_end.value=''}function PreviewMap(){var obj_box=document.getElementById('map_preview_box');var obj_preview=document.getElementById('map_preview');var obj_link=obj_box.getElementsByTagName('a')[0];if(obj_preview)obj_preview.style.display=(obj_preview.style.display=='none')?'block':'none';if(obj_link)if(obj_link.id=='link_open'){obj_link.id='link_close';obj_link.innerHTML='<span>'+msg['MapPreviewClose']+'</span>';obj_link.title=msg['MapPreviewClose']}else{obj_link.id='link_open';obj_link.innerHTML='<span>'+msg['MapPreviewOpen']+'</span>';obj_link.title=msg['MapPreviewOpen']}}function UseExample(text){var obj=document.getElementById('edt_search');if(obj){obj.value=text;Search();}}function SetRouteType(){var obj=document.getElementById('link_changerouting_type');routing.RouteType=routing.RouteType==0?1:0;if(obj){switch(routing.RouteType){case 0:obj.innerHTML=msg['MapRoutingTypeFastest'];break;case 1:obj.innerHTML=msg['MapRoutingTypeShortest'];break}}}function SetLink(obj_link,atr){var step=0;if(obj_link){for(var i=obj_link.length-1;i>=0;i--){switch(obj_link[i].className){case'page_prev':switch(atr){case'begin':obj_link[i].onclick=function(){return PrevPage('begin');};break;case'end':obj_link[i].onclick=function(){return PrevPage('end');};break;case'place':obj_link[i].onclick=function(){return PrevPage('place');};break;case'routing':obj_link[i].onclick=function(){return PrevPage('routing');};break}break;case'page_next':switch(atr){case'begin':obj_link[i].onclick=function(){return NextPage('begin');};break;case'end':obj_link[i].onclick=function(){return NextPage('end');};break;case'place':obj_link[i].onclick=function(){return NextPage('place');};break;case'routing':obj_link[i].onclick=function(){return NextPage('routing');};break}break}if(++step==2)break}}}function RouteReverse(){var tmp_pos=obj_pos_route();var tmp_result=null;var tmp_places=null;var tmp_str='';var tmp_style='';var tmp_value='';var obj_begin=document.getElementById('edt_routing_begin');var obj_end=document.getElementById('edt_routing_end');if(obj_begin&&obj_end){var obj_box_begin=document.getElementById('route_search_begin');var obj_box_begin_result=obj_box_begin.getElementsByTagName('div')[0];var obj_box_begin_link=obj_box_begin.getElementsByTagName('a')[1];var obj_box_end=document.getElementById('route_search_end');var obj_box_end_result=obj_box_end.getElementsByTagName('div')[0];var obj_box_end_link=obj_box_end.getElementsByTagName('a')[1];var idx_begin=0;var idx_end=0;var str_begin='';var sub_idx_begin=0;var sub_idx_end=0;var sub_str='';var tmp='';var prev='';var obj_link=null;tmp_str=obj_box_begin_result.innerHTML;obj_box_begin_result.innerHTML=obj_box_end_result.innerHTML;obj_box_end_result.innerHTML=tmp_str;SetLink(obj_box_end_result.getElementsByTagName('a'),'end');SetLink(obj_box_begin_result.getElementsByTagName('a'),'begin');tmp_style=obj_box_begin_link.style.display;obj_box_begin_link.style.display=obj_box_end_link.style.display;obj_box_end_link.style.display=tmp_style;tmp_pos=pos_route_begin;pos_route_begin=pos_route_end;pos_route_end=tmp_pos;tmp_value=obj_begin.value;obj_begin.value=obj_end.value;obj_end.value=tmp_value;tmp_result=(typeof(searchresults_begin)!='undefined'?searchresults_begin:null);searchresults_begin=(typeof(searchresults_end)!='undefined'?searchresults_end:null);searchresults_end=tmp_result;tmp_places=(typeof(places_route_begin)!='undefined'?places_route_begin:null);places_route_begin=(typeof(places_route_end)!='undefined'?places_route_end:null);places_route_end=tmp_places;routing.ShowResults=false;HideSearch();if(pos_route_begin.is_set)AddLocatePoint('begin',pos_route_begin.pos,pos_route_begin.desc);if(pos_route_end.is_set)AddLocatePoint('end',pos_route_end.pos,pos_route_end.desc);map.Update();}}function RouteNew(){var obj_begin=document.getElementById('edt_routing_begin');var obj_end=document.getElementById('edt_routing_end');if(obj_begin&&obj_end){var obj_box_begin=document.getElementById('route_search_begin');var obj_box_begin_result=obj_box_begin.getElementsByTagName('div')[0];var obj_box_begin_link=obj_box_begin.getElementsByTagName('a')[1];var obj_box_end=document.getElementById('route_search_end');var obj_box_end_result=obj_box_end.getElementsByTagName('div')[0];var obj_box_end_link=obj_box_end.getElementsByTagName('a')[1];obj_box_begin_result.innerHTML='';obj_box_end_result.innerHTML='';obj_box_begin_link.style.display='none';obj_box_end_link.style.display='none';pos_route_begin=new obj_pos_route();pos_route_end=new obj_pos_route();obj_begin.value='';obj_end.value='';map.ClearPopupIcons();routing.ClearPlaces();HideSearch();}}function ChangeSearchFormType(idx){var obj=document.getElementById('frm_search');var obj_items=obj.getElementsByTagName('fieldset');var link_place=document.getElementById('link_changeform_place');var link_route=document.getElementById('link_changeform_route');if(obj){switch(idx){case 0:map.search_form_type='place';link_place.className='act';link_route.className='';obj_items[0].style.display='block';obj_items[1].style.display='none';break;case 1:map.search_form_type='route';link_place.className='';link_route.className='act';obj_items[0].style.display='none';obj_items[1].style.display='block';break}}}function SetRoutingPoint(type,pos,desc){var idx=0;if(routing.IsRoute){HideSearch(true);routing.IsRoute=false;routing.ShowResults=false;routing.ClearPlaces();switch(type){case'begin':if(pos_route_end.is_set)LocatePoint('end',pos_route_end.pos,pos_route_end.desc);break;case'end':if(pos_route_begin.is_set)LocatePoint('begin',pos_route_begin.pos,pos_route_begin.desc);break}}LocatePoint(type,pos,desc);}function SetRoutingPointBegin(){var obj=document.getElementById('edt_routing_begin');var desc='';var idxB=0;var idxE=0;if(obj){idxE=map.ActivRoutingDesc.indexOf('</h4>');if(idxE!=-1)desc=map.ActivRoutingDesc.substring(4,idxE);else desc=map.ActivRoutingDesc;obj.value=nbsp(desc);SetRoutingPoint('begin',map.ActivRoutingPos,desc);}}function SetRoutingPointEnd(){var obj=document.getElementById('edt_routing_end');var desc='';var idx=0;if(obj){idx=map.ActivRoutingDesc.indexOf('</h4>');if(idx!=-1)desc=map.ActivRoutingDesc.substring(4,idx);else desc=map.ActivRoutingDesc;obj.value=nbsp(desc);SetRoutingPoint('end',map.ActivRoutingPos,desc);}}function SetActiveLayers(layers){var size=layers.length}function ShowActIcon(idxl,idxo,timeout){var al=this.ActiveLayers[idxl];if(typeof al!='object')return false;if(idxo>=al.objs.length)return false;var ao=al.objs[idxo];if(typeof ao!='object')return false;var popuphtml;if(ao.onpopup)popuphtml=ao.onpopup(map,ao);else{if(this.OnActiveObjectMenu)popuphtml=SetActIconPos(map,al,ao);else popuphtml=ao.descr}}function ChangeLocationHref(path){try{var is_open=1;if((opener!=null)&&(!opener.closed)){if(typeof(opener.ChangeLocationHref)!='undefined'){is_open=0;opener.ChangeLocationHref(path);close();}}if(is_open)parent.location.href=path}catch(e){}}function SetActIconPos(map,layer,object){map_icon_layer=true;map_icon_layer_id=object.objid;map_icon_layer_pos=object.pos;map.ActivNearestIcon=false;map.ActivNearestIconID=object.objid;map.ActivNearestIconType='hotel';if(object.objid.substring(0,5)=='hotel'){var html='';html+='<table border="0" cellspacing="0" cellpadding="0"><tr>';html+='<td valign="top">'+object.descr+'<ul><li><a href="" onclick="DetailPoint();return false;">'+msg['PopupMoreInfo']+'</a></li></ul></td>';html+='<td>&nbsp;&nbsp;&nbsp;</td>';html+='<td valign="top"><img src="./data/'+object.objid+'_nahled.jpg" width="'+HOTELIMG_WIDTH+'" height="'+HOTELIMG_HEIGHT+'" border="0" alt="'+object.objid+'" /></td>';html+='</tr></table>';return html}return object.descr+'<div class="clear"></div><ul><li><a href="" onclick="DetailPoint();return false;">'+msg['PopupMoreInfo']+'</a></li></ul>'}function CreatePopup(o,x,y,html,offsetx,offsety){var popupHTML='';var popupHead=html;var popupMenu='';var swpx=false;var swpy=false;var ZoomLevel_max=map.ZoomLevels[0];var ZoomLevel_act=map.ZoomLevels[map.ZoomLevel];var Link_MaxDetail='';var Link_MaxDetail_href='';var Link_Scale200='';var Link_More='';var Link_To_Nearest='';var idx_begin=0;var idx_end=0;var IE=false;if(o){if(map_icon_layer){map.ActivRoutingPos=map_icon_layer_pos;idx_begin=html.indexOf('<h3>');idx_end=html.indexOf('</h3>');if(idx_begin!=-1&&idx_end!=-1)map.ActivRoutingDesc=html.substring(idx_begin+4,idx_end);else map.ActivRoutingDesc=html}if(ZoomLevel_max!=ZoomLevel_act){if(map_icon_layer){Link_MaxDetail_href='\'layer\', \''+map_icon_layer_pos+'\''}else Link_MaxDetail_href='';Link_MaxDetail+='<li><a href="" onclick="PopupMaxDetail('+Link_MaxDetail_href+'); return false;">'+msg['PopupMaximalDetail']+'</a></li>'}if(ZoomLevel_max!='200000'&&ZoomLevel_act!='200000')Link_Scale200+='<li><a href="" onclick="PopupScale200(); return false;">'+msg['PopupScale200']+'</a></li>';Link_To_Nearest='<p>'+msg['PopupRtTitle']+': <br />'+'<a href="" onclick="SetRoutingPointBegin();return false;">'+msg['PopupRtBegin']+'</a>&nbsp;|&nbsp;'+'<a href="" onclick="SetRoutingPointEnd();return false;">'+msg['PopupRtEnd']+'</a> '+msg['PopupRtText']+'</p>';if(map.ActivNearestIcon){Link_More='<ul><li><a href="" onclick="DetailPoint();return false;">'+msg['PopupMoreInfo']+'</a></li></ul>';map.ActivNearestIcon=false}popupMenu='<ul>'+'<li><a href="" onclick="PopupCenter(); return false;">'+msg['PopupCenterMap']+'</a></li>'+Link_MaxDetail+Link_Scale200+'</ul>'+Link_To_Nearest;popupHead+=Link_More;o.innerHTML='<div id="idMAPPopupFrame" class="csMyMAPPopupFrame">';if(popupHead!='')o.innerHTML+='<div class="csMAPPopupHead">'+popupHead+'</div>';if(popupMenu!='')o.innerHTML+='<div class="csMAPPopupMenu">'+popupMenu+'</div>';o.innerHTML+='</div>';if(document.all&&!(navigator.userAgent.indexOf('Opera')!=-1))IE=true;if(((x+o.offsetWidth-27)>this.MapWidth+offsetx))swpx=true;if(((y-o.offsetHeight-17)>offsety))swpy=true;if(swpy)y+=-o.offsetHeight-(IE?3:17);else y+=5;if(swpx)x+=-o.offsetWidth+28;else x-=27;if(swpy)popupHTML='<div id="idMAPPopupFrame" class="csMyMAPPopupFrame">'+'<div class="csMAPPopupHead">'+popupHead+'</div>'+'<div class="csMAPPopupMenu">'+popupMenu+'</div>'+'</div>'+'<div id="idMAPPopupArrow" style=\"z-index: 503; position: relative; top:-1px; text-align:'+(swpx?'right':'left')+'\">'+'<img src=\"'+ngMapAPIURL+'/popupArrDown.gif\" style=\"vertical-align:top;\" width=\"55\" height=\"13\" alt=\"\" border=\"0\" />'+'</div>';else popupHTML='<div id="idMAPPopupArrow" style=\"position: relative; z-index: 503; font-size:0px;text-align:'+(swpx?'right':'left')+'\">'+'<img src=\"'+ngMapAPIURL+'/popupArrUp.gif\" style=\"vertical-align:bottom;\" width=\"55\" height=\"13\" alt=\"\" border=\"0\" />'+'</div>'+'<div id="idMAPPopupFrame" class="csMyMAPPopupFrame" style=\"position: relative; top: -1px;\">'+'<div class="csMAPPopupHead">'+popupHead+'</div>'+'<div class="csMAPPopupMenu">'+popupMenu+'</div>'+'</div>';o.innerHTML=popupHTML;o.style.left=x+"px";o.style.top=y+"px";o.style.visibility='visible'}map_icon_layer_pos='';map_icon_layer=false}function CreatePopupMenu(map,popup){var iconPos=popup.pos;var iconDesc=popup.descr;var gc=Array();if(popup.id=='ngRouting1_0'||popup.id=='ngRouting1_1'){gc=iconPos.split(';');if(gc.length<=2)iconPos='WGS-84;'+iconPos}else{if(popup.id.indexOf('near')!=-1){map.ActivNearestIcon=true;map.ActivNearestIconID=nearestresults.Results[popup.objid].id;map.ActivNearestIconType='tip'}else map.ActivNearestIcon=false}map.ActivPopupIconPos=iconPos;map.ActivRoutingPos=iconPos;map.ActivRoutingDesc=iconDesc;return iconDesc}function PopupCenter(){map.Center(map.PopupX,map.PopupY);map.HidePopup();}function PopupMaxDetail(type,pos){var iconPos='';switch(type){case'begin':iconPos=pos_route_begin.pos;break;case'end':iconPos=pos_route_end.pos;break;case'layer':iconPos=pos;break;default:iconPos=map.ActivPopupIconPos}map.LocateScaleXY('max',iconPos);map.HidePopup();}function PopupScale200(){map.SetScale('200000',map.PopupX,map.PopupY);map.HidePopup();}function ShowMapScale(){var obj=document.getElementById('map_scale');var width=Math.floor(map.GraphicScaleWidth/3);var str='';var desc=map.GraphicScaleText;var scale='1:'+FormatScale(map.ZoomLevels[map.ZoomLevel]);var html='';if(obj){html+='<span class="hidden">'+msg['MapScale']+'</span> ';html+='<span title="'+scale+'" style="width:'+width+'px" class="dark"></span>';html+='<span title="'+scale+'" style="width:'+width+'px" class="light"></span>';html+='<span title="'+scale+'" style="width:'+width+'px" class="dark"></span>';html+='<strong>'+desc+'</strong>';obj.innerHTML=html}}function ShowMapZoomScale(){var max=map.ZoomLevels.length;var obj=document.getElementById('map_zoom_scale');var html='';var current='';var title='';var background='';var class_name='';var scale_color_act='275caa';var scale_max_r=56;var scale_max_g=100;var scale_max_b=161;var scale_const_r=(255-scale_max_r)/(max-1);var scale_const_g=(255-scale_max_g)/(max-1);var scale_const_b=(255-scale_max_b)/(max-1);var scale_color_r='';var scale_color_g='';var scale_color_b='';if(obj){for(var i=max-1;i>=0;i--){title='1:'+FormatScale(map.ZoomLevels[i]);class_name='';act_begin='';act_end='';if(i==map.ZoomLevel){background=scale_color_act;class_name=' class="act"';act_begin='<strong>';act_end='</strong>'}else{scale_color_r=DecToHex(scale_max_r+(i*scale_const_r));scale_color_g=DecToHex(scale_max_g+(i*scale_const_g));scale_color_b=DecToHex(scale_max_b+(i*scale_const_b));background=scale_color_r+scale_color_g+scale_color_b}html+='<a href="" onclick="map.SetScale('+map.ZoomLevels[i]+');return false;"'+class_name+' title="'+title+'"><span style="background:#'+background+';">'+act_begin+'<span>'+title+'</span>'+act_end+'</span></a> '}if(html=='')html+='&nbsp;';obj.innerHTML=html}}function SetMapModeBtn(){var zoom=document.getElementById('mode_zoom');var pan=document.getElementById('mode_pan');switch(map.Mode){case'P':zoom.className='';pan.className='act';break;case'Z+':zoom.className='act';pan.className='';break;case'L':zoom.className='';pan.className=''}}function MapModePan(){if(map_locating_point)ChangeMode(map_act_point,1);map.PanMode();SetMapModeBtn();}function MapModeZoom(){if(map_locating_point)ChangeMode(map_act_point,1);map.ZoomMode();SetMapModeBtn();}function MapPrint(){if(map){var win=null;var w=700;var h=612;var l=(screen.width-w)/2;var t=(screen.heigh-h)/2;var url='';if(l<0)l=0;if(t<0)t=0;url='./print.php?lang='+lang+'&'+map.URLStateParams(true,true);if(map.ActiveSearchPos!='')url+='&search='+map.ActiveSearchPos;if(map.ActiveNearest){var tmp=Array();url+='&nearest='+map.ActiveNearestIdx;for(var i=0;i<nearest.Results.length;i++){tmp=nearest.Results[i].pos.split(';');url+=';'+tmp[1]}}win=open(url,'print','width='+w+',height='+h+',toolbar=no,location=no,scrollbars=yes,menubar=no,resizable=yes,left='+l+',top='+t);if(win)win.focus();}}function MapReset(){if(map_act_point!='')ChangeMode(map_act_point,1);map.Home();map.ClearPopupIcons();routing.ClearPlaces();MapModePan();HideSearch();HideLinkResult('begin');HideLinkResult('end');pos_route_begin=new obj_pos_route();pos_route_end=new obj_pos_route();ClearForms();}function MapMenuPos(map){var iconDesc='V tomto místě';var iconPos='WGS-84;';proj.OnCalculate=function(proj,pos){if(pos){iconPos+=pos;iconDesc=(proj.Locality.length>0?proj.Locality[0]:'');map.ActivPopupIconPos=iconPos;map.ActivRoutingPos=iconPos;map.ActivRoutingDesc=iconDesc}};proj.ResolveLocality=true;proj.Pixels2Proj(new ScreenPt(map.MouseX,map.MouseY),PROJ_WGS);return iconDesc}function Search(){var obj=document.getElementById('edt_search');if(obj&&obj.value!=''){HideSearch();map.search_result_type='place';places.Search(obj.value);}}function LocateItem(idx){if(searchresults){searchresults.LocateItem(idx);if(places.Results[idx].pos!='')map.ActiveSearchPos=places.Results[idx].pos}}function LocateNearestItem(idx){if(nearestresults)LocateNearestPoint(nearestresults,idx,true,'max');}function AddNearestPoint(ic,idx){var iconID='near'+nearest.ActivTypeIcon+'_'+idx;var iconPos=ic.pos;var iconDesc=ic.descr;var iconUrl='./img/bg_list_f'+nearest.ActivTypeIcon+'b.gif';var iconHS=new ScreenPt(12,12);var icon=null;icon=map.AddPopupIcon(iconID,iconUrl,iconPos,iconDesc,iconHS);icon.onpopup=CreatePopupMenu;icon.objid=idx}function LocateNearestPoint(places,idx){var iconID='near'+nearest.ActivTypeIcon+'_'+idx;map.LocatePopupIcon(iconID);}function AddLocatePoint(name,pos,desc){var iconID=ID_LOCATEPT_ICON+'_'+name;var iconPos=pos;var iconDesc=desc;var iconUrl='';var iconHS=new ScreenPt(7,7);var icon=null;switch(name){case'begin':pos_route_begin.is_set=true;pos_route_begin.pos=pos;pos_route_begin.desc=desc;iconUrl='/ngMapAPI/rt_start.png';break;case'end':pos_route_end.is_set=true;pos_route_end.pos=pos;pos_route_end.desc=desc;iconUrl='/ngMapAPI/rt_end.png';break;default:iconUrl='/ngMapAPI/rt_place.png'}icon=map.AddPopupIcon(iconID,iconUrl,iconPos,iconDesc,iconHS);icon.onpopup=CreatePopupMenu;}function DetailPoint(){var id=map.ActivNearestIconID;var tbl=map.ActivNearestIconType;var url='./src/nearest_detail.php?lang='+lang+'&tbl='+tbl+'&id='+id;places.ProcessUrl(url);}function ShowDetailPoint(items){var obj=document.getElementById('map_result');var html='';var addr='';ShowSearch();if(obj){html+='<h3><span>'+msg['MapResult']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';html+='<h4>'+items[0]+(map.ActivNearestIconType=='hotel'?' <em>'+items[1]+'</em>':'')+'</h4>';html+='<address>';addr+=items[2];addr+=(items[3]!='')?(addr!=''?'<br />':'')+'<strong>Tel.:</strong> '+items[3]:'';addr+=(items[4]!='')?(addr!=''?'<br />':'')+'<strong>E-mail:</strong> <a href="mailto:'+items[4]+'">'+items[4]+'</a>':'';html+=addr;html+='</address>';html+='<div class="clear"></div>';html+=(map.ActivNearestIconType=='tip')?'<p class="descr">'+items[5]+'</p>':'';obj.innerHTML=html}}function LocatePoint(name,pos,desc){var iconID=ID_LOCATEPT_ICON+'_'+name;AddLocatePoint(name,pos,desc);map.LocatePopupIcons(iconID);ChangeSearchFormType(1);}function HideLinksResult(){HideLinkResult('begin');HideLinkResult('end');}function HideLinkResult(type){var obj=document.getElementById('route_search_'+type);var obj_result=obj.getElementsByTagName('div')[0];var obj_link=obj.getElementsByTagName('a')[1];if(obj_link)obj_link.style.display='none'}function SetPos(x,y,type){var obj=obj_route_begin=document.getElementById('edt_routing_'+type);var desc='';proj.OnCalculate=function(proj,pos){if(pos){pos='WGS-84;'+pos;desc=(proj.Locality.length>0?proj.Locality[0]:'');if(obj)obj.value=desc;LocatePoint(type,pos,desc);HideLinkResult(type);}};proj.ResolveLocality=true;proj.Pixels2Proj(new ScreenPt(x,y),PROJ_WGS);}function SetPosBegin(x,y){pos_route_begin.cursor=new ScreenPt(x,y);SetPos(x,y,'begin');}function SetPosEnd(x,y){pos_route_end.cursor=new ScreenPt(x,y);SetPos(x,y,'end');}function PutPoint(e){var obj_map=document.getElementById('map_main');var obj_route_begin=null;var obj_route_end=null;var idx=0;if(obj_map&&map.Mode=='L'){if(routing.IsRoute){HideSearch(true);routing.IsRoute=false;routing.ShowResults=false;routing.ClearPlaces();switch(map.routing_form_type){case'begin':if(pos_route_end.is_set)LocatePoint('end',pos_route_end.pos,pos_route_end.desc);break;case'end':if(pos_route_begin.is_set)LocatePoint('begin',pos_route_begin.pos,pos_route_begin.desc);break}}obj_route_begin=document.getElementById('edt_routing_begin');obj_route_end=document.getElementById('edt_routing_end');map.GetMousePosition(e);switch(map_act_point){case'begin':if(obj_route_begin)obj_route_begin.value=map.MouseX+'/'+map.MouseY;SetPosBegin(map.MouseX,map.MouseY);ChangeMode('begin',1);break;case'end':if(obj_route_end)obj_route_end.value=map.MouseX+'/'+map.MouseY;SetPosEnd(map.MouseX,map.MouseY);ChangeMode('end',1);break}}}function ChangeMode(link,idx){var obj=document.getElementById('link_PutToMap_'+link);if(obj){switch(idx){case 0:if(map_locating_point==false){map_act_point=link;map.routing_form_type=link;map_mode=map.Mode;if(map_mode=='L')map_mode='P';map.SetMode('L');map.SetCursor(map.CursorRouting);map_locating_point=true;if(link=='begin')obj.onclick=function(){return ChangeMode('begin',1);};else obj.onclick=function(){return ChangeMode('end',1);};obj.className='on_map_act blue'}break;case 1:map_act_point='';map_locating_point=false;map.SetMode(map_mode);if(link=='begin')obj.onclick=function(){return ChangeMode('begin',0);};else obj.onclick=function(){return ChangeMode('end',0);};obj.className='on_map';break}SetMapModeBtn();}return false}function SearchKeyPress(e,idx){if(!e)e=window.event;if((e.which?e.which:e.keyCode)==13){if(map.search_form_type=='route'){SearchRouteClick(idx,true);}else Search();return false}return true}function SearchRouteClick(idx,mainbutton){var obj=document.getElementById('edt_routing_'+idx);map.routing_form_type=idx;map.routing_form_mainbutton=(typeof mainbutton!='undefined'?mainbutton:false);ResultBox('route_search_'+map.routing_form_type,'none');HideLinkResult(map.routing_form_type);HideSearch();if((obj)&&(obj.value!='')){switch(idx){case'begin':map.search_result_type='begin';places_route_begin.SearchText=obj.value;places_route_begin.Search(obj.value);break;case'end':map.search_result_type='end';places_route_end.SearchText=obj.value;places_route_end.Search(obj.value);break}}}function NextPage(type){switch(type){case'begin':if(searchresults_begin){map.search_result_type='begin';map.routing_form_type='begin';searchresults_begin.NextPage();}break;case'end':if(searchresults_end){map.search_result_type='end';map.routing_form_type='end';searchresults_end.NextPage();}break;case'place':if(searchresults){map.search_result_type='place';searchresults.NextPage();}break;case'routing':routing.NextPage();break}return false}function PrevPage(type){switch(type){case'begin':if(searchresults_begin){map.search_result_type='begin';map.routing_form_type='begin';searchresults_begin.PrevPage();}break;case'end':if(searchresults_end){map.search_result_type='end';map.routing_form_type='end';searchresults_end.PrevPage();}break;case'place':if(searchresults){map.search_result_type='place';searchresults.PrevPage();}break;case'routing':routing.PrevPage();break}return false}function IsPrevPlaceVisible(places){if((typeof(places.PrevVisible)!='undefined'&&places.PrevVisible)||(typeof(places.Params)!='undefined'&&places.Params.PrevVisible))return true;return false}function IsNextPlaceVisible(places){if((typeof(places.NextVisible)!='undefined'&&places.NextVisible)||(typeof(places.Params)!='undefined'&&places.Params.NextVisible))return true;return false}function ShowSearch(){var obj=document.getElementById('map_result');if(obj)obj.style.display='block'}function SetResultDescription(res){var t='';var stat='';if(typeof(res)=='object'&&res!=null){if(typeof(res.street)=='string'&&res.street!=''){t=res.street}if(typeof(res.city)=='string'&&res.city!=''){if(t!='')t+=', ';t+=res.city;if(typeof(res.statusKod)=='string'&&res.statusKod!=''){switch(res.statusKod){case 1:stat=msg['CityStatus_1'];break;case 2:stat=msg['CityStatus_2'];break;case 3:stat=msg['CityStatus_3'];break;case 4:stat=msg['CityStatus_4'];break;case 7:stat=msg['CityStatus_5'];break}if(stat!='')t+=', '+stat}}if(typeof(res.psc)=='string'&&res.psc!=''){if(t!='')t+=', ';t+=res.psc}}if(t!='')res.descr=t}function SetRouting(idx,show_ResultBox){var obj=document.getElementById('edt_routing_'+map.routing_form_type);var desc='';var ic=null;var mainbutton=((typeof map.routing_form_mainbutton!='undefined')&&(map.routing_form_mainbutton));var locatefnc=(mainbutton?AddLocatePoint:LocatePoint);if(obj){map.ActivRoutingIcon=true;if(routing.IsRoute){HideSearch(true);routing.ShowResults=false;routing.IsRoute=false;routing.ClearPlaces();switch(map.routing_form_type){case'begin':if(pos_route_end.is_set)locatefnc('end',pos_route_end.pos,pos_route_end.desc);break;case'end':if(pos_route_begin.is_set)locatefnc('begin',pos_route_begin.pos,pos_route_begin.desc);break}}if(show_ResultBox!=false)ResultBox('route_search_'+map.routing_form_type,'block');else ResultBox('route_search_'+map.routing_form_type,'none');switch(map.routing_form_type){case'begin':desc=(places_route_begin.Results[idx].descr).replace(/&nbsp;/g,function(strMatch){return' '});pos_route_begin.desc=desc;pos_route_begin.pos=places_route_begin.Results[idx].pos;pos_route_begin.is_set=true;searchresults_begin.Results[idx].descr;locatefnc('begin',pos_route_begin.pos,pos_route_begin.desc);break;case'end':desc=(places_route_end.Results[idx].descr).replace(/&nbsp;/g,function(strMatch){return' '});pos_route_end.desc=desc;pos_route_end.pos=places_route_end.Results[idx].pos;pos_route_end.is_set=true;locatefnc('end',pos_route_end.pos,pos_route_end.desc);break}obj.value=desc;if((mainbutton)||((pos_route_begin.is_set)&&(pos_route_begin.pos!='')&&(pos_route_end.is_set)&&(pos_route_end.pos!=''))){map.Update();map.routing_form_mainbutton=false;Routing();}}}function HideSearch(NoChangeMode){var obj=document.getElementById('map_result');if((obj)&&(obj.style.display!='none')){obj.style.display='none';obj.innerHTML='';if(map_act_point!=''&&NoChangeMode!=true)ChangeMode(map_act_point,1);map.ClearPopupIcons();routing.IsRoute=false;routing.ShowResults=false;routing.ClearResults();nearest.ActivTypeIcon='';map.ActiveSearchPos='';map.ActiveNearest=false;map.ActiveNearestIdx=''}}function ResultBox(id,display){var obj_edit=null;var obj_parent=document.getElementById(id);var obj=obj_parent.getElementsByTagName('div')[0];var hidden=(typeof obj=='undefined'||obj.style.display=='none'||obj.style.display=='');if((hidden)&&((typeof(display)=='undefined')||(display=='block'))){switch(id){case'route_search_begin':obj_edit=document.getElementById('edt_routing_begin');if((typeof obj_edit!='undefined')&&(typeof places_route_begin.SearchText!='undefined')&&(obj_edit.value!=places_route_begin.SearchText)){places_route_begin.SearchText=obj_edit.value;SearchRouteClick('begin');}break;case'route_search_end':obj_edit=document.getElementById('edt_routing_end');if((typeof obj_edit!='undefined')&&(typeof places_route_end.SearchText!='undefined')&&(obj_edit.value!=places_route_end.SearchText)){places_route_end.SearchText=obj_edit.value;SearchRouteClick('end');}break}}if(obj){if(typeof(display)!='undefined'&&display!='')obj.style.display=display;else{if(hidden)obj.style.display='block';else obj.style.display='none'}}}function nSearchFinished(places){nDisplaySearchResults(this);}function nDisplaySearchError(places,error){var obj_map_result=document.getElementById('map_result');var html='';if(obj_map_result){html+='<h3><span>'+msg['MapResult']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';html+='<p>'+msg['MapResultNoTip']+'.</p>';ShowSearch();obj_map_result.innerHTML=html}}function nDisplaySearchResults(places){var obj_map_result=document.getElementById('map_result');var html='';var html_title='';var max_count_items=0;map.RemovePopupIconsByID('near'+nearest.ActivTypeIcon+'_');if(obj_map_result){nearestresults=places;if(places.Results.length>0){max_count_items=(places.Results.length>10)?10:places.Results.length;html+='<ul class="nearest">'+"\n";for(i=0;i<places.Results.length;i++){html+='<li>';html+='<strong>'+places.Results[i].dist+'</strong> ';SetResultDescription(places.Results[i]);res_desc=places.Results[i].descr.substring(4,places.Results[i].descr.indexOf('</h4>'));html+='<a href="" onclick="LocateNearestItem('+i+');return false;">'+res_desc+'</a>';html+='</li>'+"\n";if(i<max_count_items)AddNearestPoint(places.Results[i],i);}html+='</ul>';html+='<div id="map_search_browser">';html+='<p class="left">'+msg['MapResultControl']+' '+places.PageFrom+'...'+places.PageTo+'</p>';html+='<p class="right">';searchresults=places;if(places.PrevVisible){html+='<a href="" onclick="PrevPage(\'place\');return false;" class="page_prev" title="'+msg['MapResultPrevTitle']+'"><span>&laquo;</span>&nbsp;'+msg['MapResultPrev']+'</a>';if(places.NextVisible){html+=' <span>|</span> '}}if(places.NextVisible)html+='<a href="" onclick="NextPage(\'place\');return false;" class="page_next" title="'+msg['MapResultNextTitle']+'">'+msg['MapResultNext']+'&nbsp;<span>&raquo;</span></a>';html+='</div>';html+='<div class="clear"></div>';map.LocatePopupIcons('near'+nearest.ActivTypeIcon+'_*');}else{html+='<p>'+msg['MapResultNoTip']+'.</p>'}ShowSearch();html_title+='<h3><span>'+msg['MapResult']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';obj_map_result.innerHTML=html_title+html}html=''}function DisplaySearchResults(places){var obj=document.getElementById('route_search_'+map.routing_form_type);var obj_result=obj.getElementsByTagName('div')[0];var obj_link=obj.getElementsByTagName('a')[1];var html='';var PrevVisible=IsPrevPlaceVisible(places);var NextVisible=IsNextPlaceVisible(places);var res_desc='';var link_href_prefix='';var link_href_posfix='';var search_result_type='';var obj_map_result=document.getElementById('map_result');if(obj_result&&obj_link&&obj_map_result){if(places.Results.length>0){if(map.search_result_type!='place'){search_result_type=map.routing_form_type;link_href_prefix='SetRouting';link_href_posfix=', false';html+='<h4>'+msg['MapResult']+'</h4>'}else{search_result_type='place';html+='<h3><span>'+msg['MapResult']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';link_href_prefix='LocateItem';link_href_posfix='';ShowSearch();}switch(search_result_type){case'begin':searchresults_begin=places;break;case'end':searchresults_end=places;break;case'place':searchresults=places;break}if(places.Results.length==1&&!PrevVisible&&!NextVisible){if(map.search_form_type=='route'){SetResultDescription(places.Results[0]);SetRouting(0,false);obj_link.style.display='none'}else{html+='<ul>'+"\n";html+='<li>';if(typeof places.Results[0].dist!='undefined')html+=places.Results[0].dist+' ';SetResultDescription(places.Results[0]);res_desc=places.Results[0].descr;html+='<a href="" onclick="'+link_href_prefix+'('+i+link_href_posfix+');return false;">'+res_desc+'</a>';html+='</li>'+"\n";html+='</ul>';obj_map_result.innerHTML=html;LocateItem(0);}}else{if(map.search_form_type=='route'&&map.search_result_type!='place'){obj_link.style.display='block';ResultBox('route_search_'+map.routing_form_type,'block');}html+='<ul>'+"\n";for(i=0;i<places.Results.length;i++){html+='<li>';if(typeof places.Results[i].dist!='undefined')html+=places.Results[i].dist+' ';SetResultDescription(places.Results[i]);res_desc=places.Results[i].descr;html+='<a href="" onclick="'+link_href_prefix+'('+i+link_href_posfix+');return false;">'+res_desc+'</a>';html+='</li>'+"\n"}html+='</ul>';if(typeof(places.Params)=='undefined'||typeof(places.Params.PageFrom)=='undefined'||typeof(places.Params.PageTo)=='undefined'){var pgFrom=places.PageFrom;var pgTo=places.PageTo}else{var pgFrom=places.Params.PageFrom;var pgTo=places.Params.PageTo}html+='<div id="map_search_browser">';if(search_result_type=='place')html+='<p class="left">'+msg['MapResultControl']+' '+pgFrom+'...'+pgTo+'</p>';html+='<p class="right">';PrevVisible=IsPrevPlaceVisible(places);NextVisible=IsNextPlaceVisible(places);if(PrevVisible){html+='<a href="" onclick="PrevPage(\''+search_result_type+'\');return false;" class="page_prev" title="'+msg['MapResultPrevTitle']+'"><span>&laquo;</span>&nbsp;'+msg['MapResultPrev']+'</a>';if(NextVisible){html+=' <span>|</span> '}}if(NextVisible)html+='<a href="" onclick="NextPage(\''+search_result_type+'\');return false;" class="page_next" title="'+msg['MapResultNextTitle']+'">'+msg['MapResultNext']+'&nbsp;<span>&raquo;</span></a>';html+='</div>';html+='<div class="clear"></div>';if(map.search_result_type!='place')obj_result.innerHTML=html;else obj_map_result.innerHTML=html}}else{html='<h3><span>'+msg['MapResult']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';html+='<p>'+msg['MapResultNoResults']+'.</p>';obj_map_result.innerHTML=html;ShowSearch();}}}function RoutingStartCalc(){var html='';var obj=document.getElementById('map_result');if(obj){obj.style.display='block';html+='<h3><span>'+msg['MapRouting']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';html+='<p>'+msg['MapResultWait']+'</p>';obj.innerHTML=html}return true}function Routing(){if((!pos_route_begin.is_set)||(pos_route_begin.pos=='')){SearchRouteClick('begin',true);return}if((!pos_route_end.is_set)||(pos_route_end.pos=='')){SearchRouteClick('end',true);return}HideLinksResult();HideSearch();map.ClearPopupIcons();routing.PageAct=0;routing.ShowResults=true;routing.ClearPlaces();routing.AddPlace(pos_route_begin.desc,pos_route_begin.pos);routing.AddPlace(pos_route_end.desc,pos_route_end.pos);routing.CalcRoute();}function LocateRoutePoint(idx){routing.LocateItem(idx);}function LocateRouteMouseOver(idx){map.ShowPopupByID(routing.ItemIconID(idx),0);}function LocateRouteMouseOut(idx){map.HidePopup();}function rt_PrevPage(){if((this.PageAct-1)*this.PageSize>=0){--this.PageAct;this.DisplayPage();}}function rt_NextPage(){if((this.PageAct+1)*this.PageSize<this.Itineraire.length){++this.PageAct;this.DisplayPage();}}function rt_DisplayPage(){var obj=document.getElementById('map_result');var idx_begin=this.PageAct*this.PageSize;var idx_end=(idx_begin+this.PageSize-1<this.Itineraire.length)?idx_begin+this.PageSize:this.Itineraire.length;var html='';var PrevVisible=false;var NextVisible=false;var pgFrom=idx_begin;var pgTo=idx_end;if(obj){html+='<h3><span>'+msg['MapRouting']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';if(this.Itineraire.length>0){html+='<table id="route_itineraire">'+'<thead>'+'<tr>'+'<th>'+msg['MapRoutingCity']+'&nbsp;</th>'+'<th>'+msg['MapRoutingTime']+'&nbsp;</th>'+'<th align="right">'+msg['MapRoutingKm']+'&nbsp;&nbsp;</th>'+'<th>'+msg['MapRoutingRoute']+'</th>'+'<th align="right">'+msg['MapRoutingLen']+'</th>'+'</tr>'+'</thead>'+'<tbody>';for(var i=idx_begin;i<idx_end;i++){point_city='<a href="" onclick="LocateRoutePoint('+i+');return false;" onmouseover="LocateRouteMouseOver('+i+');" onmouseout="LocateRouteMouseOut('+i+');">'+routing.Itineraire[i].name+'</a>';point_time=routing.Itineraire[i].duration;point_km=routing.Itineraire[i].km;point_route=routing.Itineraire[i].route;point_len=routing.Itineraire[i].len;if(typeof(this.Itineraire[i].PlaceIdx)!='undefined')row_class=' class="bold"';else row_class='';html+='<tr'+row_class+'>'+'<td>'+point_city+'&nbsp;</td>'+'<td>'+point_time+'&nbsp;</td>'+'<td align="right">'+point_km+'&nbsp;&nbsp;</td>'+'<td>'+point_route+'</td>'+'<td align="right">'+point_len+'</td>'+'</tr>'}html+='</tbody>'+'</table>';html+='<div id="map_search_browser">';html+='<p class="left">'+msg['MapResultControl']+' '+(pgFrom+1)+'...'+pgTo+'</p>';html+='<p class="right">';PrevVisible=((this.PageAct-1)*this.PageSize>=0)?true:false;NextVisible=((this.PageAct+1)*this.PageSize<this.Itineraire.length)?true:false;if(PrevVisible){html+='<a href="" onclick="PrevPage(\'routing\');return false;" class="page_prev" title="'+msg['MapResultPrevTitle']+'"><span>&laquo;</span>&nbsp;'+msg['MapResultPrev']+'</a>';if(NextVisible){html+=' <span>|</span> '}}if(NextVisible)html+='<a href="" onclick="NextPage(\'routing\');return false;" class="page_next" title="'+msg['MapResultNextTitle']+'">'+msg['MapResultNext']+'&nbsp;<span>&raquo;</span></a>';html+='</div>';html+='<div class="clear"></div>'}else{html+='<p>'+msg['MapResultNoRoute']+'</p>'}obj.innerHTML=html}}function DisplayRoutingError(routing,error){var html='';var obj=document.getElementById('map_result');var msg='';if(obj&&routing.ShowResults){ShowSearch();obj.style.display='block';routing.IsRoute=true;switch(error){case-2:msg=msg['MapResultError'];break;case-1:default:msg=msg['MapResultNoRoute'];break}html+='<h3><span>'+msg['MapRouting']+'</span></h3>';html+='<a href="" onclick="HideSearch();return false;" id="close_result" title="'+msg['MapResultClose']+'"><span>'+msg['MapResultClose']+'</span></a>';html+='<p>'+msg+'</p>';obj.innerHTML=html}routing.ShowResults=true}function DisplayRoutingItineraire(routing){var html='';var html_title='';var obj=document.getElementById('map_result');if(obj&&routing.ShowResults){ShowSearch();obj.style.display='block';routing.IsRoute=true;routing.DisplayAllItems();routing.DisplayPage();}routing.ShowResults=true}function SearchNearestClick(idx){if(map){if(proj){proj.OnCalculate=function(proj,pos){if(pos){nearest.PosCenterPoint=pos;nearest.NearestToPos(idx,pos,'','lang='+lang);}};HideSearch();map.ActiveNearest=true;map.ActiveNearestIdx=idx;map.RemovePopupIconsByID('near'+nearest.ActivTypeIcon+'_');nearest.ActivTypeIcon=idx;proj.ResolveLocality=true;proj.Pixels2Proj(new ScreenPt(map.MapWidth/2,map.MapHeight/2),PROJ_WGS);}}}function OnActiveLayers(){if(map.ShowActivePopup){map.ShowActivePopup=false;if(pID.substring(0,5)=='hotel')map.ShowActiveObjPopupByID('ea_hotel',pID);else map.ShowActiveObjPopupByID('ea_res',pID);}}function MapInitialize(map){MapModePan();}function MapInit(){var iconPos=null;var iconID='';ShowMapScale();ShowMapZoomScale();}function obj_pos_route(){this.is_set=false;this.cursor={x:0,y:0};this.pos='';this.desc=''}function init(){var InitHome=true;ClearForms();searchresults_begin=null;searchresults_end=null;searchresults=null;nearestresults=null;pos_route_begin=new obj_pos_route();pos_route_end=new obj_pos_route();map_mode='P';map_act_point='begin';map_locate_points=Array();map_locating_point=false;map_icon_layer=false;map_icon_layer_id='';map_icon_layer_pos='';map=new ngMap('map_main','map.php?lang='+lang);map.CursorRouting="url('./img/routing.cur'), move";map.CreatePopup=CreatePopup;map.OnActiveObjectMenu=SetActIconPos;map.OnCommandFinished=MapInit;map.OnMapMenu=MapMenuPos;map.ActivPopupIconPos='';map.ActivRoutingID='';map.ActivRoutingPos='';map.ActivRoutingDesc='';map.ActivNearestIcon=false;map.ActivNearestIconType='';map.ActivNearestIconID='';map.routing_form_type='begin';map.search_form_type='place';map.search_result_type='';map.OnTilesLoaded=OnActiveLayers;map.ShowActivePopup=false;map.ActiveSearchPos='';map.ActiveNearest=false;map.ActiveNearestIdx=false;map.OnInitialize=MapInitialize;preview=new ngMap('map_preview');preview.Preview(map);places=new ngPlaces(map);places.PageSize=COUNT_SEARCH_ITEM;places.Country=MAP_COUNTRY;places.OnItemPopupMenu=CreatePopupMenu;places.OnSearchResults=DisplaySearchResults;places.OnSearchError=DisplaySearchResults;places_route_begin=new ngPlaces(map);places_route_begin.PageSize=COUNT_SEARCH_ITEM;places_route_begin.Country=MAP_COUNTRY;places_route_begin.OnItemPopupMenu=CreatePopupMenu;places_route_begin.OnSearchResults=DisplaySearchResults;places_route_begin.OnSearchError=DisplaySearchResults;places_route_end=new ngPlaces(map);places_route_end.PageSize=COUNT_SEARCH_ITEM;places_route_end.Country=MAP_COUNTRY;places_route_end.OnItemPopupMenu=CreatePopupMenu;places_route_end.OnSearchResults=DisplaySearchResults;places_route_end.OnSearchError=DisplaySearchResults;routingplaces=new ngRPC('routingplaces');routing=new ngRouting(map);routing.IsRoute=false;routing.AutoCalc=true;routing.OnCalculate=RoutingStartCalc;routing.OnError=DisplayRoutingError;routing.OnItineraire=DisplayRoutingItineraire;routing.OnItemPopupMenu=CreatePopupMenu;routing.OnPlacePopupMenu=CreatePopupMenu;routing.ShowResults=true;routing.PageSize=COUNT_SEARCH_ITEM;routing.PageAct=0;routing.DisplayPage=rt_DisplayPage;routing.PrevPage=rt_PrevPage;routing.NextPage=rt_NextPage;nearest=new ngNearest(map);nearest.NearestURL='./src/nearest.php';nearest.PageSize=COUNT_SEARCH_ITEM;nearest.PosCenterPoint='';nearest.ActivTypeIcon='';nearest.ActivTypeIcons=0;nearest.OnSearchResults=nDisplaySearchResults;nearest.OnSearchError=nDisplaySearchError;nearest.OnItemPopupMenu=CreatePopupMenu;nearest.OnLocateItem=LocateNearestPoint;nearest.SearchFinished=nSearchFinished;proj=new ngProj(map);if(pRtBegin.is_set){var obj=document.getElementById('edt_routing_begin');if(obj){obj.value=pRtBegin.name;LocatePoint('begin',pRtBegin.pos,pRtBegin.name);}}if(pRtEnd.is_set){var obj=document.getElementById('edt_routing_end');if(obj){InitHome=false;obj.value=pRtEnd.name;LocatePoint('end',pRtEnd.pos,pRtEnd.name);}}if(pPos!=''){if(pSearch!=''){var obj=document.getElementById('edt_search');if(obj)obj.value=pSearch}InitHome=false;map.LocateScaleXY('max',pPos);}else if(pID!=''){if(pSearch!=''){var obj=document.getElementById('edt_search');if(obj)obj.value=pSearch}InitHome=false;map.ShowActivePopup=true;if((pIDName!='')&&(pID.substring(0,3)=='tip')){var hs=new ScreenPt(8,8);icon=map.AddPopupIcon('POS','/img/icon_tip.png',pIDPos,pIDName,hs);icon.onpopup=places.OnItemPopupMenu}map.LocateScaleXY('max',pIDPos);}else if(pSearch!=''){UseExample(pSearch);}if(InitHome)map.Home();}window.onload=init;