var a;function $EL(b){return $(b)}function $EL2(b){return $(b)}function $CLASS(b){return $$("."+b)}function $ADD_CLASS(b,c){$EL(b).addClassName(c)}function $REMOVE_CLASS(b,c){$EL(b).removeClassName(c)}function $UPDATE(b,c){return $EL(b).update(c)}function $REPLACE(b,c){return $EL(b).replace(c)}function $HASH(b){return $H(b)}function $EACH(b,c){return b.each(c)}function $MAP(b,c){return b.map(c)}function $GREP(b,c){var d=[];b.each(function(e){c(e)&&d.push(e)});return d}
function $AJAX(b,c){new Ajax.Request(b,c)}function $CLONE(b){return Object.clone(b)}function $TO_JSON(b){return Object.toJSON(b)}function $EVAL_JSON(b){return Object.evalJSONString(b)}function $EXTEND(b,c){return Object.extend(b,c)}function $BLINDDOWN(b,c){return window.Effect?Effect.BlindDown(b,c):$(b).show()}function $BLINDUP(b,c){return window.Effect?Effect.BlindUp(b,c):$(b).hide()}function $EVENT(b,c,d){return Event.observe($EL(b),c,d)}function $VISIBLE(b){return $EL(b).visible()}
function $DIMENSIONS(b){return $EL(b).getDimensions()}function $PREVIOUS(b){return $EL(b).previous()}function $NEXT(b){return $EL(b).next()}function $OPACITY(b,c){return c==null?Element.getOpacity(b):Element.setOpacity(b,c)}function $OFFSETTOP(b){return Element.cumulativeOffset(b)[1]}function $OFFSETLEFT(b){return Element.cumulativeOffset(b)[0]}function $INARRAY(b,c){return b.indexOf(c)}
function $ANIMATE(b,c,d,e){if(window.Effect)new Effect.Move(b,{x:c.left,y:c.top,mode:"absolute",duration:d/1E3});else for(var f in c)$EL(b).style[f]=c[f];e&&e()};var JsonRPCCounter=0,JsonRPCStore={};function setMessage(b,c){$EL(c||"message").style.display=b?"block":"none";$UPDATE(c||"message",b)}
function ajaxHelper(b){var c=b.url;delete b.url;window._callback=b.callback;delete b.callback;window._callback&&typeof window._callback=="string"&&eval("window._callback = "+window._callback);var d=window._callback;window._callback=null;var e=b.update;delete b.update;var f=b.replace;delete b.replace;if(b.method==null)b.method="get";b.onComplete=function(j,l){try{var n=j.getResponseHeader("X-Ajax-Redirect-Location");if(n)location.href=n}catch(q){}d&&d(j,l);e&&$UPDATE(e,j.responseText);f&&$REPLACE(f,
j.responseText)};for(var o in b.parameters)if(typeof b.parameters[o]!="string")b.parameters[o]=$TO_JSON(b.parameters[o]);return $AJAX(c,b)}
function jsonRpc(b){var c=document.createElement("script"),d="cb"+ ++JsonRPCCounter,e=b.timeout&&window.setTimeout(function(){jsonRpcCleanup(d,c);b.callback(null)},b.timeout);JsonRPCStore[d]=function(o){e&&clearTimeout(e);jsonRpcCleanup(d,c);b.callback(o)};for(var f in b.parameters)if(typeof b.parameters[f]!="string")b.parameters[f]=$TO_JSON(b.parameters[f]);f="&"+$HASH(b.parameters).toQueryString();c.src=b.url+"?"+(b.callbackFunctionName||"callback")+"=JsonRPCStore."+d+f;document.getElementsByTagName("HEAD")[0].appendChild(c)}
function jsonRpcCleanup(b,c){delete JsonRPCStore[b];setTimeout(function(){c.parentNode.removeChild(c)},1)}function $P(b,c){if(b!=null&&c!=null)return new GLatLng(b,c);if(typeof b=="object"){if(b[0]!=null&&b[1]!=null)return $P(b[0],b[1]);if(b.lat!=null&&b.lng!=null)return $P(b.lat,b.lng)}throw"invalid argument to $P "+b+", "+c;};var MapToolkit={version:"5b",host:"http://mtk2.toursprung.com",maps:{},documentLoaded:false,location:{lat:google&&google.loader.ClientLocation&&google.loader.ClientLocation.latitude,lng:google&&google.loader.ClientLocation&&google.loader.ClientLocation.longitude,country:google&&google.loader.ClientLocation&&google.loader.ClientLocation.address.country_code.toLowerCase()},language:_mHL||"en",resizeDiv:function(b,c,d){b=$EL(b);d=d.map.size;if(b)if(c){if(this.isIE6()){MapToolkit.mapParent=b.parentNode;
MapToolkit.mapParent.removeChild(b);document.getElementsByTagName("BODY")[0].appendChild(b)}b.style.position="fixed";b.style.top="0px";b.style.left="0px";b.style.width=this.windowWidth()+"px";b.style.height=this.windowHeight()+"px"}else{if(MapToolkit.mapParent){document.getElementsByTagName("BODY")[0].removeChild(b);MapToolkit.mapParent.appendChild(b);delete MapToolkit.mapParent}b.style.position="relative";b.style.top="";b.style.left="";if(d.width&&d.height){b.style.width=d.width+"px";b.style.height=
d.height+"px"}else if(d.offsetBottom){b.style.width=d.offsetRight!=null?this.windowWidth()-$OFFSETLEFT(b)-d.offsetRight+"px":"";b.style.height=this.windowHeight()-$OFFSETTOP(b)-d.offsetBottom+"px"}}},windowHeight:function(){var b=0;if(typeof window.innerHeight=="number")b=window.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)b=document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight)b=document.body.clientHeight;return b},windowWidth:function(){var b=
0;if(typeof window.innerWidth=="number")b=window.innerWidth;else if(document.documentElement&&document.documentElement.clientWidth)b=document.documentElement.clientWidth;else if(document.body&&document.body.clientWidth)b=document.body.clientWidth;return b},isIE6:function(){if(!window.navigator)return false;if(!navigator.appVersion)return false;return navigator.appVersion.match(/MSIE 6/)},isIE7:function(){if(!window.navigator)return false;if(!navigator.appVersion)return false;return navigator.appVersion.match(/MSIE 7/)},
setMap:function(b,c){return MapToolkit.maps[b]=c},getMap:function(b){return MapToolkit.maps[b]},deleteMap:function(b){delete MapToolkit.maps[b]},createMap:function(b,c,d){if(MapToolkit.maps[b])throw"MapToolkit already defined for div '"+b+"'";var e=$EL(b);e.style.overflow=e.style.overflow||"hidden";e.style.zIndex=e.style.zIndex||"50";this.resizeDiv(b,false,c);if(MapToolkit.documentLoaded){e=new MapToolkit.Map(b,$CLONE(c));d&&d(e)}else GEvent.addDomListener(window,"load",function(f,o){return function(){var j=
new MapToolkit.Map(f,o);d&&d(j)}}(b,$CLONE(c)))},classForSting:function(b){var c=window;$EACH(b.split("."),function(d){c=c[d]});return c}};GEvent.addDomListener(window,"load",function(){MapToolkit.documentLoaded=true});document.write('<script src="http://mtk2.toursprung.com/static/js/i18n/'+MapToolkit.language+'.js" type="text/javascript"><\/script>');MapToolkit.TreeMenu=function(b,c,d){var e=true;d=d||{};var f={},o=d.entry||MapToolkit.host+"/static/images/treemenu/entry.png",j=d.entrySelected||MapToolkit.host+"/static/images/treemenu/entry_selected.png",l=d.opened||MapToolkit.host+"/static/images/treemenu/open.png",n=d.closed||MapToolkit.host+"/static/images/treemenu/closed.png",q=d.loading||MapToolkit.host+"/static/images/loader.gif";b=$EL(b);if(d.map){var t=b.parentNode;b.onmouseover=function(){t.clientHeight<t.scrollHeight&&d.map.disableScrollWheelZoom()};
b.onmouseout=function(){t.clientHeight<t.scrollHeight&&d.map.enableScrollWheelZoom()}}var r=function(z,i){if(!z.icon)return i?j:o;if(typeof z.icon=="string")return z.icon;return z.icon[i]},w=function(z,i){var k=document.createElement("ul");k.className=i?"mtk-treemenu-block-first":"mtk-treemenu-block";$EACH(z,function(h){var g=document.createElement("li");if(h.name)f[h.name]=g;g.className=h.children&&h.children.length?"mtk-treemenu-group":"mtk-treemenu-entry";g.checked=false;if(h.disabled)g.className+=
" mtk-treemenu-disabled";if(h.visible!=null&&!h.visible)g.style.display="none";g.onmouseover=function(){g.className+=" mtk-treemenu-entry-hover mtk-treemenu-entry-selected";if(!h.children&&!h.isLoading)p.src=r(h,1);!e&&h.onmouseover&&h.onmouseover()};g.onmouseout=function(){g.className=g.className.replace(/ mtk-treemenu-entry-hover/g,"");if(!g.checked)g.className=g.className.replace(/ mtk-treemenu-entry-selected/g,"");if(!h.children&&!g.checked&&!h.isLoading)p.src=r(h,0);!e&&h.onmouseout&&h.onmouseout()};
k.appendChild(g);var p=document.createElement("img");p.className="mtk-treemenu-entry-image";p.width=16;p.height=16;g.appendChild(p);if(!h.children){p.src=r(h,0);g.onclick=function(J){J=J=="checkOnly";if(!(!e&&h.disabled)){g.checked=!g.checked;if(g.checked)g.className+=" mtk-treemenu-entry-selected";if(s)s.checked=g.checked;if(!J&&h.onclick&&(h.showLoading==null||h.showLoading)){p.src=q;h.isLoading=true;e||h.onclick(g.checked,function(){h.isLoading=false;p.src=r(h,g.checked?1:0)})}else{p.src=r(h,g.checked?
1:0);!J&&!e&&h.onclick&&h.onclick(g.checked)}}};if(h.checkbox){var s=document.createElement("input");s.className="mtk-treemenu-entry-checkbox";s.type="checkbox";s.onchange=g.onclick;g.appendChild(s)}}var I=document.createElement("span");I.className=h.checkbox?"mtk-treemenu-check-label":"mtk-treemenu-entry-label";I.innerHTML=h.title;g.appendChild(I);if(h.children){p.src=n;var N=w(h.children);N.style.display=h.checked?"block":"none";k.appendChild(N);g.onclick=function(J){J=J=="checkOnly";if(!(!e&&h.disabled)){g.checked=
!g.checked;e||(g.checked?$BLINDDOWN(N,{duration:0.1}):$BLINDUP(N,{duration:0.1}));p.src=g.checked?l:n;!J&&!e&&h.onclick&&h.onclick(g.checked)}}}g.check=function(){g.onclick("checkOnly")};h.checked&&g.onclick()});return k};b.appendChild(w(c,"toplevel"));e=false;return f};MapToolkit.RestAPI=function(){function b(i,k){i[k>>5]|=128<<k%32;i[(k+64>>>9<<4)+14]=k;k=1732584193;for(var h=-271733879,g=-1732584194,p=271733878,s=0;s<i.length;s+=16){var I=k,N=h,J=g,R=p;k=d(k,h,g,p,i[s+0],7,-680876936);p=d(p,k,h,g,i[s+1],12,-389564586);g=d(g,p,k,h,i[s+2],17,606105819);h=d(h,g,p,k,i[s+3],22,-1044525330);k=d(k,h,g,p,i[s+4],7,-176418897);p=d(p,k,h,g,i[s+5],12,1200080426);g=d(g,p,k,h,i[s+6],17,-1473231341);h=d(h,g,p,k,i[s+7],22,-45705983);k=d(k,h,g,p,i[s+8],7,1770035416);p=d(p,k,h,
g,i[s+9],12,-1958414417);g=d(g,p,k,h,i[s+10],17,-42063);h=d(h,g,p,k,i[s+11],22,-1990404162);k=d(k,h,g,p,i[s+12],7,1804603682);p=d(p,k,h,g,i[s+13],12,-40341101);g=d(g,p,k,h,i[s+14],17,-1502002290);h=d(h,g,p,k,i[s+15],22,1236535329);k=e(k,h,g,p,i[s+1],5,-165796510);p=e(p,k,h,g,i[s+6],9,-1069501632);g=e(g,p,k,h,i[s+11],14,643717713);h=e(h,g,p,k,i[s+0],20,-373897302);k=e(k,h,g,p,i[s+5],5,-701558691);p=e(p,k,h,g,i[s+10],9,38016083);g=e(g,p,k,h,i[s+15],14,-660478335);h=e(h,g,p,k,i[s+4],20,-405537848);k=
e(k,h,g,p,i[s+9],5,568446438);p=e(p,k,h,g,i[s+14],9,-1019803690);g=e(g,p,k,h,i[s+3],14,-187363961);h=e(h,g,p,k,i[s+8],20,1163531501);k=e(k,h,g,p,i[s+13],5,-1444681467);p=e(p,k,h,g,i[s+2],9,-51403784);g=e(g,p,k,h,i[s+7],14,1735328473);h=e(h,g,p,k,i[s+12],20,-1926607734);k=f(k,h,g,p,i[s+5],4,-378558);p=f(p,k,h,g,i[s+8],11,-2022574463);g=f(g,p,k,h,i[s+11],16,1839030562);h=f(h,g,p,k,i[s+14],23,-35309556);k=f(k,h,g,p,i[s+1],4,-1530992060);p=f(p,k,h,g,i[s+4],11,1272893353);g=f(g,p,k,h,i[s+7],16,-155497632);
h=f(h,g,p,k,i[s+10],23,-1094730640);k=f(k,h,g,p,i[s+13],4,681279174);p=f(p,k,h,g,i[s+0],11,-358537222);g=f(g,p,k,h,i[s+3],16,-722521979);h=f(h,g,p,k,i[s+6],23,76029189);k=f(k,h,g,p,i[s+9],4,-640364487);p=f(p,k,h,g,i[s+12],11,-421815835);g=f(g,p,k,h,i[s+15],16,530742520);h=f(h,g,p,k,i[s+2],23,-995338651);k=o(k,h,g,p,i[s+0],6,-198630844);p=o(p,k,h,g,i[s+7],10,1126891415);g=o(g,p,k,h,i[s+14],15,-1416354905);h=o(h,g,p,k,i[s+5],21,-57434055);k=o(k,h,g,p,i[s+12],6,1700485571);p=o(p,k,h,g,i[s+3],10,-1894986606);
g=o(g,p,k,h,i[s+10],15,-1051523);h=o(h,g,p,k,i[s+1],21,-2054922799);k=o(k,h,g,p,i[s+8],6,1873313359);p=o(p,k,h,g,i[s+15],10,-30611744);g=o(g,p,k,h,i[s+6],15,-1560198380);h=o(h,g,p,k,i[s+13],21,1309151649);k=o(k,h,g,p,i[s+4],6,-145523070);p=o(p,k,h,g,i[s+11],10,-1120210379);g=o(g,p,k,h,i[s+2],15,718787259);h=o(h,g,p,k,i[s+9],21,-343485551);k=j(k,I);h=j(h,N);g=j(g,J);p=j(p,R)}return Array(k,h,g,p)}function c(i,k,h,g,p,s){return j(l(j(j(k,i),j(g,s)),p),h)}function d(i,k,h,g,p,s,I){return c(k&h|~k&g,
i,k,p,s,I)}function e(i,k,h,g,p,s,I){return c(k&g|h&~g,i,k,p,s,I)}function f(i,k,h,g,p,s,I){return c(k^h^g,i,k,p,s,I)}function o(i,k,h,g,p,s,I){return c(h^(k|~g),i,k,p,s,I)}function j(i,k){var h=(i&65535)+(k&65535);return(i>>16)+(k>>16)+(h>>16)<<16|h&65535}function l(i,k){return i<<k|i>>>32-k}function n(i){for(var k=Array(),h=(1<<z)-1,g=0;g<i.length*z;g+=z)k[g>>5]|=(i.charCodeAt(g/z)&h)<<g%32;return k}function q(i){for(var k=w?"0123456789ABCDEF":"0123456789abcdef",h="",g=0;g<i.length*4;g++)h+=k.charAt(i[g>>
2]>>g%4*8+4&15)+k.charAt(i[g>>2]>>g%4*8&15);return h}function t(i){return q(b(n(i),i.length*z))}function r(i,k){var h=i.role?"#"+i.role:"",g=i.password||"",p=g&&parseInt((new Date).getTime()/1E3);i.parameters.api_key=""+i.api_key+h;i.parameters.token=t(i.api_key+g+p);i.url=i.url+"/"+k;i.parameters=i.parameters||{};jsonRpc(i)}var w=0,z=8;return{get:function(i){r(i,"get")},post:function(i){r(i,"post")},put:function(i){r(i,"put")},"delete":function(i){r(i,"delete")}}}();if(!GLatLng.prototype.__lat&&!GLatLng.prototype.__lng){a=GLatLng.prototype;a.__lat=GLatLng.prototype.lat;a.lat=function(){return Math.round(this.__lat()*1E5)/1E5};a.__lng=GLatLng.prototype.lng;a.lng=function(){return Math.round(this.__lng()*1E5)/1E5};a.equals=function(b){return this.lat()==b.lat()&&this.lng()==b.lng()}};MapToolkit.Tooltip=function(){var b=this,c,d={},e={},f=function(l){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else l.stopPropagation()},o=function(l,n,q){if(d[l.div])var t=d[l.div];else{t=document.createElement("div");t.style.display="none";t.style.position="absolute";l.gmap.getPane(G_MAP_FLOAT_SHADOW_PANE).appendChild(t);GEvent.bindDom(t,"mouseover",b,function(){l.disableScrollWheelZoom()});GEvent.bindDom(t,
"mouseout",b,function(){l.enableScrollWheelZoom()});GEvent.bindDom(t,"mousedown",b,f);GEvent.bindDom(t,"dblclick",b,f);GEvent.bindDom(t,"DOMMouseScroll",b,f);d[l.div]=t}t.className=n||"mtk-tooltip";if(c)for(var r in c)t.style[r]="";if(c=q)for(r in q)t.style[r]=q[r];return d[l.div]},j=function(l,n){l=o(l);if(n<0)n=0;if(n>=100)n=100;var q=n/100;if(typeof l.style.filter=="string")l.style.filter="alpha(opacity:"+n+")";if(typeof l.style.KHTMLOpacity=="string")l.style.KHTMLOpacity=q;if(typeof l.style.MozOpacity==
"string")l.style.MozOpacity=q;if(typeof l.style.opacity=="string")l.style.opacity=q};return{show:function(l){if(!((l.priority||0)<e[l.map.div])){this.hide(l);e[l.map.div]=l.priority;var n=o(l.map,l.className,l.style);if(l.text!=null)n.innerHTML=l.text;l.opacity!=null&&j(l.map,l.opacity);if(l.onmouseover)n.onmouseover=l.onmouseover;l.onmouseout&&MapToolkit.OnMouseOut(n,l.onmouseout);this.move(l);n.style.display="block";GEvent.trigger(this,"show")}},move:function(l){var n=o(l.map,l.className,l.style),
q=l.map.gmap.fromLatLngToDivPixel(l.point),t=l.map.gmap.fromLatLngToContainerPixel(l.point),r=l.icon?[l.icon.iconSize.width-l.icon.iconAnchor.x,0-l.icon.iconAnchor.y]:[0,0];if(l.iconOffsetX)r[0]+=l.iconOffsetX*2;if(l.iconOffsetY)r[1]+=l.iconOffsetY*2;q={top:q.y+r[1]-5,left:q.x+r[0]+5};r={top:t.y+r[1],left:t.x+r[0]};var w=l.map.gmap.getSize();t=$DIMENSIONS(n);l=l.icon?l.icon.iconSize:{width:0,height:0};t.width+=l.width/2;r={north:r.top,east:w.width-r.left-t.width,south:w.height-r.top-t.height,west:r.left-
t.width-l.width};if(r.east<0&&r.east<r.west)q.left-=t.width+l.width+10;if(r.south<0&&r.south<r.north)q.top+=r.south-10;if(r.north<0&&r.north<r.south)q.top-=r.north-10;n.style.left=q.left+"px";n.style.top=q.top+"px"},hide:function(l){if(!((l.priority||0)<e[l.map.div])){delete e[l.map.div];o(l.map,l.className,l.style).style.display="none"}}}}();MapToolkit.Tooltip.Options={map:null,className:null,style:null,point:null,text:null,opacity:null,icon:null,onmouseover:null,onmouseout:null};MapToolkit.InfoWindow=function(){this.prototype=new GOverlay;var b=this,c={},d,e=function(j){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else j.stopPropagation()},f=function(j,l,n){if(c[j.div])var q=c[j.div][0];else{var t=MapToolkit.isIE6()?"-ie6":"";q=document.createElement("div");q.style.position="absolute";q.innerHTML='<div id="mtk-infowindow-content-'+j.div+'">&nbsp</div><div class="mtk-infowindow-close'+
t+'" onclick="javascript:MapToolkit.InfoWindow.hide({map:MapToolkit.getMap(\''+j.div+"')})\">&nbsp;</div>";j.gmap.getPane(G_MAP_FLOAT_PANE).appendChild(q);GEvent.bindDom(q,"mouseover",b,function(){j.disableScrollWheelZoom()});GEvent.bindDom(q,"mouseout",b,function(){j.enableScrollWheelZoom()});GEvent.bindDom(q,"mousedown",b,e);GEvent.bindDom(q,"dblclick",b,e);GEvent.bindDom(q,"DOMMouseScroll",b,e);c[j.div]=[q,$EL("mtk-infowindow-content-"+j.div),null]}q.className=l||"mtk-infowindow";if(d)for(var r in d)q.style[r]=
"";if(d=n)for(r in n)q.style[r]=n[r];return c[j.div]},o=function(j,l){j=f(j)[0];if(l<0)l=0;if(l>=100)l=100;var n=l/100;if(typeof j.style.filter=="string")j.style.filter="alpha(opacity:"+l+")";if(typeof j.style.KHTMLOpacity=="string")j.style.KHTMLOpacity=n;if(typeof j.style.MozOpacity=="string")j.style.MozOpacity=n;if(typeof j.style.opacity=="string")j.style.opacity=n};return{show:function(j){this.hide(j);var l=f(j.map,j.className,j.style);l[1].innerHTML=j.text||"";j.content!=null&&l[1].appendChild(j.content);
j.opacity!=null&&o(j.map,j.opacity);if(j.onmouseover)l[0].onmouseover=j.onmouseover;j.onmouseout&&MapToolkit.OnMouseOut(l[0],j.onmouseout);if(j.onclose)l[2]=j.onclose;this.move(j);l[0].style.display="block";GEvent.trigger(this,"show")},move:function(j){var l=f(j.map,j.className,j.style),n=j.map.gmap.fromLatLngToDivPixel(j.point),q=j.map.gmap.fromLatLngToContainerPixel(j.point),t=j.icon?[j.icon.iconSize.width-j.icon.iconAnchor.x,0-j.icon.iconAnchor.y]:[0,0];if(j.iconOffsetX)t[0]+=j.iconOffsetX*2;if(j.iconOffsetY)t[1]+=
j.iconOffsetY*2;n={top:n.y+t[1]-5,left:n.x+t[0]+5};var r={top:q.y+t[1],left:q.x+t[0]};q=j.map.gmap.getSize();t=$DIMENSIONS(l[0]);var w=j.icon?j.icon.iconSize:{width:0,height:0};t.width+=w.width/2;r={north:r.top,east:q.width-r.left-t.width,south:q.height-r.top-t.height,west:r.left-t.width-w.width};if(r.east<0&&r.east<r.west)n.left-=t.width+w.width+15;if(r.south<0&&r.south<r.north)n.top+=r.south-15;if(r.north<0&&r.north<r.south)n.top-=r.north-10;l[0].style.left=n.left+"px";l[0].style.top=n.top+"px";
n=j.map.gmap.fromDivPixelToLatLng(new GPoint(n.left,n.top));n=j.map.gmap.fromLatLngToContainerPixel(n);l=j.map.gmap.getBounds().toSpan();w=j.map.gmap.getCenter().lat();r=j.map.gmap.getCenter().lng();n={north:n.y,east:q.width-n.x-t.width,south:q.height-n.y-t.height,west:n.x};if(n.north<0)w-=n.north/q.height*l.lat();if(n.east<0)r-=n.east/q.width*l.lng();if(n.west<0)r+=n.west/q.width*l.lng();j.map.gmap.panTo($P(w,r));GEvent.trigger(this,"move")},hide:function(j){j=f(j.map,j.className,j.style);j[2]&&
j[2]();j[2]=null;j[0].style.display="none";GEvent.trigger(this,"hide")}}}();MapToolkit.InfoWindow.Options={map:null,className:null,style:null,point:null,icon:null,text:null,opacity:null,onmouseover:null,onmouseout:null,onclose:null};MapToolkit.Marker=function(b){this._params=b;this.map=b.map;this.oldPoint=this.point=b.point;if(b.icon){var c=typeof b.icon=="function"?b.icon(b.params):b.icon;this.icon=MapToolkit.Icon.get(c)}else this.icon=G_DEFAULT_ICON;this.label=b.label;this.className=b.markerClass||"mtk-marker";this.style=b.markerStyle||{}};MapToolkit.Marker.prototype=new GOverlay;MapToolkit.Marker.activeMarker=null;MapToolkit.Marker.hideTimeout={};a=MapToolkit.Marker.prototype;
a.initialize=function(b){var c=this;c.gmap=b;c.image=document.createElement("div");c.image.className=this.className;c.image.style.position="absolute";c.image.style.zIndex=GOverlay.getZIndex(c.point.lat());c.image.style.width=this.icon.iconSize.width+"px";c.setImage(this.icon.image);c.image.style.height=this.icon.iconSize.height+"px";c.image.style.cursor="pointer";for(var d in this.style)c.image.style[d]=this.style[d];if(this.label)c.image.innerHTML=this.label;if(this.icon.shadow){c.shadow=document.createElement("div");
c.shadow.className=this.className+"-shadow";c.shadow.style.position="absolute";if(MapToolkit.isIE6())c.shadow.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='"+this.icon.shadow+"')";else c.shadow.style.backgroundImage="url("+this.icon.shadow+")";c.shadow.style.width=this.icon.shadowSize.width+"px";c.shadow.style.height=this.icon.shadowSize.height+"px"}c.gmap.getPane(G_MAP_MARKER_PANE).appendChild(c.image);c.shadow&&c.gmap.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(c.shadow);
GEvent.addDomListener(c.image,"click",function(){c.onclick()});GEvent.addDomListener(c.image,"mouseover",function(){c.onmouseover()});GEvent.addDomListener(c.image,"mouseout",function(){c.onmouseout()})};a.setImage=function(b){if(MapToolkit.isIE6())this.image.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='"+b+"')";else this.image.style.backgroundImage="url("+b+")"};a.setTooltip=function(b,c){this.tooltip=b;this.opacity=c};
a.setStickyTooltip=function(b,c){this.stickyTooltip={tooltip:b};this.opacity=c};a.setInfoWindow=function(b,c){this.infoWindow=b;this.opacity=c};a.setGoogleInfoWindow=function(b){this.googleInfoWindow=b};
a.onclick=function(){if(!this.dimmed){if(this.googleInfoWindow){this.log&&this.log();this.googleInfoWindow.length==1?this.gmap.openInfoWindowHtml(this.point,this.googleInfoWindow[0][1]):this.gmap.openInfoWindowTabsHtml($MAP(this.googleInfoWindow,function(b){return new GInfoWindowTab(b[0],b[1])}));this.details="googleInfoWindow"}else if(this.infoWindow){this.log&&this.log();MapToolkit.InfoWindow.show({map:this.map,point:this.point,text:this.infoWindow,opacity:this.opacity,icon:this.icon,style:this._params.infoWindowStyle,
className:this._params.infoWindowClass});this.details="infoWindow"}GEvent.trigger(this,"click",this.point)}};a.onmouseover=function(b){if(MapToolkit.Marker.hideTooltipTimeout){clearTimeout(MapToolkit.Marker.hideTooltipTimeout);MapToolkit.Marker.hideTooltipTimeout=null}this.map.bunchMarkers||this.doOnMouseOver(b);GEvent.trigger(this,"mouseover",b)};
a.onmouseout=function(){this._params.highlightImage&&this.setImage(this.icon.image);this.details=="tooltip"&&this.closeDetails();if(MapToolkit.Marker.showTooltipTimeout){clearTimeout(MapToolkit.Marker.showTooltipTimeout);MapToolkit.Marker.showTooltipTimeout=null}this.stickyTooltip&&this.hideStickyTooltip();GEvent.trigger(this,"mouseout",this.point)};
a.doOnMouseOver=function(){var b=this;if(!b.dimmed)if(b!=MapToolkit.Marker.activeMarker){MapToolkit.Marker.activeMarker=b;if(b._params.highlightImage)typeof b._params.highlightImage=="function"?b.setImage(b._params.highlightImage(b.params)):b.setImage(b._params.highlightImage);if(b.tooltip){b.log&&b.log();MapToolkit.Tooltip.show({map:b.map,point:b.point,text:b.tooltip,opacity:b.opacity,icon:b.icon,style:b._params.tooltipStyle,className:b._params.tooltipClass,priority:1});b.details="tooltip"}else b.stickyTooltip&&
b.showStickyTooltip()}};
a.showStickyTooltip=function(){var b=this;MapToolkit.Marker.showTooltipTimeout&&clearTimeout(MapToolkit.Marker.showTooltipTimeout);MapToolkit.Marker.showTooltipTimeout=setTimeout(function(){b.stickyTooltip.mayHide=true;MapToolkit.Tooltip.show({map:b.map,point:b.point,text:b.stickyTooltip.tooltip,icon:b.icon,iconOffsetX:5,style:b._params.tooltipStyle,className:b._params.tooltipClass,onmouseover:function(){b.stickyTooltip.mayHide=false;b.map.bunchMarkers.preventRestore=true},onmouseout:function(){b.stickyTooltip.mayHide=
true;b.hideStickyTooltip()}})},100)};a.hideStickyTooltip=function(){var b=this;MapToolkit.Marker.hideTooltipTimeout&&clearTimeout(MapToolkit.Marker.hideTooltipTimeout);MapToolkit.Marker.hideTooltipTimeout=setTimeout(function(){if(b.stickyTooltip.mayHide){b.map.bunchMarkers.restore();MapToolkit.Tooltip.hide({map:b.map,priority:1});MapToolkit.Marker.activeMarker=null;b.details=false}},300)};
a.closeDetails=function(){if(this.details=="tooltip")MapToolkit.Tooltip.hide({map:this.map,priority:1});else if(this.details=="infoWindow")MapToolkit.InfoWindow.hide(this._params);else this.details=="googleInfoWindow"&&this.gmap.closeInfoWindow();this.details=MapToolkit.Marker.activeMarker=null};
a.panTo=function(b,c){var d=this;c=c||100;d.zIndex=d.image.style.zIndex;d.image.style.zIndex=1E5;d.oldPoint=d.point;d.point=b;MapToolkit.Marker.showTooltipTimeout&&clearTimeout(MapToolkit.Marker.showTooltipTimeout);var e=d.gmap.fromLatLngToDivPixel(d.point);b=e.x-d.icon.iconAnchor.x;e=e.y-d.icon.iconAnchor.y;$ANIMATE(d.image,{left:b,top:e},c);d.shadow&&$ANIMATE(d.shadow,{left:b,top:e},c);setTimeout(function(){d.polyline=new GPolyline([d.oldPoint,d.point],"#555555",2,0.8);d.map.gmap.addOverlay(d.polyline)},
c)};a.dimm=function(b){this.dimmed=true;this.oldOpacity=$OPACITY(this.image);$OPACITY(this.image,b);this.shadow&&$OPACITY(this.shadow,b)};
a.restore=function(b){if(this.zIndex!=null)this.image.style.zIndex=parseFloat(this.zIndex);this.zIndex=null;if(this.oldPoint){b=b||100;this.point=this.oldPoint;this.polyline&&this.gmap.removeOverlay(this.polyline);this.polyline=null;var c=this.gmap.fromLatLngToDivPixel(this.point),d=c.x-this.icon.iconAnchor.x;c=c.y-this.icon.iconAnchor.y;$ANIMATE(this.image,{left:d,top:c},b);this.shadow&&$ANIMATE(this.shadow,{left:d,top:c},b)}this.oldPoint=null;if(this.oldOpacity!=null){$OPACITY(this.image,this.oldOpacity);
this.shadow&&$OPACITY(this.shadow,this.oldOpacity);this.oldOpacity=null}this.dimmed=false};a.remove=function(){this.closeDetails();this.image.parentNode.removeChild(this.image);this.shadow&&this.shadow.parentNode.removeChild(this.shadow)};a.copy=function(){return new MapToolkit.Marker(this._params)};
a.redraw=function(b){if(b){b=this.gmap.fromLatLngToDivPixel(this.point);this.image.style.left=b.x-this.icon.iconAnchor.x+"px";this.image.style.top=b.y-this.icon.iconAnchor.y+"px";if(this.shadow){this.shadow.style.left=b.x-this.icon.iconAnchor.x+"px";this.shadow.style.top=b.y-this.icon.iconAnchor.y+"px"}}};MapToolkit.Marker.Options={map:null,point:null,icon:null,className:null,style:null,infoWindowStyle:null,infoWindowClass:null,tooltipStyle:null,tooltipClass:null,highlightImage:null};MapToolkit.Map=function(b,c){if(GBrowserIsCompatible()){c.resources=c.resources||{};c.items=c.items||{};c.map.mapTypes=c.map.mapTypes||["G_NORMAL_MAP","G_HYBRID_MAP","G_PHYSICAL_MAP","OSM_MAP","OSM_CYCLE_MAP","G_SATELLITE_MAP"];var d=new google.maps.Map2($EL(b),{mapTypes:$MAP(c.map.mapTypes,function(m){return window[m]||alert("mapType '"+m+"' does not exists!")})});d.enableContinuousZoom();d.enableDoubleClickZoom();d.mapDiv=b;var e=this,f={visible:{},pending:{}},o=null,j="",l={},n,q=$HASH({}),t={},
r=[0,0],w=document.documentElement.clientHeight,z,i,k,h=function(m){var u=-999;$EACH(m,function(x){if(x>u)u=x});return u},g=function(m){var u=999;$EACH(m,function(x){if(x<u)u=x});return u},p=function(m){var u=0;$EACH(m,function(x){u+=x});return u},s=function(){var m=$MAP(q.values(),function(u){return u.id});m.length&&jsonRpc({url:MapToolkit.host+"/async.json",parameters:{api_key:c.api_key,version:MapToolkit.version,tileIds:$TO_JSON(m),request_id:MapToolkit.Search.requestId},callback:function(u){var x=
[];$EACH(u.tiles,function(B){B=MapToolkit.Search.convertTile(map,B,u.icons[B[0]]);if(q.get(B.id)&&!B.async){q.unset(B.id);B.count&&x.push(B)}});if(x.length){for(var D in f.visible)f.pending[D]=f.visible[D];A(x,u.requestId)}n=q.keys().length?setTimeout(s,3E3):null;I()}})},I=function(){var m={};$EACH(q.values(),function(x){m[x.resource]=true});for(var u in c.resources)$EL("spinner-"+b+u)&&!m[u]&&$EL2("spinner-"+b+u).hide()},N=function(m){var u=m.id+","+m.count;if(f.visible[u])f.pending[u]=f.visible[u];
else{m.style=c.clusters.style||"detailed";m.color=c.clusters.color||"555555";m.naming=c.clusters.naming||"Items";m.onclick=c.clusters.onclick;m.levels=c.clusters.levels;m.fixedSize=c.clusters.fixedSize;if(c.clusters.style=="simple"){m=new MapToolkit.SimpleCluster(e,m);GEvent.trigger(e,"setSimpleCluster",m)}else{m=new MapToolkit.DetailedCluster(e,m);GEvent.trigger(e,"setDetailedCluster",m)}f.pending[u]=m}},J=function(m,u){if(f.visible[m.id]&&!m.id.toString().match(/^tmp_/))f.pending[m.id]=f.visible[m.id];
else{var x=c.resources[m.resource]||c.items[m.resource]||{};x=m.icon&&typeof m.icon!="function"?new MapToolkit.Marker($EXTEND({map:e,point:$P(m),icon:m.icon,params:m},x)):{};x.params=m;x.tileI=u;f.pending[m.id]=x}},R=function(){if(c.items)for(var m in c.items)$EACH(c.items[m].ids,function(u){J({resource:m,id:u},0)})},S=function(m,u){for(var x in f.visible)if(f.pending[x]&&!x.toString().match(/^tmp_/))delete f.pending[x];else{d.removeOverlay(f.visible[x]);delete f.visible[x]}var D=[];for(x in f.pending){var B=
f.visible[x]=f.pending[x];B instanceof GOverlay?d.addOverlay(B):D.push(B);B instanceof MapToolkit.Marker&&D.push(B)}if(D.length){var E={};$EACH(D,function(M){E[M.params.resource]=E[M.params.resource]||[];E[M.params.resource].push(M.params.id+"_"+M.tileI)});v(E,m,u)}else u&&u();f.pending={}},v=function(m,u,x){MapToolkit.Search.items(e,{ids:m,callback:function(D){for(var B=[[]],E=0;E<D.items.length;E++){B[B.length-1].length>50&&B.push([]);B[B.length-1].push(D.items[E])}var M=function(O){if(O.length){var U=
O.shift();$EACH(U,function(H){var L=c.resources[H.resource]||c.items[H.resource]||{};L.detailsAs=L.detailsAs||"tooltip";var P=f.visible[H.id]?H.id:"remote_"+H.remoteid,F=f.visible[P];if(F)if(H.type=="cluster"){F=new MapToolkit.Polygon($EXTEND(H,L),e);F.params=H;GEvent.trigger(e,"setCustomCluster",F);d.addOverlay(F);f.visible[H.id]=F}else{if(!(F instanceof MapToolkit.Marker)){var K=F.params;try{var T=$P(K)}catch(X){T=$P(H)}L.icon||delete L.icon;F=new MapToolkit.Marker($EXTEND({map:e,point:T,params:H,
icon:H.icon||D.icons[K.resource]},L));F.params=K;f.visible[P]=F;d.addOverlay(F)}F.params=H;F.log=function(){e.log([H.resource,H.id,"view"])};var W=H.details[0][1];L.template&&$EACH(H.details,function(V){if(V[0]==L.template)W=V[1]});if(H.details.length)if(L.detailsAs=="googleInfoWindow")F.setGoogleInfoWindow(H.details);else if(L.detailsAs=="infoWindow")F.setInfoWindow(W,L.opacity);else if(L.detailsAs=="tooltip")F.setTooltip(W,L.opacity);else if(L.detailsAs="stickyTooltip")F.setStickyTooltip(W,L.opacity);
GEvent.addListener(F,"click",function(){e.log([H.resource,H.id,"click"]);GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction");GEvent.trigger(e,"markerClicked",F);var V=true;if(L.onclick&&L.onclick(F)==false)V=false;if(V&&(L.detailsAs=="tooltip"||L.detailsAs=="stickyTooltip")&&H.href)e.openHref(H.href)});GEvent.addListener(F,"mouseover",function(){if(H.type=="route"&&H.kml)l.timeout=setTimeout(function(){l.polyline=new GGeoXml(H.kml);d.addOverlay(l.polyline)},200);
GEvent.trigger(e,"markerMouseOver",F)});GEvent.addListener(F,"mouseout",function(){if(H.type=="route"&&H.kml){l.timeout&&clearTimeout(l.timeout);l.polyline&&d.removeOverlay(l.polyline);l={}}GEvent.trigger(e,"markerMouseOut",F)});GEvent.trigger(e,"setMarker",F)}});setTimeout(function(){M(O)},10)}else{GEvent.trigger(e,"setItemsDone");x&&x()}};M(B)}})},A=function(m,u,x){for(var D={},B=[],E=0;E<m.length;E++){var M=m[E];M.isClustered=d.getZoom()>=d.getCurrentMapType().getMaximumResolution()?false:c.resources[M.resource].clusters||
false;if(M.isClustered){D[M.xy]=D[M.xy]||[];D[M.xy].push(M)}else B.push([M])}m=[[]];D=B.concat($HASH(D).values());for(E=0;E<D.length;E++){m[m.length-1].length>5&&m.push([]);m[m.length-1].push(D[E])}var O=function(U){if(!(u<MapToolkit.Search.requestId))if(U.length){for(var H=U.shift(),L=0;L<H.length;L++){var P=H[L],F=c.resources[P[0].resource].zoom;if(!(F&&(F[0]<d.getZoom()||F[1]>d.getZoom()))){F=p($MAP(P,function(K){return K.count}));P[0].isClustered&&F>=c.clusters.threshold?N({id:P[0].xy,count:F,
lat:P[0].lat,lng:P[0].lng,north:h($MAP(P,function(K){return K.north})),east:h($MAP(P,function(K){return K.east})),south:g($MAP(P,function(K){return K.south})),west:g($MAP(P,function(K){return K.west}))}):$EACH(P,function(K){var T=K.items;if((K=c.resources[K.resource].markerLimitPerTile)&&T.length>K)T=T.splice(0,K);for(K=0;K<T.length;K++)J(T[K],K)})}}setTimeout(function(){O(U)},10)}else{GEvent.trigger(e,"setTilesDone");S(u,x)}};O(m)};e.gmap=d;e.config=c;e.div=b;e.editor=null;e.planner=null;e.isFullscreen=
false;e.reset=function(){f.pending={};S();MapToolkit.InfoWindow.hide({map:e})};e.log=function(m,u){jsonRpc({url:MapToolkit.host+"/log",parameters:{api_key:c.api_key,log:$TO_JSON(m)},callback:u||function(){}})};e.getMousePoint=function(){var m=new GPoint(r[0],r[1]);return d.fromContainerPixelToLatLng(m)};this.enableScrollWheelZoom=function(){var m=function(u){if(!u)u=window.event;u.preventDefault&&u.preventDefault();u.returnValue=false};z=GEvent.addDomListener(d.getContainer(),"DOMMouseScroll",m);
d.getContainer().onmousewheel=m;d.enableScrollWheelZoom()};this.disableScrollWheelZoom=function(){d.disableScrollWheelZoom();z&&GEvent.removeListener(z);z=d.getContainer().onmousewheel=null};e.addControl=function(m,u){var x=MapToolkit.classForSting(m);u=u||(m.match(/^G/)?new x:new x(e));t[m]=u;d.addControl(u)};e.removeControl=function(m){t[m]&&d.removeControl(t[m]);delete t[m]};e.getItems=function(){return $HASH(f.visible).values()};e.getItemById=function(m){return f.visible[m]};e.getMarkerById=function(m){return f.visible[m]};
e.getVisibleItems=function(m){var u=0,x=[],D=d.getBounds();$EACH(k.tiles,function(B){if(B.resource==m){var E=$GREP($MAP(B.items,function(O){if(D.contains($P(O)))return O}),function(O){return O});x=x.concat(E);var M=new GLatLngBounds($P(B.south,B.west),$P(B.north,B.east));u+=D.containsBounds(M)?B.count:E.length}});return{count:u,items:x}};e.openHref=function(m){location.href=m};e.initEditor=function(){if(!e.editor&&MapToolkit.RouteEditor)e.editor=new MapToolkit.RouteEditor(e);return e.editor};e.getCurrentMapTypeIndex=
function(){for(var m=0,u=d.getMapTypes(),x=0;x<u.length;x++)if(u[x]==d.getCurrentMapType())m=x;return m};e.updateLayer=function(m,u){c.layers[m].optional=u?false:true;m=c.layers[m].layer;u?d.addOverlay(m):d.removeOverlay(m);if(u){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction")}};e.updateResource=function(m,u,x){if(u){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction")}c.resources[m].optional=u?false:true;this.modified(x)};e.modified=
function(m){GEvent.trigger(e,"willBeModifyed");var u={};for(var x in c.resources){var D=c.resources[x],B=d.getZoom();if(!D.optional&&(!D.zoom||D.zoom[0]<=B&&D.zoom[1]>=B))u[x]={filter:D.filter,icon:D.icon&&1,notmp:D.notmp}}MapToolkit.Search.tiles(e,{resources:u,callback:function(E){if(E.status==403)alert("invalid MapToolkit api_key for host "+location.hostname);else if(MapToolkit.Search.requestId==E.requestId){k=E;q=$HASH({});if(!E.tiles.length&&!$HASH(E.clusters).keys().length){f.pending={};R();
S();GEvent.trigger(e,"modifiedDone",E);m&&m($HASH(E.icons).keys())}else{$EACH(E.tiles,function(O){O.async&&q.set(O.id,O)});if(q.keys().length&&!n)n=setTimeout(s,3E3);R();for(var M in E.clusters)$EACH(E.clusters[M],function(O){J({resource:M,id:O},0)});A(E.tiles,E.requestId,function(){GEvent.trigger(e,"modifiedDone",E);m&&m($HASH(E.icons).keys())})}I();GEvent.trigger(e,"modified",E)}}})};e.setFullscreen=function(m){e.isFullscreen=m;e.resize();GEvent.trigger(e,"setFullscreen",m)};e.resize=function(){MapToolkit.resizeDiv(b,
e.isFullscreen,c);setTimeout(function(){var m=d.getCenter();d.checkResize();d.setCenter(m);GEvent.trigger(e,"resize",d.getSize().width,d.getSize().height)},1)};e.updateLocationHash=function(m){if(c.map.useLocationHash){var u=d.getCenter().lat(),x=d.getCenter().lng(),D=d.getZoom(),B=e.getCurrentMapTypeIndex();if(!(!m&&c.map.location.lat==u&&c.map.location.lng==x&&c.map.location.zoom==D&&$INARRAY(c.map.mapTypes,c.map.mapType||c.map.mapTypes[0])==B)){this.setLocationHash("lt="+u+"&ln="+x+"&z="+D+"&t="+
B);GEvent.trigger(e,"updateLocationHash")}}};e.setLocationHash=function(m){j="#"+m;location.hash=m};e.checkLocationHash=function(){var m=null;if(location.hash!=j){if(location.hash.match(/lt=([\-?\d\.]+)&ln=([\-?\d\.]+)&z=(\d+)&t=(\d)(\&(.*))?$/)){var u=parseFloat(RegExp.$1),x=parseFloat(RegExp.$2),D=parseInt(RegExp.$3);m=parseInt(RegExp.$4);GEvent.trigger(e,"checkLocationHash",RegExp.$6);m={lat:u,lng:x,zoom:D,type:m}}else{u=c.map.location;m=$INARRAY(c.map.mapTypes,c.map.mapType||c.map.mapTypes[0]);
if(m==-1)m=0;if(u.north){u=new GLatLngBounds(new GLatLng(u.south,u.west),new GLatLng(u.north,u.east));m={lat:u.getCenter().lat(),lng:u.getCenter().lng(),zoom:d.getBoundsZoomLevel(u),type:m}}else m={lat:u.lat,lng:u.lng,zoom:u.zoom,type:m}}d.setCenter(new GLatLng(m.lat,m.lng),m.zoom,d.getMapTypes()[m.type]);j=location.hash}setTimeout(function(){e.checkLocationHash()},500);return m};MapToolkit.setMap(b,e);GEvent.trigger(window,"MapToolkit.Map.beforeInit",e);if(c.menu==null||c.menu){c.menu=c.menu||"MapToolkit.OptionalControl";
var C=new (MapToolkit.classForSting(c.menu))(e);if(C.categories.length){e.addControl("MapToolkit.OptionalControl",C);c.map.optionalControl=true}}if(c.editor)e.addControl(c.editor.className||"MapToolkit.RouteEditorControl");if(c.upload)e.addControl(c.upload.className||"MapToolkit.UploadControl");for(var G in c.layers){C=c.layers[G];C.layer=new GLayer(C.id);C.optional||setTimeout(function(m,u){return function(){d.addOverlay(u)}}(map,C.layer),1)}G=c.map.useLocationHash?e.checkLocationHash():null;var y=
c.map.location;if(y.north!=null&&y.east!=null&&y.south!=null&&y.west!=null){C=new GLatLngBounds(new GLatLng(y.south,y.west),new GLatLng(y.north,y.east));y.lat=C.getCenter().lat();y.lng=C.getCenter().lng();y.zoom=d.getBoundsZoomLevel(C)}else if(y.geoip){if(MapToolkit.location.lat!=null)y.lat=MapToolkit.location.lat;if(MapToolkit.location.lng!=null)y.lng=MapToolkit.location.lng;if(MapToolkit.location.lat!=null&&y.geoipZoom)y.zoom=y.geoipZoom}C=G?G.lat:y.lat;var Q=G?G.lng:y.lng;y=G?G.zoom:y.zoom;G=G?
d.getMapTypes()[G.type]:eval(c.map.mapType||c.map.mapTypes[0]);C=$P(C,Q);d.setCenter(C,y,G);i=d.fromLatLngToDivPixel(C);c.map.controls&&$MAP(c.map.controls,function(m){try{e.addControl(m)}catch(u){alert("cannot add mapControl "+m+"', details: "+u+"'")}});e.modified();GEvent.addListener(d,"moveend",function(){e.updateLocationHash();e.modified();var m=d.fromLatLngToDivPixel(d.getCenter());if(Math.abs(i.x-m.x)>10||Math.abs(i.y-m.y)>10){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,
"interaction")}i=m});GEvent.addListener(d,"maptypechanged",function(){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction")});GEvent.addListener(d,"zoomend",function(){e.reset();GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction")});GEvent.addDomListener(window,"resize",function(){if(w!=document.documentElement.clientHeight){w=document.documentElement.clientHeight;o&&clearTimeout(o);o=setTimeout(function(){e.resize();e.modified()},200)}},
false);this.enableScrollWheelZoom();GEvent.trigger(e,"init");GEvent.trigger(window,"MapToolkit.Map.init",e);$EVENT(b,"mousemove",function(m){r=[m.clientX,m.clientY]});if(c.circleBunchMarkers==null||c.circleBunchMarkers)e.bunchMarkers=new MapToolkit.BunchMarkers(e);if(c.planner)e.planner=window.planner=new MapToolkit.RoutePlanner(e);return e}else alert("cannot create map, because Browser is not compatible!")};MapToolkit.Search={requestId:0,timeout:null,convertTile:function(b,c,d){for(var e={resource:c.shift(),x:c.shift(),y:c.shift(),key:c.shift(),lat:c.shift(),lng:c.shift(),north:c.shift(),east:c.shift(),south:c.shift(),west:c.shift(),time:c.shift(),async:c.shift(),count:parseInt(c.shift()),items:[]};c.length;)e.items.push({lat:c.shift(),lng:c.shift(),id:c.shift(),remoteid:c.shift(),resource:e.resource,icon:b&&b.config.resources[e.resource].icon||d});e.xy=[e.x,e.y].join(",");e.id=[e.resource,e.x,e.y,e.key].join(",");
return e},items:function(b,c){for(var d=[],e=false;!e;){e=true;var f={};for(var o in c.ids)if(0+c.ids[o].length>300){var j=300;if(j>=c.ids[o].length)j=c.ids[o].length-1;f[o]=c.ids[o].splice(0,j)}else{f[o]=c.ids[o];delete c.ids[o]}d.push(f);for(o in c.ids)e=false}var l={};for(var n in b.config.resources)if(b.config.resources[n].templates)l[n]=b.config.resources[n].templates;var q={},t=function(r){jsonRpc({url:c.href||MapToolkit.host+"/items.json",parameters:{version:MapToolkit.version,api_key:b.config.api_key,
request_id:MapToolkit.Search.requestId,charset:b.config.charset||"",language:b.config.language||MapToolkit.language,ids:$TO_JSON(r),templates:$TO_JSON(l),static_map:c.staticMap?$TO_JSON(c.staticMap):""},callback:function(w){q={icons:$EXTEND(q.icons||{},w.icons),items:(q.items||[]).concat(w.items),requestId:w.requestId};d.length?t(d.shift()):c.callback(q)}})};t(d.shift())},tiles:function(b,c){this.requestId++;this.cancel();this.timeout=setTimeout(function(){jsonRpc({url:c.href||MapToolkit.host+"/tiles.json",
parameters:{version:MapToolkit.version,charset:b.config.charset||"",request_id:MapToolkit.Search.requestId,api_key:b.config.api_key,language:b.config.language||MapToolkit.language,query:c.query||MapToolkit.FulltextSearch.query[b.div]||"",resources:$TO_JSON(c.resources),zoom:b.gmap.getZoom(),north:b.gmap.getBounds().getNorthEast().lat(),east:b.gmap.getBounds().getNorthEast().lng(),south:b.gmap.getBounds().getSouthWest().lat(),west:b.gmap.getBounds().getSouthWest().lng(),num_x:parseInt(b.gmap.getSize().width/
128)+2,num_y:parseInt(b.gmap.getSize().height/128)+2},callback:function(d){var e=MapToolkit.Search.convertTile;d.tiles=$MAP(d.tiles,function(f){return e(b,f,d.icons[f[0]])});c.callback(d)}})},200)},cancel:function(){this.timeout&&clearTimeout(this.timeout);this.timeout=null}};MapToolkit.highlightedPolygon=null;MapToolkit.PolygonTooltip=null;MapToolkit.PolygonMouseOver=null;
MapToolkit.Polygon=function(b,c){var d=this,e=$MAP(b.polygon.polylines,function(f){return{points:f.points,levels:f.levels,numLevels:f.numLevels||0,zoomFactor:f.zoomFactor||0,color:b.polygon.color||"#ff0000",weight:b.polygon.weight||0,opacity:1}});e=new GPolygon.fromEncoded({polylines:e,fill:true,color:b.polygon.color,opacity:b.polygon.opacity,outline:true},{clickable:b.polygon.active?true:false});e.highlight=function(f){d.highlight(f)};d.polygon=e;d.map=c;d.gmap=c.gmap;d.params=b;d.detailWindow=null;
d.point=e.getBounds().getCenter();if(b.polygon.active){GEvent.addListener(e,"mouseover",function(){if(MapToolkit.PolygonMouseOver!=d){MapToolkit.PolygonMouseOver=d;d.onMouseOver(c.getMousePoint())}});GEvent.addListener(e,"mouseout",function(){if(MapToolkit.PolygonMouseOver==d){MapToolkit.PolygonMouseOver=null;d.onMouseOut(c.getMousePoint())}});GEvent.addListener(e,"mousemove",function(){if(MapToolkit.PolygonMouseOver==d)d.onMouseMove(c.getMousePoint());else{MapToolkit.PolygonMouseOver.onMouseOut(c.getMousePoint());
d.onMouseOver(c.getMousePoint());MapToolkit.PolygonMouseOver=d}})}return e};a=MapToolkit.Polygon.prototype;
a.onClick=function(b){if(this.params.onclick)this.params.onclick(b);else if(this.params.infoWindow)MapToolkit.InfoWindow.show({map:this.map,point:b,text:this.params.infoWindow,opacity:this.params.opacity,style:this.params.infoWindowStyle,className:this.params.infoWindowClassName});else if(this.params.googleInfoWindow)this.gmap.openInfoWindowHtml(b,this.params.infoWindow);else{var c=this.gmap.getBoundsZoomLevel(this.polygon.getBounds())+1;if(c<=this.gmap.getZoom())c=this.gmap.getZoom()+1;this.gmap.setCenter(b,
c)}};a.highlight=function(b){var c=this;setTimeout(function(){if(b){MapToolkit.highlightedPolygon&&MapToolkit.highlightedPolygon.highlight(false);MapToolkit.highlightedPolygon=c;c.polygon.setFillStyle({opacity:parseFloat(c.params.polygon.opacity)+0.15})}else{MapToolkit.highlightedPolygon=null;c.polygon.setFillStyle({opacity:c.params.polygon.opacity})}},1)};
a.onMouseOver=function(b){this.params.tooltip&&MapToolkit.Tooltip.show({map:this.map,point:b,text:this.params.tooltip,opacity:this.params.opacity,style:this.params.tooltipStyle,className:this.params.tooltipClassName})};a.onMouseMove=function(b){this.params.tooltip&&MapToolkit.Tooltip.move({map:this.map,point:b})};a.onMouseOut=function(){this.params.tooltip&&MapToolkit.Tooltip.hide({map:this.map})};var clusterOnClickHandlers={},clusterOnClick=null,clusterOpacity={},clusterHighlightTimeout={},clusterHighlightOn=function(b,c,d,e,f){clusterHighlightTimeout[b+c]&&clearTimeout(clusterHighlightTimeout[b+c]);clusterHighlightTimeout[b+c]=null;clusterOpacity[b+c]||(clusterOpacity[b+c]=$OPACITY(d));$OPACITY(d,0.7);$EL2(e).show();clusterOnClick&&GEvent.removeListener(clusterOnClick);clusterOnClick=GEvent.addListener(MapToolkit.getMap(b).gmap,"click",function(){clusterOnClickHandlers[c]&&clusterOnClickHandlers[c](b,
f);GEvent.removeListener(clusterOnClick);clusterOnClick=null})},clusterHighlightOff=function(b,c,d,e){clusterHighlightTimeout[b+c]||(clusterHighlightTimeout[b+c]=setTimeout(function(){$OPACITY(d,clusterOpacity[b+c]);clusterOpacity[b+c]=null;$EL2(e).hide();clusterOnClick&&GEvent.removeListener(clusterOnClick);clusterOnClick=null},1))};MapToolkit.DetailedCluster=function(b,c){this.params=c;this.mapDiv=b.div;return this};MapToolkit.DetailedCluster.prototype=new GOverlay;a=MapToolkit.DetailedCluster.prototype;
a.initialize=function(b){this.map=b;var c=this.params.color,d=$MAP(this.params.color.split(""),function(n){n=n.toLowerCase();n="0123456789abcdef".indexOf(n);n-=2;if(n<0)n=0;return"0123456789abcdef".charAt(n)}).join("");this.cluster=document.createElement("span");this.cluster.style.display="block";this.cluster.style.position="absolute";this.redraw(true);var e=this.mapDiv,f=MapToolkit.getMap(this.mapDiv);clusterOnClickHandlers[this.params.id]=this.params.onclick||function(n,q){n=q.getCenter();var t=
b.getBoundsZoomLevel(q);t==b.getZoom()&&t++;if(t>b.getCurrentMapType().getMaximumResolution())t=b.getCurrentMapType().getMaximumResolution();q=f.config.map.mapTypes[f.getCurrentMapTypeIndex()];if(q=="G_SATELLITE_MAP"||q=="G_HYBRID_MAP")b.getCurrentMapType().getMaxZoomAtLatLng(n,function(r){r.zoom&&r.zoom<t&&MapToolkit.MapTypesControl.setMapType(e,G_NORMAL_MAP,$EL("mtk-maptype-normal-"+e))});b.setCenter(n,t)};var o="new GLatLngBounds($P("+this.params.south+","+this.params.west+"),$P("+this.params.north+
","+this.params.east+"))",j="clusterOnClickHandlers['"+this.params.id+"'](MapToolkit.maps['"+this.mapDiv+"'].map,"+o+")",l;l=this.params.levels||[19,39,69,99,150];l=this.params.count<l[0]?"a":this.params.count<l[1]?"b":this.params.count<l[2]?"c":this.params.count<l[3]?"d":this.params.count<l[4]?"e":"f";this.cluster.innerHTML='<div class="mtk-cluster" style="width:'+width+"px;height:"+height+'px;"><div class="mtk-background'+l+'" style="width:'+width+"px;height:"+height+'px;"><b class="mtk-x1h" style="background: #'+
c+'"></b><b class="mtk-x2h" style="background: #'+c+'"></b><b class="mtk-x3h" style="background: #'+c+'"></b><b class="mtk-x4h" style="background: #'+c+'"></b><div class="mtk-contentx" style="height:'+(height-10)+"px;background: #"+c+'">&nbsp;</div><b class="mtk-x4bh" style="background: #'+c+'"></b><b class="mtk-x3bh" style="background: #'+c+'"></b><b class="mtk-x2bh" style="background: #'+c+'"></b><b class="mtk-x1h" style="background: #'+c+'"></b></div><div class="mtk-background'+l+'b" onmouseover="clusterHighlightOn(\''+
this.mapDiv+"','"+this.params.id+"',$PREVIOUS(this),$NEXT($NEXT(this)),"+o+')" onmouseout="clusterHighlightOff(\''+this.mapDiv+"','"+this.params.id+'\',$PREVIOUS(this),$NEXT($NEXT(this)))" style="width:'+width+"px;height:"+height+'px;"><b class="mtk-x1h" style="background: #'+d+';"></b><b class="mtk-x2h" style="border-right:4px solid #'+d+"; border-left:4px solid #"+d+"; background:#"+d+';"></b><b class="mtk-x3h" style="border-right:3px solid #'+d+"; border-left:3px solid #"+d+';"></b><b class="mtk-x4h" style="border-right:2px solid #'+
d+"; border-left:2px solid #"+d+';"></b><div class="mtk-contentx" style=" border-right:2px solid #'+d+"; border-left:2px solid #"+d+";height:"+(height-10)+'px">&nbsp;</div><b class="mtk-x4bh" style="border-right:2px solid #'+d+"; border-left:2px solid #"+d+';"></b><b class="mtk-x3bh" style="border-right:3px solid #'+d+"; border-left:3px solid #"+d+';"></b><b class="mtk-x2bh" style="border-right:4px solid #'+d+"; border-left:4px solid #"+d+"; background:#"+d+';"></b><b class="mtk-x1h" style="background: #'+
d+';"></b></div><div class="mtk-text1" onmouseover="clusterHighlightOn(\''+this.mapDiv+"','"+this.params.id+"',$PREVIOUS($PREVIOUS(this)),$NEXT(this),"+o+')" onmouseout="clusterHighlightOff(\''+this.mapDiv+"','"+this.params.id+'\',$PREVIOUS($PREVIOUS(this)),$NEXT(this))"><a href="#" onclick="'+j+';return false" style="float:right;"><img src="http://mtk2.toursprung.com/static/images/zoom.gif" border="0" /></a></div><div class="mtk-text2" style="display:none" onmouseover="clusterHighlightOn(\''+this.mapDiv+
"','"+this.params.id+"',$PREVIOUS($PREVIOUS($PREVIOUS(this))),$EL(this),"+o+')" onmouseout="clusterHighlightOff(\''+this.mapDiv+"','"+this.params.id+'\',$PREVIOUS($PREVIOUS($PREVIOUS(this))),$EL(this))"><a href="#" onclick="return false" >'+this.params.count+" "+(this.params.naming||MapToolkit.i18n.clusters_naming)+" </a></div></div>";b.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(this.cluster)};
a.redraw=function(b){if(b){b=80;minHeight=50;if(this.params.fixedSize)minHeight=b=120;var c=this.map.fromLatLngToDivPixel($P(this.params.lat,this.params.lng)),d=this.map.fromLatLngToDivPixel($P(this.params.north,this.params.east)),e=this.map.fromLatLngToDivPixel($P(this.params.south,this.params.west));width=d.x-e.x;height=e.y-d.y;clusterTop=d.y;clusterLeft=e.x;if(width<b){clusterLeft-=parseInt((b-width)/2+1);width=b}if(height<minHeight){clusterTop-=parseInt((minHeight-height)/2+1);height=minHeight}width+=
8-width%8;height+=8-height%8;if(width>120)width=120;if(height>120)height=120;clusterTop+=8-clusterTop%8;for(clusterLeft+=8-clusterLeft%8;clusterTop+height>=c.y+64;)clusterTop-=8;for(;clusterTop<=c.y-64;)clusterTop+=8;for(;clusterLeft+width>=c.x+64;)clusterLeft-=8;for(;clusterLeft<=c.x-64;)clusterLeft+=8;this.cluster.style.top=clusterTop+"px";this.cluster.style.left=clusterLeft+"px"}};a.remove=function(){this.map.getPane(G_MAP_MARKER_SHADOW_PANE).removeChild(this.cluster)};a.getZindex=function(){return 1};
a.copy=function(){};a.type=function(){return this.params.type};a.hide=function(){this.cluster.style.display="none"};a.show=function(){this.cluster.style.display="block"};MapToolkit.SimpleCluster=function(b,c){var d;d=c.count<10?MapToolkit.Icon.get({image:"http://mtk2.toursprung.com/static/images/cluster/a.png",iconSize:[53,53],iconAnchor:[27,27]}):c.count<100?MapToolkit.Icon.get({image:"http://mtk2.toursprung.com/static/images/cluster/b.png",iconSize:[56,56],iconAnchor:[28,28]}):c.count<1E3?MapToolkit.Icon.get({image:"http://mtk2.toursprung.com/static/images/cluster/c.png",iconSize:[66,66],iconAnchor:[33,33]}):c.count<1E4?MapToolkit.Icon.get({image:"http://mtk2.toursprung.com/static/images/cluster/d.png",
iconSize:[78,78],iconAnchor:[36,36]}):MapToolkit.Icon.get({image:"http://mtk2.toursprung.com/static/images/cluster/e.png",iconSize:[90,90],iconAnchor:[45,45]});var e=new GLatLngBounds($P(c.south,c.west),$P(c.north,c.east));this.prototype=new MapToolkit.Marker({map:b,point:this.bounds.getCenter(),icon:d,label:c.count});this.onclick=(this.onclick=c.onclick&&function(){c.onclick(b,e)})||function(){var f=b.gmap.getBoundsZoomLevel(that.bounds);f==b.gmap.getZoom()&&f++;b.gmap.setCenter(that.bounds.getCenter(),
f)};return this};MapToolkit.Icon=function(b){var c=new GIcon;$EXTEND(c,{image:b.image,iconSize:new GSize(b.iconSize[0],b.iconSize[1]),iconAnchor:new GPoint(b.iconAnchor[0],b.iconAnchor[1])});b.shadow&&$EXTEND(c,{shadow:b.shadow,shadowSize:new GSize(b.shadowSize[0],b.shadowSize[1])});b.infoWindowAnchor?$EXTEND(c,{infoWindowAnchor:new GPoint(b.infoWindowAnchor[0],b.infoWindowAnchor[1])}):$EXTEND(c,{infoWindowAnchor:new GPoint(b.iconAnchor[0],b.iconAnchor[1])});return c};MapToolkit.Icon.icons={};
MapToolkit.Icon.reset=function(){MapToolkit.Icon.icons={}};MapToolkit.Icon.get=function(b){if(!b)return G_DEFAULT_ICON;if(b instanceof GIcon)return b;MapToolkit.Icon.icons[b.image]||(MapToolkit.Icon.icons[b.image]=new MapToolkit.Icon(b));return MapToolkit.Icon.icons[b.image]};MapToolkit.Icon.Options={image:null,iconSize:null,iconAnchor:null,shadow:null,shadowSize:null,infoWindowAnchor:null};MapToolkit.FulltextSearch={query:{}};MapToolkit.LocationSearch=function(b,c,d){c=$EL(c);d=d||{};var e,f=-1,o,j=c.id,l=false,n=c.value,q=new GClientGeocoder,t=MapToolkit.location&&MapToolkit.location.country?MapToolkit.location.country:b.config.country||"",r=function(){$EL2(j+"-cancel")&&$EL2(j+"-cancel").hide();$EL2(j+"-spinner")&&$EL2(j+"-spinner").show()},w=function(){$EL2(j+"-cancel")&&$EL2(j+"-cancel").show();$EL2(j+"-spinner")&&$EL2(j+"-spinner").hide()},z=function(h){r();l=false;if(t&&!h.match(/,/))h=h+","+t;q.getLocations(h,function(g){w();
if(!l&&g&&g.Status.code==200){f=-1;var p=document.createElement("ul");p.id=j+"-result-list";$EACH(g.Placemark,function(s){var I=document.createElement("li");I.className="mtk-locationsearch-result-li";I.onclick=function(){var N=1;N=s.AddressDetails.Accuracy>=9?17:s.AddressDetails.Accuracy>=6?15:s.AddressDetails.Accuracy>=4?13:s.AddressDetails.Accuracy>2?7:4;if(s.ExtendedData&&s.ExtendedData.LatLonBox){var J=s.ExtendedData.LatLonBox;N=$P(J.south,J.west);J=$P(J.north,J.east);N=new GLatLngBounds(N,J);
N=b.gmap.getBoundsZoomLevel(N)}J=$P(s.Point.coordinates[1],s.Point.coordinates[0]);c.value=s.address;(d.onselect||function(R,S,v){b.gmap.setCenter(S,v)})(s.address,J,N);$EL2(j+"-result").hide()};I.innerHTML=s.address.replace(/ /g,"&nbsp;");p.appendChild(I)});e&&$EL(j+"-result").removeChild(e);$EL(j+"-result").appendChild(e=p);p.childNodes.length&&$EL2(j+"-result").show()}})},i=function(h){var g=$EL(j+"-result-list"),p=g.childNodes.length;if(h=="down"){f++;if(f>=p)f=p-1}else{f--;if(f<0)f=0}for(h=0;h<
p;h++)g.childNodes[h].className=f==h?"mtk-locationsearch-result-li-selected":"mtk-locationsearch-result-li"},k=function(){l=true;w();c.value=n;$EL2(j+"-result").hide();$ADD_CLASS(c,"mtk-locationsearch-grey");c.blur()};c.setAttribute("autocomplete","off");c.onkeypress=function(h){return(h||window.event).keyCode!=13};c.onkeyup=function(h){var g=(h||window.event).keyCode;if(h.preventDefault)h.preventDefault();else h.returnValue=false;if(g==40)return i("down");else if(g==38)return i("up");else if(g==
13){c.blur();try{if(f==-1)f=0;$EL(j+"-result-list").childNodes[f].onclick();return false}catch(p){}}else if(h.keyCode==27)return k();o&&clearTimeout(o);o=setTimeout(function(){c.value?z(c.value):k()},200)};c.onclick=function(){if(c.value==n)c.value="";$REMOVE_CLASS(c,"mtk-locationsearch-grey")};if($EL(j+"-cancel"))$EL(j+"-cancel").onclick=k;k()};MapToolkit.LocationSearchControl=function(b){var c="mtk-locationsearch-"+b.div,d=document.createElement("input");d.id=c;d.className="mtk-locationsearch-query";d.type="text";d.value=MapToolkit.i18n.location;var e=document.createElement("img");e.className="mtk-locationsearch-loupe";e.width=17;e.height=12;e.src=MapToolkit.host+"/static/images/search/loupe_single.png";var f=document.createElement("img");f.id=c+"-cancel";f.src=MapToolkit.host+"/static/images/search/cancel.png";f.className="mtk-locationsearch-cancel";
f.width=11;f.height=11;var o=document.createElement("img");o.id=c+"-spinner";o.src=MapToolkit.host+"/static/images/search/loader.gif";o.className="mtk-locationsearch-cancel";o.width=11;o.height=11;o.style.display="none";var j=document.createElement("div");j.id=c+"-result";j.className="mtk-locationsearch-result";j.style.display="none";this.initialize=function(l){var n=document.createElement("div");n.className="mtk-locationsearch";n.appendChild(d);n.appendChild(e);n.appendChild(f);n.appendChild(o);
n.appendChild(j);l.getContainer().appendChild(n);new MapToolkit.LocationSearch(b,d);return n};this.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(80,7))}};MapToolkit.LocationSearchControl.prototype=new GControl;MapToolkit.MapTypesControl=function(b){var c=b.getCurrentMapTypeIndex(),d='<div class="mtk-maptypes-container"><div class="mtk-maptypes-more" onclick="$VISIBLE(\'mtk-maptypes-more-'+b.div+"') ? $BLINDUP('mtk-maptypes-more-"+b.div+"', { duration: 0.2 }) : $BLINDDOWN('mtk-maptypes-more-"+b.div+'\', { duration: 0.2 });">&nbsp;</div><div class="mtk-maptypes-button '+(c==2?"mtk-maptypes-active":"mtk-maptypes-inactive")+'" onclick="MapToolkit.MapTypesControl.setMapType(\''+b.div+"', G_PHYSICAL_MAP, this)\">"+
MapToolkit.i18n["maptype: terrain"]+'</div><div class="mtk-maptypes-button '+(c==1?"mtk-maptypes-active":"mtk-maptypes-inactive")+'" onclick="MapToolkit.MapTypesControl.setMapType(\''+b.div+"', G_HYBRID_MAP, this)\">"+MapToolkit.i18n["maptype: satellite with labels"]+'</div><div class="mtk-maptypes-button '+(c==0?"mtk-maptypes-active":"mtk-maptypes-inactive")+'" onclick="MapToolkit.MapTypesControl.setMapType(\''+b.div+'\', G_NORMAL_MAP, this)" id="mtk-maptype-normal-'+b.div+'">'+MapToolkit.i18n["maptype: map"]+
'</div><div id="mtk-maptypes-more-'+b.div+'" class="mtk-maptypes-more-menu" style="display:none;"><ul><li onclick="$EL2(\'mtk-maptypes-more-'+b.div+"').hide();MapToolkit.MapTypesControl.setMapType('"+b.div+"', OSM_MAP)\">"+MapToolkit.i18n["maptype: openstreetmap"]+"</li><li onclick=\"$EL2('mtk-maptypes-more-"+b.div+"').hide();MapToolkit.MapTypesControl.setMapType('"+b.div+"', OSM_CYCLE_MAP)\">"+MapToolkit.i18n["maptype: opencyclemap"]+"</li><li onclick=\"$EL2('mtk-maptypes-more-"+b.div+"').hide();MapToolkit.MapTypesControl.setMapType('"+
b.div+"', G_SATELLITE_MAP)\">"+MapToolkit.i18n["maptype: satellite"]+"</li></ul></div></div>";this.initialize=function(e){var f=document.createElement("div");f.innerHTML=d;e.getContainer().appendChild(f);$EL(f).pngFix&&$EL(f).pngFix();return f};this.getDefaultPosition=function(){var e=10;if($INARRAY(b.config.map.controls,"MapToolkit.FullscreenIconControl")!=-1)e+=24;return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(e,10))};return this};MapToolkit.MapTypesControl.prototype=new GControl;
MapToolkit.MapTypesControl.setMapType=function(b,c,d){b=MapToolkit.getMap(b);b.gmap.setMapType(c);b.updateLocationHash("force");$EACH($CLASS("mtk-maptypes-button"),function(e){if(d==e){$ADD_CLASS(e,"mtk-maptypes-active");$REMOVE_CLASS(e,"mtk-maptypes-inactive")}else{$REMOVE_CLASS(e,"mtk-maptypes-active");$ADD_CLASS(e,"mtk-maptypes-inactive")}})};MapToolkit.Streetview=function(b){var c,d,e,f=b.map,o="hidden",j=$EL(b.img);new GClientGeocoder;var l=new GStreetviewOverlay;new GStreetviewClient;var n=new GDraggableObject(j,{left:0,top:0}),q=function(i){i=i||0;return f.gmap.fromContainerPixelToLatLng(new GPoint(n.left+b.position.offset.width+b.icon.iconAnchor.x,n.top+b.position.offset.height+b.icon.iconAnchor.y+i))},t=function(i,k,h){var g=f.gmap.fromLatLngToContainerPixel(i);g=f.gmap.fromContainerPixelToLatLng(new GPoint(g.x+10,g.y+10));h=parseInt(h||
g.distanceFrom(i));jsonRpc({url:"http://www.google.com/cbk",parameters:{output:"json",oe:"utf-8",cb_client:"api",ll:i.lat()+","+i.lng(),radius:h},callback:function(p){if(p){p=p.Location;return k&&k($P(p),p,h)}k&&k()}})},r=function(){j.src=b.icon.image;$EL2(j).show();f.gmap.removeOverlay(l);n.moveTo(new GPoint(0,0));o="hidden"},w=function(){var i=f.gmap.getCenter();t(i,function(k){j.src=k&&f.gmap.getBounds().containsLatLng(k)?b.icon.image:b.grey},f.gmap.getBounds().getNorthEast().distanceFrom(i))},
z=function(i){i=f.gmap.fromLatLngToContainerPixel(i);n.moveTo(new GPoint(i.x-b.icon.iconAnchor.x-b.position.offset.width,i.y-b.icon.iconAnchor.y-b.position.offset.height))};GEvent.addListener(f.gmap,"moveend",w);j.onmouseover=function(){if(o=="hidden"){f.gmap.addOverlay(l);o="visible"}};j.onmouseout=function(){if(o=="visible"){f.gmap.removeOverlay(l);o="hidden"}};GEvent.addListener(n,"mousedown",function(){o="find"});GEvent.addListener(n,"dragstart",function(){d&&GEvent.removeListener(d);f.gmap.closeInfoWindow();
n.moveBy(new GSize(0,-20));j.src=b.target});GEvent.addListener(n,"drag",function(){MapToolkit.Tooltip.hide({map:f,className:"mtk-tooltip-streetview"});c&&clearTimeout(c);c=setTimeout(function(){t(q(20),function(i,k,h){if(c)if(i){j.src=b.target;i="http://maps.google.com/cbk?output=thumbnail&w=100&h=70&radius="+h+"&ll="+k.lat+","+k.lng;k=k.description+", "+k.region+", "+k.country;MapToolkit.Tooltip.show({map:f,point:q(),text:'<img src="'+i+'" width="100" height="70" /><br />'+k,icon:b.icon,className:"mtk-tooltip-streetview"})}else if(b.targetGrey)j.src=
b.targetGrey})},200)});GEvent.addListener(n,"dragend",function(){o="streetview";c&&clearTimeout(c);c=0;n.moveBy(new GSize(0,20));j.src=b.icon.image;MapToolkit.Tooltip.hide({map:f,className:"mtk-tooltip-streetview"});t(q(),function(i){if(!i)return r();e=i;z(i);var k=document.createElement("div");k.style.marginTop="10px";k.style.width="600px";k.style.height="400px";var h=new GStreetviewPanorama(k);GEvent.addListener(h,"error",function(g){if(g==603)k.innerHTML='StreetView requires flash plugin. Click <a href="http://get.adobe.com/flashplayer/" target="_blank"> here</a> to download';
if(g==600)k.innerHTML="No street view available"});GEvent.addListener(h,"initialized",function(g){var p=f.gmap.getCenter(),s=g.lat-e.lat(),I=g.lng-e.lng();f.gmap.setCenter($P(p.lat()+s,p.lng()+I));e=g.latlng;f.gmap.getInfoWindow().reset(e);z(e)});f.gmap.openInfoWindow(i,k,{noCloseOnClick:true});setTimeout(function(){h.setLocationAndPOV(i)},100);GEvent.addListener(f.gmap.getInfoWindow(),"closeclick",r);d=GEvent.addListener(f.gmap,"move",function(){o=="streetview"&&z(e)})})});w()};MapToolkit.StreetviewControl=function(b){var c=this,d=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(17,303)),e=MapToolkit.Icon.get({image:"http://mtk2.toursprung.com/static/images/pegman.png",iconSize:[38,71],iconAnchor:[19,35]});c.initialize=function(f){var o=document.createElement("div");o.style.position="relative";var j=document.createElement("div");j.style.position="absolute";j.style.backgroundImage="url(http://mtk2.toursprung.com/static/images/pegman-control.png)";j.style.width="44px";j.style.height=
"45px";j.style.top="-6px";j.style.left="-3px";var l=document.createElement("img");l.src=e.image;l.style.position="absolute";l.style.top="0";l.style.left="0";new MapToolkit.Streetview({map:b,img:l,icon:e,grey:"http://mtk2.toursprung.com/static/images/pegman-grey.png",target:"http://mtk2.toursprung.com/static/images/pegman-target.png",targetGrey:"http://mtk2.toursprung.com/static/images/pegman-target-grey.png",position:d});o.appendChild(j);o.appendChild(l);f.getContainer().appendChild(o);return o};
c.getDefaultPosition=function(){return d}};MapToolkit.StreetviewControl.prototype=new GControl;MapToolkit.FullscreenControl=function(b){var c,d=b.isFullscreen,e=this;e.initialize=function(f){c=document.createElement("div");c.className=d?"mtk-fullscreen mtk-fullscreen-active":"mtk-fullscreen mtk-fullscreen-inactive";c.innerHTML=d?MapToolkit.i18n.fullscreen_off:MapToolkit.i18n.fullscreen_on;GEvent.addDomListener(c,"click",function(){e.fullscreenToggle()});f.getContainer().appendChild(c);return c};e.getDefaultPosition=function(){var f=300;b.config.map.optionalControl||(f-=70);if($INARRAY(b.config.map.controls,
"MapToolkit.MapTypesControl")==-1)f-=220;if($INARRAY(b.config.map.controls,"MapToolkit.FullscreenIconControl")!=-1)f+=24;return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(f,10))};e.fullscreenToggle=function(){d=d?0:1;MapToolkit.InfoWindow.hide({map:b});c.innerHTML=d?MapToolkit.i18n.fullscreen_off:MapToolkit.i18n.fullscreen_on;c.className=d?"mtk-fullscreen mtk-fullscreen-active":"mtk-fullscreen mtk-fullscreen-inactive";var f=$EL(b.div);f.style.zIndex=d?parseInt(f.style.zIndex)+1E3:parseInt(f.style.zIndex)-
1E3;f=b.gmap.getCenter();var o=b.gmap.getBounds();b.setFullscreen(d);b.resize();b.gmap.setCenter(f,b.gmap.getBoundsZoomLevel(o));if(b.config.map.fullscreenControls){f=b.config.map.controls;$EACH(f,function(j){b.removeControl(j)});b.config.map.optionalControl&&b.removeControl("MapToolkit.OptionalControl");b.config.map.controls=b.config.map.fullscreenControls;$EACH(b.config.map.controls,function(j){b.addControl(j)});b.config.map.optionalControl&&b.addControl("MapToolkit.OptionalControl");b.config.map.fullscreenControls=
f}}};MapToolkit.FullscreenControl.prototype=new GControl;MapToolkit.FullscreenIconControl=function(b){var c,d=b.isFullscreen,e=this;e.initialize=function(f){c=document.createElement("div");c.className=d?"mtk-fullscreen-icon mtk-fullscreen-icon-active":"mtk-fullscreen-icon mtk-fullscreen-icon-inactive";c.innerHTML="&nbsp;";GEvent.addDomListener(c,"click",function(){e.fullscreenToggle()});f.getContainer().appendChild(c);return c};e.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(10,10))};e.fullscreenToggle=function(){d=
d?0:1;MapToolkit.InfoWindow.hide({map:b});c.className=d?"mtk-fullscreen-icon mtk-fullscreen-icon-active":"mtk-fullscreen-icon mtk-fullscreen-icon-inactive";var f=$EL(b.div);f.style.zIndex=d?parseInt(f.style.zIndex)+1E3:parseInt(f.style.zIndex)-1E3;f=b.gmap.getCenter();var o=b.gmap.getBounds();b.setFullscreen(d);b.resize();b.gmap.setCenter(f,b.gmap.getBoundsZoomLevel(o));if(b.config.map.fullscreenControls){f=b.config.map.controls;$EACH(f,function(j){b.removeControl(j)});b.config.map.optionalControl&&
b.removeControl("MapToolkit.OptionalControl");b.config.map.controls=b.config.map.fullscreenControls;$EACH(b.config.map.controls,function(j){b.addControl(j)});b.config.map.optionalControl&&b.addControl("MapToolkit.OptionalControl");b.config.map.fullscreenControls=f}}};MapToolkit.FullscreenIconControl.prototype=new GControl;MapToolkit.OptionalControl=function(b){var c=this,d=[],e=[],f=$INARRAY(b.config.map.controls,"MapToolkit.MapTypesControl")==-1;c.categories=[];for(var o in b.config.resources){if(b.config.resources[o].isOptional==null)b.config.resources[o].isOptional=b.config.resources[o].optional;var j=function(q){if(b.config.resources[q].isOptional){c.categories.push({name:q,title:MapToolkit.i18n[q],onclick:function(t,r){n(t,q,r)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+q+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+
q+".png"]});b.config.resources[q].optional||d.push(q)}}(o)}for(o in b.config.layers){if(b.config.layers[o].isOptional==null)b.config.layers[o].isOptional=b.config.layers[o].optional;j=function(q){if(b.config.layers[o].isOptional){c.categories.push({name:q,title:MapToolkit.i18n[q],onclick:function(t,r){b.updateLayer(q,t);setTimeout(r,500)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+q+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+q+".png"]});b.config.layers[q].optional||
d.push(q)}}(o)}var l='<div class="mtk-menu-pos-container"><div id="mtk-menu-container-toggle-'+b.div+'" class="mtk-menu-container-toggle mtk-menu-container-closed" onclick="MapToolkit.OptionalControl.toogleMenu(\''+b.div+"')\">&nbsp;&nbsp;&nbsp;"+MapToolkit.i18n.more.toUpperCase()+'<img src="http://mtk2.toursprung.com/static/images/buttons/arrow.png" border="0" class="mtk-menu-container-toggle-arrow" /></div><div id="mtk-menu-'+b.div+'" class="mtk-menu-menu'+(f?"-right":"")+'" style="display:none"><div class="mtk-menu-container"><div class="mtk-menu-container-header"></div><div class="mtk-menu-container-body"><div class="mtk-menu-content mtk-menu-max300"><div id="mtk-menu-content-'+
b.div+'"></div></div></div><div class="mtk-menu-container-footer"></div></div>\t<a href="http://maptoolkit.net" target="_blank"><img src="http://mtk2.toursprung.com/static/images/menu/mtk-logo.png" alt="mtk-logo" width="179" height="23"  border="0" /></a></div></div>',n=function(q,t,r){e.push(r);b.updateResource(t,q,function(){$EACH(e,function(w){w()});e=[]})};c.initialize=function(q){var t=document.createElement("div");t.innerHTML=l;q.getContainer().appendChild(t);var r=new MapToolkit.TreeMenu("mtk-menu-content-"+
b.div,c.categories,{map:b});$EACH(d,function(w){r[w].check()});$EL(t).pngFix&&$EL(t).pngFix();return t};c.getDefaultPosition=function(){var q=f?10:230;if($INARRAY(b.config.map.controls,"MapToolkit.FullscreenIconControl")!=-1)q+=24;return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(q,10))}};MapToolkit.OptionalControl.mouseover=false;MapToolkit.OptionalControl.prototype=new GControl;
MapToolkit.OptionalControl.toogleMenu=function(b){var c=$EL("mtk-menu-"+b);MapToolkit.getMap(b);if($VISIBLE(c)){$BLINDUP(c,{duration:0.2});setTimeout(function(){$EL("mtk-menu-container-toggle-"+b).className="mtk-menu-container-toggle mtk-menu-container-closed"},200);document.body.onclick=null;document.body.onmouseover=null}else{document.body.onclick=function(){MapToolkit.OptionalControl.toogleMenu(b)};document.body.onmouseover=function(d){var e=false,f=10;for(d=(d||window.event).srcElement;d&&f--;){if(d==
c){e=true;break}d=d.parentNode}MapToolkit.OptionalControl.mouseover=e};$BLINDDOWN(c,{duration:0.2});$EL("mtk-menu-container-toggle-"+b).className="mtk-menu-container-toggle mtk-menu-container-opened"}};MapToolkit.OptionalControlExpanded=function(b){var c=this,d=[],e=[];$INARRAY(b.config.map.controls,"MapToolkit.MapTypesControl");c.categories=[];for(var f in b.config.resources){if(b.config.resources[f].isOptional==null)b.config.resources[f].isOptional=b.config.resources[f].optional;var o=function(n){if(b.config.resources[n].isOptional){c.categories.push({name:n,title:MapToolkit.i18n[n],onclick:function(q,t){l(q,n,t)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+n+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+
n+".png"]});b.config.resources[n].optional||d.push(n)}}(f)}for(f in b.config.layers){if(b.config.layers[f].isOptional==null)b.config.layers[f].isOptional=b.config.layers[f].optional;o=function(n){if(b.config.layers[f].isOptional){c.categories.push({name:n,title:MapToolkit.i18n[n],onclick:function(q,t){b.updateLayer(n,q);setTimeout(t,500)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+n+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+n+".png"]});b.config.layers[n].optional||
d.push(n)}}(f)}var j='<div class="mtk-menu-pos-container"><div id="mtk-menu-'+b.div+'" class="mtk-menu-menu"><a href="http://maptoolkit.net" target="_blank"><img src="http://mtk2.toursprung.com/static/images/menu/mtk-logo.png" alt="mtk-logo" width="179" height="23"  border="0" /></a><div class="mtk-menu-container"><div class="mtk-menu-container-header"></div><div class="mtk-menu-container-body"><div class="mtk-menu-content mtk-menu-max300"><div id="mtk-menu-content-'+b.div+'"></div></div></div><div class="mtk-menu-container-footer"></div></div>\t</div></div>',
l=function(n,q,t){e.push(t);b.updateResource(q,n,function(){$EACH(e,function(r){r()});e=[]})};c.initialize=function(n){var q=document.createElement("div");q.innerHTML=j;n.getContainer().appendChild(q);var t=new MapToolkit.TreeMenu("mtk-menu-content-"+b.div,c.categories,{map:b});$EACH(d,function(r){t[r].check()});$EL(q).pngFix&&$EL(q).pngFix();return q};c.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(123,30))}};MapToolkit.OptionalControlExpanded.prototype=new GControl;MapToolkit.BunchMarkers=function(b){var c=this,d,e,f=false,o=false,j=null,l=[],n=[];c.preventRestore=false;c.expansionRadius=0;var q=function(w,z){return Math.sqrt(Math.pow(z.x-w.x,2)+Math.pow(z.y-w.y,2))},t=function(w){return Math.round(l.length/4*w*0.6)},r=function(w,z){var i=l.length,k=i<5?100:i*20;z=t(z);var h=2*Math.PI/i;angle=i==3?Math.PI/2:0;for(var g=0;g<i;g++){angle+=h;newX=w.x+z*Math.cos(angle);newY=w.y+z*Math.sin(angle);l[g].panTo(b.gmap.fromDivPixelToLatLng(new GPoint(newX,newY)),k)}};
c.restore=function(){if(f){var w=l.length,z=w<5?100:w*20;$EACH(l,function(i){i.restore(z)});$EACH(n,function(i){i.restore(z)});o=f=false;c.preventRestore=false;c.expansionRadius=0}};GEvent.addListener(b.gmap,"mousemove",function(w){d&&clearTimeout(d);if(e)d=setTimeout(function(){e&&e();e=null},100);if(f){w=b.gmap.fromLatLngToDivPixel(w);q(w,j)<c.expansionRadius||c.preventRestore||c.restore()}});GEvent.addListener(b,"markerMouseOver",function(w){o&&w.doOnMouseOver();f||(e=function(){var z=w.icon.iconAnchor.y,
i=w.icon.iconSize.height,k=w.icon.iconSize.width,h=b.gmap.fromLatLngToDivPixel(w.point);l=$GREP(b.getItems(),function(g){if(!(g instanceof MapToolkit.Marker))return 0;if(g.params.resource!=w.params.resource)return 0;g=b.gmap.fromLatLngToDivPixel(g.point);return q(h,g)<=i/4});if(l.length<2)return w.doOnMouseOver();f=true;w.closeDetails();k=i/k<2?i/(i/k):i/2;c.expansionRadius=t(i)+k;j=new GPoint(h.x,h.y-i/2+(i-z));n=$GREP(b.getItems(),function(g){if(!(g instanceof MapToolkit.Marker))return 0;g=b.gmap.fromLatLngToDivPixel(g.point);
g=q(h,g);return g>i/4&&g<2*c.expansionRadius});$EACH(n,function(g){g.dimm(0.25)});r(h,i);setTimeout(function(){o=true},100)})});GEvent.addListener(b,"markerMouseOut",function(){e=null})};MapToolkit.OnMouseOut=function(b,c){b=$EL(b);GEvent.addDomListener(b,"mouseover",function(){var d=GEvent.addDomListener(document.body,"mouseover",function(e){var f=20;e=e||window.event;for(var o=e.srcElement?e.srcElement:e.target;o&&f--;){if(o==b)return;o=o.parentNode}GEvent.removeListener(d);c(e)})})};MapToolkit.CloudmadeRouting=function(b){var c="http://routes.cloudmade.com/"+b.cloudmadeApikey+"/api/0.3/",d={en:"en",de:"de",ro:"ro",ru:"ru",nl:"nl",vi:"vi",zh:"zh",fr:"fr",hu:"hu",se:"se"};return{loadFromWaypoints:function(e,f){var o=this;f=f||{};if(!(e.length<2)){var j=$MAP(e,function(q){return q.lat()+","+q.lng()}),l=j.shift(),n=","+j.pop();j=j.length?",["+j.join(",")+"]":"";jsonRpc({url:c+l+j+n+("/"+(f.travelMode||"car"))+("."+(f.format||"js")),parameters:{lang:d[MapToolkit.language]||"en",units:f.unit||
"km"},callback:function(q){var t=$MAP(q.route_geometry,function(r){return $P(r)});GEvent.trigger(o,"load",{getDirectionsHtml:function(r){var w=0;var z=(r=r||"")&&r+" "+r+"-first",i=r&&r+" "+r+"-last";return $MAP(q.route_instructions,function(k){return'<tr><td class="'+z+'">'+ ++w+'.&nbsp;</td><td class="'+r+'">'+k[0]+'</td><td class="'+i+'">'+k[4].replace(/ /,"&nbsp;")+"</td></tr>"}).join("")},getNumGeocodes:function(){return e.length},getMarker:function(r){r=e[r];for(var w=null,z=99999999999,i=0;i<
t.length;i++)if(r.distanceFrom(t[i])<z){w=i;z=r.distanceFrom(t[i])}return w!=null?new GMarker(t[w]):null},getPolyline:function(r){return new GPolyline(t,null,null,null,r||{})}})}})}}}};MapToolkit.CloudmadeRouting.TravelmodeCar="car";MapToolkit.CloudmadeRouting.TravelmodeFoot="foot";MapToolkit.CloudmadeRouting.TravelmodeBicycle="bicycle";MapToolkit.CloudmadeRouting.Config={travelMode:null,unit:null};MapToolkit.CloudmadeRouting.Result={getDirectionsHtml:null,getNumGeocodes:null,getMarker:null,getPolyline:null};MapToolkit.RoutePlanner=function(b){function c(v){if(v=="vertex")return p;return o.icon&&o.icon[v]?MapToolkit.Icon.get(o.icon[v]):G_DEFAULT_ICON}var d=this,e,f=b.gmap,o=b.config.planner,j=null,l,n,q=[],t=false,r,w=function(v){return(o.i18n&&o.i18n[v]?o.i18n[v]:MapToolkit.i18n["planner: "+v]||v).replace(/\s/g,"&nbsp;")},z=function(v,A){MapToolkit.Tooltip.show({map:b,icon:A,point:v,text:w("Drag to change route")})},i=function(){MapToolkit.Tooltip.hide({map:b})};if(o.onScreenMenu==null||o.onScreenMenu){var k=
function(){MapToolkit.InfoWindow.hide({map:b});t=false};o.onScreenMenu=o.onScreenMenu||{};var h=o.onScreenMenu.event||"click";MapToolkit.OnMouseOut(b.div,k);GEvent.addListener(f,h,function(v,A){if(!v)if(t)k();else{v=document.createElement("div");v.className="mtk-onscreenmenu-item";v.onclick=function(){k();d.setStartPoint(A);d.redraw()};v.innerHTML=w("Directions from here");var C=document.createElement("div");C.className="mtk-onscreenmenu-item";C.onclick=function(){k();d.setEndPoint(A);d.redraw()};
C.innerHTML=w("Directions to here");var G=document.createElement("div");G.className="mtk-onscreenmenu-divider";var y=document.createElement("div");y.className="mtk-onscreenmenu-item";y.onclick=function(){f.setZoom(f.getZoom()+1)};y.innerHTML=w("Zoom in");var Q=document.createElement("div");Q.className="mtk-onscreenmenu-item";Q.onclick=function(){f.setZoom(f.getZoom()-1)};Q.innerHTML=w("Zoom out");var m=document.createElement("div");m.appendChild(v);m.appendChild(C);m.appendChild(G);m.appendChild(y);
m.appendChild(Q);MapToolkit.InfoWindow.show({map:b,point:A,content:m,opacity:o.onScreenMenu.opacity||95,onclose:function(){t=false}});t=true}})}var g=o.routingClass?(new MapToolkit.classForSting(o.routingClass))(o):new GDirections;GEvent.addListener(g,"load",function(v){for(var A=0;A<v.getNumGeocodes();A++){var C=v.getMarker(A).getLatLng();if(A==0){l.setLatLng(d.setStartPoint(C));GEvent.addListener(l,"mouseover",function(){return function(G){z(G,l.getIcon())}}(C));GEvent.addListener(l,"mouseout",
i)}else if(A==v.getNumGeocodes()-1){n.setLatLng(d.setEndPoint(C));GEvent.addListener(n,"mouseover",function(){return function(G){z(G,n.getIcon())}}(C));GEvent.addListener(n,"mouseout",i)}else{d.transitPoints[A-1]=C;I(C,A-1,c("vertex"))}}r=v.getDirectionsHtml;J(v.getPolyline({mouseOutTolerance:5}));s.hide();GEvent.trigger(d,"redraw");o.onRedraw&&o.onRedraw(d);e&&e()});var p=new MapToolkit.Icon({image:MapToolkit.host+"/static/images/editor/via.png",iconSize:[10,10],iconAnchor:[5,5]}),s=new GMarker($P(0,
0),{icon:p,draggable:true,dragCrossMove:true,bouncy:false,zIndexProcess:function(){return-999999999}});s.hide();f.addOverlay(s);GEvent.addListener(s,"mouseout",function(){i();s.hide()});GEvent.addListener(s,"dragstart",function(v){movePosition=N(v)});GEvent.addListener(s,"dragend",function(v){d.transitPoints.splice(movePosition,0,v);d.redraw()});var I=function(v,A,C){var G=new GMarker(v,{icon:C,draggable:true,bouncy:false});GEvent.addListener(G,"click",function(){if(A!="start"&&A!="end")for(var y=
0;y<q.length;y++)if(q[y]==G){GEvent.clearInstanceListeners(G);f.removeOverlay(G);q.splice(y,1);d.transitPoints.splice(y,1);d.redraw()}});GEvent.addListener(G,"dragend",function(y){if(A=="start")d.setStartPoint(y);else if(A=="end")d.setEndPoint(y);else d.transitPoints[A]=y;q[A]&&q[A].setLatLng(y);d.redraw()});if(A=="start")l=G;else if(A=="end")n=G;else q.splice(A,0,G);f.addOverlay(G)},N=function(v){for(var A=0,C=99999999,G=d.transitPoints.length,y=0;y<=G;y++){var Q=y==0?d.startPoint:d.transitPoints[y-
1],m=y==G?d.endPoint:d.transitPoints[y],u=Q.distanceFrom(m);Q=Q.distanceFrom(v);m=m.distanceFrom(v);if(Q+m-u<C){A=y;C=Q+m-u}}return A},J=function(v){j=v;f.addOverlay(v);GEvent.addListener(v,"mouseover",function(){});GEvent.addListener(v,"mousemove",function(A,C){s.show();s.setLatLng(C);z(C,s.getIcon())});d.distance=v.getLength()},R=function(){if(j){f.removeOverlay(j);GEvent.clearInstanceListeners(j)}if(l){f.removeOverlay(l);GEvent.clearInstanceListeners(l)}if(n){f.removeOverlay(n);GEvent.clearInstanceListeners(n)}for(var v=
0;v<q.length;v++){GEvent.clearInstanceListeners(q[v]);f.removeOverlay(q[v])}n=l=j=null;q=[]},S=function(v,A){if(!o.maxDistance||!v||!A)return true;if(v.distanceFrom(A)<=o.maxDistance)return true;alert(w("Reached maximal distance limit").replace(/&nbsp;/g," "));return false};d.setStartPoint=function(v){if(!S(d.endPoint,v))return false;d.startPoint=v;o.onSetStartPoint&&o.onSetStartPoint(v);GEvent.trigger(d,"setStartPoint",v);return v};d.startPoint=null;d.setEndPoint=function(v){if(!S(d.startPoint,v))return false;
d.endPoint=v;o.onSetEndPoint&&o.onSetEndPoint(v);GEvent.trigger(d,"setEndPoint",v);return v};d.endPoint=null;d.transitPoints=[];d.travelMode=o.travelMode||G_TRAVEL_MODE_DRIVING;d.avoidHighways=o.avoidHighways||false;d.distance=0;d.redraw=function(v){e=v;i();R();d.startPoint&&I(d.startPoint,"start",c("start"));d.endPoint&&I(d.endPoint,"end",c("end"));if(d.startPoint&&d.endPoint){v=[].concat(d.startPoint,d.transitPoints,d.endPoint);g.loadFromWaypoints(v,{getPolyline:true,travelMode:d.travelMode,avoidHighways:d.avoidHighways,
getSteps:true,unit:o.unit})}};d.reverse=function(){var v=d.endPoint;d.endPoint=d.startPoint;d.startPoint=v;d.transitPoints=d.transitPoints.reverse();d.redraw()};d.remove=function(){R();d.setStartPoint(null);d.setEndPoint(null);d.transitPoints=[];d.distance=0};d.getDirectionsHtml=function(v){return r(v)};d.getVertices=function(){if(!(d.startPoint&&d.endPoint))return[];for(var v=[],A=0;A<j.getVertexCount();A++)v.push(j.getVertex(A));return v};d.getDistance=function(){return j?j.getLength():0};d.getParts=
function(){var v=[].concat(d.startPoint,d.transitPoints,d.endPoint);return[{type:"waypoints",points:$MAP(v,function(A){return[A.lat(),A.lng()]})}]};d.centerMap=function(){if(j){var v=j.getBounds();f.setZoom(f.getBoundsZoomLevel(v));f.panTo(v.getCenter())}}};MapToolkit.RoutePlanner.Config={i18n:null,onScreenMenu:{},routingClass:null,onRedraw:null,onSetStartPoint:null,onSetEndPoint:null,icon:{start:null,end:null},travelMode:null,unit:null,avoidHighways:null,maxDistance:null};var OSM_MAP=function(){var b=new GCopyrightCollection(""),c=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,'(cc) <a href="http://www.openstreetmap.org/" target="_blank" style="color: rgb(119, 119, 204);">OpenStreetMap</a>');b.addCopyright(c);b=new GTileLayer(b,1,17);b.myBaseURL="http://tile.openstreetmap.org/";b.getTileUrl=function(d,e){return this.myBaseURL+"/mapnik_tiles/"+e+"/"+d.x+"/"+d.y+".png"};b.isPng=function(){return true};b.getOpacity=function(){return 1};
return new GMapType([b],G_SATELLITE_MAP.getProjection(),"OSM ",G_SATELLITE_MAP)}();var OSM_CYCLE_MAP=function(){var b=new GCopyrightCollection(""),c=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,'(cc) <a href="http://www.opencyclemap.org/" target="_blank" style="color: rgb(119, 119, 204);">OpenCycleMap</a>');b.addCopyright(c);b=new GTileLayer(b,1,17);b.myBaseURL="http://andy.sandbox.cloudmade.com";b.getTileUrl=function(d,e){return this.myBaseURL+"/tiles/cycle/"+e+"/"+d.x+"/"+d.y+".png"};b.isPng=function(){return true};b.getOpacity=function(){return 1};
return new GMapType([b],G_SATELLITE_MAP.getProjection(),"OSM Cycle",G_SATELLITE_MAP)}();
