if(!MREITTI)var MREITTI={};MREITTI.UTIL={};MREITTI.UTIL.routeLocationToString=function(h){var l="";if(h.getCategory()==RouteLocation.CATEGORY_POINT&&h.getName()===null)l+=Dictionary.CoordinateLocationPrefix+" ["+Math.round(h.getX())+";"+Math.round(h.getY())+"]";else{l=h.getName();if(h.getNumber()!==null)l+=" "+h.getNumber();if(h.getCity()!==null)l+=", "+h.getCity()}return l};
MREITTI.UTIL.formatDate=function(h,l){l||(l="");var o=h.getFullYear(),b=h.getMonth()+1;b=b<10?"0"+b:b;var m=h.getDate();return""+o+l+b+l+(m<10?"0"+m:m)};MREITTI.UTIL.formatTime=function(h,l){l||(l="");var o=h.getHours();o=o<10?"0"+o:o;var b=h.getMinutes();return""+o+l+(b<10?"0"+b:b)};
var CssSettings={AboutFrame:{visible:"AboutFrame",invisible:"AboutFrameInvisible"},SearchFrameMenu:{visible:"SearchFrameMenu",invisible:"SearchFrameMenuInvisible"},SearchFrameMenuItem:{enabled:"SearchFrameMenuItem",selected:"SearchFrameMenuItemSelected",disabled:"SearchFrameMenuItemDisabled",invisible:"SearchFrameMenuItemInvisible"},IndexSearchFrame:{visible:"IndexSearchFrame",invisible:"IndexSearchFrameInvisible",MainTabs:{Tab:{enabled:{selected:"MainTabSelected",unSelected:{noMouse:"MainTab",mouseOver:"MainTabMouseOver",
mouseDown:"MainTab"}},disabled:"MainTabDisabled",invisible:""}},AlphabeticalIndex:{Frame:{visible:"AlphabeticalIndex",invisible:"AlphabeticalIndexInvisible"},Char:{enabled:{selected:"CharButtonSelected",unSelected:{noMouse:"CharButton",mouseOver:"CharButtonMouseOver",mouseDown:"CharButton"}},disabled:{selected:"CharButtonSelected",unSelected:""},invisible:""}},LocationButton:{enabled:{noMouse:"LocationButton",mouseOver:"LocationButtonMouseOver",mouseDown:"LocationButton"},disabled:"LocationButton",
invisible:"LocationButtonInvisible"}},CalendarFrame:{visible:"CalendarFrame",invisible:"CalendarFrameInvisible",DateButton:{enabled:{noMouse:"DateButton",mouseOver:"DateButtonMouseOver",mouseDown:"DateButtonMouseOver"},disabled:"DateButtonDisabled",invisible:""},CurrentDateButton:{enabled:{noMouse:"CurrentDateButton",mouseOver:"CurrentDateButtonMouseOver",mouseDown:"CurrentDateButtonMouseOver"},disabled:"CurrentDateButtonDisabled",invisible:""},SelectedDateButton:{enabled:{noMouse:"SelectedDateButton",
mouseOver:"SelectedDateButtonMouseOver",mouseDown:"SelectedDateButtonMouseOver"},disabled:"SelectedDateButtonDisabled",invisible:""},ChangeMonthButton:{enabled:{noMouse:"ChangeMonthButton",mouseOver:"ChangeMonthButtonMouseOver",mouseDown:"ChangeMonthButtonMouseOver"},disabled:"ChangeMonthButtonDisabled",invisible:""}},SearchingRouteFrame:{visible:"SearchingRouteFrame",invisible:"SearchingRouteFrameInvisible"},RoutingErrorFrame:{visible:"RoutingErrorFrame",invisible:"RoutingErrorFrameInvisible"},AdvancedSearchFrame:{visible:{toggled:"AdvancedSearchFrameToggled",
unToggled:"AdvancedSearchFrameUnToggled"},invisible:"AdvancedSearchFrameInvisible"},OwnRoutesFrame:{visible:{toggled:"OwnRoutesFrameToggled",unToggled:"OwnRoutesFrameUnToggled"},invisible:"OwnRoutesFrameInvisible"},MapAreaHeader:{SaveRouteButton:{enabled:{noMouse:"SaveRouteButton",mouseOver:"SaveRouteButtonMouseOver",mouseDown:"SaveRouteButtonMouseOver"},disabled:"SaveRouteButtonDisabled",invisible:""}},MapLegend:{visible:"MapLegend",invisible:"MapLegendInvisible"},DisclaimerTextArea:{visible:"DisclaimerTextArea",
invisible:"DisclaimerTextAreaInvisible"},RouteDescription:{LocationButton:{enabled:{noMouse:"LocationButton",mouseOver:"LocationButtonMouseOver",mouseDown:"LocationButton"},disabled:"",invisible:""},SaveRouteButton:{enabled:{noMouse:"SaveRouteButton",mouseOver:"SaveRouteButtonMouseOver",mouseDown:"SaveRouteButtonMouseOver"},disabled:"SaveRouteButtonDisabled",invisible:""}},RouteSuggestion:{enabled:{selected:"RouteSuggestionSelected",unSelected:{noMouse:"RouteSuggestion",mouseOver:"RouteSuggestionMouseOver",
mouseDown:"RouteSuggestion"}},disabled:{selected:"RouteSuggestionSelected",unSelected:{noMouse:"RouteSuggestion",mouseOver:"RouteSuggestionMouseOver",mouseDown:"RouteSuggestion"}},invisible:""},RouteSuggestionLinkButton:{enabled:{noMouse:"RouteSuggestionLinkButton",mouseOver:"RouteSuggestionLinkButtonMouseOver",mouseDown:"RouteSuggestionLinkButtonMouseOver"},disabled:"",invisible:""},InputField:{enabled:"InputField",validating:"InputFieldValidating",valid:"InputFieldValid",invalid:"InputFieldInvalid",
disabled:"InputField",invisible:"InputField"},SuggestionList:{Item:{enabled:{noMouse:"Suggestion",mouseOver:"SuggestionMouseOver",mouseDown:"Suggestion"},selected:{noMouse:"SuggestionSelected",mouseOver:"SuggestionSelected",mouseDown:"SuggestionSelected"},disabled:{noMouse:"",mouseOver:"",mouseDown:""},invisible:{noMouse:"",mouseOver:"",mouseDown:""}},ScrollUpButton:{enabled:{noMouse:"ScrollUpButtonEnabled",mouseOver:"ScrollUpButtonEnabledMouseOver",mouseDown:"ScrollUpButtonEnabledMouseDown"},disabled:"ScrollUpButtonDisabled",
invisible:"ScrollButtonInvisible"},ScrollDownButton:{enabled:{noMouse:"ScrollDownButtonEnabled",mouseOver:"ScrollDownButtonEnabledMouseOver",mouseDown:"ScrollDownButtonEnabledMouseDown"},disabled:"ScrollDownButtonDisabled",invisible:"ScrollButtonInvisible"}},SearchButton:{enabled:{noMouse:"SearchButtonEnabled",mouseOver:"SearchButtonEnabledMouseOver",mouseDown:"SearchButtonEnabledMouseDown"},disabled:"SearchButtonDisabled",invisible:"SearchButtonInvisible"}},LocationsCookieManager=new function(){var h=
LBS.UTIL.COOKIE;this.locationToCookieString=function(l){if(l===null)return null;var o=Math.round(l.getX())+"*"+Math.round(l.getY()),b=MREITTI.UTIL.routeLocationToString(l);b=b.replace(/[\\]/g,"\\\\");b=b.replace(/[(]/g,"\\(");b=b.replace(/[)]/g,"\\)");var m="";m=l.getCategory()==RouteLocation.CATEGORY_POINT?"kkj3":l.getCategory()==RouteLocation.CATEGORY_STREET?"street":l.getCategory()==RouteLocation.CATEGORY_ADDRESS?"address":l.getCategory()==RouteLocation.CATEGORY_POI?"poi":"kkj3";var n=l.getName();
if(n===null)n=b;var c=l.getNumber();if(c==null)c="";l=l.getCity();if(l==null)l="";return"("+o+"*"+b+"*"+m+"*"+n+"*"+c+"*"+l+")"};this.saveLocation=function(l){if(l===null)return false;l=LocationsCookieManager.locationToCookieString(l);var o=h.readCookie("locations");if(o!==null)l=o+l;h.writeCookie("locations",l,1728E4);return true};this.getLocations=function(){var l=h.readCookie("locations");return LocationsCookieManager.parseLocationsFromCookieString(l)};this.parseLocationsFromCookieString=function(l){var o=
[];if(l===null||l.length<5)return o;for(var b="",m="",n=0;n<l.length;n++){var c=l.charAt(n);if(m=="\\")b+=c;else if(c!="(")if(c==")"){b=LocationsCookieManager.parseLocationFromCookieString(b);b!==null&&o.push(b);b=""}else if(c!="\\")b+=c;m=c}return o};this.parseLocationFromCookieString=function(l){function o(){for(var n="";m<l.length;){var c=l.charAt(m);if(c=="*"){m++;break}else{n+=c;m++}}return n}var b={},m=0;b.x=o();b.y=o();b.alias=o();b.type=o();b.name=o();b.number=o();b.city=o();return b};this.deleteLocation=
function(l){var o=h.readCookie("locations");if(o===null||o.length<5)h.eraseCookie("locations");else{for(var b=-1,m="",n="",c=0;c<o.length;c++){var a=o.charAt(c);n!="\\"&&a=="("&&b++;if(b!=l)m+=a;n=a}m.length<5?h.eraseCookie("locations"):h.writeCookie("locations",m)}}},RoutesCookieManager=new function(){var h=LBS.UTIL.COOKIE;this.saveRoute=function(b){startLocationStr=LocationsCookieManager.locationToCookieString(b[0]);endLocationStr=LocationsCookieManager.locationToCookieString(b[1]);if(startLocationStr!==
null&&endLocationStr!==null){var m="("+startLocationStr+endLocationStr+")";b=h.readCookie("routes");m=m;if(b!==null)m=b+m;h.writeCookie("routes",m,1728E4);for(var n in l)l[n](o);return true}return false};this.getRoutes=function(){var b=[],m=h.readCookie("routes");if(m===null||m.length<5)return b;for(var n="",c="",a=0,e=false,p=0;p<m.length;p++){var x=m.charAt(p);if(c=="\\")n+=x;else if(x=="("){if(a==0)e=true;else n+=x;a++}else if(x==")"){a--;if(a==0&&e==true){c=LocationsCookieManager.parseLocationsFromCookieString(n);
n="";e=false;c.length==2&&b.push(c)}else n+=x}else if(x!="\\")n+=x;c=x}return b};this.deleteRoute=function(b){var m=h.readCookie("routes");if(m===null||m.length<5)h.eraseCookie("routes");else{for(var n=-1,c=0,a="",e="",p=0;p<m.length;p++){var x=m.charAt(p);if(e=="\\"){if(n!=b)a+=x}else if(x=="("){c==0&&n++;if(n!=b)a+=x;c++}else{x==")"&&c--;if(n!=b)a+=x}e=x}a.length<5?h.eraseCookie("routes"):h.writeCookie("routes",a);for(var s in l)l[s](o)}};this.addValueChangeCBF=function(b){l.push(b)};var l=[],o=
this};
function OwnLocationsMenu(h,l,o){var b=LBS.GUI,m=LBS.UTIL.DOM,n=m.appendNewElement,c=m.appendText;this.update=function(){m.clearElement(k);var f=LocationsCookieManager.getLocations();if(f.length<1)A.setState(b.MenuItem.STATE.DISABLED);else{for(var d=0;d<f.length;d++){var j=f[d],r=new RouteLocation(j.x,j.y);if(j.type=="address"){r.setCategory(RouteLocation.CATEGORY_ADDRESS);r.setName(j.name);r.setNumber(j.number);r.setCity(j.city)}else if(j.type=="street"){r.setCategory(RouteLocation.CATEGORY_STREET);r.setName(j.name);
r.setCity(j.city)}else if(j.type=="poi"){r.setCategory(RouteLocation.CATEGORY_POI);r.setName(j.name);r.setCity(j.city)}else r.setName(j.alias);var w=n(k,"div");c(w,j.alias);j=new b.MenuItem(w,b.MenuItem.STATE.ENABLED,r);s.addMenuItem(j);y.addMenuItem(j);j.addMouseClickCBF(a)}w=n(k,"div");c(w,Dictionary.SearchArea.Menu.editOwnLocations);j=new b.MenuItem(w,b.MenuItem.STATE.ENABLED,"OwnLocations");s.addMenuItem(j);y.addMenuItem(j);j.addMouseClickCBF(e);A.setState(b.MenuItem.STATE.ENABLED)}};this.addLocationSelectCBF=
function(f){p.push(f)};var a=function(f){f=f.getData();for(var d in p)p[d](f)};this.addEditLocationsCBF=function(f){x.push(f)};var e=function(f){for(var d in x)x[d](f)},p=[],x=[],s=l,A=h,y=o,k=l.getDomNode();this.update()}
function IndexSearchFrame(h,l,o){var b=LBS.GUI;b.Frame.call(this,h,l,o);var m=LBS.UTIL.DOM,n=m.createElement,c=m.createTextNode,a=m.appendElement,e=m.appendNewElement,p=m.appendText,x=Dictionary.IndexSearchFrame,s=this.setState;this.setState=function(F){F===b.Frame.STATE.INVISIBLE&&f();s(F)};this.clear=function(){f()};this.showContent=function(F){if(F==null)F="Street";f();var T=new b.FrameStyleManager(CssSettings.IndexSearchFrame.AlphabeticalIndex.Frame),J=n("div");C=new b.Frame(J,b.Frame.STATE.VISIBLE);
T.addFrame(C);T=e(J,"table");T=e(T,"tbody");T=e(T,"tr");var Y=new b.RadioButtonGroup,Z=new b.RadioButtonStyleManager(CssSettings.IndexSearchFrame.AlphabeticalIndex.Char),W;for(W in E){var U=e(T,"td");U=e(U,"div");p(U,E[W]);U=new b.RadioButton(U,b.Button.STATE.ENABLED,b.RadioButton.SELECTION_STATE.UNSELECTED,E[W]);Z.addRadioButton(U);Y.addRadioButton(U)}B=Y;Y.addSelectionChangeCBF(d);a(t,y(F));W=t;F=F;z=n("div","Title");k(F);a(W,z);a(t,J);J=t;if(q===null)q=n("div","SearchResult");a(J,q);a(t,A());d()};
var A=function(){var F=n("div","CloseButton");(new b.Button(F,b.Button.STATE.ENABLED)).addMouseClickCBF(function(){f();H.setState(b.Frame.STATE.INVISIBLE)});return F},y=function(F){var T=n("div","MainTabs"),J=e(T,"table");J=e(J,"tbody");var Y=e(J,"tr");J=new b.RadioButtonStyleManager(CssSettings.IndexSearchFrame.MainTabs.Tab);var Z=e(Y,"td");Z=e(Z,"div");p(Z,x.AddressTab.tabName);var W=b.RadioButton.SELECTION_STATE.UNSELECTED;if(F=="Street"||F===null)W=b.RadioButton.SELECTION_STATE.SELECTED;W=new b.RadioButton(Z,
b.Button.STATE.ENABLED,W,"Street");J.addRadioButton(W);Z=e(Y,"td");Z=e(Z,"div");p(Z,x.StopTab.tabName);var U=b.RadioButton.SELECTION_STATE.UNSELECTED;if(F=="Stop")U=b.RadioButton.SELECTION_STATE.SELECTED;U=new b.RadioButton(Z,b.Button.STATE.ENABLED,U,"Stop");J.addRadioButton(U);Z=e(Y,"td");Z=e(Z,"div");p(Z,x.OwnLocationsTab.tabName);Y=b.RadioButton.SELECTION_STATE.UNSELECTED;if(F=="OwnLocations")Y=b.RadioButton.SELECTION_STATE.SELECTED;ownLocationsState=b.Button.STATE.ENABLED;if(LocationsCookieManager.getLocations().length<
1)ownLocationsState=b.Button.STATE.DISABLED;S=new b.RadioButton(Z,ownLocationsState,Y,"OwnLocations");J.addRadioButton(S);v=F=new b.RadioButtonGroup;F.addRadioButton(W);F.addRadioButton(U);F.addRadioButton(S);F.addSelectionChangeCBF(function(V){V=V.getSelectedRadioButton().getData();k(V);d()});return T},k=function(F){if(z!==null){m.clearElement(z);if(F==="Stop"){p(z,x.StopTab.title);C.setState(b.Frame.STATE.VISIBLE)}else if(F==="Street"){p(z,x.AddressTab.title);C.setState(b.Frame.STATE.VISIBLE)}else if(F===
"OwnLocations"){p(z,x.OwnLocationsTab.title);C.setState(b.Frame.STATE.INVISIBLE)}}},f=function(){m.clearElement(t);q=null},d=function(){q&&m.clearElement(q);var F=v.getSelectedRadioButton();if(F!==null){F=F.getData();if(F==="OwnLocations"){F=LocationsCookieManager.getLocations();if(F.length<1)p(q,x.OwnLocationsTab.noOwnLocations);else{for(var T=n("table"),J=e(T,"tbody"),Y=new b.ButtonStyleManager(CssSettings.IndexSearchFrame.LocationButton),Z=0;Z<F.length;Z++){var W=F[Z],U=e(J,"tr"),V=e(U,"td");V=
e(V,"div");p(V,W.alias);routeLocation=new RouteLocation(W.x,W.y);if(W.type=="address"){routeLocation.setCategory(RouteLocation.CATEGORY_ADDRESS);routeLocation.setName(W.name);routeLocation.setNumber(W.number);routeLocation.setCity(W.city)}else if(W.type=="street"){routeLocation.setCategory(RouteLocation.CATEGORY_STREET);routeLocation.setName(W.name);routeLocation.setCity(W.city)}else if(W.type=="poi"){routeLocation.setCategory(RouteLocation.CATEGORY_POI);routeLocation.setName(W.name);routeLocation.setCity(W.city)}else routeLocation.setName(W.alias);
W=new b.Button(V,b.Button.STATE.ENABLED,routeLocation);Y.addButton(W);W.addMouseClickCBF(j);V=e(U,"td");V=e(V,"div");p(V,x.OwnLocationsTab.deleteLocation);W=new b.Button(V,b.Button.STATE.ENABLED,Z);Y.addButton(W);W.addMouseClickCBF(w)}a(q,T)}}else{T=B.getSelectedRadioButton();if(T!==null){g=T.getData();q.appendChild(c(x.Searching));J=Settings.Geocoding.cities;T=J[0];for(Y=1;Y<J.length;Y++)T+=","+J[Y];J=new GeoserverGeocodingXml;J.addLocationRestriction("Municipality",null,"All",T);J.setMaxResults(1E4);
F=="Street"?J.addLocationRestriction("Street",g,"Start"):J.addLocationRestriction("POI",g,"Start");naviciAjaxApi.getAddressByObject(null,J,r)}}}},j=function(F){for(var T in u)u[T](F.getData())},r=function(F,T,J,Y){m.clearElement(q);if(Y!=0)alert("Error in geocoding (status: "+Y+")");else{F=n("table");T=e(F,"tbody");Y=new b.ButtonStyleManager(CssSettings.IndexSearchFrame.LocationButton);for(var Z=0;Z<J.length;Z++){var W=e(T,"tr");W=e(W,"td");W=e(W,"div");p(W,J[Z].getName()+", "+J[Z].getCity());routeLocation=
new RouteLocation(J[Z].getX(),J[Z].getY());routeLocation.setName(J[Z].getName());routeLocation.setCity(J[Z].getCity());if(J[Z].getCategory()=="poi")routeLocation.setCategory(RouteLocation.CATEGORY_POI);else if(J[Z].getCategory()=="street")if(J[Z].getNumber()!==null&&J[Z].getNumber()>0){routeLocation.setCategory(RouteLocation.CATEGORY_ADDRESS);routeLocation.setNumber(J[Z].getNumber())}else routeLocation.setCategory(RouteLocation.CATEGORY_STREET);W=new b.Button(W,b.Button.STATE.ENABLED,routeLocation);
Y.addButton(W);W.addMouseClickCBF(j)}q.appendChild(F)}};this.addLocationSelectCBF=function(F){u.push(F)};var w=function(F){LocationsCookieManager.deleteLocation(F.getData());LocationsCookieManager.getLocations().length<1&&S.setState(b.Button.STATE.DISABLED);d()},u=[],t=this.getDomNode(),z=null,q=null,g=null,v=null,B=null,E=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Å","Ä","Ö"],S=null,C=null,H=this}
function CalendarFrame(h,l,o){var b=LBS.GUI;b.Frame.call(this,h,l,o);var m=LBS.UTIL.DOM,n=m.createElement,c=m.appendElement,a=m.appendNewElement,e=m.appendText,p=Dictionary.SearchArea.Calendar,x=this.setState;this.setState=function(z){z===b.Frame.STATE.INVISIBLE&&m.clearElement(d);x(z)};this.clear=function(){m.clearElement(d)};this.showContent=function(z,q,g,v){w=z;u=q;j=v;s(g)};this.addDateSelectCBF=function(z){r.push(z)};var s=function(z){m.clearElement(d);var q=new b.ButtonStyleManager(CssSettings.CalendarFrame.ChangeMonthButton),
g=new b.ButtonStyleManager(CssSettings.CalendarFrame.DateButton),v=new Date(z.getFullYear(),z.getMonth(),1);v.setHours(10);z=v.getFullYear();var B=v.getMonth(),E=null,S=null;E=B==0?new Date(z-1,11,1):new Date(z,B-1,1);S=B==11?new Date(z+1,0,1):new Date(z,B+1,1);z=n("table","CalendarTable");var C=a(z,"tbody"),H=a(C,"tr");B=a(H,"th");var F=a(B,"div");e(F,"<<");B=b.Button.STATE.ENABLED;if(E.getFullYear()<w.getFullYear()||E.getFullYear()==w.getFullYear()&&E.getMonth()<w.getMonth())B=b.Button.STATE.DISABLED;
B=new b.Button(F,B,E);q.addButton(B);B.addMouseClickCBF(y);B=a(H,"th");B.colSpan=5;e(B,t[v.getMonth()]+" "+v.getFullYear());B=a(H,"th");F=a(B,"div");e(F,">>");B=b.Button.STATE.ENABLED;if(S.getFullYear()>u.getFullYear()||S.getFullYear()==u.getFullYear()&&S.getMonth()>u.getMonth())B=b.Button.STATE.DISABLED;B=new b.Button(F,B,S);q.addButton(B);B.addMouseClickCBF(y);H=a(C,"tr");B=p.DayNames;e(a(H,"th"),B.Mon);e(a(H,"th"),B.Tue);e(a(H,"th"),B.Wed);e(a(H,"th"),B.Thu);e(a(H,"th"),B.Fri);e(a(H,"th"),B.Sat);
e(a(H,"th"),B.Sun);q=v;H=a(C,"tr");for(B=1;B!=q.getDay();){a(H,"td");if(B==6)B=0;else B+=1}for(B=q.getMonth();q.getMonth()==B;){if(q.getDay()==1&&q.getDate()!=1)H=a(C,"tr");tdElem=a(H,"td");F=a(tdElem,"div");e(F,q.getDate());S=b.Button.STATE;v=S.ENABLED;if(q.getFullYear()<w.getFullYear()||q.getFullYear()==w.getFullYear()&&q.getMonth()<w.getMonth()||q.getFullYear()==w.getFullYear()&&q.getMonth()==w.getMonth()&&q.getDate()<w.getDate()||q.getFullYear()>u.getFullYear()||q.getFullYear()==u.getFullYear()&&
q.getMonth()>u.getMonth()||q.getFullYear()==u.getFullYear()&&q.getMonth()==u.getMonth()&&q.getDate()>u.getDate())v=S.DISABLED;S=g;for(var T in j){E=j[T].date;if(q.getFullYear()==E.getFullYear()&&q.getMonth()==E.getMonth()&&q.getDate()==E.getDate()){S=new b.ButtonStyleManager(j[T].style);break}}F=new b.Button(F,v,q);S&&S.addButton(F);F.addMouseClickCBF(k);q=new Date(q.getTime()+864E5)}for(B=q.getDay();B!=1;){a(H,"td");if(B==6)B=0;else B+=1}c(d,z);c(d,A())},A=function(){var z=n("div","CloseButton"),
q=a(z,"span");e(q,p.CloseButton);(new b.Button(q,b.Button.STATE.ENABLED)).addMouseClickCBF(function(){f.setState(b.Frame.STATE.INVISIBLE)});return z},y=function(z){z=z.getData();s(z)},k=function(z){z=z.getData();for(var q in r)r[q]!=null&&r[q](z)},f=this,d=f.getDomNode(),j=[],r=[],w=null,u=null;h=p.MonthNames;var t=[h.Jan,h.Feb,h.Mar,h.Apr,h.May,h.Jun,h.Jul,h.Aug,h.Sep,h.Oct,h.Nov,h.Dec]}
function OwnRoutesFrame(h,l,o,b,m,n){var c=LBS.GUI;c.ToggleFrame.call(this,h,l,o,b,n);var a=LBS.UTIL.DOM,e=a.appendNewElement,p=a.appendText,x=this.setState;this.setState=function(y){y===c.Frame.STATE.INVISIBLE&&a.clearElement(A);x(y)};this.clear=function(){a.clearElement(A)};this.showContent=function(){a.clearElement(A);var y=RoutesCookieManager.getRoutes();if(y.length<1)p(A,Dictionary.OwnRoutesFrame.noOwnRoutes);else{var k=e(A,"table");k=e(k,"tbody");for(var f in y){var d=e(k,"tr"),j=e(d,"td"),
r=y[f][0],w=y[f][1];j=e(j,"div");j=e(j,"a");p(j,r.alias+" - "+w.alias);var u=LBS.STATESAVER,t=new u.State;t.setLocation("from",new u.Point(r.x,r.y,u.Point.COORDINATE_SYSTEM.KKJ3));t.setLocation("to",new u.Point(w.x,w.y,u.Point.COORDINATE_SYSTEM.KKJ3));j.href=window.location.pathname+window.location.search+"#"+t.getUrlHash();j=e(d,"td");j=e(j,"div","DeleteButton");p(j,Dictionary.OwnRoutesFrame.deleteRoute);(new c.Button(j,c.Button.STATE.ENABLED,f)).addMouseClickCBF(s)}}};var s=function(y){RoutesCookieManager.deleteRoute(y.getData())},
A=m;RoutesCookieManager.addValueChangeCBF(this.showContent)}function CurrentTimeManager(h,l){this.getCurrentDateTime=function(){var m=(new Date).getTime()-o.getTime();return new Date(b.getTime()+m)};var o=h,b=l}
function SearchArea(h,l,o,b,m,n,c,a,e){function p(C,H){for(var F=0;F<C.length;F++)if(C[F]==null){C[F]=H;return F}C.push(H);return F}function x(C,H){var F=null;return function(T){F!==null&&naviciAjaxApi.deleteDivMarker(F);if(T!==null){F=naviciAjaxApi.addDivMarker("LocationMarker",T.getX(),T.getY(),"",0,0,"");T=LBS.UTIL.DOM.appendNewElement(F,"div",C);H!==null&&LBS.UTIL.DOM.appendText(T,H)}v()}}function s(C){return function(H,F,T,J,Y){Y!==0&&alert("Error occured in getAddressByCoordinates");if(Y===
0&&J!==null&&S.x==F&&S.y==T)if(J.length>0){H=new RouteLocation(F,T);H.setCategory(RouteLocation.CATEGORY_POINT);H.setName(J[0].getName());H.setCity(J[0].getCity());J[0].getNumber()!==null&&J[0].getNumber()>0&&H.setNumber(J[0].getNumber());C(H)}}}function A(C){var H=[{attributename:"radius",attributevalue:Settings.ReverseGeocoding.radius}];return function(F,T,J){var Y=new RouteLocation(T,J);Y.setCategory(RouteLocation.CATEGORY_POINT);C(Y);S={x:T,y:J};naviciAjaxApi.getAddressByCoordinates(F,T,J,1,H,
new s(C))}}var y=LBS.GUI;this.searchRoute=function(){g.setState(y.Button.STATE.DISABLED);var C=j.getStartLocation(),H=j.getEndLocation(),F=r.getDateTime(),T=new RouteRequest;T.setStartLocation(C);T.setEndLocation(H);if(C!==null&&H!==null&&F!==null){var J=[];J[0]=C;J[1]=H;E!==null&&naviciAjaxApi.clearDynamicLayer();var Y=w.selectedIndex;C=w.options[Y].value;Y=u.selectedIndex;H=u.options[Y].value;Y=t.selectedIndex;var Z=t.options[Y].value;Y=z.selectedIndex;var W=z.options[Y].value;Y=q.selectedIndex;
Y=q.options[Y].value;var U="",V=LineManager.getLines(),G;for(G in V)if(V[G].getState()==LineManager.Line.STATE.DISABLED){var N=V[G].getIds(),Q;for(Q in N){if(U.length>0)U+=",";U+=N[Q]}}F=[{attributename:"TimeDirection",attributevalue:C},{attributename:"Date",attributevalue:MREITTI.UTIL.formatDate(F)},{attributename:"Time",attributevalue:MREITTI.UTIL.formatTime(F)},{attributename:"WalkSpeed",attributevalue:H},{attributename:"MaxWalk",attributevalue:Z},{attributename:"RoutingMethod",attributevalue:W},
{attributename:"ChangeMargin",attributevalue:Y},{attributename:"NumberRoutes",attributevalue:"5"},{attributename:"ExcludedLines",attributevalue:U}];E=naviciAjaxApi.searchRoute(null,J,F,new d(T));for(G in k)k[G]!=null&&k[G](T)}};this.validateAllInput=function(){var C=searchFrom.getRouteLocation(),H=searchTo.getRouteLocation(),F=r.getDateTime();return C!==null&&H!==null&&F!==null?true:false};this.addRouteRequestSentCBF=function(C){return p(k,C)};this.removeRouteRequestSentCBF=function(C){k[C]=null};
this.addRouteResponseReadyCBF=function(C){return p(f,C)};this.removeRouteResponseReadyCBF=function(C){f[C]=null};var k=[],f=[],d=function(C){return function(H,F,T){var J=null;J=F==null||T!=0?null:LBS.MTRAVEL.parseResponse(F);for(var Y in f)f[Y]!=null&&f[Y](H,J,C)}},j=new RouteRequest;j.setStartLocation(null);j.setEndLocation(null);searchFrom=h;searchFrom.addRouteLocationChangeCBF(new x("StartLocationMarker",null));searchFrom.addRouteLocationChangeCBF(j.setStartLocation);searchTo=l;searchTo.addRouteLocationChangeCBF(new x("EndLocationMarker",
null));searchTo.addRouteLocationChangeCBF(j.setEndLocation);var r=new DateTimeInputArea(o,b),w=m,u=n,t=c,z=a,q=e,g=new y.Button(LBS.UTIL.DOM.getElement("SearchButton"),y.Button.STATE.DISABLED);(new y.ButtonStyleManager(CssSettings.SearchButton)).addButton(g);g.addMouseClickCBF(function(){B.searchRoute()});var v=function(){var C=searchFrom.getRouteLocation(),H=searchTo.getRouteLocation(),F=r.getDateTime();C!==null&&H!==null&&F!==null?g.setState(y.Button.STATE.ENABLED):g.setState(y.Button.STATE.DISABLED)};
r.addDateTimeChangeCBF(v);this.addRouteResponseReadyCBF(v);var B=this,E=null,S={x:null,y:null};naviciAjaxApi.addMapMenuItem(null,Dictionary.MapMenu.startLocation,new A(searchFrom.setRouteLocation),[{attributename:"class",attributevalue:"StartLocationMapMenuItem"},{attributename:"className",attributevalue:"StartLocationMapMenuItem"}]);naviciAjaxApi.addMapMenuItem(null,Dictionary.MapMenu.endLocation,new A(searchTo.setRouteLocation),[{attributename:"class",attributevalue:"EndLocationMapMenuItem"},{attributename:"className",
attributevalue:"EndLocationMapMenuItem"}])}
function SearchFrame(h,l,o){var b=LBS.GUI;this.getRouteLocation=function(){return f};this.setRouteLocation=function(u){if(u!==null){var t=MREITTI.UTIL.routeLocationToString(u);A=t;s.setInput(t);k.setState(SelectionList.STATE_INVISIBLE);k.clear();m(u)}};this.setInput=function(u){s.setInput(u)};this.setSuggestions=function(u){if(u.length<1){k.setState(SelectionList.STATE_INVISIBLE);f!==null&&m(null)}else{k.clear();var t=[],z;for(z in u){var q=MREITTI.UTIL.routeLocationToString(u[z]),g="Poi";if(u[z].getCategory()==
RouteLocation.CATEGORY_ADDRESS)g="Address";else if(u[z].getCategory()==RouteLocation.CATEGORY_STREET)g="Street";var v=LBS.UTIL.DOM.createElement("div");g=LBS.UTIL.DOM.appendNewElement(v,"div",g);LBS.UTIL.DOM.appendText(g,q);q=new SelectionList.Item(v,u[z],SelectionList.Item.STATE.ENABLED);q.addMouseClickCBF(a);w.addSelectionListItem(q);t.push(q)}k.addArrayOfItems(t);k.setSelectedIndex(0);k.setState(SelectionList.STATE_ENABLED);m(k.getSelectedItem().getData())}};this.addRouteLocationChangeCBF=function(u){d.push(u)};
var m=function(u){var t=b.InputField.STATE;if(u===null)s.getInput().length>2?s.setState(t.INVALID):s.setState(t.ENABLED);else s.setState(t.VALID);if(u!==f){f=u;for(var z in d)d[z](u)}},n=function(u,t,z,q){y=false;if(s.getInput()==t)if(q!=0){x.setSuggestions([]);s.setState(b.InputField.STATE.INVALID)}else{z.length<1?s.setState(b.InputField.STATE.INVALID):s.setState(b.InputField.STATE.VALID);u=[];for(var g in z){u[g]=new RouteLocation(z[g].getX(),z[g].getY());u[g].setName(z[g].getName());u[g].setCity(z[g].getCity());
if(z[g].getCategory()=="poi")u[g].setCategory(RouteLocation.CATEGORY_POI);else if(z[g].getCategory()=="street")if(z[g].getNumber()!==null&&z[g].getNumber()>0){u[g].setCategory(RouteLocation.CATEGORY_ADDRESS);u[g].setNumber(z[g].getNumber())}else u[g].setCategory(RouteLocation.CATEGORY_STREET)}x.setSuggestions(u)}else c()},c=function(){var u=s.getInput();if(!(u==A||y)){A=null;if(u.length<3){m(null);x.setSuggestions([]);s.setState(b.InputField.STATE.ENABLED)}else{for(var t=Settings.Geocoding.cities,
z=t[0],q=1;q<t.length;q++)z+=","+t[q];t=new GeoserverGeocodingXml;t.addLocationRestriction("Municipality",null,"All",z);t.setMaxResults(Settings.SuggestionList.maxSuggestions);t.setFreeFormKey(u);naviciAjaxApi.getAddressByObject(null,t,n);y=true;s.setState(b.InputField.STATE.VALIDATING);k.setState(SelectionList.STATE_INVISIBLE);k.clear()}}},a=function(u){k.setState(SelectionList.STATE_INVISIBLE);x.setRouteLocation(u.getData())},e=function(){if(j.timer!==null){clearInterval(j.timer);j.timer=null}},
p=function(){if(r.timer!==null){clearInterval(r.timer);r.timer=null}},x=this;h.autocomplete="off";h.value=o?o:"";var s=new b.InputField(h,b.InputField.STATE.ENABLED);(new b.InputFieldStyleManager(CssSettings.InputField)).addInputField(s);var A=null,y=false,k=l;k.setState(SelectionList.STATE_INVISIBLE);k.addSelectionChangeCBF(function(u){u=u.getSelectedItem();u!==null&&m(u.getData())});var f=null,d=[];h=Settings.SuggestionList.scrollInterval;var j={CBF:k.selectNextItem,interval:h,timer:null},r={CBF:k.selectPreviousItem,
interval:h,timer:null},w=new SelectionList.Item.StyleManager(CssSettings.SuggestionList.Item);s.addKeyReleaseCBF(p,null);s.addKeyReleaseCBF(e,null);s.addInputChangeCBF(c,Settings.LocationInputField.onChangeReactionTime);s.addKeyPressCBF(function(){if(k.getSelectedIndex()===null){k.getState();k.setState(SelectionList.STATE_INVISIBLE)}else x.setRouteLocation(k.getSelectedItem().getData())},[13]);s.addKeyPressCBF(function(){if(k.getState()!=SelectionList.STATE_ENABLED)k.getLength()>0&&k.setState(SelectionList.STATE_ENABLED);
else if(j.timer===null){k.selectNextItem();if(j.timer===null)j.timer=setInterval(j.CBF,j.interval)}},[40]);s.addKeyPressCBF(function(){if(k.getState()==SelectionList.STATE_ENABLED)if(k.getSelectedIndex()!==null)if(r.timer===null){k.selectPreviousItem();if(r.timer===null)r.timer=setInterval(r.CBF,r.interval)}},[38]);s.addKeyPressCBF(function(u,t){t!=40&&e();t!=38&&p()},null);c()}
function DateTimeInputArea(h,l){this.setHours=function(c){n.setHours(c)};this.setMinutes=function(c){n.setMinutes(c)};this.getDateTime=function(){if(n.validateTime()===false||m.validateDate()===false)return null;return new Date(m.getYear(),m.getMonth()-1,m.getDay(),n.getHours(),n.getMinutes())};this.addDateTimeChangeCBF=function(c){b.push(c)};_timeChangeHandler=function(){for(var c in b)b[c]!=null&&b[c](o)};_dateChangeHandler=function(){for(var c in b)b[c]!=null&&b[c](o)};var o=this,b=[],m=h;m.addDateChangeCBF(_dateChangeHandler);
var n=l;n.addTimeChangeCBF(_timeChangeHandler)}
function SelectionList(h,l,o,b,m){var n=LBS.GUI;this.getState=function(){return j.state};this.setState=function(q){var g=n.Button.STATE,v;if(q==SelectionList.STATE_ENABLED){s.className=A;j.state=q}else if(q==SelectionList.STATE_DISABLED){s.className=y;for(v in u)u[v].setState(g.DISABLED);for(v in t)t[v].setState(g.DISABLED);j.state=q}else if(q==SelectionList.STATE_INVISIBLE){s.className=k;for(v in u)u[v].setState(g.INVISIBLE);for(v in t)t[v].setState(g.INVISIBLE);j.state=q}};this.clear=function(){f=
[];d=null;w=r=0;e()};this.addItem=function(q){f.push(q);w<j.size-1&&w++;e()};this.addArrayOfItems=function(q){for(var g in q)f.push(q[g]);if(w<j.size-1)w=f.length>j.size?j.size-1:f.length-1;e()};this.getLength=function(){return f.length};this.setSelectedIndex=function(q){if(q===null)d=null;else if(q>=0&&q<f.length)d=q;e()};this.getSelectedIndex=function(){return d};this.getSelectedItem=function(){return d===null?null:f[d]};this.getItems=function(){return f};this.selectNextItem=function(){if(d!==null)if(d<
f.length-1){d++;f[d-1].setState(SelectionList.Item.STATE.ENABLED);f[d].setState(SelectionList.Item.STATE.SELECTED);w<f.length-1&&d>r+j.selectNextScrollLimit&&x.scrollDown();for(var q in z)z[q](x)}return d};this.selectPreviousItem=function(){if(d!==null)if(d!==0)if(d>0){d--;f[d+1].setState(SelectionList.Item.STATE.ENABLED);f[d].setState(SelectionList.Item.STATE.SELECTED);r>0&&d<r+j.selectPreviousScrollLimit&&x.scrollUp();for(var q in z)z[q](x)}return d};this.scrollDown=function(){if(w<f.length-1){w++;
r++;for(var q=s.childNodes.length-1;q>=0;q--)s.replaceChild(f[q+r].getDomNode(),s.childNodes[q]);p()}};this.scrollUp=function(){if(r>0){w--;r--;for(var q=s.childNodes.length,g=0;g<q;g++)s.replaceChild(f[g+r].getDomNode(),s.childNodes[g]);p()}};this.addScrollUpButton=function(q,g){q.addMouseClickCBF(a);q.setState(n.Button.STATE.INVISIBLE);q.addMouseDownCBF(a,g);u.push(q)};this.addScrollDownButton=function(q,g){q.addMouseClickCBF(c);q.setState(n.Button.STATE.INVISIBLE);q.addMouseDownCBF(c,g);t.push(q)};
this.addSelectionChangeCBF=function(q){z.push(q)};var c=function(){if(d===null)x.setSelectedIndex(0);else w>=f.length-1||x.scrollDown()},a=function(){if(d===null)x.setSelectedIndex(0);else r<=0||x.scrollUp()},e=function(){var q=s.childNodes.length,g;for(g=q-1;g>=0;g--){s.removeChild(s.childNodes[g]);q--}var v=0;for(g=r;g<f.length&&g<=w;g++){if(d===null)f[g].setState(SelectionList.Item.STATE.ENABLED);else g==d?f[g].setState(SelectionList.Item.STATE.SELECTED):f[g].setState(SelectionList.Item.STATE.ENABLED);
if(v<q){s.replaceChild(f[g].getDomNode(),s.childNodes[v]);v++}else s.appendChild(f[g].getDomNode())}p()},p=function(){var q=n.Button.STATE,g;if(f.length>j.size){for(g in u)r===null||r<=0?u[g].setState(q.DISABLED):u[g].setState(q.ENABLED);for(g in t)w>=f.length-1?t[g].setState(q.DISABLED):t[g].setState(q.ENABLED)}else{for(g in u)u[g].setState(q.INVISIBLE);for(g in t)t[g].setState(q.INVISIBLE)}},x=this,s=h,A=l,y=o,k=b,f=[],d=null,j=m,r=0,w=j.size-1,u=[],t=[],z=[];this.setState(j.state)}
SelectionList.STATE_ENABLED=1;SelectionList.STATE_DISABLED=2;SelectionList.STATE_INVISIBLE=3;SelectionList.parameters=function(h,l,o,b){this.size=h;this.selectNextScrollLimit=l<0?0:l>h-1?h-1:l;this.selectPreviousScrollLimit=o<0?0:o>h-1?h-1:o;this.state=b};
SelectionList.Item=function(h,l,o){LBS.GUI.GuiItem.call(this,h,l,o==SelectionList.Item.STATE.ENABLED||o==SelectionList.Item.STATE.SELECTED?true:false);this.getState=function(){return m};this.setState=function(c){c===SelectionList.Item.STATE.ENABLED||c==SelectionList.Item.STATE.SELECTED?n.enableEvents():n.disableEvents();if(m!==c){m=c;for(var a in b)b[a](n)}};this.addStateChangeCBF=function(c){b.push(c)};var b=[],m=o,n=this};SelectionList.Item.STATE={ENABLED:1,SELECTED:2,DISABLED:3,INVISIBLE:4};
SelectionList.Item.StyleManager=function(h){var l=LBS.GUI,o=SelectionList.Item.STATE,b=l.GuiItem.MOUSE_STATE;o=[[o.ENABLED,"enabled"],[o.SELECTED,"selected"],[o.DISABLED,"disabled"],[o.INVISIBLE,"invisible"]];b=[[b.NO_MOUSE,"noMouse"],[b.MOUSE_OVER,"mouseOver"],[b.MOUSE_DOWN,"mouseDown"]];var m=[],n;for(n in o){m[o[n][0]]=[];for(var c in b)m[o[n][0]][b[c][0]]=h[o[n][1]][b[c][1]]}l.GuiItemStyleManager.call(this,m);this.addSelectionListItem=function(p){a(p);p.addStateChangeCBF(e.updateStyle)};var a=
this.addGuiItem;this.addGuiItem=null;this.updateStyle=function(p){var x=p.getDomNode(),s=p.getState();p=p.getMouseState();x.className=m[s][p]};var e=this};
function RouteLocation(h,l){this.getX=function(){return o};this.getY=function(){return b};this.setX=function(e){o=e};this.setY=function(e){b=e};this.setCategory=function(e){m=e};this.getCategory=function(){return m};this.setCity=function(e){n=e};this.getCity=function(){return n};this.setName=function(e){c=e};this.getName=function(){return c};this.setNumber=function(e){a=e};this.getNumber=function(){return a};var o=h,b=l,m=null,n=null,c=null,a=null}RouteLocation.CATEGORY_POI=1;
RouteLocation.CATEGORY_STREET=2;RouteLocation.CATEGORY_ADDRESS=3;RouteLocation.CATEGORY_POINT=4;function RouteRequest(){this.setStartLocation=function(b){h=b};this.getStartLocation=function(){return h};this.setEndLocation=function(b){l=b};this.getEndLocation=function(){return l};this.setViaLocation=function(b,m){o[b]=m};this.getViaLocations=function(){return o};var h=null,l=null,o=[]}
function RouteSuggestionsFrame(h,l){var o=LBS.GUI,b=LBS.UTIL.DOM,m=b.createElement,n=b.createTextNode,c=b.appendElement,a=b.appendNewElement,e=b.appendText,p=Dictionary.RouteSuggestions;this.clear=function(){b.clearElement(s)};this.getRoutes=function(){return f};this.getRouteResponse=function(){return d};this.getRouteRequest=function(){return w};this.getRouteResponseId=function(){return r};this.getSelectedRouteNumber=function(){return j};this.addRouteSelectionChangeCBF=function(z){k.push(z)};this.showRouteSuggestions=
function(z,q,g,v){w=g;d=q;var B=function(){var L=A.getState(),O=0,K=0,ea=0,aa=0,ka=0,la=L.getParam("date");if(la!==null&&la.length==8){O=parseInt(la.substring(0,4),10);K=parseInt(la.substring(4,6),10);ea=parseInt(la.substring(6,8),10)}L=L.getParam("time");if(L!==null&&L.length==4){aa=parseInt(L.substring(0,2),10);ka=parseInt(L.substring(2),10)}return new Date(O,K-1,ea,aa,ka)},E=function(L,O){var K=A.getState();K.setParam("mapcenter",null);K.setParam("mapzoom",null);K.setParam("routesuggestion",null);
K.setParam("date",MREITTI.UTIL.formatDate(L));K.setParam("time",MREITTI.UTIL.formatTime(L));var ea=m("a");ea.href=window.location.pathname+window.location.search+"#"+K.getUrlHash();ea.appendChild(n(O));return ea},S=function(L){var O=L[0].getStartDateTime();L=L[L.length-1].getStartDateTime();var K=B();O=new Date(K.getTime()-(L.getTime()-O.getTime()));L=m("div","EarlierSuggestionsButtonDeparture");c(L,E(O,p.earlierRoutesLink));return L},C=function(L){L=L[L.length-1].getStartDateTime();L=new Date(L.getTime()+
6E4);var O=m("div","LaterSuggestionsButtonDeparture");c(O,E(L,p.laterRoutesLink));return O},H=function(L){L=L[L.length-1].getEndDateTime();L=new Date(L.getTime()-6E4);var O=m("div","EarlierSuggestionsButtonArrival");c(O,E(L,p.earlierRoutesLink));return O},F=function(){var L=B();L=new Date(L.getTime()+9E5);var O=m("div","LaterSuggestionsButtonArrival");c(O,E(L,p.laterRoutesLink));return O},T=A.getState().getParam("timetype");routes=q.getRoutes();y.clear();s.style.display="block";c(s,function(L,O){var K=
L[0].getLegs()[0].getStartDateTime(),ea=t[K.getDay()],aa=K.getDate(),ka=K.getMonth()+1;K=K.getFullYear();ea=ea+" "+aa+"."+ka+"."+K;ka=MREITTI.UTIL.routeLocationToString(O.getStartLocation());K=MREITTI.UTIL.routeLocationToString(O.getEndLocation());aa=m("div","RouteSuggestionsHeader");var la=a(aa,"table");la=a(la,"tbody");la=a(la,"tr");tdElem=a(la,"td");var I=a(tdElem,"div","Title");e(I,p.Header.title+" "+ka+" - "+K);tdElem=a(la,"td");ka=a(tdElem,"div","Date");e(ka,ea);return aa}(routes,g));T=="arrival"?
c(s,F(routes)):c(s,S(routes));q=m("table");q.id="RouteSuggestionsTable";g=a(q,"tbody");var J=a(g,"tr");a(J,"th","SuggestionNumber");e(a(J,"th","DepartureTime"),p.Table.departureTime);e(a(J,"th","FromStopTime"),p.Table.fromStopTime);e(a(J,"th","ArrivalTime"),p.Table.arrivalTime);e(a(J,"th","Line"),p.Table.route);e(a(J,"th","Duration"),p.Table.duration);e(a(J,"th","WalkLength"),p.Table.totalWalkingLength);a(J,"th","SuggestionLink");S=new o.RadioButtonStyleManager(CssSettings.RouteSuggestion);F=new o.RadioButtonGroup;
for(var Y=new o.ButtonStyleManager(CssSettings.RouteSuggestionLinkButton),Z=null,W=0;W<routes.length;W++){var U=routes[W].getStartDateTime();if(Z!==null&&Z.getDate()!==U.getDate()){J=a(g,"tr");tdElem=a(J,"td","NextDay");tdElem.colSpan="8";J=t[U.getDay()];Z=U.getDate();var V=U.getMonth()+1,G=U.getFullYear();e(tdElem,J+" "+Z+"."+V+"."+G)}Z=U;V=routes[W].getLegs();J=a(g,"tr");e(a(J,"td","SuggestionNumber"),W+1+".");e(a(J,"td","DepartureTime"),MREITTI.UTIL.formatTime(U,":"));U=null;for(G=0;G<V.length;G++)if(V[G]instanceof
LBS.MTRAVEL.Line){U=V[G];break}G="-";if(U!==null){U=U.getLocations()[0].getDepartureDateTime();G=MREITTI.UTIL.formatTime(U,":")}e(a(J,"td","FromStopTime"),G);U=routes[W].getEndDateTime();e(a(J,"td","ArrivalTime"),MREITTI.UTIL.formatTime(U,":"));tdElem=a(J,"td","Line");U=a(tdElem,"table","TransportTypeTable");U=a(U,"tbody");U=a(U,"tr");for(G=0;G<V.length;G++){var N="",Q="",da="";if(V[G]instanceof LBS.MTRAVEL.Walk){N="WalkIcon";Q="WalkCode";da="-"}else if(V[G]instanceof LBS.MTRAVEL.Line){N="LineIcon";
Q="LineCode";da=V[G].getCode()}var M=a(U,"td");N=a(M,"div",N);Q=a(M,"div",Q);e(Q,da)}U=routes[W].getDuration();U=Math.round(U/60);G=Math.floor(U/60);if(G>0){U-=G*60;durationText=G+" h "+U+" min"}else durationText=U+" min";e(a(J,"td","Duration"),durationText);for(G=U=0;G<V.length;G++)if(V[G]instanceof LBS.MTRAVEL.Walk)U+=V[G].getLength();V=(new Number(U/1E3)).toFixed(1)+" km";e(a(J,"td","WalkLength"),V);tdElem=a(J,"td","SuggestionLink");N=a(tdElem,"div");V=new o.Button(N,o.Button.STATE.ENABLED);Y.addButton(V);
V=a(N,"a");U=A.getState();U.setParam("routesuggestion",W+1);U.setParam("mapzoom",null);U.setParam("mapcenter",null);V.href=window.location.pathname+window.location.search+"#"+U.getUrlHash();V.target="_blank";N=a(V,"div","NewPageIcon");N.title=p.Table.openInNewPageTooltip;V=o.RadioButton.SELECTION_STATE.UNSELECTED;if(W==v)V=o.RadioButton.SELECTION_STATE.SELECTED;radioButton=new o.RadioButton(J,o.Button.STATE.ENABLED,V,W);F.addRadioButton(radioButton);S.addRadioButton(radioButton)}s.appendChild(q);
f=routes;r=z;j=0;F.addSelectionChangeCBF(x);T=="arrival"?c(s,H(routes)):c(s,C(routes))};var x=function(z){j=z.getSelectedRadioButton().getData();for(var q in k)k[q](y)},s=h,A=l,y=this,k=[],f=null,d=null,j=null,r=null,w=null,u=p.Header.DayNames,t=[u.Sun,u.Mon,u.Tue,u.Wed,u.Thu,u.Fri,u.Sat]}
function RouteDescriptionFrame(h,l){var o=LBS.GUI,b=LBS.UTIL.DOM,m=b.createElement,n=b.createTextNode,c=b.appendElement,a=b.appendNewElement,e=b.appendText,p=Dictionary.RouteDescription;this.clear=function(){for(;f.firstChild;)f.removeChild(f.firstChild);d=null};this.showRouteDescription=function(w,u,t,z){var q=function(Q,da){var M=z.getStartLocation(),L=Q.getLocations()[0].getArrivalDateTime(),O=m("tr",da),K=a(O,"td","WalkStartTime");K.colSpan="2";e(K,MREITTI.UTIL.formatTime(L,":"));K=a(O,"td","WalkStartLocation");
L=a(K,"div");e(L,MREITTI.UTIL.routeLocationToString(M));k(L,{x:M.getX(),y:M.getY()});return O},g=function(Q,da){var M=m("tr",da);a(M,"td","WalkLineLeft");a(M,"td","WalkLineRight");var L=a(M,"td","WalkInformation"),O=m("div","WalkDetailsToggleButtonUnToggled"),K=m("table"),ea=a(K,"tbody");ea=a(ea,"tr");var aa=a(ea,"td");c(aa,O);aa=a(ea,"td");a(aa,"div","WalkTransportTypeIcon");aa=a(ea,"td");ea=a(aa,"div","WalkTransportTypeInformation");aa=(new Number(Q.getLength()/1E3)).toFixed(1)+" km";e(ea,p.Table.walk+
" "+aa);c(L,K);K=Q.getLocations();ea=m("div","WalkDetailsInvisible");aa=a(ea,"table");aa=a(aa,"tbody");for(var ka in K){var la=K[ka].getDepartureDateTime();if(ka==K.length-1)la=K[ka].getArrivalDateTime();var I=K[ka].getName("1");if(I===null)I="|";var R=a(aa,"tr"),X=a(R,"td");e(X,MREITTI.UTIL.formatTime(la,":"));la=a(a(R,"td"),"div");e(la,I);k(la,K[ka].getCoordinates())}c(L,ea);(new o.ToggleButton(O,o.Button.STATE.ENABLED,o.ToggleButton.TOGGLE_STATE.UNTOGGLED,ea)).addToggleStateChangeCBF(A);return M},
v=function(Q,da){var M=z.getEndLocation(),L=E[H].getLocations(),O=L[L.length-1].getDepartureDateTime();L=m("tr",da);var K=a(L,"td","WalkEndTime");K.colSpan="2";e(K,MREITTI.UTIL.formatTime(O,":"));K=a(L,"td","WalkEndLocation");O=a(K,"div");e(O,MREITTI.UTIL.routeLocationToString(M));k(O,{x:M.getX(),y:M.getY()});return L},B=function(Q){Q=Q.getLocations();var da=m("div","LineDetailsInvisible"),M=a(da,"table");M=a(M,"tbody");for(var L in Q){var O=Q[L].getDepartureDateTime();if(L==Q.length-1)O=Q[L].getArrivalDateTime();
var K=a(M,"tr");e(a(K,"td"),MREITTI.UTIL.formatTime(O,":"));O=a(a(K,"td"),"div");e(O,Q[L].getName("1"));k(O,Q[L].getCoordinates())}return da};r.clear();d=new o.ButtonStyleManager(CssSettings.RouteDescription.LocationButton);f.appendChild(function(){var Q=m("div","RouteDescriptionHeader");e(Q,t+1+". "+p.Header.title);return Q}());for(var E=u.getLegs(),S=m("table","RouteDescriptionTable"),C=a(S,"tbody"),H=0;H<E.length;H++){var F=H%2?"LegRowEven":"LegRowOdd";if(E[H]instanceof LBS.MTRAVEL.Walk){H==0&&
c(C,q(E[H],F));c(C,g(E[H],F));H==E.length-1&&c(C,v(E[H],F))}else{var T=E[H].getLocations(),J=T[0].getDepartureDateTime(),Y=T[T.length-1].getArrivalDateTime(),Z=T[0].getName("1"),W=T[T.length-1].getName("1"),U=a(C,"tr",F),V=a(U,"td","LineStartTime");V.colSpan="2";e(V,MREITTI.UTIL.formatTime(J,":"));V=a(U,"td","LineStartLocation");locationElem=a(V,"div");e(locationElem,Z);k(locationElem,T[0].getCoordinates());U=a(C,"tr",F);a(U,"td","LineLineLeft");a(U,"td","LineLineRight");V=m("td","LineInformation");
J=m("table");Z=a(J,"tbody");var G=a(Z,"tr"),N=a(G,"td");Z=a(N,"div","LineDetailsToggleButtonUnToggled");N=a(G,"td");a(N,"div","LineTransportTypeIcon");N=a(G,"td");G=a(N,"div","LineTransportTypeInformation");e(G,p.Table.bus+" "+E[H].getCode());V.appendChild(J);J=c(V,B(E[H]));(new o.ToggleButton(Z,o.Button.STATE.ENABLED,o.ToggleButton.TOGGLE_STATE.UNTOGGLED,J)).addToggleStateChangeCBF(s);U.appendChild(V);U=a(C,"tr",F);V=a(U,"td","LineEndTime");V.colSpan="2";e(V,MREITTI.UTIL.formatTime(Y,":"));V=a(U,
"td","LineEndLocation");locationElem=a(V,"div");e(locationElem,W);k(locationElem,T[T.length-1].getCoordinates())}}c(f,S);c(f,x(w,u,t,z))};var x=function(w,u,t,z){w=function(v,B){var E=m("div","PrintRoute"),S=a(E,"span");e(S,B);(new o.Button(S,o.Button.STATE.ENABLED,v)).addMouseClickCBF(function(C){C.getData().submit()});return E};t=b.getElement("PrintForm");var q=m("div","Links"),g=c(q,function(v){var B=j.getState();v=v.getEndDateTime();var E=new Date(v.getTime()+6E4),S=B.getParam("to"),C=B.getParam("from");
v=m("div","ReturnRoute");B.setParam("mapcenter",null);B.setParam("mapzoom",null);B.setParam("date",MREITTI.UTIL.formatDate(E));B.setParam("time",MREITTI.UTIL.formatTime(E));B.setParam("timetype","departure");B.setParam("from",S);B.setParam("to",C);B.setParam("routesuggestion",null);E=a(v,"a");E.href=window.location.pathname+window.location.search+"#"+B.getUrlHash();e(E,p.Links.returnRoute);return v}(u));g.insertBefore(n("• "),g.firstChild);g=c(q,function(v){var B=j.getState();v=v.getEndDateTime();
var E=new Date(v.getTime()+6E4),S=B.getParam("to");v=m("div","ContinueRoute");B.setParam("mapcenter",null);B.setParam("mapzoom",null);B.setParam("date",MREITTI.UTIL.formatDate(E));B.setParam("time",MREITTI.UTIL.formatTime(E));B.setParam("timetype","departure");B.setParam("from",S);B.setParam("to",null);B.setParam("routesuggestion",null);E=a(v,"a");E.href=window.location.pathname+window.location.search+"#"+B.getUrlHash();e(E,p.Links.continueRoute);return v}(u));g.insertBefore(n("• "),g.firstChild);
g=c(q,w(t,p.Links.routeDetails));g.insertBefore(n("• "),g.firstChild);g=c(q,w(t,p.Links.printRoute));g.insertBefore(n("• "),g.firstChild);g=c(q,function(v){var B=m("div","SaveRoute"),E=a(B,"span"),S=a(E,"span","LinkName");e(S,p.Links.saveRoute);S=a(E,"span","SavedNote");e(S,p.Links.routeSaved);saveButtonSM=new o.ButtonStyleManager(CssSettings.RouteDescription.SaveRouteButton);var C=new o.Button(E,o.Button.STATE.ENABLED,v);saveButtonSM.addButton(C);C.addMouseClickCBF(function(H){v=H.getData();H=v.getStartLocation();
var F=v.getEndLocation();RoutesCookieManager.saveRoute([H,F])==true&&C.setState(o.Button.STATE.DISABLED)});return B}(z));g.insertBefore(n("• "),g.firstChild);return q},s=function(w){var u=w.getDomNode(),t=w.getData();if(w.getToggleState()===o.ToggleButton.TOGGLE_STATE.TOGGLED){u.className="LineDetailsToggleButton";t.className="LineDetails"}else{u.className="LineDetailsToggleButtonUnToggled";t.className="LineDetailsInvisible"}},A=function(w){var u=w.getDomNode(),t=w.getData();if(w.getToggleState()===
o.ToggleButton.TOGGLE_STATE.TOGGLED){u.className="WalkDetailsToggleButton";t.className="WalkDetails"}else{u.className="WalkDetailsToggleButtonUnToggled";t.className="WalkDetailsInvisible"}},y=function(w){w=w.getData();naviciAjaxApi.setMapCenter(w.x,w.y)},k=function(w,u){var t=new o.Button(w,o.Button.STATE.ENABLED,u);t.addMouseClickCBF(y);d.addButton(t)},f=h,d=null,j=l,r=this}
function MapAreaHeaderFrame(h,l){var o=LBS.GUI,b=LBS.UTIL.DOM,m=b.createElement,n=b.appendElement,c=b.appendNewElement,a=b.appendText,e=Dictionary.MapAreaHeader;this.clear=function(){b.clearElement(x);x.style.display="none"};this.show=function(y,k,f,d){A.clear();x.style.display="block";var j=m("table"),r=c(j,"tbody");r=c(r,"tr");var w=c(r,"td");w=c(w,"div","Title");a(w,d+1+". "+e.title);w=c(r,"td");w=c(w,"div","Links");n(w,p(y,k,f,d));n(x,j)};var p=function(y,k,f){k=b.getElement("PrintForm");var d=
m("div");n(d,function(j){var r=m("span","SaveRoute"),w=c(r,"span","LinkName");a(w,e.Links.saveRoute);w=c(r,"span","SavedNote");a(w,e.Links.routeSaved);saveButtonSM=new o.ButtonStyleManager(CssSettings.MapAreaHeader.SaveRouteButton);var u=new o.Button(r,o.Button.STATE.ENABLED,j);saveButtonSM.addButton(u);u.addMouseClickCBF(function(t){j=t.getData();t=j.getStartLocation();var z=j.getEndLocation();RoutesCookieManager.saveRoute([t,z])==true&&u.setState(o.Button.STATE.DISABLED)});return r}(y));n(d,function(j){var r=
s.getState();j=j.getEndDateTime();var w=new Date(j.getTime()+6E4),u=r.getParam("to"),t=r.getParam("from");j=m("span","ReturnRoute");r.setParam("mapcenter",null);r.setParam("mapzoom",null);r.setParam("date",MREITTI.UTIL.formatDate(w));r.setParam("time",MREITTI.UTIL.formatTime(w));r.setParam("timetype","departure");r.setParam("from",u);r.setParam("to",t);r.setParam("routesuggestion",null);w=c(j,"a");w.href=window.location.pathname+window.location.search+"#"+r.getUrlHash();a(w,e.Links.returnRoute);return j}(f));
n(d,function(j,r){var w=m("span","PrintRoute");a(w,r);(new o.Button(w,o.Button.STATE.ENABLED,j)).addMouseClickCBF(function(u){u.getData().submit()});return w}(k,e.Links.printRoute));return d},x=h,s=l,A=this}
function PrintForm(h){var l=LBS.UTIL.DOM,o=l.createElement,b=l.appendElement,m=l.appendNewElement;this.update=function(c,a,e){function p(s,A){var y=o("input");y.type="hidden";y.name=s;y.value=A;return y}l.clearElement(n);var x=m(n,"div");b(x,p("routeResponse",util.xml2text(a.getResponseDom())));b(x,p("startLocation",MREITTI.UTIL.routeLocationToString(c.getStartLocation())));b(x,p("endLocation",MREITTI.UTIL.routeLocationToString(c.getEndLocation())));b(x,p("routeNumber",e));b(x,p("language",Dictionary.LanguageId))};
var n=h}var LineManager=new function(){this.addLine=function(l){h.push(l)};this.setLineState=function(l,o){for(var b in h)if(h[b].getCode()==l){h[b].setState(o);break}};this.getLines=function(){return h};var h=[]};LineManager.Line=function(h,l,o){this.getCode=function(){return b};this.getIds=function(){return m};this.getState=function(){return n};this.setState=function(c){n=c};var b=h,m=l,n=o};LineManager.Line.STATE={ENABLED:1,DISABLED:2};
function AdvancedSearchLinesFrame(h,l,o,b){var m=LBS.GUI,n=LBS.UTIL.DOM,c=n.appendNewElement,a=n.appendText;this.clear=function(){n.clearElement(s)};this.showContent=function(){e()};this.setMode=function(f){if(f!=A){A=f;p();x()}};var e=function(){n.clearElement(s);var f=LineManager.getLines();if(y.length<1){var d=c(s,"div","NoLinesSelectedNote");a(d,Dictionary.SearchArea.AdvancedSearch.IncludeExcludeLines.noLinesSelectedNote)}else{var j=c(s,"table");j=c(j,"tbody");for(var r in y){var w=c(j,"tr");
d=c(w,"td");d=c(d,"div","LineCode");a(d,y[r]);d=c(w,"td");d=c(d,"div","DeleteButton");a(d,Dictionary.SearchArea.AdvancedSearch.IncludeExcludeLines.removeLine);(new m.Button(d,m.Button.STATE.ENABLED,y[r])).addMouseClickCBF(function(z){z=z.getData();var q=LineManager.getLines(),g=y;y=[];for(var v in q){var B=false,E;for(E in g)if(q[v].getCode()==g[E]){B=true;break}B==true&&q[v].getCode()!=z&&y.push(q[v].getCode())}p();e();x()})}}if(y.length<f.length){d=c(s,"div");a(d,Dictionary.SearchArea.AdvancedSearch.IncludeExcludeLines.addLine+
" ");var u=c(d,"select");j=c(u,"option");for(r in f){j=false;for(var t in y)if(f[r].getCode()==y[t]){j=true;break}if(j==false){j=c(u,"option");j.value=f[r].getCode();a(j,f[r].getCode());u.onchange=function(){var z=u.options[u.selectedIndex].value,q=LineManager.getLines(),g=y;y=[];for(var v in q){var B=false,E;for(E in g)if(q[v].getCode()==g[E]){B=true;break}if(B==true)y.push(q[v].getCode());else q[v].getCode()==z&&y.push(z)}p();e();x();e()}}}}},p=function(){var f=LineManager.Line.STATE,d=LineManager.getLines(),
j;for(j in d){var r=false,w=d[j].getCode();if(y.length<1)LineManager.setLineState(w,f.ENABLED);else{for(var u in y)if(w==y[u]){r=true;break}var t=f.DISABLED;if(r==true){if(A==AdvancedSearchLinesFrame.MODE.INCLUDE_SELECTED)t=f.ENABLED}else if(A!=AdvancedSearchLinesFrame.MODE.INCLUDE_SELECTED)t=f.ENABLED;LineManager.setLineState(w,t)}}},x=function(){var f=AdvancedSearchLinesFrame.MODE;y.length>0&&A==f.INCLUDE_SELECTED?k.setArrayParam("includelines",y):k.setArrayParam("includelines",null);y.length>0&&
A==f.EXCLUDE_SELECTED?k.setArrayParam("excludelines",y):k.setArrayParam("excludelines",null)},s=h,A=l,y=o,k=b;p()}AdvancedSearchLinesFrame.MODE={INCLUDE_SELECTED:1,EXCLUDE_SELECTED:2};var naviciAjaxApi=null,pageLoadTimestamp=new Date;function main(){var h=new LBS.STATESAVER.UrlHandler(500);initService(h,startService)}
function startService(h,l,o,b,m,n){var c=LBS.GUI,a=LBS.UTIL,e=a.DOM.getElement,p=CssSettings,x=e("Timestamp"),s=new CurrentTimeManager(pageLoadTimestamp,new Date(x.value*1E3)),A=null,y=true;if(n.getLocation("mapcenter")!==null)y=false;if(n.getParam("routesuggestion")!==null)A=n.getParam("routesuggestion");x=e(Settings.Map.placeHolderId);var k=getMapDimensions();x.style.height=k.height+"px";x.style.width=k.width+"px";util.setUseFormData(false);naviciAjaxApi=new NaviciAjaxApi;naviciAjaxApi.start(h);
var f=new PrintForm(e("PrintForm"));k=new c.FrameStyleManager(p.AboutFrame);h=new c.Frame(e("AboutFrame"),c.Frame.STATE.VISIBLE);k.addFrame(h);k=new c.ToggleButton(e("OwnRoutesFrameToggleButton"),c.Button.STATE.ENABLED,c.ToggleButton.TOGGLE_STATE.TOGGLED);var d=new c.ToggleFrameStyleManager(p.OwnRoutesFrame),j=new OwnRoutesFrame(e("OwnRoutesFrame"),k,c.Frame.STATE.VISIBLE,c.ToggleFrame.TOGGLE_STATE.TOGGLED,e("OwnRoutesFrameContent"));d.addToggleFrame(j);j.showContent();k=new c.FrameStyleManager(p.MapLegend);
var r=new c.Frame(e("MapLegend"),c.Frame.STATE.INVISIBLE);k.addFrame(r);k=new c.FrameStyleManager(p.DisclaimerTextArea);var w=new c.Frame(e("DisclaimerTextArea"),c.Frame.STATE.INVISIBLE);k.addFrame(w);k=new c.FrameStyleManager(p.SearchingRouteFrame);var u=new c.Frame(e("SearchingRouteFrame"),c.Frame.STATE.INVISIBLE);k.addFrame(u);k=new c.FrameStyleManager(p.RoutingErrorFrame);var t=new c.Frame(e("RoutingErrorFrame"),c.Frame.STATE.INVISIBLE);k.addFrame(t);k=new c.ToggleButton(e("AdvancedSearchFrameToggleButton"),
c.Button.STATE.ENABLED,c.ToggleButton.TOGGLE_STATE.UNTOGGLED);k=new c.ToggleFrame(e("AdvancedSearchFrame"),k,c.Frame.STATE.VISIBLE,c.ToggleFrame.TOGGLE_STATE.UNTOGGLED);(new c.ToggleFrameStyleManager(p.AdvancedSearchFrame)).addToggleFrame(k);k=e("IncludeLinesRadioButton");d=e("ExcludeLinesRadioButton");var z=[],q=AdvancedSearchLinesFrame.MODE.INCLUDE_SELECTED,g=n.getArrayParam("includelines"),v=n.getArrayParam("excludelines");if(v!=null&&g==null){k.checked=false;d.checked=true;q=AdvancedSearchLinesFrame.MODE.EXCLUDE_SELECTED;
z=v}else if(g!=null){k.checked=true;d.checked=false;z=g}else{k.checked=true;d.checked=false}var B=new AdvancedSearchLinesFrame(e("AdvancedSearchLinesFrame"),q,z,n);B.showContent();k.onclick=function(){B.setMode(AdvancedSearchLinesFrame.MODE.INCLUDE_SELECTED)};d.onclick=function(){B.setMode(AdvancedSearchLinesFrame.MODE.EXCLUDE_SELECTED)};k=function(I){return function(R){if(R===null)n.setParam(I,null);else{var X=LBS.STATESAVER,ga=null;ga=null;if(R.getCategory()==RouteLocation.CATEGORY_POI){ga=R.getName();
if(R.getCity()!==null)ga+=", "+R.getCity();ga=new X.NamedLocation(ga,X.NamedLocation.TYPE.POI)}else if(R.getCategory()==RouteLocation.CATEGORY_ADDRESS){ga=R.getName()+" "+R.getNumber();if(R.getCity()!==null)ga+=", "+R.getCity();ga=new X.NamedLocation(ga,X.NamedLocation.TYPE.ADDRESS)}else if(R.getCategory()==RouteLocation.CATEGORY_STREET){ga=R.getName();if(R.getCity()!==null)ga+=", "+R.getCity();ga=new X.NamedLocation(ga,X.NamedLocation.TYPE.STREET)}else{R.getCategory();ga=new X.Point(Math.round(R.getX()),
Math.round(R.getY()),X.Point.COORDINATE_SYSTEM.KKJ3)}n.setLocation(I,ga)}}};z=new c.ButtonStyleManager(p.SuggestionList.ScrollUpButton);d=new c.ButtonStyleManager(p.SuggestionList.ScrollDownButton);q=new SelectionList(e("SearchFromSuggestionList"),"SuggestionListEnabled","SuggestionListDisabled","SuggestionListInvisible",new SelectionList.parameters(7,6,0,SelectionList.STATE_ENABLED));g=new c.Button(e("SearchFromScrollUpButton"),c.Button.STATE.INVISIBLE);z.addButton(g);v=new c.Button(e("SearchFromScrollDownButton"),
c.Button.STATE.INVISIBLE);d.addButton(v);q.addScrollUpButton(g,Settings.SuggestionList.scrollInterval);q.addScrollDownButton(v,Settings.SuggestionList.scrollInterval);var E=new SearchFrame(e("SearchFromInputField"),q,null);E.addRouteLocationChangeCBF(new k("from"));e("SearchFromInputField").focus();q=new SelectionList(e("SearchToSuggestionList"),"SuggestionListEnabled","SuggestionListDisabled","SuggestionListInvisible",new SelectionList.parameters(7,6,0,SelectionList.STATE_ENABLED));g=new c.Button(e("SearchToScrollUpButton"),
c.Button.STATE.INVISIBLE);z.addButton(g);z=new c.Button(e("SearchToScrollDownButton"),c.Button.STATE.INVISIBLE);d.addButton(z);q.addScrollUpButton(g,Settings.SuggestionList.scrollInterval);q.addScrollDownButton(z,Settings.SuggestionList.scrollInterval);var S=new SearchFrame(e("SearchToInputField"),q,null);S.addRouteLocationChangeCBF(new k("to"));k=new c.InputFieldStyleManager(p.InputField);d=new c.InputField(e("DayInputField"),c.InputField.STATE.ENABLED);z=new c.InputField(e("MonthInputField"),c.InputField.STATE.ENABLED);
q=new c.InputField(e("YearInputField"),c.InputField.STATE.ENABLED);k.addInputField(d);k.addInputField(z);k.addInputField(q);var C=new c.DateInputArea(q,z,d);d=new c.InputField(e("HourInputField"),c.InputField.STATE.ENABLED);z=new c.InputField(e("MinuteInputField"),c.InputField.STATE.ENABLED);k.addInputField(d);k.addInputField(z);var H=new c.TimeInputArea(d,z);(new c.Button(e("CurrentTimeButton"),c.Button.STATE.ENABLED)).addMouseClickCBF(function(){var I=s.getCurrentDateTime();C.setYear(I.getFullYear());
var R=I.getMonth()+1;C.setMonth((R<10?"0":"")+R);R=I.getDate();C.setDay((R<10?"0":"")+R);R=I.getHours();H.setHours((R<10?"0":"")+R);I=I.getMinutes();H.setMinutes((I<10?"0":"")+I)});var F=e("TimeTypeInputField"),T=e("WalkSpeedInputField"),J=e("MaxWalkInputField"),Y=e("RoutingMethodInputField"),Z=e("ChangeMarginInputField");k=new SearchArea(E,S,C,H,F,T,J,Y,Z);(function(I,R,X,ga){var ua=X(function(){var ca=I.parentNode.removeChild(I);R.appendChild(ca);ga(ua)})})(x,e("MapAreaContainer"),k.addRouteRequestSentCBF,
k.removeRouteRequestSentCBF);(function(I,R,X){var ga=R(function(){I.setState(c.Frame.STATE.INVISIBLE);X(ga)})})(h,k.addRouteRequestSentCBF,k.removeRouteRequestSentCBF);k.addRouteRequestSentCBF(function(){t.setState(c.Frame.STATE.INVISIBLE);u.setState(c.Frame.STATE.VISIBLE);W.clear();U.clear();V.clear();j.setToggleState(c.ToggleFrame.TOGGLE_STATE.UNTOGGLED)});var W=new RouteSuggestionsFrame(e("RouteSuggestions"),n);W.addRouteSelectionChangeCBF(function(){var I=W.getRouteResponseId(),R=W.getSelectedRouteNumber(),
X=W.getRoutes(),ga=W.getRouteResponse(),ua=W.getRouteRequest();n.setParam("routesuggestion",R+1);f.update(ua,ga,R);V.show(ua,ga,X[R],R);naviciAjaxApi.clearDynamicLayer();naviciAjaxApi.setRouteVisibility(I,true,R);naviciAjaxApi.redrawDynamicLayer();U.showRouteDescription(ga,X[R],R,ua)});var U=new RouteDescriptionFrame(e("RouteDescription"),n),V=new MapAreaHeaderFrame(e("MapAreaHeader"),n);k.addRouteResponseReadyCBF(function(I,R,X){var ga=LBS.MTRAVEL;u.setState(c.Frame.STATE.INVISIBLE);if(R==null)t.setState(c.Frame.STATE.VISIBLE);
else if(R instanceof ga.ErrorResponse)t.setState(c.Frame.STATE.VISIBLE);else if(R instanceof ga.RouteResponse){_dateChangeHandler(C);_timeChangeHandler(H);G();routes=R.getRoutes();ga=routes[0].getStartLocation().getCoordinates();if(y===true)naviciAjaxApi.setMapCenter(ga.x,ga.y);else y=true;ga=0;if(A!==null&&A>0&&A<=routes.length){ga=A-1;A=null}else n.setParam("routesuggestion",null);f.update(X,R,ga);W.showRouteSuggestions(I,R,X,ga);V.show(X,R,routes[ga],ga);var ua=ga;naviciAjaxApi.clearDynamicLayer();
naviciAjaxApi.setRouteVisibility(I,true,ua);naviciAjaxApi.redrawDynamicLayer();U.showRouteDescription(R,routes[ga],ga,X);r.setState(c.Frame.STATE.VISIBLE);w.setState(c.Frame.STATE.VISIBLE)}else alert("Unknown route response type!")});x=naviciAjaxApi.getMap();x.addZoomChangeCallback(function(){var I=naviciAjaxApi.getMapInfos();n.setParam("mapzoom",I.zoom)});x.addMapMovedCallback(function(){var I=naviciAjaxApi.getMapInfos();I=new LBS.STATESAVER.Point(Math.round(I.centerX),Math.round(I.centerY),LBS.STATESAVER.Point.COORDINATE_SYSTEM.KKJ3);
n.setLocation("mapcenter",I)});_dateChangeHandler=function(I){if(I.validateDate()!==true)n.setParam("date",null);else{var R=I.getYear(),X=I.getMonth();I=I.getDay();R=""+R;if(X<10)R+="0";R+=X;if(I<10)R+="0";R+=I;n.setParam("date",R)}};C.addDateChangeCBF(_dateChangeHandler);_timeChangeHandler=function(I){var R=I.getHours();I=I.getMinutes();if(R===null||I===null)n.setParam("time",null);else{var X="";if(R<10)X+="0";X+=R;if(I<10)X+="0";X+=I;n.setParam("time",X)}};H.addTimeChangeCBF(_timeChangeHandler);
var G=function(){switch(F.options[F.selectedIndex].value){case "forward":n.setParam("timetype","departure");break;case "backward":n.setParam("timetype","arrival");break;default:n.setParam("timetype",null)}};F.onchange=function(){G()};T.onchange=function(){n.setParam("walkspeed",T.options[T.selectedIndex].value)};J.onchange=function(){n.setParam("maxwalk",J.options[J.selectedIndex].value)};Y.onchange=function(){n.setParam("method",Y.options[Y.selectedIndex].value)};Z.onchange=function(){n.setParam("changemargin",
Z.options[Z.selectedIndex].value)};(function(I){I=I.getParam("date");if(I!==null&&I.length==8){C.setYear(I.substring(0,4));C.setMonth(I.substring(4,6));C.setDay(I.substring(6,8))}})(n);(function(I){I=I.getParam("time");if(I!==null)if(I.length<3){H.setHours(I);H.setMinutes("00")}else if(I.length==3){H.setHours(I.substring(0,1));H.setMinutes(I.substring(1))}else{H.setHours(I.substring(0,2));H.setMinutes(I.substring(2))}})(n);(function(I){I=I.getParam("timetype");if(I!==null){switch(I){case "departure":I=
"forward";break;case "arrival":I="backward";break;default:I="forward"}for(var R=F.options,X=0;X<R.length;X++)if(F.options[X].value==I){F.selectedIndex=X;break}}})(n);(function(I){I=I.getParam("walkspeed");for(var R=T.options,X=0;X<R.length;X++)if(T.options[X].value==I){T.selectedIndex=X;break}})(n);(function(I){I=I.getParam("maxwalk");for(var R=J.options,X=0;X<R.length;X++)if(J.options[X].value==I){J.selectedIndex=X;break}})(n);(function(I){I=I.getParam("method");for(var R=Y.options,X=0;X<R.length;X++){var ga=
Y.options[X].value;if(ga==I){Y.selectedIndex=X;break}else if(ga=="default")Y.selectedIndex=X}})(n);(function(I){I=I.getParam("changemargin");for(var R=Z.options,X=0;X<R.length;X++)if(Z.options[X].value==I){Z.selectedIndex=X;break}})(n);if(l!==null)E.setRouteLocation(l);else o!==null&&E.setInput(o);if(b!==null)S.setRouteLocation(b);else m!==null&&S.setInput(m);l!==null&&b!==null&&k.searchRoute();l=function(){Q.setState(c.Frame.STATE.INVISIBLE)};o=function(){L.setState(c.Frame.STATE.INVISIBLE)};var N=
function(){la.setState(c.Frame.STATE.INVISIBLE)};m=function(I){var R=e("IndexSearchFrame"),X=e("IndexSearchFramePlaceHolder");X=a.getElementPosition(X);R.style.position="absolute";R.style.top=X.y+"px";R.style.left=X.x+"px";R.style.zIndex=255;aa.setState(c.Frame.STATE.VISIBLE);aa.showContent(I.getData())};x=new c.FrameStyleManager(p.SearchFrameMenu);b=new c.MenuItemStyleManager(p.SearchFrameMenuItem);var Q=new c.MenuFrame(e("SearchFromMainMenuFrame"),c.Frame.STATE.INVISIBLE);x.addFrame(Q);h=new c.MenuItem(e("SearchFromMainMenuItemIndexSearch"),
c.MenuItem.STATE.ENABLED);b.addMenuItem(h);h.addMouseClickCBF(l);h.addMouseClickCBF(m);k=new c.MenuFrame(e("SearchFromIndexSearchMenuFrame"),c.Frame.STATE.INVISIBLE);x.addFrame(k);d=new c.MenuItem(e("SearchFromIndexSearchMenuItemAddress"),c.MenuItem.STATE.ENABLED,"Street");k.addMenuItem(d);b.addMenuItem(d);d.addMouseClickCBF(l);d.addMouseClickCBF(m);d=new c.MenuItem(e("SearchFromIndexSearchMenuItemStop"),c.MenuItem.STATE.ENABLED,"Stop");k.addMenuItem(d);b.addMenuItem(d);d.addMouseClickCBF(l);d.addMouseClickCBF(m);
h.setSubMenu(k);k=new c.MenuItem(e("SearchFromMainMenuItemOwnLocations"),c.MenuItem.STATE.DISABLED,"OwnLocations");b.addMenuItem(k);k.addMouseClickCBF(l);k.addMouseClickCBF(m);d=new c.MenuFrame(e("SearchFromOwnLocationsMenuFrame"),c.Frame.STATE.INVISIBLE);x.addFrame(d);k.setSubMenu(d);var da=new OwnLocationsMenu(k,d,b);da.addLocationSelectCBF(l);da.addLocationSelectCBF(E.setRouteLocation);da.addEditLocationsCBF(l);da.addEditLocationsCBF(m);var M=new c.MenuItem(e("SearchFromMainMenuItemSave"),c.MenuItem.STATE.ENABLED);
b.addMenuItem(M);M.addMouseClickCBF(l);M.addMouseClickCBF(function(){LocationsCookieManager.saveLocation(E.getRouteLocation())});d=new c.MenuItem(e("SearchFromMainMenuItemClear"),c.MenuItem.STATE.ENABLED);b.addMenuItem(d);d.addMouseClickCBF(l);d.addMouseClickCBF(function(){E.setInput("")});Q.addMenuItem(h);Q.addMenuItem(k);Q.addMenuItem(M);Q.addMenuItem(d);var L=new c.MenuFrame(e("SearchToMainMenuFrame"),c.Frame.STATE.INVISIBLE);x.addFrame(L);h=new c.MenuItem(e("SearchToMainMenuItemIndexSearch"),
c.MenuItem.STATE.ENABLED);b.addMenuItem(h);h.addMouseClickCBF(o);h.addMouseClickCBF(m);k=new c.MenuFrame(e("SearchToIndexSearchMenuFrame"),c.Frame.STATE.INVISIBLE);x.addFrame(k);d=new c.MenuItem(e("SearchToIndexSearchMenuItemAddress"),c.MenuItem.STATE.ENABLED,"Street");k.addMenuItem(d);b.addMenuItem(d);d.addMouseClickCBF(o);d.addMouseClickCBF(m);d=new c.MenuItem(e("SearchToIndexSearchMenuItemStop"),c.MenuItem.STATE.ENABLED,"Stop");k.addMenuItem(d);b.addMenuItem(d);d.addMouseClickCBF(o);d.addMouseClickCBF(m);
h.setSubMenu(k);k=new c.MenuItem(e("SearchToMainMenuItemOwnLocations"),c.MenuItem.STATE.DISABLED,"OwnLocations");b.addMenuItem(k);k.addMouseClickCBF(o);k.addMouseClickCBF(m);d=new c.MenuFrame(e("SearchToOwnLocationsMenuFrame"),c.Frame.STATE.INVISIBLE);x.addFrame(d);k.setSubMenu(d);var O=new OwnLocationsMenu(k,d,b);O.addLocationSelectCBF(o);O.addLocationSelectCBF(S.setRouteLocation);O.addEditLocationsCBF(o);O.addEditLocationsCBF(m);var K=new c.MenuItem(e("SearchToMainMenuItemSave"),c.MenuItem.STATE.ENABLED);
b.addMenuItem(K);K.addMouseClickCBF(o);K.addMouseClickCBF(function(){LocationsCookieManager.saveLocation(S.getRouteLocation())});m=new c.MenuItem(e("SearchToMainMenuItemClear"),c.MenuItem.STATE.ENABLED);b.addMenuItem(m);m.addMouseClickCBF(o);m.addMouseClickCBF(function(){S.setInput("")});L.addMenuItem(h);L.addMenuItem(k);L.addMenuItem(K);L.addMenuItem(m);b=function(I){I===null?M.setState(c.MenuItem.STATE.DISABLED):M.setState(c.MenuItem.STATE.ENABLED)};E.addRouteLocationChangeCBF(b);b(E.getRouteLocation());
b=function(I){I===null?K.setState(c.MenuItem.STATE.DISABLED):K.setState(c.MenuItem.STATE.ENABLED)};S.addRouteLocationChangeCBF(b);b(S.getRouteLocation());var ea=function(){aa.setState(c.Frame.STATE.INVISIBLE)};b=new c.FrameStyleManager(p.IndexSearchFrame);var aa=new IndexSearchFrame(e("IndexSearchFrame"),c.Frame.STATE.INVISIBLE);b.addFrame(aa);aa.addLocationSelectCBF(function(I){ka.setRouteLocation(I);ea()});b=new c.Button(e("SearchFromMenuButton"),c.Button.STATE.ENABLED);b.addMouseClickCBF(function(){var I=
Q.getDomNode();if(Q.getState()==c.Frame.STATE.INVISIBLE){var R=e("SearchFromMenuPlaceHolder");R=a.getElementPosition(R);I.style.position="absolute";I.style.top=R.y+"px";I.style.left=R.x+"px";I.style.zIndex=255;Q.setState(c.Frame.STATE.VISIBLE);ka=E;da.update()}else Q.setState(c.Frame.STATE.INVISIBLE)});b.addMouseClickCBF(ea);b.addMouseClickCBF(o);b.addMouseClickCBF(N);b=new c.Button(e("SearchToMenuButton"),c.Button.STATE.ENABLED);b.addMouseClickCBF(function(){var I=L.getDomNode();if(L.getState()==
c.Frame.STATE.INVISIBLE){var R=e("SearchToMenuPlaceHolder");R=a.getElementPosition(R);I.style.position="absolute";I.style.top=R.y+"px";I.style.left=R.x+"px";I.style.zIndex=255;L.setState(c.Frame.STATE.VISIBLE);ka=S;O.update()}else L.setState(c.Frame.STATE.INVISIBLE)});b.addMouseClickCBF(ea);b.addMouseClickCBF(l);b.addMouseClickCBF(N);var ka=E;b=new c.Button(e("CalendarButton"),c.Button.STATE.ENABLED);m=new c.FrameStyleManager(p.CalendarFrame);var la=new CalendarFrame(e("CalendarFrame"),c.Frame.STATE.INVISIBLE);
m.addFrame(la);b.addMouseClickCBF(function(){if(la.getState()===c.Frame.STATE.INVISIBLE){var I=e("CalendarFrame"),R=e("CalendarFramePlaceHolder");R=a.getElementPosition(R);I.style.position="absolute";I.style.top=R.y+"px";I.style.left=R.x+"px";I.style.zIndex=255;la.setState(c.Frame.STATE.VISIBLE);I=new Date(e("TimeTableValidFrom").value*1E3);R=new Date(e("TimeTableValidTo").value*1E3);var X=s.getCurrentDateTime(),ga=[];ga.push({date:X,style:p.CalendarFrame.CurrentDateButton});C.getYear()!==null&&C.getMonth()!==
null&&C.getDay()!==null&&ga.push({date:new Date(C.getYear(),C.getMonth()-1,C.getDay()),style:p.CalendarFrame.SelectedDateButton});la.showContent(I,R,X,ga)}else N()});b.addMouseClickCBF(ea);b.addMouseClickCBF(l);b.addMouseClickCBF(o);la.addDateSelectCBF(function(I){N();C.setYear(I.getFullYear());var R=I.getMonth()+1;if(R<10)R="0"+R;C.setMonth(R);I=I.getDate();if(I<10)I="0"+I;C.setDay(I)})}
function initService(h,l){function o(t){var z=n.Point.COORDINATE_SYSTEM;return t.getCoordinateSystem()===z.KKJ3?{x:t.getX(),y:t.getY()}:t.getCoordinateSystem()===z.WGS84?LBS.COORDINATECONVERTER.WGS84ToKKJ3(t.getX(),t.getY()):{x:t.getX(),y:t.getY()}}function b(t,z){function q(C,H,F,T){if(T==0&&F.length==1){var J=F[0].getX(),Y=F[0].getY();C=F[0].getType();H=F[0].getName();T=F[0].getStreet();var Z=F[0].getNumber();F=F[0].getCity();J=new RouteLocation(J,Y);J.setCategory(RouteLocation.CATEGORY_POINT);
if(C=="Poi"){J.setCategory(RouteLocation.CATEGORY_POI);J.setName(H);J.setCity(F)}else if(C=="Street"){J.setName(T);J.setCity(F);if(Z!==null&&Z>0){J.setCategory(RouteLocation.CATEGORY_ADDRESS);J.setNumber(Z)}else J.setCategory(RouteLocation.CATEGORY_STREET)}else if(C=="Address"){J.setCategory(RouteLocation.CATEGORY_ADDRESS);J.setName(T);J.setNumber(Z);J.setCity(F)}v(J)}else v(null)}function g(C,H,F,T,J){C=new RouteLocation(H,F);C.setCategory(RouteLocation.CATEGORY_POINT);if(J==0&&T!==null&&T.length>
0){C.setName(T[0].getName());C.setCity(T[0].getCity());T[0].getNumber()!==null&&T[0].getNumber()>0&&C.setNumber(T[0].getNumber())}v(C)}for(var v=z,B=c.Geocoding.cities,E=B[0],S=1;S<B.length;S++)E+=","+B[S];B=new GeoserverGeocodingXml;B.addLocationRestriction("Municipality",null,"All",E);B.setMaxResults(2);E=h.getLocation(t);if(E===null){E=h.getParam(t);if(E===null||E.length<3)v(null);else{B.setFreeFormKey(E);u.getAddressByObject(null,B,q)}}else if(E instanceof n.Point){E=o(E);B=[{attributename:"radius",
attributevalue:Settings.ReverseGeocoding.radius}];S=new GeocodingReversed;S.start(w);S.getAddress(null,E.x,E.y,"fi",1,B,g)}else if(E instanceof n.NamedLocation){B.setFreeFormKey(E.getName());if(E.getType()===n.NamedLocation.TYPE.POI){B.deleteAllLocationType();B.addLocationType("POI")}else if(E.getType()===n.NamedLocation.TYPE.STREET){B.deleteAllLocationType();B.addLocationType("Street")}else if(E.getType()===n.NamedLocation.TYPE.ADDRESS){B.deleteAllLocationType();B.addLocationType("Street")}u.getAddressByObject(null,
B,q)}else v(null)}function m(){if(d===true&&j===true&&r===true){if(s!==null&&A!==null&&f===null){e.MAP_START_X=s.getX();e.MAP_START_Y=s.getY()}l(e,s,y,A,k,h)}}var n=LBS.STATESAVER,c=Settings,a=c.NaviciAjaxApi,e=new NaviciAjaxConfiguration,p=getMapDimensions();e.MAP_AREA=c.Map.placeHolderId;e.MAP_FIXEDSIZE=true;e.MAP_WIDTH=p.width;e.MAP_HEIGHT=p.height;e.CREATE_INDEXMAP=a.CREATE_INDEXMAP;e.INDEXMAP_WIDTH=p.width*0.3;e.INDEXMAP_HEIGHT=p.height*0.3;e.SERVER_SIDE_FILE=a.SERVER_SIDE_FILE;e.LANGUAGE=a.LANGUAGE;
e.IE_FIX_CSS=a.IE_FIX_CSS;e.MAP_MIN_X=a.MAP_MIN_X;e.MAP_MAX_X=a.MAP_MAX_X;e.MAP_MIN_Y=a.MAP_MIN_Y;e.MAP_MAX_Y=a.MAP_MAX_Y;e.MAP_START_X=a.MAP_START_X;e.MAP_START_Y=a.MAP_START_Y;e.scales=a.scales;e.availableImages=a.availableImages;e.MAP_MIN_ZOOM=a.MAP_MIN_ZOOM;e.MAP_MAX_ZOOM=a.MAP_MAX_ZOOM;e.MAP_INI_ZOOM=a.MAP_INI_ZOOM;e.MAP_IMAGEPATH=a.MAP_IMAGEPATH;e.PAN_CURSOR_STYLE=a.PAN_CURSOR_STYLE;e.MAP_SMOOTHMOVE=a.MAP_SMOOTHMOVE;e.CREATE_TYPE_MENU=a.CREATE_TYPE_MENU;e.CREATE_PRINT_MENU=a.CREATE_PRINT_MENU;
e.LAYERS=a.LAYERS;p=h.getParam("mapzoom");if(p!==null){p=parseInt(p);if(isNaN(p)===false&&p>=e.MAP_MIN_ZOOM&&p<=e.MAP_MAX_ZOOM)e.MAP_INI_ZOOM=p}for(var x in Lines)LineManager.addLine(new LineManager.Line(Lines[x].lineCode,Lines[x].lineIds,LineManager.Line.STATE.ENABLED));var s=null,A=null,y=null,k=null,f=null,d=false,j=false,r=false,w=new AjaxObject(a.SERVER_SIDE_FILE),u=new Geocoding;u.start(w);b("mapcenter",function(t){if(t!==null){e.MAP_START_X=t.getX();e.MAP_START_Y=t.getY();f=t}d=true;m()});
a=h.getLocation("from");y=a!==null&&a instanceof n.NamedLocation?a.getName():h.getParam("from");b("from",function(t){s=t;j=true;m()});a=h.getLocation("to");k=a!==null&&a instanceof n.NamedLocation?a.getName():h.getParam("to");b("to",function(t){A=t;r=true;m()});w.sendRequest()}
function getMapDimensions(){var h=LBS.UTIL,l=h.getWindowDimensions(),o=h.DOM.getElement(Settings.Map.placeHolderId);o=h.getElementPosition(o);h=l.width-o.x;l=l.height-o.y;o=Settings.Map.dimensions;h-=o.marginRight;l-=o.marginBottom;if(h<o.minWidth)h=o.minWidth;else if(h>o.maxWidth)h=o.maxWidth;if(l<o.minHeight)l=o.minHeight;else if(l>o.maxHeight)l=o.maxHeight;return{width:h,height:l}}
function poll(h,l,o,b){var m=LBS.UTIL.DOM.getElement,n=null;n=window.setInterval(function(){if(m(l)){window.clearTimeout(n);var c=m(o);c.parentNode.removeChild(c);c=m(l);c.parentNode.removeChild(c);m(b).style.display="block";h()}},10)}poll(main,"TheLastElementInBody","NoScript","Page");
var util=new function(){function h(G,N){if(N==null)window.onload=G;else{W!=null&&clearTimeout(W);if(z(N)==null)W=setTimeout(function(){util.onPageLoad(G,N)},10);else G()}}function l(G,N){if(N==null)if(document.addEventListener!=null)document.addEventListener("DOMContentLoaded",G,false);else window.onload=G;else{W!=null&&clearTimeout(W);if(z(N)==null)W=setTimeout(function(){util.onPageLoad(G,N)},10);else G()}}function o(G){return document.createElementNS("http://www.w3.org/1999/xhtml","html:"+G)}function b(G){return document.createElement(G)}
function m(G){try{var N=null;N=new XMLSerializer;var Q=N.serializeToString(G);return Q==null?n(G):Q}catch(da){try{return G.xml}catch(M){return"<error>No XML Serializer available</error>"}}}function n(G){var N="";if(G.nodeType==9){if(G.hasChildNodes())for(var Q=G.firstChild;Q;){N+=n(Q);Q=Q.nextSibling}}else if(G.nodeType!=3)if(G.nodeType==1){N="<"+G.tagName;if(G.hasAttributes()){Q=G.attributes;for(var da=0;da<Q.length;da++)N+=" "+Q[da].name+'="'+Q[da].value+'"'}if(G.hasChildNodes()){N+=">";for(Q=G.firstChild;Q;){N+=
n(Q);Q=Q.nextSibling}N+="</"+G.tagName+">"}else N+=" />"}return N}function c(G){var N=null;N=new XMLSerializer;return N.serializeToString(G)}function a(G){return G.xml}function e(){var G=null;if(typeof window.pageYOffset=="number")return new Point(window.pageXOffset,window.pageYOffset);else G=document.body.scrollTop>0||document.body.scrollLeft>0?new Point(document.body.scrollLeft,document.body.scrollTop):new Point(document.documentElement.scrollLeft,document.documentElement.scrollTop);return G}function p(){return new Point(document.documentElement.scrollLeft,
document.documentElement.scrollTop)}function x(){return new Point(document.body.scrollLeft,document.body.scrollTop)}function s(){return new Point(document.documentElement.scrollLeft,document.documentElement.scrollTop)}function A(){return new Point(window.pageXOffset,window.pageYOffset)}function y(){return new Point(0,0)}function k(G){if(!G)return window.event;return G}function f(){return window.event}function d(G){return G}function j(G,N){G.src=N+".png"}function r(G,N){G.src=N+".gif";G.style.filter=
"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='scale', src='"+N+".png');"}function w(){return new XMLHttpRequest}function u(){return new ActiveXObject("Microsoft.XMLHTTP")}function t(){return new ActiveXObject("Msxml2.XMLHTTP")}function z(G){return document.all?document.all[G]:document.layers?document.layers[G]:document.getElementById(G)}function q(G){return document.all[G]}function g(G){return document.getElementById(G)}function v(G){G=k(G);if(G.stopPropagation)G.stopPropagation();
else G.cancelBubble=true}function B(G){G.stopPropagation()}function E(){window.event.cancelBubble=true}function S(){return window.innerHeight?window.innerHeight:document.documentElement.clientHeight}function C(){return document.documentElement.clientHeight}function H(){return window.innerHeight}function F(){return document.documentElement.clientHeight>0?document.documentElement.clientHeight:document.body.clientHeight}function T(){return window.innerWidth?window.innerWidth:document.documentElement.clientWidth}
function J(){return document.documentElement.clientWidth}function Y(){return window.innerWidth}function Z(){return document.documentElement.clientWidth>0?document.documentElement.clientWidth:document.body.clientWidth}var W=null,U=true;this.useFormData=function(){return U};this.setUseFormData=function(G){U=G};this.loadCssFile=function(G){var N=util.createElement("link");N.setAttribute("rel","stylesheet");N.setAttribute("type","text/css");N.setAttribute("href",G);document.getElementsByTagName("head")[0].appendChild(N)};
var V=new CurrentBrowser;this.currentBrowser=V;this.currentOs=V.operatingSystem;this.isMobile=V.isMobile;this.isIE6=this.isIE=this.fixIEmarking=this.fixIEpng=false;this.createElement=document.createElementNS?o:b;if(V.browser=="Explorer"){this.onPageLoad=h;this.getEvent=f;this.xml2text=a;this.attach=q;this.stopPropagation=E;this.isIE=true;if(V.version<7){this.getScrollbarPosition=document.compatMode=="BackCompat"?x:p;this.getWindowHeight=F;this.getWindowWidth=Z;this.fixIEmarking=this.fixIEpng=this.isIE6=
true;this.loadPngImage=r;this.getXmlhttp=t}else{this.getScrollbarPosition=s;this.fixIEmarking=this.fixIEpng=false;this.loadPngImage=j;this.getXmlhttp=u;this.getWindowHeight=C;this.getWindowWidth=J}}else if(V.browser=="Firefox"){this.onPageLoad=l;this.fixIEmarking=this.fixIEpng=false;this.getEvent=d;this.loadPngImage=j;this.getXmlhttp=w;this.xml2text=c;this.getScrollbarPosition=A;this.getWindowHeight=H;this.getWindowWidth=Y;this.stopPropagation=B;this.attach=g}else if(V.browser=="Safari"){this.onPageLoad=
h;this.fixIEmarking=this.fixIEpng=false;this.getEvent=d;this.loadPngImage=j;this.getXmlhttp=w;this.xml2text=m;this.getScrollbarPosition=V.version>=520?A:y;this.getWindowHeight=H;this.getWindowWidth=Y;this.stopPropagation=B;this.attach=g;if(V.operatingSystem=="Series60")U=false}else{this.onPageLoad=h;this.fixIEmarking=this.fixIEpng=false;this.getEvent=k;this.loadPngImage=j;this.getXmlhttp=w;this.xml2text=m;this.getScrollbarPosition=e;this.stopPropagation=v;this.attach=z;this.getWindowHeight=S;this.getWindowWidth=
T}this.objectXY=function(G){var N=this.getScrollbarPosition();for(G=G;G;G=G.offsetParent){N.x+=G.offsetLeft;N.y+=G.offsetTop}return N};this.inObjectXY=function(G,N){var Q=this.getScrollbarPosition();Q=new Point(G.clientX+Q.x,G.clientY+Q.y);for(var da=N;da;da=da.offsetParent){Q.x-=da.offsetLeft;Q.y-=da.offsetTop}return Q};this.inObjectXYname=function(G,N){var Q=z(N);return this.inObjectXY(G,Q)};this.parameterObject2Text=function(G){var N="";if(G!=null)for(var Q=0;Q<G.length;Q++)N+=G[Q].attributename+
'="'+this.xmlAttributeString(G[Q].attributevalue)+'" ';return N};this.falseFunction=function(){return false};this.voidFunction=function(){};this.getFreeIndex=function(G){try{for(var N=G.length;G[N]!=undefined;)N++;return N}catch(Q){return null}};this.leavingObject=function(G,N){if(N==null)return false;else{var Q=util.inObjectXY(G,N);return Q.x<=1||Q.y<=1||Q.x>N.clientWidth||Q.y>N.clientHeight}};this.xmlAttributeString=function(G){if(G==null)return null;else{G=G+"";G=G.replace(/&/g,"&amp;");G=G.replace(/</g,
"&lt;");G=G.replace(/>/g,"&gt;");G=G.replace(/\'/g,"&apos;");return G=G.replace(/"/g,"&quot;")}};this.xmlUnescape=function(G){if(G==null)return null;else{G=G+"";G=G.replace(/&amp;/g,"&");G=G.replace(/&lt;/g,"<");G=G.replace(/&gt;/g,">");G=G.replace(/&apos;/g,"'");return G=G.replace(/&quot;/g,'"')}};this.xmlElementTextContent=function(G){var N="";for(G=G.firstChild;G!=null;){if(G.nodeType==3)N+=G.nodeValue;G=G.nextSibling}return N}};function Point(h,l){this.x=h;this.y=l}
function Tile(h,l,o){this.id=h;this.indexCol=l;this.indexRow=o;this.col=l;this.row=o;this.y=this.x=0;this.div=null;this.created=true}function Attribute(h,l){this.attributename=h;this.attributevalue=l}
function AssociatedArray(){var h=[];this.get=function(l){for(var o=null,b=0;b<h.length&&o==null;b++)if(h[b]!=null&&h[b].itemName==l)o=h[b].itemValue;return o};this.set=function(l,o){for(var b=false,m=0;m<h.length&&!b;m++)if(h[m]!=null&&h[m].itemName==l){b=true;h[m].itemValue=o}b||h.push({itemName:l,itemValue:o})}}
function CurrentBrowser(){function h(l){var o=l.indexOf(this.versionSearchString);if(o==-1)return null;return parseFloat(l.substring(o+this.versionSearchString.length+1))}this.browser=function(l,o){for(var b=0;b<l.length;b++){var m=l[b].string,n=l[b].prop;this.versionSearchString=l[b].versionSearch||l[b].identity;if(m){if(m.indexOf(l[b].subString)!=-1)return l[b].identity}else if(n)return l[b].identity}return o}([{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},
{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},
{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],"Unknown Browser");this.version=h(navigator.userAgent,null)||h(navigator.appVersion,null)||"Unknown Version";this.operatingSystem=navigator.platform;this.isMobile=navigator.platform=="Series60"||navigator.platform=="Symbian OS"||navigator.platform=="SymbianOS"||navigator.platform=="Series80"||navigator.platform=="Windows CE"||
navigator.platform=="Pocket PC"||navigator.platform=="Windows Mobile'"||navigator.platform=="PalmOS'"}
function DropDownList(h,l,o){function b(){e!=null&&clearTimeout(e);A.style.visibility="hidden"}function m(y,k){var f=util.createElement("div");f.appendChild(document.createTextNode(y.caption));f.className=o+"_item";f.onmouseover=function(){return n(k)};f.onclick=function(){b();l(x[k].callbackArgument)};return f}function n(y){p[s].className=o+"_item";s=y;p[s].className=o+"_item_select"}var c=null,a=null,e=null,p=[],x=[],s=null,A=null;(function(){A=util.createElement("div");A.className=o;h.parentNode.appendChild(A);
A.style.left="0px";A.style.top="0px";var y=util.objectXY(A),k=util.objectXY(h);A.style.left=k.x-y.x+"px";A.style.top=k.y-y.y+h.offsetHeight+"px"})();a=h.onblur;h.onblur=function(y){e=setTimeout(b,100);a!=null&&a(y)};c=h.onkeydown;h.onkeydown=function(y){var k=null,f=util.getEvent(y);if(f.keyCode)k=f.keyCode;else if(f.which)k=f.which;if(A.style.visibility=="visible")if(k==13){if(s!=null){k=s;b();l(x[k].callbackArgument)}}else if(k==40&&s<p.length-1)n(s+1);else k==38&&s>0&&n(s-1);c!=null&&c(y)};this.show=
function(y){for(var k=0;k<p.length;k++)A.removeChild(p[k]);p=[];k=p.length;for(var f=0;f<y.length;f++){p[k+f]=m(y[f],k+f);x[k+f]=y[f];A.appendChild(p[k+f])}s=k;p[s].className=o+"_item_select";A.style.visibility="visible"};this.hide=b}
function EventHandler(){var h=[];this.addListener=function(l){var o=util.getFreeIndex(h);h[o]=l;return o};this.deleteListener=function(l){if(l!=null){h[l]=null;l=true;for(var o=0;o<h.length&&l;o++)if(h[o]!=null)l=false;if(l)h=[]}};this.triggerEvent=function(l){for(var o=0;o<h.length;o++)h[o]!=null&&h[o](l)}}
var visualFx=new function(){this.shrinkHiding=function(h,l,o,b,m,n,c,a,e){function p(t){if(u){if(t)try{t()}catch(z){}}else{if(y==null)y=Math.round(l.offsetWidth);if(k==null)k=Math.round(l.offsetHeight);d=Math.round(y/a);j=Math.round(k/a);h.onclick=util.stopPropagation;f!=null&&clearTimeout(f);f=setTimeout(function(){x(1,t)},c)}}function x(t,z){f!=null&&clearTimeout(f);var q=y-d*t;if(q<0)q=0;var g=k-j*t;if(g<0)g=0;if(g==0&&q==0){if(util.isIE6){if(w)l.style.width="1px";if(r)l.style.height="1px"}else{if(w)l.style.width=
"0px";if(r)l.style.height="0px"}l.style.visibility="hidden";if(n!=null)h.className=n+"_show";h.onclick=s;e!=null&&e(false);if(z!=null)try{z()}catch(v){}u=true}else{if(!util.isIE6||q>0&&g>0){var B="";if(w){l.style.width=q+"px";B+="width: "+q+"px;"}if(r){l.style.height=g+"px";B+=" height: "+g+"px;"}l.setAttribute("style",B)}f=setTimeout(function(){return x(t+1,z)},c)}}function s(t){if(u){l.style.visibility="hidden";if(y==null||k==null){l.style.width="auto";l.style.height="auto";y=Math.round(l.offsetWidth);
k=Math.round(l.offsetHeight);l.style.width="0";l.style.height="0"}d=Math.round(y/a);j=Math.round(k/a);h.onclick=util.stopPropagation;f!=null&&clearTimeout(f);f=setTimeout(function(){A(1,t)},c)}else if(t)try{t()}catch(z){}}function A(t,z){l.style.visibility="visible";f!=null&&clearTimeout(f);var q=d*t;if(y<q)q=y;var g=j*t;if(k<g)g=k;var v="";if(w){l.style.width=q+"px";v+="width: "+q+"px;"}if(r){l.style.height=g+"px";v+=" height: "+g+"px;"}l.setAttribute("style",v);if(y==q&&k==g){if(n!=null)h.className=
n+"_hide";h.onclick=p;e!=null&&e(true);if(z)try{z()}catch(B){}u=false}else f=setTimeout(function(){A(t+1,z)},c)}var y=o,k=b,f=null,d=1,j=1,r=true,w=true,u=true;this.hide=p;this.show=s;this.setShrinkDirection=function(t,z){r=z;w=t};h.oncontextmenu=util.stopPropagation;h.onmousedown=util.stopPropagation;h.ondblclick=util.stopPropagation;u=m;h.onclick=m?s:p}};
function DocumentEvents(h){function l(b){for(var m=0;m<o.length;m++)o[m]!=null&&o[m](b)}var o=[];this.addEvent=function(b){var m=util.getFreeIndex(o);o[m]=b;if(h=="mouseMove")document.onmousemove=l;else if(h=="mouseUp")document.onmouseup=l;return m};this.deleteEvent=function(b){if(b!=null){o[b]=null;b=true;for(var m=0;m<o.length;m++)if(o[m]!=null)b=false;if(b){o=[];if(h=="mouseMove")document.onmousemove=null;else if(h=="mouseUp")document.onmouseup=null}}};this.handleEvent=l}
var DocumentMouseMoveEvent=new DocumentEvents("mouseMove"),DocumentMouseUpEvent=new DocumentEvents("mouseUp");
function AjaxObject(h){function l(){if(a==0||a==4){var f="";if(a==0)f=n();if(f!=""){c=util.getXmlhttp();a=1;c.open("POST",h,true);c.onreadystatechange=o;p=setTimeout(function(){clearTimeout(p);try{c.abort()}catch(d){}m()},x);if(util.useFormData()){f="--"+k+'\r\nContent-Disposition: form-data; name="requestXml"\r\n\r\n'+f+"\r\n--"+k+"--\r\n";c.setRequestHeader("Content-type",'multipart/form-data; boundary="'+k+'"');c.send(f)}else{c.setRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8");
c.send("requestXml="+encodeURIComponent(f))}}else a=0}}function o(){if(c.readyState==4){clearTimeout(p);var f=-1;try{f=c.status}catch(d){m()}if(f!=200&&f!=0&&f!=-1)m();else if(f!=-1){f=c.responseXML;if(f.getElementsByTagName("navici_response")[0]==null)for(f=0;f<y.length;f++)e[f]&&y[f].requestFailed();else{var j=f.getElementsByTagName("ajax_response_object");for(f=0;f<j.length;f++)if(j[f].hasChildNodes()){var r=j[f].getAttribute("object_id");try{y[r].parseResultXML(j[f])}catch(w){}e[r]=false}for(f=
0;f<y.length;f++)e[f]&&y[f].parseResultXML(null)}c=null;a=0;l()}else m()}}function b(){if(s){clearTimeout(s);s=0}a==0&&l();s=setTimeout(function(){b()},A)}function m(){for(var f=a=0;f<y.length;f++)y[f].requestFailed()}function n(){for(var f="",d=0;d<y.length;d++){e[d]=false;var j=y[d].buildRequest();if(j!=null){f+='<ajax_request_object object_id="'+d+'" service="'+y[d].service+'">'+j+"</ajax_request_object>";e[d]=true}}if(f!="")f="<navici_request>"+f+"</navici_request>";return f}var c=null,a=0,e=
[],p=null,x=1E4,s=0,A=1E4,y=[],k="<<<<<Navici<<<<";this.lookupTime=A;this.addRequestObject=function(f){y.push(f)};this.sendRequest=l;this.requestQueueLookup=b;this.setRequestTimeout=function(f){x=f}}
function ImageLayer(h,l,o,b,m,n){function c(){var g=util.attach(t.settings.MAP_AREA);g.className=g.className}function a(){for(var g="",v=0;v<j.length;v++)if(j[v]!=null)g+=j[v];if(g!="")g="<image_layer_objects>"+g+"</image_layer_objects >";return g}function e(){if(A!=null)for(var g=0;g<A.length;g++){A[g].tileZoom=null;A[g].tileCol=null;A[g].tileRow=null}y=[];for(g=t.settings.MAP_MIN_ZOOM;g<=t.settings.MAP_MAX_ZOOM;g++)y[g]=[]}function p(g,v,B,E){if(u&&A[g])if(A[g].tileZoom!=v||A[g].tileCol!=B||A[g].tileRow!=
E){A[g].style.visibility="hidden";A[g].src=z;var S=null;if(y[v][B]!=null)if(y[v][B][E]!=null)S=y[v][B][E];if(S==null){S="EMPTY";if(w==null)f[g]={zoom:v,col:B,row:E};else if(B>=w[v].MIN_COL&&B<=w[v].MAX_COL&&E>=w[v].MIN_ROW&&E<=w[v].MAX_ROW)f[g]={zoom:v,col:B,row:E}}x(g,B,E,v,S)}return true}function x(g,v,B,E,S){if(E==t.getZoom())if(k[g].col==v&&k[g].row==B){if(S=="EMPTY"){if(A[g].src!=z)A[g].src=z;if(A[g].style.visibility=="visible")A[g].style.visibility="hidden"}else if(A[g].src!=S)if(n&&q&&o=="png"){if(A[g].style.visibility==
"hidden")A[g].style.visibility="visible";A[g].src=t.settings.MAP_IMAGEPATH+"/spacer.gif";A[g].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src='"+S+"');"}else{A[g].style.visibility="hidden";A[g].src=S;A[g].style.visibility="visible"}else if(A[g].style.visibility=="hidden")A[g].style.visibility="visible";A[g].tileZoom=E;A[g].tileCol=v;A[g].tileRow=B}}function s(){f.length>0&&u&&l.sendRequest()}var A=null,y=null,k=null,f=[],d=[],j=[],r="",w=null,u=m,t=null,z="",q=util.fixIEpng&&
o=="png";this.service="ImageLayer";this.imageRequest=p;this.setAutoVisible=function(){};this.start=function(g){l.addRequestObject(this);t=g;w=t.settings.availableImages;k=t.getTileArray();e();A=[];t.getTiles();z=t.settings.MAP_IMAGEPATH+"/empty.gif";for(g=0;g<k.length;g++)if(k[g].created){A[g]=util.createElement("img");A[g].className=b;A[g].src=z;A[g].style.visibility=u?"visible":"hidden";A[g].tileCol=null;A[g].tileRow=null;A[g].tileZoom=null;k[g].div.appendChild(A[g])}else A[g]=k[g].div.childNodes[t.tempLayerIndex]};
this.redraw=function(){for(var g=0;g<k.length;g++)p(k[g].id,t.getZoom(),k[g].col,k[g].row);s()};this.buildRequest=function(){if(u){var g=0,v=f;f=[];for(var B="",E=0;E<v.length;E++){if(v[E]!=null&&g<1E3){d[E]=v[E];B+='<tile response_id="'+E+'" ';B+='zoom="'+v[E].zoom+'" ';B+='row="'+v[E].row+'" ';B+='column="'+v[E].col+'" />'}g++}if(g>0){g='<tiles layer="'+h+'" format="'+o+'" >';g+=r;g+=B;g+="</tiles>";return g}else return null}else return null};this.parseResultXML=function(g){if(u&&g!=null){d=[];
g=g.getElementsByTagName("tile");for(var v=0;v<g.length;v++){var B=g[v].getAttribute("id"),E=g[v].getAttribute("column"),S=g[v].getAttribute("row"),C=g[v].getAttribute("zoom"),H=g[v].firstChild.nodeValue;if(y[C][E]==null)y[C][E]=[];y[C][E][S]=H;x(B,E,S,C,H)}}};this.requestFailed=function(){if(u){for(var g=0;g<d.length;g++)if(f[g]==null)f[g]=d[g];d=[];l.sendRequest()}};this.resetCache=e;this.setVisibility=function(g){u=g;g="hidden";if(u)g="visible";for(var v=0;v<A.length;v++)A[v].style.visibility=
g;util.isIE6&&setTimeout(c,100)};this.getVisibility=function(){return u};this.getID=function(){return h};this.getImages=function(){return A};this.addImageLayerObject=function(g){var v=util.getFreeIndex(j);j[v]=g;r=a();return v};this.deleteImageLayerObject=function(g){j[g]=null;g=false;for(var v=0;v<j.length;v++)if(j[v]!=null)g=true;if(g)r=a();else{r="";j=[]}return 0};this.clearImageLayerObjects=function(){j=[];r=""};this.getImageLayerObjects=function(){return j};this.finishMove=s}
function LayerMarker(h){this.addMarker=function(l,o,b,m,n){l='<marker type="'+l+'" ';l+='x="'+o+'" y="'+b+'" ';if(n!=null&&n!="")l+='label="'+encodeURIComponent(n)+'" ';if(m!=null&&m!="")l+='color="'+m+'" ';l+=" />";return h.addImageLayerObject(l)};this.addMarkerImage=function(l,o,b,m){var n='<marker type="image" ';n+='x="'+l+'" y="'+o+'" ';n+='imagename="'+b+'" ';if(m!=null&&m!="")n+='label="'+encodeURIComponent(m)+'" ';n+=" />";return h.addImageLayerObject(n)};this.deleteMarker=function(l){return h.deleteImageLayerObject(l)}}
function LayerManager(h,l,o){function b(d){return function(){return h.setMapType(d)}}function m(d,j){if(j){d.menuItemBackground.className=l.MAP_CSS_BASE+"_typemenu_item_bg_active";d.menuItemText.className=l.MAP_CSS_BASE+"_typemenu_item_text_active";d.menuItemText.onclick=null}else{d.menuItemBackground.className=l.MAP_CSS_BASE+"_typemenu_item_bg";d.menuItemText.className=l.MAP_CSS_BASE+"_typemenu_item_text";d.menuItemText.onclick=b(d.type)}}function n(d,j,r,w,u,t,z,q){d=d;j=j;w=w;u=u;t=t;var g=r,v=
null;r=c.getInfo();if(d==null)d=r.width;if(j==null)j=r.height;if(w==null)w=r.zoom;if(u==null)u=r.centerX;if(t==null)t=r.centerY;if(g==null)g=p;for(r=0;r<a.length;r++)if(a[r].type==g)v=a[r].format;g='<image type="'+g+'" ';if(v!=null)g+='format="'+v+'" ';if(q!=null)g+='id="'+q+'" ';g+='zoom="'+w+'" ';g+='width="'+d+'" ';g+='height="'+j+'" ';g+='center_x="'+u+'" ';g+='center_y="'+t+'" ';g+=util.parameterObject2Text(z);g+=">";for(r=0;r<a.length;r++){q=a[r].layer.getImageLayerObjects();for(z=0;z<q.length;z++)g+=
q[z]}for(r=0;r<e.length;r++)if(e[r]!=null){q=e[r].getMarkers();for(z=0;z<q.length;z++)if(q[z]!=null&&q[z].div.printXML!=null)g+=q[z].div.printXML}g+="</image>";return g}var c=null,a=[],e=[],p=null,x=null,s=null,A=new EventHandler,y=[],k=[],f=false;this.service="Image";this.start=function(d,j){c=j;s=d;for(var r=false,w=0,u=0;u<l.LAYERS.length;u++)if(!o||l.LAYERS[u].view=="background"){var t=false,z="map_image_background",q=false;if(l.LAYERS[u].view=="dynamic"){z="map_image_dynamic";t=true}else if(!r){r=
q=true;p=l.LAYERS[u].type}var g=null;g=l.LAYERS[u].object==null?new ImageLayer(l.LAYERS[u].type,s,l.LAYERS[u].format,z,q,t):l.LAYERS[u].object;a[w]={layer:g,type:l.LAYERS[u].type,dynamic:l.LAYERS[u].view=="dynamic",format:l.LAYERS[u].format,label:l.LAYERS[u].label};w++;c.addLayer(g)}s.addRequestObject(this)};this.setMapType=function(d){for(var j=0;j<a.length;j++)if(!a[j].dynamic){a[j].layer.setVisibility(a[j].type==d);x!=null&&m(a[j],a[j].type==d)}p=d;c.redraw();A.triggerEvent(p);return 0};this.getLayer=
function(d){for(var j=0;j<a.length;j++)if(a[j].type==d)return a[j].layer;return null};this.clearLayer=function(d){for(var j=0;j<a.length;j++)if(a[j].type==d){a[j].dynamic&&a[j].layer.setVisibility(false);a[j].layer.clearImageLayerObjects();a[j].layer.resetCache();return 0}return 1};this.redrawLayer=function(d){for(var j=0;j<a.length;j++)if(a[j].type==d){a[j].layer.resetCache();if(a[j].dynamic){d=a[j].layer.getImageLayerObjects();a[j].layer.setVisibility(d.length>0)}a[j].layer.redraw();return 0}return 1};
this.setLayerVisibility=function(d,j){for(var r=0;r<a.length;r++)if(a[r].type==d){a[r].layer.setVisibility(j);return 0}return 1};this.getMapPrintXML=n;this.getMapPrintURL=function(d,j,r,w,u,t,z,q){id=util.getFreeIndex(y);y[id]={id:id,callback:d,width:j,height:r,type:w,zoom:u,x:t,y:z,parameters:q,status:"queued"};f=true;s.sendRequest()};this.getCurrentType=function(){return p};this.createMenu=function(){var d=c.getMapNode();x=util.createElement("div");d.appendChild(x);x.className=l.MAP_CSS_BASE+"_typemenu";
for(d=0;d<a.length;d++)if(!a[d].dynamic){var j=util.createElement("div");j.className=l.MAP_CSS_BASE+"_typemenu_item";j.onclick=util.stopPropagation;j.oncontextmenu=util.stopPropagation;j.onmousedown=util.stopPropagation;j.ondblclick=util.stopPropagation;var r=util.createElement("div");j.appendChild(r);var w=util.createElement("div");w.appendChild(document.createTextNode(a[d].label));j.appendChild(w);x.appendChild(j);a[d].menuItemBackground=r;a[d].menuItemText=w;m(a[d],a[d].type==p)}};this.buildRequest=
function(){if(f){for(var d="",j=0;j<y.length;j++){d+=n(y[j].width,y[j].height,y[j].type,y[j].zoom,y[j].x,y[j].y,y[j].parameters,j);k[id]=y[id];k[id].send=false}y=[];f=false;return d}else return null};this.parseResultXML=function(d){if(d!=null){d=d.getElementsByTagName("image");for(i=0;i<d.length;i++){var j=d[i].getAttribute("id");k[j].callback(d[i].firstChild.nodeValue);k[j].send=true}}for(j=0;j<k.length;j++)k[j]!=null&&!k[j].send&&k[j].callback(null);k=[]};this.requestFailed=function(){for(var d=
0;d<k.length;d++)k[d]!=null&&!k[d].send&&k[d].callback(1);k=[]};this.addTypeChangeCallback=function(d){return A.addListener(d)};this.deleteTypeChangeCallback=function(d){A.addListener(d)};this.addDivLayer=function(d){var j=util.getFreeIndex(e);e[j]=d;return j};this.deleteDivLayer=function(d){if(d!=null){e[d]=null;d=true;for(var j=0;j<e.length;j++)if(e[j]!=null)d=false;if(d)e=[]}}}
function PoisOnLayer(h){function l(){a=[];for(var e=0;e<m.length;e++)if(m[e]!=null){m[e].layerObjectId!=null&&a.push({category:n[e],subcategory:null});for(var p=0;p<m[e].subcategories.length;p++)m[e].subcategories[p]!=null&&a.push({category:n[e],subcategory:c[p]})}}function o(){this.layerObjectId=null;this.subcategories=[]}function b(e){for(var p=null,x=0;x<c.length&&p==null;x++)if(c[x]==e)p=x;if(p==null){p=c.length;c[c.length]=e}return p}var m=[],n=[],c=[],a=[];this.setPoiVisibility=function(e,p,
x,s,A){var y;y=null;for(var k=0;k<n.length&&y==null;k++)if(n[k]==p)y=k;if(y==null){y=n.length;n[n.length]=p}y=y;if(A){e='<pois service="'+e+'" category="'+p+'" ';if(x!=null&&x!="")e+='subcategory="'+x+'" ';e+=util.parameterObject2Text(s);e+=" />";s=e;if(m[y]==null){m[y]=new o;if(x==null)m[y].layerObjectId=h.addImageLayerObject(s);else m[y].subcategories[x]=h.addImageLayerObject(s)}else if(x==null){m[y].layerObjectId!=null&&h.deleteImageLayerObject(m[y].layerObjectId);m[y].layerObjectId=h.addImageLayerObject(s)}else{subcategoryNr=
b(x);m[y].subcategories[subcategoryNr]!=null&&h.deleteImageLayerObject(m[y].subcategories[subcategoryNr]);m[y].subcategories[subcategoryNr]=h.addImageLayerObject(s)}l();return 0}else{s=0;if(m[y]!=null)if(x==null){if(m[y].layerObjectId!=null){s=h.deleteImageLayerObject(m[y].layerObjectId);m[y].layerObjectId=null}}else{subCats=m[y].subcategories;subcategoryNr=b(x);if(subCats[subcategoryNr]!=null){s=h.deleteImageLayerObject(subCats[subcategoryNr]);subCats[subcategoryNr].layerObjectId=null}}l();return s}};
this.getVisiblePois=function(){return a}}
function DivMarkerLayer(){function h(){var k=x[0][0].col,f=x[0][0].row;if(y)for(var d=0;d<b.length;d++)if(b[d]!=null){var j=l(b[d],k,f);if(j==null&&b[d].shown){A.removeChild(b[d].div);b[d].shown=false}else if(j!=null){var r=(j.row-f)*n+j.top+s.y+b[d].offsetY;b[d].div.style.left=(j.col-k)*n+j.left+s.x+b[d].offsetX+"px";b[d].div.style.top=r+"px";if(!b[d].shown){A.appendChild(b[d].div);b[d].shown=true}}}e=k;p=f}function l(k,f,d){k=m.calcMapTileCoords(k.x,k.y,m.getZoom());return k.col>=f&&k.col<f+a&&
k.row>=d&&k.row<d+c?k:null}function o(k,f,d,j,r,w,u){this.id=k;this.div=f;this.x=d;this.y=j;this.offsetX=r;this.offsetY=w;this.shown=false;this.div.printXML=u}var b=[],m=null,n=256,c=0,a=0,e=0,p=0,x=null,s=null,A=null,y=false;this.start=function(k){m=k;A=m.getActiveSurface();n=m.settings.MAP_TILE_SIZE;x=m.getTiles();a=x.length;c=x[0].length;s=m.getTileContainer()};this.redraw=function(){h()};this.imageRequest=function(){};this.finishMove=h;this.addMarker=function(k,f,d,j,r,w,u){var t=util.getFreeIndex(b),
z=util.createElement("div");z.className=k;if(j!=null&&j!=""){k=document.createTextNode(j);z.appendChild(k)}z.markerId=t;b[t]=new o(t,z,f,d,r,w,u);f=l(b[t],e,p);if(f!=null){b[t].shown=true;d=(f.row-p)*n+f.top+s.y+b[t].offsetY;z.style.left=(f.col-e)*n+f.left+s.x+b[t].offsetX+"px";z.style.top=d+"px";A.appendChild(z)}y=true;return z};this.deleteMarker=function(k){if(b[k.markerId]!=null){b[k.markerId].shown&&A.removeChild(b[k.markerId].div);b[k.markerId]=null}k=false;for(var f=0;f<b.length;f++)if(b[f]!=
null)k=true;if(!k){b=[];y=false}return 0};this.getMarkers=function(){return b};this.getVisibility=function(){return y}}
function RouteRequests(h){function l(a){if(n[a]!=null&&c!=null){for(var e=0;e<n[a].length;e++)n[a][e].layerObjectId!=null&&c.deleteImageLayerObject(n[a][e].layerObjectId);n[a]=null}return 0}var o=[],b=[],m=false,n=[],c=null;this.service="RouteRequests";this.start=function(a){c=a};this.getRoute=function(a,e,p,x,s){if(e.length>=2){if(n[a]!=null&&n[a].layerObjectId!=null){c.deleteImageLayerObject(n[a].layerObjectId);n[a]=null}if(a==null)a=util.getFreeIndex(n);o[a]={locations:e,language:p,parameters:x,
callback:s};m=true;h.sendRequest();return a}else return null};this.deleteRoute=l;this.setRouteVisibility=function(a,e,p){if(c!=null){if(n[a]!=null)if(p==null)for(p=0;p<n[a].length;p++)if(n[a][p].layerObjectId!=null&&!e){c.deleteImageLayerObject(n[a][p].layerObjectId);n[a][p].layerObjectId=null}else{if(n[a].layerObjectId==null&&e)n[a][p].layerObjectId=c.addImageLayerObject(n[a][p].imageLayerXML)}else{if(n[a][p]!=null)if(n[a][p].layerObjectId!=null&&!e){c.deleteImageLayerObject(n[a][p].layerObjectId);
n[a][p].layerObjectId=null}else if(n[a].layerObjectId==null&&e)n[a][p].layerObjectId=c.addImageLayerObject(n[a][p].imageLayerXML)}else return 2;return 0}else return 1};this.getRouteVisibility=function(a,e){var p=0;if(e!=null)p=e;return n[a]!=null&&n[a][p]!=null?n[a][p].layerObjectId!=null:false};this.getRouteCount=function(a){return n[a]==0?0:n[a].length};this.buildRequest=function(){if(m){for(var a="",e=0;e<o.length;e++)if(o[e]!=null){b[e]=o[e];b[e].send=false;a+='<get_route id="'+e+'" language="'+
o[e].language+'" ';a+=util.parameterObject2Text(o[e].parameters);a+=" >";a+='<output type="image_layer_objects"/>';a+='<output type="gui_objects"/>';for(var p=o[e].locations,x=0;x<p.length;x++){a+='<location order="'+x;a+='" x="'+p[x].getX()+'" y="'+p[x].getY();a+='" name="'+p[x].getName();if(p[x].getNumber()!=null&&p[x].getNumber()!="")a+='" number="'+p[x].getNumber();a+='" city="'+p[x].getCity();a+='" />'}a+="</get_route>"}o=[];m=false;return a}else return null};this.parseResultXML=function(a){if(a!=
null){a=a.getElementsByTagName("route_response");for(var e=0;e<a.length;e++){var p=a[e].getAttribute("id");if(p!=null){var x=a[e].getElementsByTagName("image_layer_objects"),s=a[e].getElementsByTagName("gui_objects");if(x.length==0||s.length==0)b[p].callback(p,null,null,2);else{var A=[];e=0;for(x=x[0].firstChild;x;x=x.nextSibling){A[e]=util.xml2text(x);e++}x=p;A=A;s=s[0].firstChild;var y=b[p].callback;if(c!=null){l(x);if(A.length>0){n[x]=[];for(var k=0,f=0;f<A.length;f++)if(A[f]!=null&&A[f]!=""){n[x][k]=
{imageLayerXML:A[k],layerObjectId:null};k++}n[x][0].layerObjectId=c.addImageLayerObject(A[0])}}y(x,s,0)}b[p].send=true}}for(p=0;p<b.length;p++)b[p]!=null&&!b[p].send&&b[p].callback(p,null,null,0);b=[]}};this.requestFailed=function(){for(var a=0;a<b.length;a++)b[a]!=null&&b[a].callback(a,null,null,1)}}
function GeoserverGeocodingXml(){function h(f,d,j){var r="";if(j!=null){r+='<POIProperty name="'+f+'" ';r+=b("matchMethod",j.method);r+=b(d,j.idList);r+=b("value",j.key);r+=" />"}return r}function l(f,d){var j="";if(d!=null){j+="<"+f+" ";j+=b("matchMethod",d.method);j+=b("locationIds",d.idList);j+=" >";if(d.key!=null&&d.key!="")j+=util.xmlAttributeString(d.key);j+="</"+f+">"}return j}function o(f,d){var j="";if(d!=null){j+='<Place type="'+f+'" ';j+=b("matchMethod",d.method);j+=b("locationIds",d.idList);
j+=" >";if(d.key!=null&&d.key!="")j+=util.xmlAttributeString(d.key);j+="</Place>"}return j}function b(f,d){var j="";if(d!=null&&d!="")j+=f+'="'+util.xmlAttributeString(d)+'" ';return j}function m(f){var d={id:0,locations:null,status:0},j=f.getAttribute("requestID");if(j!=null){d.id=j;j=[];if(f.hasChildNodes())for(f=f.firstChild;f!=null;){if(f.nodeType==1){var r=j;if(f.nodeName=="LocationResponseList")for(var w=f.firstChild;w!=null;){if(w.nodeType==1){var u,t=w;u=null;if(t.nodeName=="GeocodedAddress"){u=
new MapLocation(0,0);if(t.hasChildNodes())for(t=t.firstChild;t!=null;){if(t.nodeType==1)if(t.nodeName=="Point")a(u,t);else if(t.nodeName=="Address")n(u,t);else t.nodeName=="GeocodeMatchCode"&&c(u,t);t=t.nextSibling}u.getStreetLocation()==null?u.setType("Street"):u.setType("Address")}else if(t.nodeName=="POI"){u=new MapLocation(0,0);u.setType("Poi");var z=util.xmlUnescape(t.getAttribute("POIName"));u.setPOIName(z);if(t.hasChildNodes())for(t=t.firstChild;t!=null;){if(t.nodeType==1)if(t.nodeName=="Point")a(u,
t);else if(t.nodeName=="POIAttributeList"){z=u;var q=t;if(q.getElementsByTagName("POIInfoList").length>0){q=q.getElementsByTagName("POIInfo");for(var g=0;g<q.length;g++){var v=util.xmlUnescape(q[g].getAttribute("name")),B=util.xmlUnescape(q[g].getAttribute("value"));v!=null&&v!=""&&B!=null&&B!=""&&z.setAttribute(v,B)}}}else if(t.nodeName=="Address")n(u,t);else t.nodeName=="GeocodeMatchCode"&&c(u,t);t=t.nextSibling}}u=u;if(u!=null)r[r.length]=u}w=w.nextSibling}}f=f.nextSibling}d.locations=j}return d}
function n(f,d){d.getAttribute("countryCode")!=null&&f.setCountryCode(d.getAttribute("countryCode"));var j=d.getElementsByTagName("StreetAddress");if(j.length>0){var r=j[0].getElementsByTagName("Street");if(r.length>0){r=util.xmlElementTextContent(r[0]);f.setStreet(util.xmlUnescape(r))}j=j[0].getElementsByTagName("StreetLocation");if(j.length>0){j=util.xmlElementTextContent(j[0]);f.setStreetLocation(util.xmlUnescape(j))}}j=d.getElementsByTagName("Postalcode");if(j.length>0){j=util.xmlElementTextContent(j[0]);
f.setPostalcode(util.xmlUnescape(j))}j=d.getElementsByTagName("Place");for(r=0;r<j.length;r++){var w=f,u=j[r];if(u.getAttribute("type")!=null){var t=u.getAttribute("type");u=util.xmlUnescape(util.xmlElementTextContent(u));if(t=="Municipality")w.setMunicipality(u);else if(t=="MunicipalitySubdivision")w.setMunicipalitySubdivision(u);else if(t=="CountrySecondarySubdivision")w.setCountrySecondarySubdivision(u);else if(t=="CountrySubdivision")w.setCountrySubdivision(u);else t=="Country"&&w.setCountry(u)}}}
function c(f,d){if(d.getAttribute("accuracy")!=null){var j=Number(d.getAttribute("accuracy"));f.setAttribute("accuracy",j)}}function a(f,d){var j=d.getElementsByTagName("pos");if(j.length>0){j=util.xmlElementTextContent(j[0]);if(j!=null&&j!=""){var r=j.split(" ");j=Number(r[0]);r=Number(r[1]);if(j!="NaN"&&r!="NaN"){f.setX(j);f.setY(r)}}}}function e(f){var d=0,j=-1;if(f!=null)for(;d<k.length&&j==-1;){if(k[d]==f)j=d;d++}return j}var p=null,x=100,s=[],A=[],y=[],k=[];(function(){k[0]="POI";k[1]="Street";
k[2]="PostalCode";k[3]="MunicipalitySubdivision";k[4]="Municipality";k[5]="CountrySecondarySubdivision";k[6]="CountrySubdivision";k[7]="Country";k[8]="POIClass";k[9]="StreetAddress";for(var f=0;f<=7;f++)A[f]=true})();this.getXml=function(f){var d="";d+='<Request methodName="LocationRequest" requestID="'+f+'" maximumResponses="'+x+'">';d+="<LocationRequest>";f=d;d="";if(p!=null){d+="<FreeFormLocationName>";d+=util.xmlAttributeString(p);d+="</FreeFormLocationName>"}f=d=f+d;for(var j=d="",r=false,w=
0;w<7;w++)if(A[w]==true){j+="<LocationType ";j+='name="'+k[w]+'" ';j+="/>"}else r=true;if(r){d+="<LocationTypeList>";d+=j;d+="</LocationTypeList>"}f=d=f+d;result="";if(s[1]!=null||s[2]!=null||s[3]!=null||s[4]!=null||s[5]!=null||s[6]!=null||s[7]!=null||s[9]!=null){result+="<Address>";if(s[1]!=null||s[9]!=null){result+="<StreetAddress>";result+=l("StreetLocation",s[9]);result+=l("Street",s[1]);result+="</StreetAddress>"}result+=l("PostalCode",s[2]);result+=o("MunicipalitySubdivision",s[3]);result+=
o("Municipality",s[4]);result+=o("CountrySecondarySubdivision",s[5]);result+=o("CountrySubdivision",s[6]);result+=o("Country",s[7]);result+="</Address>"}f=d=f+result;d="";if(s[0]!=null||s[8]!=null){d+="<POIProperties>";d+=h("POIName","locationIds",s[0]);d+=h("POIClass","classIds",s[8]);d+="</POIProperties>"}d=f+d;d+="</LocationRequest>";d+="</Request>";return d};this.getKey=function(){return p};this.getParseFunction=function(){return m};this.getRootElementName=function(){return"Response"};this.getFreeFormKey=
function(){return p};this.setFreeFormKey=function(f){p=f};this.getMaxResults=function(){return x};this.setMaxResults=function(f){x=f};this.addLocationRestriction=function(f,d,j,r){f=e(f);if(f>=0){s[f]=d==null&&j==null&&r==null?null:{key:d,method:j,idList:r};return 0}else return 1};this.deleteLocationRestriction=function(f){f=e(f);if(f>=0){s[f]=null;return 0}else return 1};this.getLocationRestriction=function(f){f=e(f);return f>=0?s[f]:null};this.addLocationType=function(f){f=e(f);if(f>=0&&f<=7){A[f]=
true;return 0}else return 1};this.deleteLocationType=function(f){f=e(f);if(f>=0&&f<=7){A[f]=false;return 0}else return 1};this.addAllLocationType=function(){for(var f=0;f<7;f++)A[f]=true};this.deleteAllLocationType=function(){for(var f=0;f<7;f++)A[f]=false};this.addLanguage=function(f){if(f!=null&&f!=""){var d=false;for(f=f.toUpperCase();0<y.length&&!d;)if(y[0]!=null&&y[0].key==f)d=true;if(!d){d=getFreeIndex(y);y[d]={key:key}}return 0}else return 1};this.deleteLanguage=function(f){if(f!=null&&f!=
""){var d=false;for(f=f.toUpperCase();0<y.length&&!d;)if(y[0]!=null&&y[0].key==f){y[0]=null;d=true}return d?2:0}else return 1}}
function Geocoding(){function h(){function c(a){var e={id:0,locations:null,status:0};id=a.getAttribute("id");if(id!=null){e.id=id;var p=[];a=a.getElementsByTagName("location");for(var x=0;x<a.length;x++){var s=p,A=x,y=a[x],k=new MapLocation(y.getAttribute("x"),y.getAttribute("y"));k.setType(y.getAttribute("type"));for(var f=0;f<y.attributes.length;f++)k.setAttribute(y.attributes[f].nodeName,y.attributes[f].nodeValue);s[A]=k}e.locations=p}return e}this.getXml=function(a,e,p,x,s){a='<address_for_key id="'+
a+'" key="'+util.xmlAttributeString(e)+'" ';a+='max_results="'+x+'" ';a+='language="'+p+'" ';a+=util.parameterObject2Text(s);a+="/>";return a};this.getRootElementName=function(){return"locations"};this.getParseFunction=function(){return c}}var l=[],o=null,b=[],m=false,n=null;this.service="Geocoding";this.start=function(c){o=c;o.addRequestObject(this);n=new h};this.getAddress=function(c,a,e,p,x,s){if(c==null)c=util.getFreeIndex(b);b[c]={key:a,xml:n.getXml(c,a,e,p,x),root:n.getRootElementName(),parser:n.getParseFunction(),
callback:s};m=true;return c};this.getAddressByObject=function(c,a,e){if(c==null)c=util.getFreeIndex(b);b[c]={key:a.getKey(),xml:a.getXml(c),root:a.getRootElementName(),parser:a.getParseFunction(),callback:e};m=true;return c};this.buildRequest=function(){if(m){for(var c="",a=0;a<b.length;a++)if(b[a]!=null)if(b[a].xml==null)b[a].callback(a,b[a].key,[],0);else{l[a]=b[a];l[a].send=false;c+=b[a].xml}b=[];m=false;return c}else return null};this.parseResultXML=function(c){if(c!=null&&c.nodeType==1&&c.nodeName==
"ajax_response_object")if(c.hasChildNodes())for(c=c.firstChild;c!=null;){if(c.nodeType==1)for(var a=0,e=false;a<l.length&&!e;){if(l[a]!=null&&l[a].root==c.nodeName){response=l[a].parser(c);l[response.id].callback(response.id,l[response.id].key,response.locations,response.status);l[response.id]=null;e=true}a++}c=c.nextSibling}for(a=0;a<l.length;a++)l[a]!=null&&!l[a].send&&l[a].callback(a,l[a].key,[],0);l=[]};this.requestFailed=function(){for(var c=0;c<l.length;c++)l[c]!=null&&!l[c].send&&l[c].callback(c,
l[c].key,null,this.errorAjaxFailed);l=[]};this.errorAjaxFailed=1}
function GeocodingReversed(){var h=[],l=null,o=[],b=false;this.service="ReverseGeocoding";this.start=function(m){l=m;l.addRequestObject(this)};this.getAddress=function(m,n,c,a,e,p,x){if(m==null)m=util.getFreeIndex(o);o[m]={x:n,y:c,language:a,maxResults:e,parameters:p,callback:x};b=true;return m};this.buildRequest=function(){if(b){for(var m="",n=0;n<o.length;n++)if(o[n]!=null){h[n]=o[n];h[n].send=false;m+='<address_for_location id="'+n+'" x="'+o[n].x+'" y="'+o[n].y+'" ';m+='language="'+o[n].language+
'" ';m+=util.parameterObject2Text(o[n].parameters);m+="/>"}o=[];b=false;return m}else return null};this.parseResultXML=function(m){if(m!=null){m=m.getElementsByTagName("locations");for(a=0;a<m.length;a++){var n=m[a].getAttribute("id"),c=[];locationsXml=m[a].getElementsByTagName("location");for(var a=0;a<locationsXml.length;a++){var e=c,p=a,x=locationsXml[a],s=new MapLocation(x.getAttribute("x"),x.getAttribute("y"));s.setType(x.getAttribute("type"));for(var A=0;A<x.attributes.length;A++)s.setAttribute(x.attributes[A].name,
x.attributes[A].nodeValue);e[p]=s}h[n].callback(n,h[n].x,h[n].y,c,0);h[n].send=true}}for(n=0;n<h.length;n++)h[n]!=null&&!h[n].send&&h[n].callback(n,h[n].x,h[n].y,null,0);h=[]};this.requestFailed=function(){for(var m=0;m<h.length;m++)h[m]!=null&&!h[m].send&&h[m].callback(m,h[m].x,h[m].y,null,this.errorAjaxFailed);h=[]};this.errorAjaxFailed=1}
function GeocodingReversedPoi(){var h=[],l=null,o=[],b=false;this.service="PoiReverseGeocoding";this.start=function(m){l=m;l.addRequestObject(this)};this.getPois=function(m,n,c,a,e,p,x,s,A){if(m==null)m=util.getFreeIndex(o);o[m]={x:n,y:c,types:a,language:e,maxResults:p,service:x,parameters:s,callback:A};b=true;l.sendRequest();return m};this.buildRequest=function(){if(b){request="";for(var m=0;m<o.length;m++)if(o[m]!=null){h[m]=o[m];h[m].send=false;request+='<poi_for_location id="'+m+'" service="'+
o[m].service+'" x="'+o[m].x+'" y="'+o[m].y+'" ';request+='language="'+o[m].language+'" ';request+=util.parameterObject2Text(o[m].parameters);request+=">";for(var n=o[m].types,c=0;c<n.length;c++){request+='<poi_type category="'+n[c].category+'" ';if(n[c].subcategory!=null)request+='subcategory="'+n[c].subcategory+'" ';request+="/>"}request+="</poi_for_location>"}o=[];b=false;return request}else return null};this.parseResultXML=function(m){if(m!=null){m=m.getElementsByTagName("locations");for(a=0;a<
m.length;a++){var n=m[a].getAttribute("id"),c=[];locationsXml=m[a].getElementsByTagName("location");for(var a=0;a<locationsXml.length;a++){for(var e=c,p=a,x=locationsXml[a],s=new MapLocation(x.getAttribute("x"),x.getAttribute("y")),A=0;A<x.attributes.length;A++)s.setAttribute(x.attributes[A].name,x.attributes[A].nodeValue);e[p]=s}h[n].callback(n,h[n].x,h[n].y,c,0);h[n].send=true}}for(n=0;n<h.length;n++)h[n]!=null&&!h[n].send&&h[n].callback(n,h[n].x,h[n].y,null,0);h=[]};this.requestFailed=function(){for(var m=
0;m<h.length;m++)h[m]!=null&&!h[m].send&&h[m].callback(m,h[m].x,h[m].y,null,this.errorAjaxFailed);h=[]};this.errorAjaxFailed=1}
function MapPopupManager(h,l){function o(k,f){var d=util.getEvent(k);util.stopPropagation(k);util.leavingObject(d,a[f])&&b(f)}function b(k){h.deleteDivMarker(a[k]);e!=null&&e(a[k],1);a[k]=null}function m(k){a[k].onmouseout=null;a[k].pinDiv.className=p+"_pinclose";a[k].pinDiv.onclick=function(){return n(k)};e(a[k],2)}function n(k){a[k].onmouseout=function(f){return o(f,k)};a[k].pinDiv.className=p+"_pinopen";a[k].pinDiv.onclick=function(){return m(k)};e(a[k],3)}var c="Points of Interest",a=[],e=null,
p=l.POPUP_CSS_BASE,x=l.POPUP_DYNAMIC_POSITION,s=l.POPUP_WIDTH,A=l.POPUP_HEIGHT,y=l.POPUP_BACKGROUND_IMAGE;this.setEventCallback=function(k){e=k};this.setTitle=function(k){c=k};this.setCssBase=function(k){p=k};this.addPopup=function(k,f,d){var j=-4,r=-4,w="auto",u="auto",t="auto",z="auto",q="_";if(x){var g=h.getMapInfos();if(f<g.centerY){r=-A-r;u="0px";q+="t"}else{w="0px";q+="b"}if(k>g.centerX){j=-s-j;z="0px";q+="l"}else{t="0px";q+="r"}}var v=h.addDivMarker(p,k,f,"",j,r);v.onmouseout=function(B){return o(B,
v.markerId)};k=util.createElement("div");k.className=p+"_background";v.appendChild(k);if(y!=null){f=util.createElement("img");k.appendChild(f);util.loadPngImage(f,y+q);if(x){f.style.top=w;f.style.bottom=u;f.style.left=t;f.style.right=z}}q=util.createElement("div");q.className=p+"_window";if(x){q.style.top=w;q.style.bottom=u;q.style.left=t;q.style.right=z}q.onmousedown=util.stopPropagation;q.onmousemove=util.stopPropagation;q.ondblclick=util.stopPropagation;v.appendChild(q);w=util.createElement("div");
w.className=p+"_header";w.appendChild(document.createTextNode(c));q.appendChild(w);u=util.createElement("div");u.className=p+"_close";u.onclick=function(){return b(v.markerId)};w.appendChild(u);u=util.createElement("div");u.className=p+"_pinopen";u.onclick=function(){return m(v.markerId)};v.pinDiv=u;w.appendChild(u);w=util.createElement("div");w.className=p+"_infoarea";q.appendChild(w);for(u=0;u<d.length;u++)w.appendChild(d[u]);return a[v.markerId]=v};this.deletePopup=b}
function PoiPopupFormatter(){var h=[],l="poi_popup";this.setCssBase=function(o){l=o};this.format=function(o){elements=[];for(var b=0;b<o.length;b++){var m=util.createElement("div");m.className=l;if(o[b].getAttribute("category")!=null){var n=util.createElement("div");n.className=l+"_head";var c=o[b].getAttribute("category"),a=o[b].getAttribute("subcategory");if(a!=null)c+="("+a+")";n.appendChild(document.createTextNode(c));m.appendChild(n)}n=util.createElement("p");n.className=l+"_text";n.appendChild(document.createTextNode(o[b].getName()));
m.appendChild(n);for(n=0;n<h.length;n++)if(h[n]!=null){c=h[n].cloneNode(true);a=h[n];var e=c;e.onclick=a.onclick;e.ondblclick=a.ondblclick;e.onmousedown=a.onmousedown;e.onmouseup=a.onmouseup;e.onmouseover=a.onmouseover;e.onmousemove=a.onmousemove;e.onmouseout=a.onmouseout;e.onkeypress=a.onkeypress;e.onkeydown=a.onkeydown;e.onkeyup=a.onkeyup;m.appendChild(c);c.locationObject=o[b]}elements.push(m)}return elements};this.addElement=function(o){var b=util.getFreeIndex(h);h[b]=o;return b};this.deleteElement=
function(o){h[o]=null;return 0}}
function PoiManager(h,l,o,b,m,n){function c(){if(k==null)if(n=="Click")k=A.addClickCallback(a);else if(n=="DoubleClick")k=A.addDoubleClickCallback(a);else if(n=="ContextClick")k=A.addContextClickCallback(a);else{A.setMouseOverCallbackIntervall(m);k=A.addMouseOverCallback(a)}}function a(f){var d;if(d=!y){d=false;s=b();for(var j=0;j<s.length&&!d;j++)d=s[j];d=d&&(p!=f.mouseCoordX||x!=f.mouseCoordY)}if(d){y=true;p=f.mouseCoordX;x=f.mouseCoordY;d=[];d.push({attributename:"zoom",attributevalue:f.zoom});
j=[];for(var r=0;r<s.length;r++)j.push({category:s[r].category,subcategory:s[r].subcategory});h.getPoisByCoordinates(1,f.mouseCoordX,f.mouseCoordY,j,99,d,e)}}function e(f,d,j,r,w){if(w==0&&r!=null&&r.length>0){f=o.format(r);l.addPopup(d,j,f)}else y=false}var p=0,x=0,s=[],A=h.getMap(),y=true,k=null;c();l.setEventCallback(function(f,d){y=d==3?true:false});y=false;this.disable=function(){if(k!=null){if(n=="Click")A.deleteClickCallback(k);else if(n=="DoubleClick")A.addDoubleClickCallback(k);else n=="ContextClick"?
A.addContextClickCallback(k):A.addMouseOverCallback(k);k=null}};this.enable=c}
function MapLocation(h,l){function o(C){r=C;if(r=="Poi"||r=="poi"){d=w;f="poi";r="Poi"}else if(r=="Address"||r=="Street"||r=="street"){d=u;f="street";r="Street"}else if(r=="Postalcode"){d=z;f="postalcode"}else if(r=="MunicipalitySubdivision"){d=q;f="district"}else if(r=="Municipality"){d=g;f="city"}else if(r=="CountrySecondarySubdivision"){f="county";d=v}else if(r=="CountrySubdivision"){f="state";d=B}else if(r=="Country"){f="country";d=E}}function b(C){d=C;if(r=="Poi")w=d;else if(r=="Address"||r==
"Street")u=C;else if(r=="Postalcode")z=C;else if(r=="MunicipalitySubdivision")q=C;else if(r=="Municipality")g=C;else if(r=="CountrySecondarySubdivision")v=C;else if(r=="CountrySubdivision")B=C;else if(r=="Country")E=C}function m(C){w=C;if(r=="Poi")d=C}function n(C){u=C;if(r=="Street")d=C}function c(C){z=C;if(r=="Postalcode")d=C}function a(C){q=C;if(r=="MunicipalitySubdivision")d=C}function e(C){g=C;if(r=="Municipality")d=C}function p(C){v=C;if(r=="CountrySecondarySubdivision")d=C}function x(C){B=
C;if(r=="CountrySubdivision")d=C}function s(C){E=C;if(r=="Country")d=C}var A=[],y=h,k=l,f=null,d=null,j=null,r=null,w=null,u=null,t=null,z=null,q=null,g=null,v=null,B=null,E=null,S=null;this.getAddress=function(){var C=d;if(t!=null&&t!="")C+=" "+t;if(g!=null)C+=", "+g;return C};this.setAttribute=function(C,H){if(C=="Type"||C=="type")o(H);else if(C=="category")f=H;else if(C=="name")b(H);else if(C=="x")y=H;else if(C=="y")k=H;else if(C=="number"||C=="StreetLocation")t=H;else if(C=="caption")j=H;else if(C==
"POIName")m(H);else if(C=="Street")n(H);else if(C=="Postalcode")c(H);else if(C=="city"||C=="Municipality")e(H);else if(C=="MunicipalitySubdivision")a(H);else if(C=="CountrySecondarySubdivision")p(H);else if(C=="CountrySubdivision")x(H);else if(C=="Country")s(H);else{for(var F=false,T=0;T<A.length&&!F;T++)if(A[T].attributename==C){F=true;A[T].attributevalue=H}F||A.push({attributename:C,attributevalue:H})}};this.getAttribute=function(C){if(C=="category")return f;else if(C=="name")return d;else if(C==
"x")return y;else if(C=="y")return k;else if(C=="number"||C=="StreetLocation")return t;else if(C=="caption")return j;else if(C=="POIName")return w;else if(C=="Street")return u;else if(C=="Postalcode")return z;else if(C=="city"||C=="Municipality")return g;else if(C=="MunicipalitySubdivision")return MmunicipalitySubdivision;else if(C=="CountrySecondarySubdivision")return v;else if(C=="CountrySubdivision")return B;else if(C=="Country")return E;else{for(var H=null,F=0;F<A.length&&H==null;F++)if(A[F].attributename==
C)H=A[F].attributevalue;return H}};this.getX=function(){return y};this.getY=function(){return k};this.getCategory=function(){return f};this.getCity=function(){return g};this.getName=function(){return d};this.getNumber=function(){return t};this.getType=function(){return r};this.getPOIName=function(){return w};this.getStreet=function(){return u};this.getStreetLocation=function(){return t};this.getPostalcode=function(){return z};this.getMunicipalitySubdivision=function(){return q};this.getMunicipality=
function(){return g};this.getCountrySecondarySubdivision=function(){return v};this.getCountrySubdivision=function(){return B};this.getCountry=function(){return E};this.getCountryCode=function(){return S};this.setX=function(C){y=C};this.setY=function(C){k=C};this.setCategory=function(C){f=C};this.setNumber=function(C){t=C};this.setStreetLocation=function(C){t=C};this.setCountryCode=function(C){S=C};this.setName=b;this.setType=o;this.setPOIName=m;this.setStreet=n;this.setPostalcode=c;this.setMunicipality=
e;this.setMunicipalitySubdivision=a;this.setCity=e;this.setCountrySecondarySubdivision=p;this.setCountrySubdivision=x;this.setCountry=s}
function Map(h){function l(D){if(da!=null){clearTimeout(da);da=null}Q=Math.floor(D/4);if(Q>0){var ha=ga,ia=ua;da=setTimeout(function(){return f(ha,ia,0)},Q)}return 0}function o(){ka=new Point(0,0);R=new Point(0,0);var D=ca==null,ha=pa,ia=P;pa=Math.ceil((O+2*ja)/K)+1;P=Math.ceil((L+2*ja)/K)+1;if(D)ca=[];else{if(P<ia){for(var na=ia-P,qa=0;qa<na;qa++)for(var va=ca.pop(),$=0;$<ha;$++){var ma=va.pop();xa.splice(ma.id,1);t.div.removeChild(ma.div)}ia=P}if(pa<ha){na=ha-pa;for(qa=0;qa<ia;qa++){va=ca[qa];for($=
0;$<na;$++){ma=va.pop();xa.splice(ma.id,1);t.div.removeChild(ma.div)}}}}t.width=P*K;t.height=pa*K;t.div.style.width=t.width+"px";t.div.style.height=t.height+"px";t.x=0;for(qa=ha=t.y=0;qa<P;qa++){va=ca[qa];if(va==null)va=[];for($=0;$<pa;$++){ma=va[$];if(ma==null){ma=new Tile(ha,null,null);ma.div=util.createElement("div");ma.div.className=h.MAP_CSS_BASE+"_tile";t.div.appendChild(ma.div);ma.created=true}else ma.created=false;ma.id=ha;xa[ha]=ma;ha++;va[$]=ma}ca[qa]=va}if(D){w.onmousedown=c;w.ondblclick=
k;w.onmousemove=p;w.oncontextmenu=y;w.onmouseout=x}}function b(D,ha){var ia=Number(D),na=Number(ha);if(!z&&!q){z=true;var qa=Math.floor((ia-h.MAP_MIN_X)/ra),va=Math.floor((h.MAP_MAX_Y-na)/ra),$=ia-(h.MAP_MIN_X+qa*ra),ma=na-(h.MAP_MAX_Y-va*ra);$=-Math.ceil($/aa[ea]);ma=Math.ceil(ma/aa[ea]);ka.x=-qa*K+$+sa;ka.y=-va*K+ma+wa;$+=sa-ba*K;ma+=wa-ta*K;if(P*K+$<L){qa++;$+=K}if(pa*K+ma<O){va++;ma+=K}t.x=$;t.y=ma;t.div.style.top=ma+"px";t.div.style.left=$+"px";for($=0;$<P;$++)for(ma=0;ma<pa;ma++){var fa=ca[$][ma];
fa.x=$*K;fa.y=ma*K;fa.div.style.top=fa.y+"px";fa.div.style.left=fa.x+"px";var ya=qa+$-ba,za=va+ma-ta;if(fa.col!=ya||fa.row!=za){fa.col=ya;fa.row=za;n(fa.id,fa.col,fa.row)}}la=ia;I=na;A();V.triggerEvent(j());z=false}else g=new Point(ia,na);return 0}function m(D,ha){var ia=Number(D),na=Number(ha);if(z)return false;else{z=true;var qa=t.y+na,va=t.x+ia;if(va>-ja){va-=K;t.x-=K;for(var $=0;$<pa;$++){for(var ma=ca[P-1][$],fa=P-1;fa>0;fa--){ca[fa][$]=ca[fa-1][$];ca[fa][$].x=fa*K;ca[fa][$].div.style.left=ca[fa][$].x+
"px"}ca[0][$]=ma;ca[0][$].x=0;ca[0][$].col-=P;ca[0][$].div.style.left="0px";n(ca[0][$].id,ca[0][$].col,ca[0][$].row)}}else if(va<-K-ja){va+=K;t.x+=K;for($=0;$<pa;$++){ma=ca[0][$];for(fa=0;fa<P-1;fa++){ca[fa][$]=ca[fa+1][$];ca[fa][$].x=fa*K;ca[fa][$].div.style.left=ca[fa][$].x+"px"}ca[P-1][$]=ma;ca[P-1][$].x=(P-1)*K;ca[P-1][$].col+=P;ca[P-1][$].div.style.left=ca[P-1][$].x+"px";n(ca[P-1][$].id,ca[P-1][$].col,ca[P-1][$].row)}}if(qa>-ja){qa-=K;t.y-=K;for(fa=0;fa<P;fa++){ma=ca[fa][pa-1];for($=pa-1;$>0;$--){ca[fa][$]=
ca[fa][$-1];ca[fa][$].y=$*K;ca[fa][$].div.style.top=ca[fa][$].y+"px"}ca[fa][0]=ma;ca[fa][0].y=0;ca[fa][0].row-=pa;ca[fa][0].div.style.top="0px";n(ca[fa][0].id,ca[fa][0].col,ca[fa][0].row)}}else if(qa<-K-ja){qa+=K;t.y+=K;for(fa=0;fa<P;fa++){ma=ca[fa][0];for($=0;$<pa-1;$++){ca[fa][$]=ca[fa][$+1];ca[fa][$].y=$*K;ca[fa][$].div.style.top=ca[fa][$].y+"px"}ca[fa][pa-1]=ma;ca[fa][pa-1].y=(pa-1)*K;ca[fa][pa-1].row+=pa;ca[fa][pa-1].div.style.top=ca[fa][pa-1].y+"px";n(ca[fa][pa-1].id,ca[fa][pa-1].col,ca[fa][pa-
1].row)}}ka.x+=ia;ka.y+=na;la=h.MAP_MIN_X-(ka.x-sa)*aa[ea];I=h.MAP_MAX_Y+(ka.y-wa)*aa[ea];t.x=va;t.y=qa;t.div.style.top=qa+"px";t.div.style.left=va+"px";U.triggerEvent(j());A();z=false;return true}}function n(D,ha,ia){for(var na=0;na<oa.length;na++)oa[na].imageRequest(D,ea,ha,ia)}function c(D){s(0,0);D=util.getEvent(D);if(!v&&!q){v=true;var ha=util.inObjectXY(D,w);u.style.cursor=w.style.cursor=h.PAN_CURSOR_STYLE;R=new Point(ha.x,ha.y);X=new Point(ha.x,ha.y);H=DocumentMouseMoveEvent.addEvent(e);F=
DocumentMouseUpEvent.addEvent(a);w.onmousedown=null;G.triggerEvent(j(D.clientX,D.clientY))}util.stopPropagation(D)}function a(D){s(0,0);if(!q){D=util.getEvent(D);DocumentMouseUpEvent.deleteEvent(F);DocumentMouseMoveEvent.deleteEvent(H);F=H=null;u.style.cursor=w.style.cursor="default";var ha=util.inObjectXY(D,w);if(Math.abs(ha.x-X.x)<=T&&Math.abs(ha.y-X.y)<=T){ga=D.clientX;ua=D.clientY;var ia=D.clientX,na=D.clientY;ha=setTimeout(function(){s(0,0);!z&&!q&&J.triggerEvent(j(ia,na))},C);s(ha,0)}if(v){v=
false;w.onmousedown=c;V.triggerEvent(j(D.clientX,D.clientY))}util.stopPropagation(D);util.fixIEmarking&&document.selection.empty()}}function e(D){if(!q){D=util.getEvent(D);var ha=(new Date).getTime();if(ha-E>S){E=ha;ha=util.inObjectXY(D,w);if(m(ha.x-R.x,ha.y-R.y)){R.x=ha.x;R.y=ha.y}}util.stopPropagation(D)}}function p(D){D=util.getEvent(D);M=true;ga=D.clientX;ua=D.clientY}function x(){M=false}function s(D){B>0&&clearTimeout(B);B=D}function A(){for(var D=0;D<oa.length;D++)oa[D].finishMove()}function y(D){s(0,
0);D=util.getEvent(D);if(!z&&!q){ga=D.clientX;ua=D.clientY;Z.triggerEvent(j(ga,ua))}util.stopPropagation(D)}function k(D){s(0,0);D=util.getEvent(D);if(!z&&!q){ga=D.clientX;ua=D.clientY;Y.triggerEvent(j(ga,ua))}util.stopPropagation(D)}function f(D,ha,ia){clearTimeout(da);var na=ga,qa=ua;if(M&&!z&&!q&&Math.abs(ga-D)<=1&&Math.abs(ua-ha)<=1)if(ia<4)da=setTimeout(function(){return f(na,qa,ia+1)},Q);else{N.triggerEvent(j(na,qa));da=setTimeout(function(){return f(na,qa,0)},Q)}else da=setTimeout(function(){return f(na,
qa,0)},Q)}function d(D,ha,ia){ia=Number(ia);return new Point(h.MAP_MIN_X-Math.floor(ka.x-sa-(Number(D)-L/2))*aa[ia],h.MAP_MAX_Y+Math.floor(ka.y-wa-(Number(ha)-O/2))*aa[ia])}function j(D,ha){if(D==null||ha==null){D=ga;ha=ua}var ia=util.inObjectXY({clientX:D,clientY:ha},w),na=d(ia.x,ia.y,ea);return{zoom:ea,centerX:la,centerY:I,mouseX:D,mouseY:ha,mouseOnMapX:ia.x,mouseOnMapY:ia.y,mouseCoordX:na.x,mouseCoordY:na.y,width:L,height:O}}var r=null,w=null,u=null,t=null,z=false,q=true,g=null,v=false,B=0,E=0,
S=40,C=250,H=null,F=null,T=0,J=new EventHandler,Y=new EventHandler,Z=new EventHandler,W=new EventHandler,U=new EventHandler,V=new EventHandler,G=new EventHandler,N=new EventHandler,Q=50,da=null,M=false,L=h.MAP_WIDTH,O=h.MAP_HEIGHT,K=h.MAP_TILE_SIZE,ea=5,aa=h.scales,ka=null,la=0,I=0,R=null,X=new Point(0,0),ga=0,ua=0,ca=null,xa=[],pa=1,P=1,ja=20,oa=[],ra=K*aa[ea],sa=Math.floor(L/2),wa=Math.floor(O/2),ba=Math.floor(L/2/K)+1,ta=Math.floor(O/2/K)+1;this.settings=h;this.getWidth=function(){return L};this.getHeight=
function(){return O};this.getCenter=function(){return d(sa,wa,ea)};this.getZoom=function(){return ea};this.getActiveSurface=function(){return w};this.getMapNode=function(){return r};this.getTileBackground=function(){return u};this.getTileContainer=function(){return t};this.getTiles=function(){return ca};this.getTileArray=function(){return xa};this.getMapDivObject=function(){return r};this.setBlock=function(D){if(!D)if(g!=null){b(g.x,g.y);g=null}q=D};this.getBlock=function(){return q};this.getDragStatus=
function(){return v};this.addZoomChangeCallback=function(D){return W.addListener(D)};this.deleteZoomChangeCallback=function(D){W.deleteListener(D)};this.addContextClickCallback=function(D){return Z.addListener(D)};this.deleteContextClickCallback=function(D){Z.deleteListener(D)};this.addClickCallback=function(D){return J.addListener(D)};this.deleteClickCallback=function(D){J.deleteListener(D)};this.addDoubleClickCallback=function(D){return Y.addListener(D)};this.deleteDoubleClickCallback=function(D){Y.deleteListener(D)};
this.addMapMovedCallback=function(D){return V.addListener(D)};this.deleteMapMovedCallback=function(D){V.deleteListener(D)};this.addMapDraggedCallback=function(D){return U.addListener(D)};this.deleteMapDraggedCallback=function(D){return U.deleteListener(D)};this.addMapMouseDownCallback=function(D){return G.addListener(D)};this.deleteMapMouseDownCallback=function(D){G.deleteListener(D)};this.addMouseOverCallback=function(D){return N.addListener(D)};this.deleteMouseOverCallback=function(D){N.deleteListener(D)};
this.setMouseOverCallbackIntervall=l;this.getSingleClickSensitivity=function(){return T};this.setSingleClickSensitivity=function(D){T=D};this.addLayer=function(D){oa.push(D);return oa.length-1};this.start=function(D,ha,ia){ea=ia;ra=K*aa[ea];ia=util.attach(h.MAP_AREA);r=util.createElement("div");ia.appendChild(r);r.className=h.MAP_CSS_BASE;r.style.width=L+"px";r.style.height=O+"px";u=util.createElement("div");r.appendChild(u);u.className=h.MAP_CSS_BASE+"_backgroundtiles";t={x:0,y:0,div:null,width:0,
height:0};t.div=util.createElement("div");u.appendChild(t.div);t.div.className=h.MAP_CSS_BASE+"_tilecontainer";w=util.createElement("div");r.appendChild(w);w.className=h.MAP_CSS_BASE+"_surface";o();if(util.isIE){ia=w.clientHeight;var na=w.clientWidth;w.style.height=ia+2*K+"px";w.style.width=na+2*K+"px";w.style.backgroundPosition=Math.round(na/2)+"px "+Math.round(ia/2)+"px"}for(ia=0;ia<oa.length;ia++)oa[ia].start(this);q=false;b(D,ha);l(Q*4)};this.setCenter=b;this.moveMapDelta=m;this.moveMapDeltaXY=
function(D,ha){var ia=Number(D),na=Number(ha);m((la-ia)/aa[ea],(na-I)/aa[ea]);la=ia;I=na};this.moveMapDeltaFinished=function(){V.triggerEvent(j())};this.setZoom=function(D){D=Number(D);if(D!=ea)if(D>=h.MAP_MIN_ZOOM&&D<=h.MAP_MAX_ZOOM){ea=D;ra=K*aa[ea];b(la,I);W.triggerEvent(j());return 0}else return 1;else return 0};this.redraw=function(){for(var D=0;D<oa.length;D++)oa[D].redraw()};this.setSize=function(D,ha,ia,na){if(!z){z=true;L=D;O=ha;sa=Math.floor(L/2);wa=Math.floor(O/2);ba=Math.floor(L/2/K)+
1;ta=Math.floor(O/2/K)+1;r.style.width=L+"px";r.style.height=O+"px";o();z=false;for(D=0;D<oa.length;D++){this.tempLayerIndex=D;oa[D].start(this)}for(D=0;D<xa.length;D++)xa[D].create=false;ia!=null&&na!=null?b(ia,na):b(la,I);W.triggerEvent(j())}};this.calcMapCoordinates=d;this.calcMapTileCoords=function(D,ha,ia){D=Number(D);ha=Number(ha);ia=Number(ia);var na=Math.floor((D-h.MAP_MIN_X)/aa[ia]/K),qa=Math.floor((h.MAP_MAX_Y-ha)/aa[ia]/K);D=D-(h.MAP_MIN_X+na*K*aa[ia]);ha=ha-(h.MAP_MAX_Y-qa*K*aa[ia]);D=
Math.ceil(D/aa[ia]);ha=-Math.ceil(ha/aa[ia]);return{zoom:ia,col:na,row:qa,left:D,top:ha}};this.getInfo=j}
function IndexMap(h){function l(P,ja){var oa=Number(P),ra=Number(ja);if(!T&&!J&&X){T=true;d!=null&&d.stopCentering();var sa=Math.floor((oa-h.MAP_MIN_X)/ga),wa=Math.floor((h.MAP_MAX_Y-ra)/ga),ba=oa-(h.MAP_MIN_X+sa*ga),ta=ra-(h.MAP_MAX_Y-wa*ga);ba=-Math.ceil(ba/Q[da]);ta=Math.ceil(ta/Q[da]);I.x=-sa*N+ba+xa;I.y=-wa*N+ta+pa;ba+=xa-ua*N;ta+=pa-ca*N;if(K*N+ba<w){sa++;ba+=N}if(O*N+ta<u){wa++;ta+=N}F.x=ba;F.y=ta;F.div.style.top=ta+"px";F.div.style.left=ba+"px";for(ba=0;ba<K;ba++)for(ta=0;ta<O;ta++){var D=
M[ba][ta];D.x=ba*N;D.y=ta*N;D.div.style.top=D.y+"px";D.div.style.left=D.x+"px";var ha=sa+ba-ua,ia=wa+ta-ca;if(D.col!=ha||D.row!=ia){D.col=ha;D.row=ia;y(D.id,D.col,D.row)}}ka=oa;la=ra;S=B;E=v;z.style.left=S+"px";z.style.top=E+"px";A();T=false}else new Point(oa,ra);return 0}function o(){if(X)for(var P=0;P<aa.length;P++)aa[P].redraw()}function b(P){if(!J&&X){d!=null&&d.stopCentering();P=util.getEvent(P);var ja=util.inObjectXY(P,H),oa=ka+(ja.x-xa)*Q[da],ra=la-(ja.y-pa)*Q[da];if(d!=null){var sa=f.getInfo(),
wa=Math.abs(ja.y-pa)*Q[da]/Q[sa.zoom];Math.abs(ja.x-xa)*Q[da]/Q[sa.zoom]<sa.width/2&&wa<sa.height/2?d.startCenteringCoordinate(oa,ra):f.setCenter(oa,ra)}else f.setCenter(oa,ra);util.stopPropagation(P)}}function m(P){P=util.getEvent(P);if(!Y&&!J&&X){d!=null&&d.stopCentering();Y=true;var ja=util.inObjectXY(P,H);H.style.cursor=h.PAN_CURSOR_STYLE;G=new Point(ja.x,ja.y);U=DocumentMouseMoveEvent.addEvent(c);V=DocumentMouseUpEvent.addEvent(n);z.onmousedown=null}util.stopPropagation(P)}function n(P){if(!J&&
X){P=util.getEvent(P);DocumentMouseUpEvent.deleteEvent(V);DocumentMouseMoveEvent.deleteEvent(U);V=U=null;H.style.cursor="default";if(Y){Y=false;f.setCenter(ka-(B-S)*Q[da],la+(v-E)*Q[da]);S=B;E=v;z.style.left=S+"px";z.style.top=E+"px";z.onmousedown=m}util.stopPropagation(P);util.fixIEmarking&&document.selection.empty()}}function c(P){if(!J&&X){P=util.getEvent(P);var ja=(new Date).getTime();if(ja-Z>W){Z=ja;ja=util.inObjectXY(P,H);S=B+ja.x-G.x;E=v+ja.y-G.y;z.style.left=S+"px";z.style.top=E+"px"}util.stopPropagation(P)}}
function a(P){P=util.getEvent(P);if(!Y&&!J&&X){d!=null&&d.stopCentering();Y=true;var ja=util.inObjectXY(P,H);H.style.cursor=h.PAN_CURSOR_STYLE;G=new Point(ja.x,ja.y);R=new Point(ja.x,ja.y);U=DocumentMouseMoveEvent.addEvent(p);V=DocumentMouseUpEvent.addEvent(e);H.onmousedown=null}util.stopPropagation(P)}function e(P){if(!J&&X){P=util.getEvent(P);DocumentMouseUpEvent.deleteEvent(V);DocumentMouseMoveEvent.deleteEvent(U);V=U=null;H.style.cursor="default";if(Y){Y=false;B=S;v=E;t.style.left=B+"px";t.style.top=
v+"px";f.setCenter(ka-(B-S)*Q[da],la+(v-E)*Q[da]);H.onmousedown=a}util.stopPropagation(P);util.fixIEmarking&&document.selection.empty()}}function p(P){if(!J&&X){P=util.getEvent(P);var ja=(new Date).getTime();if(ja-Z>W){Z=ja;ja=util.inObjectXY(P,H);var oa;oa=Number(ja.x-R.x);var ra=Number(ja.y-R.y);if(!T&&X){T=true;var sa=F.y+ra,wa=F.x+oa;if(wa>-ea){wa-=N;F.x-=N;for(var ba=0;ba<O;ba++){for(var ta=M[K-1][ba],D=K-1;D>0;D--){M[D][ba]=M[D-1][ba];M[D][ba].x=D*N;M[D][ba].div.style.left=M[D][ba].x+"px"}M[0][ba]=
ta;M[0][ba].x=0;M[0][ba].col-=K;M[0][ba].div.style.left="0px";y(M[0][ba].id,M[0][ba].col,M[0][ba].row)}}else if(wa<-N-ea){wa+=N;F.x+=N;for(ba=0;ba<O;ba++){ta=M[0][ba];for(D=0;D<K-1;D++){M[D][ba]=M[D+1][ba];M[D][ba].x=D*N;M[D][ba].div.style.left=M[D][ba].x+"px"}M[K-1][ba]=ta;M[K-1][ba].x=(K-1)*N;M[K-1][ba].col+=K;M[K-1][ba].div.style.left=M[K-1][ba].x+"px";y(M[K-1][ba].id,M[K-1][ba].col,M[K-1][ba].row)}}if(sa>-ea){sa-=N;F.y-=N;for(D=0;D<K;D++){ta=M[D][O-1];for(ba=O-1;ba>0;ba--){M[D][ba]=M[D][ba-1];
M[D][ba].y=ba*N;M[D][ba].div.style.top=M[D][ba].y+"px"}M[D][0]=ta;M[D][0].y=0;M[D][0].row-=O;M[D][0].div.style.top="0px";y(M[D][0].id,M[D][0].col,M[D][0].row)}}else if(sa<-N-ea){sa+=N;F.y+=N;for(D=0;D<K;D++){ta=M[D][0];for(ba=0;ba<O-1;ba++){M[D][ba]=M[D][ba+1];M[D][ba].y=ba*N;M[D][ba].div.style.top=M[D][ba].y+"px"}M[D][O-1]=ta;M[D][O-1].y=(O-1)*N;M[D][O-1].row+=O;M[D][O-1].div.style.top=M[D][O-1].y+"px";y(M[D][O-1].id,M[D][O-1].col,M[D][O-1].row)}}I.x+=oa;I.y+=ra;ka=h.MAP_MIN_X-(I.x-xa)*Q[da];la=
h.MAP_MAX_Y+(I.y-pa)*Q[da];F.x=wa;F.y=sa;F.div.style.top=sa+"px";F.div.style.left=wa+"px";A();T=false;oa=true}else oa=false;if(oa){R.x=ja.x;R.y=ja.y}B=S+ja.x-G.x;v=E+ja.y-G.y;t.style.left=B+"px";t.style.top=v+"px"}util.stopPropagation(P)}}function x(P){P=Number(P);if(X)if(P>=h.MAP_MIN_ZOOM&&P<=h.MAP_MAX_ZOOM){d!=null&&d.stopCentering();P=P;for(var ja=false,oa=f.getWidth()*Q[f.getZoom()],ra=w*h.INDEXMAP_ZOOM_MAPSIZE/100;P<h.MAP_MAX_ZOOM&&!ja;)(ja=oa/Q[P]<ra)||P++;if(da!=P){da=P;ga=N*Q[da];l(ka,la)}k();
return 0}else return 1;else return 0}function s(P){if(X=P){P=f.getInfo();x(f.zoom);l(P.centerX,P.centerY);o()}}function A(){for(var P=0;P<aa.length;P++)aa[P].finishMove()}function y(P,ja,oa){for(var ra=0;ra<aa.length;ra++)aa[ra].imageRequest(P,da,ja,oa)}function k(){q=Math.round(f.getWidth()*Q[f.getZoom()]/Q[da]);g=Math.round(f.getHeight()*Q[f.getZoom()]/Q[da]);B=Math.round((w-q)/2);v=Math.round((u-g)/2);t.style.width=q+"px";t.style.height=g+"px";t.style.left=B+"px";t.style.top=v+"px";S=B;E=v;z.style.width=
q+"px";z.style.height=g+"px";z.style.left=S+"px";z.style.top=E+"px"}var f=null,d=null,j=null,r=null,w=200,u=200,t=null,z=null,q=50,g=50,v=0,B=0,E=0,S=0,C=null,H=null,F=null,T=false,J=true,Y=false,Z=0,W=40,U=null,V=null,G=null,N=h.MAP_TILE_SIZE,Q=h.scales,da=1,M=null,L=[],O=2,K=2,ea=20,aa=[],ka=h.MAP_START_X,la=h.MAP_START_Y,I=null,R=G=null,X=true,ga=N*Q[da],ua=Math.floor(w/2/N)+1,ca=Math.floor(u/2/N)+1,xa=Math.floor(w/2),pa=Math.floor(u/2);this.settings=h;this.getZoom=function(){return da};this.getTiles=
function(){return M};this.getTileArray=function(){return L};this.start=function(P){f=P;if(h.MAP_SMOOTHMOVE){d=new MapSmoothMove;d.start(f)}w=h.INDEXMAP_WIDTH;u=h.INDEXMAP_HEIGHT;xa=Math.floor(w/2);pa=Math.floor(u/2);ua=Math.floor(w/2/N)+1;ca=Math.floor(u/2/N)+1;r=util.createElement("div");P=f.getMapNode();P.appendChild(r);r.className=h.INDEXMAP_CSS_BASE;r.style.width=w+"px";r.style.height=u+"px";F={x:0,y:0,div:null,width:0,height:0};F.div=util.createElement("div");r.appendChild(F.div);F.div.className=
h.INDEXMAP_CSS_BASE+"_tilecontainer";H=util.createElement("div");r.appendChild(H);H.className=h.INDEXMAP_CSS_BASE+"_surface";t=util.createElement("div");t.className=h.INDEXMAP_CSS_BASE+"_zoomframe";H.appendChild(t);z=util.createElement("div");z.className=h.INDEXMAP_CSS_BASE+"_moveframe";H.appendChild(z);j=util.createElement("div");j.className=h.INDEXMAP_CSS_BASE+"_button_hide";P.appendChild(j);C=new visualFx.shrinkHiding(j,r,w,u,false,h.INDEXMAP_CSS_BASE+"_button",50,10,s);x(f.getZoom());ga=N*Q[da];
k();I=new Point(0,0);G=new Point(0,0);M=[];F.width=K*N;F.height=O*N;F.div.style.width=F.width+"px";F.div.style.height=F.height+"px";F.x=0;for(var ja=P=F.y=0;ja<K;ja++){for(var oa=[],ra=0;ra<O;ra++){var sa=new Tile(P,null,null);sa.div=util.createElement("div");sa.div.className=h.MAP_CSS_BASE+"_tile";F.div.appendChild(sa.div);L[P]=sa;P++;oa[ra]=sa}M[ja]=oa}z.onmousedown=m;H.onclick=util.stopPropagation;H.oncontextmenu=util.stopPropagation;H.onmousedown=a;H.ondblclick=b;for(P=0;P<aa.length;P++)aa[P].start(this);
J=false;P=f.getCenter();l(P.x,P.y)};this.setCenter=l;this.setZoom=x;this.setDragCenter=function(P,ja){var oa=Number(P),ra=Number(ja);if(X){S=Math.round(B+(oa-ka)/Q[da]);E=Math.round(v-(ra-la)/Q[da]);z.style.left=S+"px";z.style.top=E+"px"}};this.redraw=o;this.setLayout=function(P,ja){w=P;u=ja};this.addLayer=function(P){aa.push(P);return aa.length-1};this.hide=function(P){C.hide(P)};this.show=function(P){C.show(P)};this.getVisibility=function(){return X};this.getActiveSurface=function(){return H};this.getWidth=
function(){return w};this.getHeight=function(){return u}}
function MapPanControl(){function h(r){if(!x&&!e.getBlock()){x=true;e.setBlock(true);r=util.getEvent(r);var w=util.inObjectXY(r,a);s=-Math.ceil((w.x-n/2)*p);A=-Math.ceil((w.y-c/2)*p);j=1E3;b();y=DocumentMouseMoveEvent.addEvent(l);k=DocumentMouseUpEvent.addEvent(o);a.onmouseout=o;a.onmousedown=null;util.stopPropagation(r)}}function l(r){if(x){r=util.getEvent(r);var w=util.inObjectXY(r,a);s=-Math.ceil((w.x-n/2)*p);A=-Math.ceil((w.y-c/2)*p);j=1E3;util.stopPropagation(r)}}function o(){if(x){d>0&&clearTimeout(d);
j=0;DocumentMouseUpEvent.deleteEvent(k);DocumentMouseMoveEvent.deleteEvent(y);k=y=null;a.onmousedown=h;x=false;e.setBlock(false);e.moveMapDeltaFinished()}}function b(){d>0&&clearTimeout(d);j--;e.moveMapDelta(s,A);if(j>0)d=setTimeout(function(){b()},f)}var m="map_pan",n=52,c=52,a=null,e=null,p=0.25,x=false,s=0,A=0,y=null,k=null,f=50,d=0,j=0;this.start=function(r){e=r;p=e.settings.PAN_FACTOR;f=e.settings.PAN_SPEED;a=util.createElement("div");r=e.getMapNode();var w=util.createElement("div");r.appendChild(w);
w.className=m+"_background";r.appendChild(a);a.className=m;a.style.width=n+"px";a.style.height=c+"px";a.onmousedown=h;a.onmouseout=o};this.setLayout=function(r,w,u){c=w;n=r;m=u}}
function MapSmoothMove(){function h(){s>0&&clearTimeout(s);b&&o.moveMapDeltaFinished();b=false;p=e=0}function l(k){s>0&&clearTimeout(s);if(A<k)k=A;var f=y.getTime(),d=Math.round(k*(m-c)/A),j=Math.round(k*(n-a)/A);c+=d;a+=j;o.moveMapDelta(d,j);A-=k;if(A>0)if(x-(y.getTime()-f)>0)s=setTimeout(function(){l(1)},x);else l(2);else{e!=0&&p!=0&&o.moveMapDeltaXY(e,p);h()}}var o=null,b=false,m=0,n=0,c=0,a=0,e=0,p=0,x=40,s=0,A=0,y=new Date;this.start=function(k){o=k};this.startCentering=function(k){b&&h();if(!b){b=
true;y=new Date;a=c=0;m=o.getWidth()/2-k.mouseOnMapX;n=o.getHeight()/2-k.mouseOnMapY;e=k.centerX-m*o.settings.scales[k.zoom];p=k.centerY+n*o.settings.scales[k.zoom];A=15;l(1)}};this.startCenteringCoordinate=function(k,f){var d=Number(k),j=Number(f);b&&h();if(!b){e=d;p=j;a=c=0;b=true;y=new Date;var r=o.getInfo();m=(r.centerX-d)/o.settings.scales[r.zoom];n=(j-r.centerY)/o.settings.scales[r.zoom];A=15;l(1)}};this.stopCentering=h}
function MapScaleBar(){function h(M){w.style.top=z+Math.ceil(g*(M-s.settings.MAP_MIN_ZOOM))+"px"}function l(M){if(!s.getDragStatus()){var L=s.getZoom();m(M,L)}}function o(M){if(!s.getDragStatus()){var L=util.getEvent(M);L=util.inObjectXY(L,r).y;if(L<0)L=0;else if(L>j)L=j;m(M,Math.floor(L/g+s.settings.MAP_MIN_ZOOM))}}function b(){if(u!=null&&U!=null&&!J)U.style.visibility="hidden"}function m(M,L){if(u!=null&&!J){var O=util.getEvent(M);O=util.inObjectXY(O,A);V!=null&&U.removeChild(V);V=document.createTextNode(u[L]);
U.appendChild(V);U.style.visibility="visible";U.style.top=O.y+N+"px";U.style.left=O.x+G+"px"}}function n(){if(!J&&!s.getBlock()){s.setZoom(s.getZoom()-1);h(s.getZoom())}}function c(){if(!J&&!s.getBlock()){s.setZoom(s.getZoom()+1);h(s.getZoom())}}function a(M){if(!J&&!s.getBlock()){M=util.getEvent(M);var L=util.inObjectXY(M,r).y;if(L>=0&&L<=j){s.setZoom(Math.round(L/g)+s.settings.MAP_MIN_ZOOM);h(s.getZoom())}util.stopPropagation(M)}}function e(M){if(!J&&!s.getBlock()){J=true;s.setBlock(true);F=s.getTiles();
C=F.length;S=F[0].length;H=s.getTileContainer();B=s.getWidth()/2;E=s.getHeight()/2;Z=H.div.style.left;W=H.div.style.top;var L=util.getEvent(M);q=util.inObjectXY(L,w);for(var O=0,K=r;K;K=K.offsetParent)O+=K.offsetTop;r.bartop=O;m(M,s.getZoom());Q=DocumentMouseMoveEvent.addEvent(x);da=DocumentMouseUpEvent.addEvent(p);w.onmousedown=null;util.stopPropagation(L);if(y!=null)if(y.getVisibility()){k=y.getMarkers();M=F[0][0].col;L=F[0][0].row;for(O=0;O<k.length;O++)if(k[O]!=null&&k[O].shown){K=s.calcMapTileCoords(k[O].x,
k[O].y,s.getZoom());k[O].baseCol=K.col-M;k[O].baseRow=K.row-L;k[O].baseLeft=K.left+k[O].offsetX;k[O].baseTop=K.top+k[O].offsetY}}}}function p(){if(J){DocumentMouseUpEvent.deleteEvent(da);DocumentMouseMoveEvent.deleteEvent(Q);da=Q=null;for(var M=0;M<C;M++)for(var L=0;L<S;L++){F[M][L].div.style.height=s.settings.MAP_TILE_SIZE+"px";F[M][L].div.style.width=s.settings.MAP_TILE_SIZE+"px";F[M][L].div.style.left=M*s.settings.MAP_TILE_SIZE+"px";F[M][L].div.style.top=L*s.settings.MAP_TILE_SIZE+"px"}H.div.style.left=
Z;H.div.style.top=W;k=null;M=Math.floor(Y/g+0.5)+s.settings.MAP_MIN_ZOOM;h(M);s.setBlock(false);s.setZoom(M);w.onmousedown=e;b();util.fixIEmarking&&document.selection.empty();J=false}}function x(M){M=util.getEvent(M);if(!T&&J){T=true;var L=util.inObjectXY(M,r).y;if(L<0)L=0;else if(L>j)L=j;Y=L;w.style.top=L-q.y+z+"px";if(U!=null)U.style.top=L+z+N+"px";L=t[s.getZoom()];var O=Y/g+s.settings.MAP_MIN_ZOOM,K=Math.floor(O),ea=t[K];if(O!=K){ea+=(t[K+1]-t[K])*(O-K);if(U!=null){V!=null&&U.removeChild(V);V=
document.createTextNode(u[K]);U.appendChild(V)}}L=L/ea;O=Math.round(s.settings.MAP_TILE_SIZE*L);K=Math.round(H.x+(-H.x+B)*(1-L));ea=Math.round(H.y+(-H.y+E)*(1-L));H.div.style.left=K+"px";H.div.style.top=ea+"px";for(var aa=0;aa<C;aa++)for(var ka=0;ka<S;ka++){F[aa][ka].div.style.height=O+"px";F[aa][ka].div.style.width=O+"px";F[aa][ka].div.style.left=aa*O+"px";F[aa][ka].div.style.top=ka*O+"px"}if(k!=null)for(aa=0;aa<k.length;aa++)if(k[aa]!=null&&k[aa].shown){s.calcMapTileCoords(k[aa].x,k[aa].y,s.getZoom());
ka=k[aa].baseRow*O+Math.round(k[aa].baseTop*L)+ea;k[aa].div.style.left=k[aa].baseCol*O+Math.round(k[aa].baseLeft*L)+K+"px";k[aa].div.style.top=ka+"px"}util.fixIEmarking&&document.selection.empty();T=false}util.stopPropagation(M)}var s=null,A=null,y=null,k=null,f="map_scalebar",d=22,j=157,r=null,w=null,u=null,t=null,z=0,q=null,g=0,v=0,B=0,E=0,S=1,C=1,H=null,F=null,T=false,J=false,Y=0,Z="0px",W="0px",U=null,V=null,G=-15,N=15,Q=null,da=null;this.start=function(M,L){s=M;y=L;t=s.settings.scales;G=s.settings.SCALEBAR_TOOLTIPS_OFF_X;
N=s.settings.SCALEBAR_TOOLTIPS_OFF_Y;if(s.settings.SCALEBAR_TOOLTIPS.length>0)u=s.settings.SCALEBAR_TOOLTIPS;A=s.getMapNode();var O=util.createElement("div");A.appendChild(O);O.className=f+"_background";var K=util.createElement("div");A.appendChild(K);K.className=f;var ea=util.createElement("img");K.appendChild(ea);ea.src=s.settings.MAP_IMAGEPATH+"/scalebar_plus.gif";ea.className=f+"_plus";ea.onclick=n;r=util.createElement("img");K.appendChild(r);r.src=s.settings.MAP_IMAGEPATH+"/scalebar_bar.gif";
r.className=f+"_plus";r.onclick=a;ea=util.createElement("img");K.appendChild(ea);ea.src=s.settings.MAP_IMAGEPATH+"/scalebar_minus.gif";ea.className=f+"_minus";ea.onclick=c;w=util.createElement("div");A.appendChild(w);w.className=f+"_slider";w.onmousedown=e;if(u!=null){U=util.createElement("div");U.className=f+"_tooltip";U.style.visibility="hidden";A.appendChild(U);w.onmouseover=l;w.onmouseout=b;r.onmousemove=o;r.onmouseout=b}z=O.offsetTop+d;w.style.top=z+"px";v=s.settings.MAP_MAX_ZOOM-s.settings.MAP_MIN_ZOOM+
1;g=j/(v-1)};this.setLayout=function(M,L,O){f=M;d=L;j=O};this.setZoom=h;this.getPseudoZoomStatus=function(){return T};this.releaseZoom=p}
function MapMenu(){function h(p){return function(){l();e[p].callback(p,c,a,0)}}function l(){b.style.visibility="hidden"}function o(p){p=util.getEvent(p);if(util.leavingObject(p,b))b.style.visibility="hidden"}var b=null,m=0,n=0,c=null,a=null,e=[];this.show=function(p){m=p.mouseOnMapX-8;n=p.mouseOnMapY-8;c=p.mouseCoordX;a=p.mouseCoordY;b.style.visibility="visible";b.style.left=m+"px";b.style.top=n+"px"};this.start=function(p,x){b=util.createElement("div");b.className=p;b.onmouseout=o;b.onclick=util.stopPropagation;
b.onmousedown=util.stopPropagation;b.onmouseup=util.stopPropagation;b.onmousemove=util.stopPropagation;x.getActiveSurface().appendChild(b)};this.hide=l;this.addMapMenuItem=function(p,x,s,A){p=p;if(p==null)p=util.getFreeIndex(e);e[p]=util.createElement("a");e[p].menuItemId=p;e[p].onclick=new h(p);e[p].setAttribute("href","javascript: util.voidFunction();");e[p].callback=s;if(x!=null&&x!=""){x=document.createTextNode(x);e[p].appendChild(x)}b.appendChild(e[p]);if(A!=null)for(x=0;x<A.length;x++)e[p].setAttribute(A[x].attributename,
A[x].attributevalue);return e[p]};this.deleteMapMenuItem=function(p){b.removeChild(p);e[p.menuItemId]=null;return 0}}
function MapMeter(){var h=null,l="",o="",b=null,m="";this.set=function(n,c){if(n!=null)l=n;if(c!=null)o=c;util.loadPngImage(b,m+"/"+l+"/meter"+o)};this.update=function(){o=h.getZoom();util.loadPngImage(b,m+"/"+l+"/meter"+o)};this.start=function(n,c,a){h=n;o=c.MAP_INI_ZOOM;l=a;m=c.MAP_IMAGEPATH;b=util.createElement("img");h.getTileBackground().appendChild(b);b.className=c.MAP_CSS_BASE+"_meter";util.loadPngImage(b,m+"/"+l+"/meter"+o)}}
function PrintMenu(h){function l(q){return function(){return o(q)}}function o(q){if(y!=null){var g=h.scales[c.getZoom()]/h.scales[a.getZoom()],v=Math.round(j[q].width*g);g=Math.round(j[q].height*g);y.style.width=v+"px";y.style.height=g+"px";y.style.left=Math.round((a.getWidth()-v)/2)+"px";y.style.top=Math.round((a.getHeight()-g)/2)+"px"}r=q}function b(q){if(A=q){if(a!=null){a.getVisibility()||a.show();y.style.visibility="visible"}}else if(a!=null)y.style.visibility="hidden"}function m(){if(!w){w=
true;e.getMapPrintURL(n,j[r].width,j[r].height,null,null,null,null,u)}}function n(q){window.open(q,"Print","menubar=yes,toolbar=yes,resizable=yes,scrollbars=yes");w=false}var c=null,a=null,e=null,p=null,x=null,s=null,A=false,y=null,k=null,f=null,d=null,j=[],r=0,w=false,u=null,t=null,z=null;this.start=function(q,g,v){c=q;a=v;e=g;q=c.getMapNode();x=util.createElement("div");q.appendChild(x);x.className=h.PRINT_MENU_CSS_BASE;p=util.createElement("div");x.appendChild(p);p.className=h.PRINT_MENU_CSS_BASE+
"_item";p.onclick=util.stopPropagation;p.oncontextmenu=util.stopPropagation;p.onmousedown=util.stopPropagation;p.ondblclick=util.stopPropagation;g=util.createElement("div");p.appendChild(g);z=util.createElement("div");z.appendChild(document.createTextNode(h.PRINT_MENU_BUTTON));p.appendChild(z);x.appendChild(p);g.className=h.PRINT_MENU_CSS_BASE+"_item_bg";z.className=h.PRINT_MENU_CSS_BASE+"_item_text";s=util.createElement("div");s.className=h.PRINT_MENU_CSS_BASE+"_dialog";s.style.visibility="hidden";
if(h.PRINT_MENU_FORMATS!=null){g=util.createElement("form");g.setAttribute("method","post");for(v=0;v<h.PRINT_MENU_FORMATS.length;v++){var B=util.createElement("div"),E=null;if(util.isIE)E=v==0?util.createElement('<input type="radio" name="PrintMenuTypeSetting" checked="checked" />'):util.createElement('<input type="radio" name="PrintMenuTypeSetting"  />');else{E=util.createElement("input");E.type="radio";E.name="PrintMenuTypeSetting";E.checked=v==0}if(a!=null)E.onclick=l(v);j[v]={type:h.PRINT_MENU_FORMATS[v].type,
width:h.PRINT_MENU_FORMATS[v].width,height:h.PRINT_MENU_FORMATS[v].height};B.appendChild(E);B.appendChild(document.createTextNode(h.PRINT_MENU_FORMATS[v].label));g.appendChild(B)}s.appendChild(g)}t=util.createElement("div");s.appendChild(t);g=util.createElement("div");d=util.createElement("input");d.setAttribute("type","Button");d.setAttribute("value",h.PRINT_MENU_BUTTON_CLOSE);g.appendChild(d);f=util.createElement("input");f.setAttribute("type","Button");f.setAttribute("value",h.PRINT_MENU_BUTTON_PRINT);
g.appendChild(f);s.appendChild(g);if(a!=null){a.getVisibility()||a.show();y=util.createElement("div");y.className=h.PRINT_MENU_CSS_BASE+"_previewframe";y.style.visibility="hidden";o(0);a.getActiveSurface().appendChild(y)}q.appendChild(s);k=new visualFx.shrinkHiding(z,s,null,null,true,null,50,10,b);d.onclick=k.hide;f.onclick=m};this.getDialog=function(){return s};this.getPrintButton=function(){return z};this.getUserDiv=function(){return t};this.setFormatSize=function(q,g,v){for(var B=-1,E=0;E<j.length&&
B==-1;E++)if(j[E].type==q){j[E].width=g;j[E].height=v;B=E}if(B==-1)return 1;else{A&&B==r&&o(r);return 0}};this.setPrintParameters=function(q){u=q};this.getPrintParameters=function(){return u};this.setPrintCallback=function(q){f.onclick=q};this.setCloseCallback=function(q){d.onclick=q};this.getCurrentFormat=function(){return j[r]};this.updateZoom=function(){o(r)};this.getPreviewInfo=function(){var q=h.scales[c.getZoom()]/h.scales[a.getZoom()];return{frameWidth:Math.round(j[r].width*q),frameHeight:Math.round(j[r].height*
q),indexMapZoom:a.getZoom(),mapZoom:c.getZoom()}};this.getMapPrintXML=function(){return e.getMapPrintXML(j[r].width,j[r].height,null,null,null,null,u)};this.getMapPrintURL=function(q){e.getMapPrintURL(q,j[r].width,j[r].height,null,null,null,null,u)};this.hide=function(q){k.hide(q)};this.show=function(q){k.show(q)}}
function MapCopyright(){var h=null,l="",o="",b=null,m="";this.set=function(n,c){if(n!=null)l=n;if(c!=null)o=c;util.loadPngImage(b,m+"/"+l+"/copyright"+o)};this.update=function(){o=h.getZoom();util.loadPngImage(b,m+"/"+l+"/copyright"+o)};this.start=function(n,c,a){h=n;o=c.MAP_INI_ZOOM;l=a;m=c.MAP_IMAGEPATH;b=util.createElement("img");h.getTileBackground().appendChild(b);b.className=c.MAP_CSS_BASE+"_copyright";util.loadPngImage(b,m+"/"+l+"/copyright"+o)}}
function NaviciAjaxConfiguration(){this.LANGUAGE="fi";this.IE_FIX_CSS="css/ie_specials.css";this.SERVER_SIDE_FILE="ajaxRequest.php";this.MAP_MAX_Y=this.MAP_MIN_Y=this.MAP_MAX_X=this.MAP_MIN_X=this.MAP_START_Y=this.MAP_START_X=0;this.scales=[];this.availableImages=[];this.MAP_TILE_SIZE=256;this.MAP_INI_ZOOM=this.MAP_MIN_ZOOM=this.MAP_MAX_ZOOM=0;this.MAP_IMAGEPATH="img";this.CREATE_MAP_COPYRIGHT=this.CREATE_MAP_METER=this.MAP_SMOOTHMOVE=true;this.MAP_FIXEDSIZE=false;this.MAP_WIDTH=600;this.MAP_HEIGHT=
400;this.MAP_MARGIN_RIGHT=15;this.MAP_MARGIN_BOTTOM=10;this.MAP_AREA="MapArea";this.MAP_CSS_BASE="map_image";this.CREATE_MAP_SCALEBAR=true;this.SCALEBAR_CSS_BASE="map_scalebar";this.SCALEBAR_TOP=22;this.SCALEBAR_LENGTH=157;this.SCALEBAR_TOOLTIPS=[];this.SCALEBAR_TOOLTIPS_OFF_X=-5;this.SCALEBAR_TOOLTIPS_OFF_Y=15;this.CREATE_MAP_PAN=true;this.PAN_CSS_BASE="map_pan";this.PAN_HIGHT=this.PAN_WIDTH=52;this.PAN_FACTOR=0.25;this.PAN_SPEED=50;this.CREATE_PRINT_MENU=this.CREATE_TYPE_MENU=this.CREATE_MAP_MENU=
true;this.PRINT_MENU_BUTTON_PRINT=this.PRINT_MENU_BUTTON="Print";this.PRINT_MENU_BUTTON_CLOSE="Close";this.PRINT_MENU_FORMATS=[];this.PRINT_MENU_FORMATS[0]={type:"Portrait",width:535,height:782,label:"Portrait"};this.PRINT_MENU_FORMATS[1]={type:"Landscape",width:782,height:535,label:"Landscape"};this.PRINT_MENU_CSS_BASE="map_printmenu";this.PAN_CURSOR_STYLE="pointer";this.LAYERS=[];this.POI_SERVICE="navici_poi";this.CREATE_INDEXMAP=true;this.INDEXMAP_WIDTH=250;this.INDEXMAP_HEIGHT=200;this.INDEXMAP_ZOOM_MAPSIZE=
60;this.INDEXMAP_CSS_BASE="indexmap_image";this.POPUP_CSS_BASE="map_popup";this.POPUP_DYNAMIC_POSITION=true;this.POPUP_BACKGROUND_IMAGE="images/pois_bg";this.POPUP_WIDTH=238;this.POPUP_HEIGHT=291}
function NaviciAjaxApi(){var h="fi",l=null,o=null,b=null,m=null,n=null,c=null,a=null,e=null,p=null,x=null,s=null,A=null,y=null,k=null,f=null,d=null,j=null,r=null,w=null,u=null,t=null,z=null,q=null;this.start=function(g){q=g;h=q.LANGUAGE;q.IE_FIX_CSS!=null&&util.isIE&&util.loadCssFile(q.IE_FIX_CSS);o=new AjaxObject(q.SERVER_SIDE_FILE);if(!q.MAP_FIXEDSIZE){g=util.objectXY(util.attach(q.MAP_AREA));q.MAP_WIDTH=util.getWindowWidth()-g.x-q.MAP_MARGIN_RIGHT;q.MAP_HEIGHT=util.getWindowHeight()-g.y-q.MAP_MARGIN_BOTTOM}l=
new Map(q);b=new LayerManager(this,q,false);b.start(o,l);n=b.getLayer("Dynamic");if(n!=null){A=new LayerMarker(n);r=new PoisOnLayer(n)}a=new DivMarkerLayer;l.addLayer(a);b.addDivLayer(a);s=new RouteRequests(o);o.addRequestObject(s);s.start(n);if(q.MAP_SMOOTHMOVE){c=new MapSmoothMove;c.start(l);l.addDoubleClickCallback(c.startCentering);l.addZoomChangeCallback(c.stopCentering);l.addMapMouseDownCallback(c.stopCentering);l.addClickCallback(c.stopCentering)}else l.addDoubleClickCallback(function(v){l.setCenter(v.mouseCoordX,
v.mouseCoordY)});l.start(q.MAP_START_X,q.MAP_START_Y,q.MAP_INI_ZOOM);q.CREATE_TYPE_MENU&&b.createMenu();if(q.CREATE_MAP_SCALEBAR){d=new MapScaleBar;d.setLayout(q.SCALEBAR_CSS_BASE,q.SCALEBAR_TOP,q.SCALEBAR_LENGTH);d.start(l,a);d.setZoom(q.MAP_INI_ZOOM);l.addZoomChangeCallback(function(v){d.setZoom(v.zoom)})}if(q.CREATE_MAP_PAN){g=new MapPanControl;g.setLayout(q.PAN_WIDTH,q.PAN_HIGHT,q.PAN_CSS_BASE);g.start(l)}if(q.CREATE_INDEXMAP){j=new IndexMap(q);m=new LayerManager(this,q,true);m.start(o,j);j.start(l,
b.getCurrentType());l.addMapDraggedCallback(function(v){j.setDragCenter(v.centerX,v.centerY)});l.addMapMovedCallback(function(v){j.setCenter(v.centerX,v.centerY)});l.addZoomChangeCallback(function(v){j.setZoom(v.zoom)});b.addTypeChangeCallback(m.setMapType)}if(q.CREATE_PRINT_MENU){z=new PrintMenu(q);z.start(l,b,j);l.addZoomChangeCallback(z.updateZoom)}if(q.CREATE_MAP_MENU){y=new MapMenu;y.start("map_menu",l);l.addClickCallback(y.show)}if(q.CREATE_MAP_METER){k=new MapMeter;k.start(l,q,b.getCurrentType());
l.addZoomChangeCallback(k.update);b.addTypeChangeCallback(k.set)}if(q.CREATE_MAP_COPYRIGHT){f=new MapCopyright;f.start(l,q,b.getCurrentType());l.addZoomChangeCallback(f.update);b.addTypeChangeCallback(f.set)}e=new Geocoding;e.start(o);p=new GeocodingReversed;p.start(o);x=new GeocodingReversedPoi;x.start(o);w=new MapPopupManager(this,q);u=new PoiPopupFormatter};this.getVersion=function(){return"1.3.2"};this.setLanguage=function(g){h=g};this.getLanguage=function(){return h};this.setMapSize=function(g,
v,B,E){return l.setSize(g,v,B,E)};this.setMapCenter=function(g,v){if(c!=null){var B=l.getInfo(),E=Math.abs((v-B.centerY)/q.scales[B.zoom]);if(Math.abs((g-B.centerX)/q.scales[B.zoom])<B.width/2&&E<B.height/2){c.startCenteringCoordinate(g,v);return 0}else return l.setCenter(g,v)}else return l.setCenter(g,v)};this.setMapZoom=function(g){return l.setZoom(g)};this.getMapZoom=function(){return l.getZoom()};this.getMapInfos=function(){return l.getInfo()};this.getMap=function(){return l};this.getMapPrintMenu=
function(){return z};this.getLayerManager=function(){return b};this.getIndexMap=function(){return j};this.setMapType=function(g){return b.setMapType(g)};this.getMapType=function(){return b.getCurrentType()};this.addMapTypeChangeCallback=function(g){return b.addTypeChangeCallback(g)};this.deleteMapTypeChangeCallback=function(g){return b.deleteTypeChangeCallback(g)};this.clearDynamicLayer=function(){return b.clearLayer("Dynamic")};this.redrawDynamicLayer=function(){return b.redrawLayer("Dynamic")};
this.setDynamicLayerVisibility=function(g){return b.setLayerVisibility("Dynamic",g)};this.addDynamicLayerObject=function(g){var v=b.getLayer("Dynamic");return v==null?null:v.addImageLayerObject(g)};this.deleteDynamicLayerObject=function(g){var v=b.getLayer("Dynamic");return v==null?1:v.deleteImageLayerObject(g)};this.getMapPrintXML=function(g,v,B,E,S,C,H){return b.getMapPrintXML(g,v,B,E,S,C,H)};this.getMapPrintURL=function(g,v,B,E,S,C,H,F){return b.getMapPrintURL(g,v,B,E,S,C,H,F)};this.addLayerMarker=
function(g,v,B,E,S){return A!=null?A.addMarker(g,v,B,E,S):null};this.addLayerMarkerImage=function(g,v,B,E){return A!=null?A.addMarkerImage(g,v,B,E):null};this.deleteLayerMarker=function(g){return A!=null?A.deleteMarker(g):1};this.addDivMarker=function(g,v,B,E,S,C,H){return a!=null?a.addMarker(g,v,B,E,S,C,H):null};this.deleteDivMarker=function(g){return a!=null?a.deleteMarker(g):1};this.searchRoute=function(g,v,B,E){return s.getRoute(g,v,h,B,E)};this.getRouteVisibility=function(g,v){return s.getRouteVisibility(g,
v)};this.setRouteVisibility=function(g,v,B){return s.setRouteVisibility(g,v,B)};this.getRouteCount=function(g){return s.getRouteCount(g)};this.deleteRoute=function(g){s.deleteRoute(g)};this.addMapMenuItem=function(g,v,B,E){return y.addMapMenuItem(g,v,B,E)};this.deleteMapMenuItem=function(g){return y.deleteMapMenuItem(g)};this.getAddressByKey=function(g,v,B,E,S){g=e.getAddress(g,v,h,B,E,S);o.sendRequest();return g};this.getAddressByObject=function(g,v,B){g=e.getAddressByObject(g,v,B);o.sendRequest();
return g};this.getAddressByCoordinates=function(g,v,B,E,S,C){g=p.getAddress(g,v,B,h,E,S,C);o.sendRequest();return g};this.getPoisByCoordinates=function(g,v,B,E,S,C,H){return x.getPois(g,v,B,E,h,S,q.POI_SERVICE,C,H)};this.startPoiManager=function(g,v,B){if(r!=null){w.setTitle(v);t=new PoiManager(this,w,u,r.getVisiblePois,g,B);return 0}else return 1};this.getPoiManager=function(){return t};this.setPoiVisibility=function(g,v,B,E){return r!=null?r.setPoiVisibility(q.POI_SERVICE,g,v,B,E):1};this.getPoiPopupFormatter=
function(){return u};this.setPoiPopupFormatter=function(g){u=g};this.getMapPopupManager=function(){return w};this.setMapPopupManager=function(g){w=g}};

