var a;
(function(){var b=false,c=0,d=function(g){if(!b)return g;for(var h=0;h<c;h++)g[g.length]="\t";return g},e=function(g){if(b)g[g.length]="\n";return g},f={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o={array:function(g){var h=["["],m,p,t,r=g.length,w;h=e(h);c++;for(t=0;t<r;t+=1){w=g[t];if(p=o[typeof w]){w=p(w);if(typeof w=="string"){if(m){h[h.length]=",";h=e(h)}h=d(h);h[h.length]=w;m=true}}}c--;h=e(h);h=d(h);h[h.length]="]";return h.join("")},"boolean":function(g){return String(g)},"null":function(){return"null"},
number:function(g){return isFinite(g)?String(g):"null"},object:function(g){if(g){if(g instanceof Array)return o.array(g);var h=["{"],m,p,t,r;h=e(h);c++;for(t in g){r=g[t];if(p=o[typeof r]){r=p(r);if(typeof r=="string"){if(m){h[h.length]=",";h=e(h)}h=d(h);h.push(o.string(t),b?" : ":":",r);m=true}}}c--;h=e(h);h=d(h);h[h.length]="}";return h.join("")}return"null"},string:function(g){if(/["\\\x00-\x1f]/.test(g))g=g.replace(/([\x00-\x1f\\"])/g,function(h,m){if(h=f[m])return h;h=m.charCodeAt();return"\\u00"+
Math.floor(h/16).toString(16)+(h%16).toString(16)});return'"'+g+'"'}};Object.toJSONString=function(g,h){b=h;return o[typeof g](g)};Array.toJSONString=function(g,h){b=h;return o.array(g)}})();String.parseJSON=function(b){try{return!/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(b.replace(/"(\\.|[^"\\])*"/g,""))&&eval("("+b+")")}catch(c){return false}};function $EL(b){if(typeof b=="string")b="#"+b;return jQuery(b)?jQuery(b).get(0):b}function $EL2(b){if(typeof b=="string")b="#"+b;return jQuery(b)}function $CLASS(b){return jQuery("."+b)}function $ADD_CLASS(b,c){$EL2(b).addClass(c)}function $REMOVE_CLASS(b,c){$EL2(b).removeClass(c)}function $UPDATE(b,c){return $EL2(b).html(c)}function $REPLACE(b,c){return $EL(b).replaceWith(c)}
function $HASH(b){return{get:function(c){return b[c]},set:function(c,d){b[c]=d},unset:function(c){delete b[c]},keys:function(){var c=[];for(var d in b)c.push(d);return c},values:function(){var c=[];for(var d in b)c.push(b[d]);return c},toQueryString:function(){return jQuery.param(b)}}}function $EACH(b,c){for(var d=0;d<b.length;d++)c(b[d])}function $MAP(b,c){for(var d=[],e=0;e<b.length;e++)d.push(c(b[e]));return d}function $GREP(b,c){return jQuery.grep(b,c)}
function $AJAX(b,c){var d=c.onComplete;jQuery.ajax({type:c.method||"GET",url:b,data:c.parameters||{},complete:function(e){var f=e.getResponseHeader("X-JSON");if(f)f=String.parseJSON(f);d(e,f)}})}function $CLONE(b){return jQuery.extend(true,{},b)}function $TO_JSON(b){return Object.toJSONString(b)}function $EVAL_JSON(b){return String.parseJSON(b)}function $EXTEND(b,c){for(var d in c)b[d]=c[d];return b}function $BLINDDOWN(b,c){return $EL2(b).slideDown(c.duration?c.duration*1E3:"slow")}
function $BLINDUP(b,c){return $EL2(b).slideUp(c.duration?c.duration*1E3:"slow")}function $EVENT(b,c,d){return $EL2(b).bind(c,d)}function $VISIBLE(b){return $EL2(b).is(":visible")}function $DIMENSIONS(b){return{width:$EL2(b).width(),height:$EL2(b).height()}}function $PREVIOUS(b){return $EL2(b).prev().get(0)}function $NEXT(b){return $EL2(b).next().get(0)}
function $OPACITY(b,c){if(c==null)return b.currentStyle&&b.currentStyle.filter?b.currentStyle.filter.match(/alpha\(opacity=(.*)\)/)?parseFloat(RegExp.$1)/100:1:$EL2(b).css("opacity");else $EL2(b).css("opacity",c)}function $OFFSETTOP(b){return $EL2(b).offset?$EL2(b).offset().top:$EL(b).offsetTop}function $OFFSETLEFT(b){return $EL2(b).offset?$EL2(b).offset().left:$EL(b).offsetLeft}function $INARRAY(b,c){return jQuery.inArray(c,b)}function $ANIMATE(b,c,d,e){jQuery(b).animate(c,d,"linear",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(g,h){try{var m=g.getResponseHeader("X-Ajax-Redirect-Location");if(m)location.href=m}catch(p){}d&&d(g,h);e&&$UPDATE(e,g.responseText);f&&$REPLACE(f,
g.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 g=
new MapToolkit.Map(f,o);d&&d(g)}}(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",g=d.entrySelected||MapToolkit.host+"/static/images/treemenu/entry_selected.png",h=d.opened||MapToolkit.host+"/static/images/treemenu/open.png",m=d.closed||MapToolkit.host+"/static/images/treemenu/closed.png",p=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,k){if(!z.icon)return k?g:o;if(typeof z.icon=="string")return z.icon;return z.icon[k]},w=function(z,k){var l=document.createElement("ul");l.className=k?"mtk-treemenu-block-first":"mtk-treemenu-block";$EACH(z,function(j){var i=document.createElement("li");if(j.name)f[j.name]=i;i.className=j.children&&j.children.length?"mtk-treemenu-group":"mtk-treemenu-entry";i.checked=false;if(j.disabled)i.className+=
" mtk-treemenu-disabled";if(j.visible!=null&&!j.visible)i.style.display="none";i.onmouseover=function(){i.className+=" mtk-treemenu-entry-hover mtk-treemenu-entry-selected";if(!j.children&&!j.isLoading)q.src=r(j,1);!e&&j.onmouseover&&j.onmouseover()};i.onmouseout=function(){i.className=i.className.replace(/ mtk-treemenu-entry-hover/g,"");if(!i.checked)i.className=i.className.replace(/ mtk-treemenu-entry-selected/g,"");if(!j.children&&!i.checked&&!j.isLoading)q.src=r(j,0);!e&&j.onmouseout&&j.onmouseout()};
l.appendChild(i);var q=document.createElement("img");q.className="mtk-treemenu-entry-image";q.width=16;q.height=16;i.appendChild(q);if(!j.children){q.src=r(j,0);i.onclick=function(J){J=J=="checkOnly";if(!(!e&&j.disabled)){i.checked=!i.checked;if(i.checked)i.className+=" mtk-treemenu-entry-selected";if(s)s.checked=i.checked;if(!J&&j.onclick&&(j.showLoading==null||j.showLoading)){q.src=p;j.isLoading=true;e||j.onclick(i.checked,function(){j.isLoading=false;q.src=r(j,i.checked?1:0)})}else{q.src=r(j,i.checked?
1:0);!J&&!e&&j.onclick&&j.onclick(i.checked)}}};if(j.checkbox){var s=document.createElement("input");s.className="mtk-treemenu-entry-checkbox";s.type="checkbox";s.onchange=i.onclick;i.appendChild(s)}}var I=document.createElement("span");I.className=j.checkbox?"mtk-treemenu-check-label":"mtk-treemenu-entry-label";I.innerHTML=j.title;i.appendChild(I);if(j.children){q.src=m;var N=w(j.children);N.style.display=j.checked?"block":"none";l.appendChild(N);i.onclick=function(J){J=J=="checkOnly";if(!(!e&&j.disabled)){i.checked=
!i.checked;e||(i.checked?$BLINDDOWN(N,{duration:0.1}):$BLINDUP(N,{duration:0.1}));q.src=i.checked?h:m;!J&&!e&&j.onclick&&j.onclick(i.checked)}}}i.check=function(){i.onclick("checkOnly")};j.checked&&i.onclick()});return l};b.appendChild(w(c,"toplevel"));e=false;return f};MapToolkit.RestAPI=function(){function b(k,l){k[l>>5]|=128<<l%32;k[(l+64>>>9<<4)+14]=l;l=1732584193;for(var j=-271733879,i=-1732584194,q=271733878,s=0;s<k.length;s+=16){var I=l,N=j,J=i,R=q;l=d(l,j,i,q,k[s+0],7,-680876936);q=d(q,l,j,i,k[s+1],12,-389564586);i=d(i,q,l,j,k[s+2],17,606105819);j=d(j,i,q,l,k[s+3],22,-1044525330);l=d(l,j,i,q,k[s+4],7,-176418897);q=d(q,l,j,i,k[s+5],12,1200080426);i=d(i,q,l,j,k[s+6],17,-1473231341);j=d(j,i,q,l,k[s+7],22,-45705983);l=d(l,j,i,q,k[s+8],7,1770035416);q=d(q,l,j,
i,k[s+9],12,-1958414417);i=d(i,q,l,j,k[s+10],17,-42063);j=d(j,i,q,l,k[s+11],22,-1990404162);l=d(l,j,i,q,k[s+12],7,1804603682);q=d(q,l,j,i,k[s+13],12,-40341101);i=d(i,q,l,j,k[s+14],17,-1502002290);j=d(j,i,q,l,k[s+15],22,1236535329);l=e(l,j,i,q,k[s+1],5,-165796510);q=e(q,l,j,i,k[s+6],9,-1069501632);i=e(i,q,l,j,k[s+11],14,643717713);j=e(j,i,q,l,k[s+0],20,-373897302);l=e(l,j,i,q,k[s+5],5,-701558691);q=e(q,l,j,i,k[s+10],9,38016083);i=e(i,q,l,j,k[s+15],14,-660478335);j=e(j,i,q,l,k[s+4],20,-405537848);l=
e(l,j,i,q,k[s+9],5,568446438);q=e(q,l,j,i,k[s+14],9,-1019803690);i=e(i,q,l,j,k[s+3],14,-187363961);j=e(j,i,q,l,k[s+8],20,1163531501);l=e(l,j,i,q,k[s+13],5,-1444681467);q=e(q,l,j,i,k[s+2],9,-51403784);i=e(i,q,l,j,k[s+7],14,1735328473);j=e(j,i,q,l,k[s+12],20,-1926607734);l=f(l,j,i,q,k[s+5],4,-378558);q=f(q,l,j,i,k[s+8],11,-2022574463);i=f(i,q,l,j,k[s+11],16,1839030562);j=f(j,i,q,l,k[s+14],23,-35309556);l=f(l,j,i,q,k[s+1],4,-1530992060);q=f(q,l,j,i,k[s+4],11,1272893353);i=f(i,q,l,j,k[s+7],16,-155497632);
j=f(j,i,q,l,k[s+10],23,-1094730640);l=f(l,j,i,q,k[s+13],4,681279174);q=f(q,l,j,i,k[s+0],11,-358537222);i=f(i,q,l,j,k[s+3],16,-722521979);j=f(j,i,q,l,k[s+6],23,76029189);l=f(l,j,i,q,k[s+9],4,-640364487);q=f(q,l,j,i,k[s+12],11,-421815835);i=f(i,q,l,j,k[s+15],16,530742520);j=f(j,i,q,l,k[s+2],23,-995338651);l=o(l,j,i,q,k[s+0],6,-198630844);q=o(q,l,j,i,k[s+7],10,1126891415);i=o(i,q,l,j,k[s+14],15,-1416354905);j=o(j,i,q,l,k[s+5],21,-57434055);l=o(l,j,i,q,k[s+12],6,1700485571);q=o(q,l,j,i,k[s+3],10,-1894986606);
i=o(i,q,l,j,k[s+10],15,-1051523);j=o(j,i,q,l,k[s+1],21,-2054922799);l=o(l,j,i,q,k[s+8],6,1873313359);q=o(q,l,j,i,k[s+15],10,-30611744);i=o(i,q,l,j,k[s+6],15,-1560198380);j=o(j,i,q,l,k[s+13],21,1309151649);l=o(l,j,i,q,k[s+4],6,-145523070);q=o(q,l,j,i,k[s+11],10,-1120210379);i=o(i,q,l,j,k[s+2],15,718787259);j=o(j,i,q,l,k[s+9],21,-343485551);l=g(l,I);j=g(j,N);i=g(i,J);q=g(q,R)}return Array(l,j,i,q)}function c(k,l,j,i,q,s){return g(h(g(g(l,k),g(i,s)),q),j)}function d(k,l,j,i,q,s,I){return c(l&j|~l&i,
k,l,q,s,I)}function e(k,l,j,i,q,s,I){return c(l&i|j&~i,k,l,q,s,I)}function f(k,l,j,i,q,s,I){return c(l^j^i,k,l,q,s,I)}function o(k,l,j,i,q,s,I){return c(j^(l|~i),k,l,q,s,I)}function g(k,l){var j=(k&65535)+(l&65535);return(k>>16)+(l>>16)+(j>>16)<<16|j&65535}function h(k,l){return k<<l|k>>>32-l}function m(k){for(var l=Array(),j=(1<<z)-1,i=0;i<k.length*z;i+=z)l[i>>5]|=(k.charCodeAt(i/z)&j)<<i%32;return l}function p(k){for(var l=w?"0123456789ABCDEF":"0123456789abcdef",j="",i=0;i<k.length*4;i++)j+=l.charAt(k[i>>
2]>>i%4*8+4&15)+l.charAt(k[i>>2]>>i%4*8&15);return j}function t(k){return p(b(m(k),k.length*z))}function r(k,l){var j=k.role?"#"+k.role:"",i=k.password||"",q=i&&parseInt((new Date).getTime()/1E3);k.parameters.api_key=""+k.api_key+j;k.parameters.token=t(k.api_key+i+q);k.url=k.url+"/"+l;k.parameters=k.parameters||{};jsonRpc(k)}var w=0,z=8;return{get:function(k){r(k,"get")},post:function(k){r(k,"post")},put:function(k){r(k,"put")},"delete":function(k){r(k,"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(h){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else h.stopPropagation()},o=function(h,m,p){if(d[h.div])var t=d[h.div];else{t=document.createElement("div");t.style.display="none";t.style.position="absolute";h.gmap.getPane(G_MAP_FLOAT_SHADOW_PANE).appendChild(t);GEvent.bindDom(t,"mouseover",b,function(){h.disableScrollWheelZoom()});GEvent.bindDom(t,
"mouseout",b,function(){h.enableScrollWheelZoom()});GEvent.bindDom(t,"mousedown",b,f);GEvent.bindDom(t,"dblclick",b,f);GEvent.bindDom(t,"DOMMouseScroll",b,f);d[h.div]=t}t.className=m||"mtk-tooltip";if(c)for(var r in c)t.style[r]="";if(c=p)for(r in p)t.style[r]=p[r];return d[h.div]},g=function(h,m){h=o(h);if(m<0)m=0;if(m>=100)m=100;var p=m/100;if(typeof h.style.filter=="string")h.style.filter="alpha(opacity:"+m+")";if(typeof h.style.KHTMLOpacity=="string")h.style.KHTMLOpacity=p;if(typeof h.style.MozOpacity==
"string")h.style.MozOpacity=p;if(typeof h.style.opacity=="string")h.style.opacity=p};return{show:function(h){if(!((h.priority||0)<e[h.map.div])){this.hide(h);e[h.map.div]=h.priority;var m=o(h.map,h.className,h.style);if(h.text!=null)m.innerHTML=h.text;h.opacity!=null&&g(h.map,h.opacity);if(h.onmouseover)m.onmouseover=h.onmouseover;h.onmouseout&&MapToolkit.OnMouseOut(m,h.onmouseout);this.move(h);m.style.display="block";GEvent.trigger(this,"show")}},move:function(h){var m=o(h.map,h.className,h.style),
p=h.map.gmap.fromLatLngToDivPixel(h.point),t=h.map.gmap.fromLatLngToContainerPixel(h.point),r=h.icon?[h.icon.iconSize.width-h.icon.iconAnchor.x,0-h.icon.iconAnchor.y]:[0,0];if(h.iconOffsetX)r[0]+=h.iconOffsetX*2;if(h.iconOffsetY)r[1]+=h.iconOffsetY*2;p={top:p.y+r[1]-5,left:p.x+r[0]+5};r={top:t.y+r[1],left:t.x+r[0]};var w=h.map.gmap.getSize();t=$DIMENSIONS(m);h=h.icon?h.icon.iconSize:{width:0,height:0};t.width+=h.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-h.width};if(r.east<0&&r.east<r.west)p.left-=t.width+h.width+10;if(r.south<0&&r.south<r.north)p.top+=r.south-10;if(r.north<0&&r.north<r.south)p.top-=r.north-10;m.style.left=p.left+"px";m.style.top=p.top+"px"},hide:function(h){if(!((h.priority||0)<e[h.map.div])){delete e[h.map.div];o(h.map,h.className,h.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(g){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&document.all){window.event.cancelBubble=true;window.event.returnValue=false}else g.stopPropagation()},f=function(g,h,m){if(c[g.div])var p=c[g.div][0];else{var t=MapToolkit.isIE6()?"-ie6":"";p=document.createElement("div");p.style.position="absolute";p.innerHTML='<div id="mtk-infowindow-content-'+g.div+'">&nbsp</div><div class="mtk-infowindow-close'+
t+'" onclick="javascript:MapToolkit.InfoWindow.hide({map:MapToolkit.getMap(\''+g.div+"')})\">&nbsp;</div>";g.gmap.getPane(G_MAP_FLOAT_PANE).appendChild(p);GEvent.bindDom(p,"mouseover",b,function(){g.disableScrollWheelZoom()});GEvent.bindDom(p,"mouseout",b,function(){g.enableScrollWheelZoom()});GEvent.bindDom(p,"mousedown",b,e);GEvent.bindDom(p,"dblclick",b,e);GEvent.bindDom(p,"DOMMouseScroll",b,e);c[g.div]=[p,$EL("mtk-infowindow-content-"+g.div),null]}p.className=h||"mtk-infowindow";if(d)for(var r in d)p.style[r]=
"";if(d=m)for(r in m)p.style[r]=m[r];return c[g.div]},o=function(g,h){g=f(g)[0];if(h<0)h=0;if(h>=100)h=100;var m=h/100;if(typeof g.style.filter=="string")g.style.filter="alpha(opacity:"+h+")";if(typeof g.style.KHTMLOpacity=="string")g.style.KHTMLOpacity=m;if(typeof g.style.MozOpacity=="string")g.style.MozOpacity=m;if(typeof g.style.opacity=="string")g.style.opacity=m};return{show:function(g){this.hide(g);var h=f(g.map,g.className,g.style);h[1].innerHTML=g.text||"";g.content!=null&&h[1].appendChild(g.content);
g.opacity!=null&&o(g.map,g.opacity);if(g.onmouseover)h[0].onmouseover=g.onmouseover;g.onmouseout&&MapToolkit.OnMouseOut(h[0],g.onmouseout);if(g.onclose)h[2]=g.onclose;this.move(g);h[0].style.display="block";GEvent.trigger(this,"show")},move:function(g){var h=f(g.map,g.className,g.style),m=g.map.gmap.fromLatLngToDivPixel(g.point),p=g.map.gmap.fromLatLngToContainerPixel(g.point),t=g.icon?[g.icon.iconSize.width-g.icon.iconAnchor.x,0-g.icon.iconAnchor.y]:[0,0];if(g.iconOffsetX)t[0]+=g.iconOffsetX*2;if(g.iconOffsetY)t[1]+=
g.iconOffsetY*2;m={top:m.y+t[1]-5,left:m.x+t[0]+5};var r={top:p.y+t[1],left:p.x+t[0]};p=g.map.gmap.getSize();t=$DIMENSIONS(h[0]);var w=g.icon?g.icon.iconSize:{width:0,height:0};t.width+=w.width/2;r={north:r.top,east:p.width-r.left-t.width,south:p.height-r.top-t.height,west:r.left-t.width-w.width};if(r.east<0&&r.east<r.west)m.left-=t.width+w.width+15;if(r.south<0&&r.south<r.north)m.top+=r.south-15;if(r.north<0&&r.north<r.south)m.top-=r.north-10;h[0].style.left=m.left+"px";h[0].style.top=m.top+"px";
m=g.map.gmap.fromDivPixelToLatLng(new GPoint(m.left,m.top));m=g.map.gmap.fromLatLngToContainerPixel(m);h=g.map.gmap.getBounds().toSpan();w=g.map.gmap.getCenter().lat();r=g.map.gmap.getCenter().lng();m={north:m.y,east:p.width-m.x-t.width,south:p.height-m.y-t.height,west:m.x};if(m.north<0)w-=m.north/p.height*h.lat();if(m.east<0)r-=m.east/p.width*h.lng();if(m.west<0)r+=m.west/p.width*h.lng();g.map.gmap.panTo($P(w,r));GEvent.trigger(this,"move")},hide:function(g){g=f(g.map,g.className,g.style);g[2]&&
g[2]();g[2]=null;g[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(n){return window[n]||alert("mapType '"+n+"' does not exists!")})});d.enableContinuousZoom();d.enableDoubleClickZoom();d.mapDiv=b;var e=this,f={visible:{},pending:{}},o=null,g="",h={},m,p=$HASH({}),t={},
r=[0,0],w=document.documentElement.clientHeight,z,k,l,j=function(n){var u=-999;$EACH(n,function(x){if(x>u)u=x});return u},i=function(n){var u=999;$EACH(n,function(x){if(x<u)u=x});return u},q=function(n){var u=0;$EACH(n,function(x){u+=x});return u},s=function(){var n=$MAP(p.values(),function(u){return u.id});n.length&&jsonRpc({url:MapToolkit.host+"/async.json",parameters:{api_key:c.api_key,version:MapToolkit.version,tileIds:$TO_JSON(n),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(p.get(B.id)&&!B.async){p.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)}m=p.keys().length?setTimeout(s,3E3):null;I()}})},I=function(){var n={};$EACH(p.values(),function(x){n[x.resource]=true});for(var u in c.resources)$EL("spinner-"+b+u)&&!n[u]&&$EL2("spinner-"+b+u).hide()},N=function(n){var u=n.id+","+n.count;if(f.visible[u])f.pending[u]=f.visible[u];
else{n.style=c.clusters.style||"detailed";n.color=c.clusters.color||"555555";n.naming=c.clusters.naming||"Items";n.onclick=c.clusters.onclick;n.levels=c.clusters.levels;n.fixedSize=c.clusters.fixedSize;if(c.clusters.style=="simple"){n=new MapToolkit.SimpleCluster(e,n);GEvent.trigger(e,"setSimpleCluster",n)}else{n=new MapToolkit.DetailedCluster(e,n);GEvent.trigger(e,"setDetailedCluster",n)}f.pending[u]=n}},J=function(n,u){if(f.visible[n.id]&&!n.id.toString().match(/^tmp_/))f.pending[n.id]=f.visible[n.id];
else{var x=c.resources[n.resource]||c.items[n.resource]||{};x=n.icon&&typeof n.icon!="function"?new MapToolkit.Marker($EXTEND({map:e,point:$P(n),icon:n.icon,params:n},x)):{};x.params=n;x.tileI=u;f.pending[n.id]=x}},R=function(){if(c.items)for(var n in c.items)$EACH(c.items[n].ids,function(u){J({resource:n,id:u},0)})},S=function(n,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,n,u)}else u&&u();f.pending={}},v=function(n,u,x){MapToolkit.Search.items(e,{ids:n,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)h.timeout=setTimeout(function(){h.polyline=new GGeoXml(H.kml);d.addOverlay(h.polyline)},200);
GEvent.trigger(e,"markerMouseOver",F)});GEvent.addListener(F,"mouseout",function(){if(H.type=="route"&&H.kml){h.timeout&&clearTimeout(h.timeout);h.polyline&&d.removeOverlay(h.polyline);h={}}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(n,u,x){for(var D={},B=[],E=0;E<n.length;E++){var M=n[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])}n=[[]];D=B.concat($HASH(D).values());for(E=0;E<D.length;E++){n[n.length-1].length>5&&n.push([]);n[n.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=q($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:j($MAP(P,function(K){return K.north})),east:j($MAP(P,function(K){return K.east})),south:i($MAP(P,function(K){return K.south})),west:i($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(n)};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(n,u){jsonRpc({url:MapToolkit.host+"/log",parameters:{api_key:c.api_key,log:$TO_JSON(n)},callback:u||function(){}})};e.getMousePoint=function(){var n=new GPoint(r[0],r[1]);return d.fromContainerPixelToLatLng(n)};this.enableScrollWheelZoom=function(){var n=function(u){if(!u)u=window.event;u.preventDefault&&u.preventDefault();u.returnValue=false};z=GEvent.addDomListener(d.getContainer(),"DOMMouseScroll",n);
d.getContainer().onmousewheel=n;d.enableScrollWheelZoom()};this.disableScrollWheelZoom=function(){d.disableScrollWheelZoom();z&&GEvent.removeListener(z);z=d.getContainer().onmousewheel=null};e.addControl=function(n,u){var x=MapToolkit.classForSting(n);u=u||(n.match(/^G/)?new x:new x(e));t[n]=u;d.addControl(u)};e.removeControl=function(n){t[n]&&d.removeControl(t[n]);delete t[n]};e.getItems=function(){return $HASH(f.visible).values()};e.getItemById=function(n){return f.visible[n]};e.getMarkerById=function(n){return f.visible[n]};
e.getVisibleItems=function(n){var u=0,x=[],D=d.getBounds();$EACH(l.tiles,function(B){if(B.resource==n){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(n){location.href=n};e.initEditor=function(){if(!e.editor&&MapToolkit.RouteEditor)e.editor=new MapToolkit.RouteEditor(e);return e.editor};e.getCurrentMapTypeIndex=
function(){for(var n=0,u=d.getMapTypes(),x=0;x<u.length;x++)if(u[x]==d.getCurrentMapType())n=x;return n};e.updateLayer=function(n,u){c.layers[n].optional=u?false:true;n=c.layers[n].layer;u?d.addOverlay(n):d.removeOverlay(n);if(u){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction")}};e.updateResource=function(n,u,x){if(u){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,"interaction")}c.resources[n].optional=u?false:true;this.modified(x)};e.modified=
function(n){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){l=E;p=$HASH({});if(!E.tiles.length&&!$HASH(E.clusters).keys().length){f.pending={};R();
S();GEvent.trigger(e,"modifiedDone",E);n&&n($HASH(E.icons).keys())}else{$EACH(E.tiles,function(O){O.async&&p.set(O.id,O)});if(p.keys().length&&!m)m=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);n&&n($HASH(E.icons).keys())})}I();GEvent.trigger(e,"modified",E)}}})};e.setFullscreen=function(n){e.isFullscreen=n;e.resize();GEvent.trigger(e,"setFullscreen",n)};e.resize=function(){MapToolkit.resizeDiv(b,
e.isFullscreen,c);setTimeout(function(){var n=d.getCenter();d.checkResize();d.setCenter(n);GEvent.trigger(e,"resize",d.getSize().width,d.getSize().height)},1)};e.updateLocationHash=function(n){if(c.map.useLocationHash){var u=d.getCenter().lat(),x=d.getCenter().lng(),D=d.getZoom(),B=e.getCurrentMapTypeIndex();if(!(!n&&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(n){g="#"+n;location.hash=n};e.checkLocationHash=function(){var n=null;if(location.hash!=g){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);n=parseInt(RegExp.$4);GEvent.trigger(e,"checkLocationHash",RegExp.$6);n={lat:u,lng:x,zoom:D,type:n}}else{u=c.map.location;n=$INARRAY(c.map.mapTypes,c.map.mapType||c.map.mapTypes[0]);
if(n==-1)n=0;if(u.north){u=new GLatLngBounds(new GLatLng(u.south,u.west),new GLatLng(u.north,u.east));n={lat:u.getCenter().lat(),lng:u.getCenter().lng(),zoom:d.getBoundsZoomLevel(u),type:n}}else n={lat:u.lat,lng:u.lng,zoom:u.zoom,type:n}}d.setCenter(new GLatLng(n.lat,n.lng),n.zoom,d.getMapTypes()[n.type]);g=location.hash}setTimeout(function(){e.checkLocationHash()},500);return n};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(n,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);k=d.fromLatLngToDivPixel(C);c.map.controls&&$MAP(c.map.controls,function(n){try{e.addControl(n)}catch(u){alert("cannot add mapControl "+n+"', details: "+u+"'")}});e.modified();GEvent.addListener(d,"moveend",function(){e.updateLocationHash();e.modified();var n=d.fromLatLngToDivPixel(d.getCenter());if(Math.abs(k.x-n.x)>10||Math.abs(k.y-n.y)>10){GEvent.trigger(window,"MapToolkit.Map.interaction",e);GEvent.trigger(e,
"interaction")}k=n});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(n){r=[n.clientX,n.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 g=300;if(g>=c.ids[o].length)g=c.ids[o].length-1;f[o]=c.ids[o].splice(0,g)}else{f[o]=c.ids[o];delete c.ids[o]}d.push(f);for(o in c.ids)e=false}var h={};for(var m in b.config.resources)if(b.config.resources[m].templates)h[m]=b.config.resources[m].templates;var p={},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(h),static_map:c.staticMap?$TO_JSON(c.staticMap):""},callback:function(w){p={icons:$EXTEND(p.icons||{},w.icons),items:(p.items||[]).concat(w.items),requestId:w.requestId};d.length?t(d.shift()):c.callback(p)}})};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(m){m=m.toLowerCase();m="0123456789abcdef".indexOf(m);m-=2;if(m<0)m=0;return"0123456789abcdef".charAt(m)}).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(m,p){m=p.getCenter();var t=
b.getBoundsZoomLevel(p);t==b.getZoom()&&t++;if(t>b.getCurrentMapType().getMaximumResolution())t=b.getCurrentMapType().getMaximumResolution();p=f.config.map.mapTypes[f.getCurrentMapTypeIndex()];if(p=="G_SATELLITE_MAP"||p=="G_HYBRID_MAP")b.getCurrentMapType().getMaxZoomAtLatLng(m,function(r){r.zoom&&r.zoom<t&&MapToolkit.MapTypesControl.setMapType(e,G_NORMAL_MAP,$EL("mtk-maptype-normal-"+e))});b.setCenter(m,t)};var o="new GLatLngBounds($P("+this.params.south+","+this.params.west+"),$P("+this.params.north+
","+this.params.east+"))",g="clusterOnClickHandlers['"+this.params.id+"'](MapToolkit.maps['"+this.mapDiv+"'].map,"+o+")",h;h=this.params.levels||[19,39,69,99,150];h=this.params.count<h[0]?"a":this.params.count<h[1]?"b":this.params.count<h[2]?"c":this.params.count<h[3]?"d":this.params.count<h[4]?"e":"f";this.cluster.innerHTML='<div class="mtk-cluster" style="width:'+width+"px;height:"+height+'px;"><div class="mtk-background'+h+'" 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'+h+'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="'+g+';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,g=c.id,h=false,m=c.value,p=new GClientGeocoder,t=MapToolkit.location&&MapToolkit.location.country?MapToolkit.location.country:b.config.country||"",r=function(){$EL2(g+"-cancel")&&$EL2(g+"-cancel").hide();$EL2(g+"-spinner")&&$EL2(g+"-spinner").show()},w=function(){$EL2(g+"-cancel")&&$EL2(g+"-cancel").show();$EL2(g+"-spinner")&&$EL2(g+"-spinner").hide()},z=function(j){r();h=false;if(t&&!j.match(/,/))j=j+","+t;p.getLocations(j,function(i){w();
if(!h&&i&&i.Status.code==200){f=-1;var q=document.createElement("ul");q.id=g+"-result-list";$EACH(i.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(g+"-result").hide()};I.innerHTML=s.address.replace(/ /g,"&nbsp;");q.appendChild(I)});e&&$EL(g+"-result").removeChild(e);$EL(g+"-result").appendChild(e=q);q.childNodes.length&&$EL2(g+"-result").show()}})},k=function(j){var i=$EL(g+"-result-list"),q=i.childNodes.length;if(j=="down"){f++;if(f>=q)f=q-1}else{f--;if(f<0)f=0}for(j=0;j<
q;j++)i.childNodes[j].className=f==j?"mtk-locationsearch-result-li-selected":"mtk-locationsearch-result-li"},l=function(){h=true;w();c.value=m;$EL2(g+"-result").hide();$ADD_CLASS(c,"mtk-locationsearch-grey");c.blur()};c.setAttribute("autocomplete","off");c.onkeypress=function(j){return(j||window.event).keyCode!=13};c.onkeyup=function(j){var i=(j||window.event).keyCode;if(j.preventDefault)j.preventDefault();else j.returnValue=false;if(i==40)return k("down");else if(i==38)return k("up");else if(i==
13){c.blur();try{if(f==-1)f=0;$EL(g+"-result-list").childNodes[f].onclick();return false}catch(q){}}else if(j.keyCode==27)return l();o&&clearTimeout(o);o=setTimeout(function(){c.value?z(c.value):l()},200)};c.onclick=function(){if(c.value==m)c.value="";$REMOVE_CLASS(c,"mtk-locationsearch-grey")};if($EL(g+"-cancel"))$EL(g+"-cancel").onclick=l;l()};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 g=document.createElement("div");g.id=c+"-result";g.className="mtk-locationsearch-result";g.style.display="none";this.initialize=function(h){var m=document.createElement("div");m.className="mtk-locationsearch";m.appendChild(d);m.appendChild(e);m.appendChild(f);m.appendChild(o);
m.appendChild(g);h.getContainer().appendChild(m);new MapToolkit.LocationSearch(b,d);return m};this.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(80,7))}};MapToolkit.LocationSearchControl.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(g){b.removeControl(g)});b.config.map.optionalControl&&b.removeControl("MapToolkit.OptionalControl");b.config.map.controls=b.config.map.fullscreenControls;$EACH(b.config.map.controls,function(g){b.addControl(g)});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(g){b.removeControl(g)});b.config.map.optionalControl&&
b.removeControl("MapToolkit.OptionalControl");b.config.map.controls=b.config.map.fullscreenControls;$EACH(b.config.map.controls,function(g){b.addControl(g)});b.config.map.optionalControl&&b.addControl("MapToolkit.OptionalControl");b.config.map.fullscreenControls=f}}};MapToolkit.FullscreenIconControl.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",g=$EL(b.img);new GClientGeocoder;var h=new GStreetviewOverlay;new GStreetviewClient;var m=new GDraggableObject(g,{left:0,top:0}),p=function(k){k=k||0;return f.gmap.fromContainerPixelToLatLng(new GPoint(m.left+b.position.offset.width+b.icon.iconAnchor.x,m.top+b.position.offset.height+b.icon.iconAnchor.y+k))},t=function(k,l,j){var i=f.gmap.fromLatLngToContainerPixel(k);i=f.gmap.fromContainerPixelToLatLng(new GPoint(i.x+10,i.y+10));j=parseInt(j||
i.distanceFrom(k));jsonRpc({url:"http://www.google.com/cbk",parameters:{output:"json",oe:"utf-8",cb_client:"api",ll:k.lat()+","+k.lng(),radius:j},callback:function(q){if(q){q=q.Location;return l&&l($P(q),q,j)}l&&l()}})},r=function(){g.src=b.icon.image;$EL2(g).show();f.gmap.removeOverlay(h);m.moveTo(new GPoint(0,0));o="hidden"},w=function(){var k=f.gmap.getCenter();t(k,function(l){g.src=l&&f.gmap.getBounds().containsLatLng(l)?b.icon.image:b.grey},f.gmap.getBounds().getNorthEast().distanceFrom(k))},
z=function(k){k=f.gmap.fromLatLngToContainerPixel(k);m.moveTo(new GPoint(k.x-b.icon.iconAnchor.x-b.position.offset.width,k.y-b.icon.iconAnchor.y-b.position.offset.height))};GEvent.addListener(f.gmap,"moveend",w);g.onmouseover=function(){if(o=="hidden"){f.gmap.addOverlay(h);o="visible"}};g.onmouseout=function(){if(o=="visible"){f.gmap.removeOverlay(h);o="hidden"}};GEvent.addListener(m,"mousedown",function(){o="find"});GEvent.addListener(m,"dragstart",function(){d&&GEvent.removeListener(d);f.gmap.closeInfoWindow();
m.moveBy(new GSize(0,-20));g.src=b.target});GEvent.addListener(m,"drag",function(){MapToolkit.Tooltip.hide({map:f,className:"mtk-tooltip-streetview"});c&&clearTimeout(c);c=setTimeout(function(){t(p(20),function(k,l,j){if(c)if(k){g.src=b.target;k="http://maps.google.com/cbk?output=thumbnail&w=100&h=70&radius="+j+"&ll="+l.lat+","+l.lng;l=l.description+", "+l.region+", "+l.country;MapToolkit.Tooltip.show({map:f,point:p(),text:'<img src="'+k+'" width="100" height="70" /><br />'+l,icon:b.icon,className:"mtk-tooltip-streetview"})}else if(b.targetGrey)g.src=
b.targetGrey})},200)});GEvent.addListener(m,"dragend",function(){o="streetview";c&&clearTimeout(c);c=0;m.moveBy(new GSize(0,20));g.src=b.icon.image;MapToolkit.Tooltip.hide({map:f,className:"mtk-tooltip-streetview"});t(p(),function(k){if(!k)return r();e=k;z(k);var l=document.createElement("div");l.style.marginTop="10px";l.style.width="600px";l.style.height="400px";var j=new GStreetviewPanorama(l);GEvent.addListener(j,"error",function(i){if(i==603)l.innerHTML='StreetView requires flash plugin. Click <a href="http://get.adobe.com/flashplayer/" target="_blank"> here</a> to download';
if(i==600)l.innerHTML="No street view available"});GEvent.addListener(j,"initialized",function(i){var q=f.gmap.getCenter(),s=i.lat-e.lat(),I=i.lng-e.lng();f.gmap.setCenter($P(q.lat()+s,q.lng()+I));e=i.latlng;f.gmap.getInfoWindow().reset(e);z(e)});f.gmap.openInfoWindow(k,l,{noCloseOnClick:true});setTimeout(function(){j.setLocationAndPOV(k)},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 g=document.createElement("div");g.style.position="absolute";g.style.backgroundImage="url(http://mtk2.toursprung.com/static/images/pegman-control.png)";g.style.width="44px";g.style.height=
"45px";g.style.top="-6px";g.style.left="-3px";var h=document.createElement("img");h.src=e.image;h.style.position="absolute";h.style.top="0";h.style.left="0";new MapToolkit.Streetview({map:b,img:h,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(g);o.appendChild(h);f.getContainer().appendChild(o);return o};
c.getDefaultPosition=function(){return d}};MapToolkit.StreetviewControl.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 g=function(p){if(b.config.resources[p].isOptional){c.categories.push({name:p,title:MapToolkit.i18n[p],onclick:function(t,r){m(t,p,r)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+p+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+
p+".png"]});b.config.resources[p].optional||d.push(p)}}(o)}for(o in b.config.layers){if(b.config.layers[o].isOptional==null)b.config.layers[o].isOptional=b.config.layers[o].optional;g=function(p){if(b.config.layers[o].isOptional){c.categories.push({name:p,title:MapToolkit.i18n[p],onclick:function(t,r){b.updateLayer(p,t);setTimeout(r,500)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+p+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+p+".png"]});b.config.layers[p].optional||
d.push(p)}}(o)}var h='<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>',m=function(p,t,r){e.push(r);b.updateResource(t,p,function(){$EACH(e,function(w){w()});e=[]})};c.initialize=function(p){var t=document.createElement("div");t.innerHTML=h;p.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 p=f?10:230;if($INARRAY(b.config.map.controls,"MapToolkit.FullscreenIconControl")!=-1)p+=24;return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(p,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(m){if(b.config.resources[m].isOptional){c.categories.push({name:m,title:MapToolkit.i18n[m],onclick:function(p,t){h(p,m,t)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+m+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+
m+".png"]});b.config.resources[m].optional||d.push(m)}}(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(m){if(b.config.layers[f].isOptional){c.categories.push({name:m,title:MapToolkit.i18n[m],onclick:function(p,t){b.updateLayer(m,p);setTimeout(t,500)},icon:["http://mtk2.toursprung.com/static/images/menu/icons/grey/"+m+".png","http://mtk2.toursprung.com/static/images/menu/icons/color/"+m+".png"]});b.config.layers[m].optional||
d.push(m)}}(f)}var g='<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>',
h=function(m,p,t){e.push(t);b.updateResource(p,m,function(){$EACH(e,function(r){r()});e=[]})};c.initialize=function(m){var p=document.createElement("div");p.innerHTML=g;m.getContainer().appendChild(p);var t=new MapToolkit.TreeMenu("mtk-menu-content-"+b.div,c.categories,{map:b});$EACH(d,function(r){t[r].check()});$EL(p).pngFix&&$EL(p).pngFix();return p};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,g=null,h=[],m=[];c.preventRestore=false;c.expansionRadius=0;var p=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(h.length/4*w*0.6)},r=function(w,z){var k=h.length,l=k<5?100:k*20;z=t(z);var j=2*Math.PI/k;angle=k==3?Math.PI/2:0;for(var i=0;i<k;i++){angle+=j;newX=w.x+z*Math.cos(angle);newY=w.y+z*Math.sin(angle);h[i].panTo(b.gmap.fromDivPixelToLatLng(new GPoint(newX,newY)),l)}};
c.restore=function(){if(f){var w=h.length,z=w<5?100:w*20;$EACH(h,function(k){k.restore(z)});$EACH(m,function(k){k.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);p(w,g)<c.expansionRadius||c.preventRestore||c.restore()}});GEvent.addListener(b,"markerMouseOver",function(w){o&&w.doOnMouseOver();f||(e=function(){var z=w.icon.iconAnchor.y,
k=w.icon.iconSize.height,l=w.icon.iconSize.width,j=b.gmap.fromLatLngToDivPixel(w.point);h=$GREP(b.getItems(),function(i){if(!(i instanceof MapToolkit.Marker))return 0;if(i.params.resource!=w.params.resource)return 0;i=b.gmap.fromLatLngToDivPixel(i.point);return p(j,i)<=k/4});if(h.length<2)return w.doOnMouseOver();f=true;w.closeDetails();l=k/l<2?k/(k/l):k/2;c.expansionRadius=t(k)+l;g=new GPoint(j.x,j.y-k/2+(k-z));m=$GREP(b.getItems(),function(i){if(!(i instanceof MapToolkit.Marker))return 0;i=b.gmap.fromLatLngToDivPixel(i.point);
i=p(j,i);return i>k/4&&i<2*c.expansionRadius});$EACH(m,function(i){i.dimm(0.25)});r(j,k);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 g=$MAP(e,function(p){return p.lat()+","+p.lng()}),h=g.shift(),m=","+g.pop();g=g.length?",["+g.join(",")+"]":"";jsonRpc({url:c+h+g+m+("/"+(f.travelMode||"car"))+("."+(f.format||"js")),parameters:{lang:d[MapToolkit.language]||"en",units:f.unit||
"km"},callback:function(p){var t=$MAP(p.route_geometry,function(r){return $P(r)});GEvent.trigger(o,"load",{getDirectionsHtml:function(r){var w=0;var z=(r=r||"")&&r+" "+r+"-first",k=r&&r+" "+r+"-last";return $MAP(p.route_instructions,function(l){return'<tr><td class="'+z+'">'+ ++w+'.&nbsp;</td><td class="'+r+'">'+l[0]+'</td><td class="'+k+'">'+l[4].replace(/ /,"&nbsp;")+"</td></tr>"}).join("")},getNumGeocodes:function(){return e.length},getMarker:function(r){r=e[r];for(var w=null,z=99999999999,k=0;k<
t.length;k++)if(r.distanceFrom(t[k])<z){w=k;z=r.distanceFrom(t[k])}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 q;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,g=null,h,m,p=[],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")})},k=function(){MapToolkit.Tooltip.hide({map:b})};if(o.onScreenMenu==null||o.onScreenMenu){var l=
function(){MapToolkit.InfoWindow.hide({map:b});t=false};o.onScreenMenu=o.onScreenMenu||{};var j=o.onScreenMenu.event||"click";MapToolkit.OnMouseOut(b.div,l);GEvent.addListener(f,j,function(v,A){if(!v)if(t)l();else{v=document.createElement("div");v.className="mtk-onscreenmenu-item";v.onclick=function(){l();d.setStartPoint(A);d.redraw()};v.innerHTML=w("Directions from here");var C=document.createElement("div");C.className="mtk-onscreenmenu-item";C.onclick=function(){l();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 n=document.createElement("div");n.appendChild(v);n.appendChild(C);n.appendChild(G);n.appendChild(y);
n.appendChild(Q);MapToolkit.InfoWindow.show({map:b,point:A,content:n,opacity:o.onScreenMenu.opacity||95,onclose:function(){t=false}});t=true}})}var i=o.routingClass?(new MapToolkit.classForSting(o.routingClass))(o):new GDirections;GEvent.addListener(i,"load",function(v){for(var A=0;A<v.getNumGeocodes();A++){var C=v.getMarker(A).getLatLng();if(A==0){h.setLatLng(d.setStartPoint(C));GEvent.addListener(h,"mouseover",function(){return function(G){z(G,h.getIcon())}}(C));GEvent.addListener(h,"mouseout",
k)}else if(A==v.getNumGeocodes()-1){m.setLatLng(d.setEndPoint(C));GEvent.addListener(m,"mouseover",function(){return function(G){z(G,m.getIcon())}}(C));GEvent.addListener(m,"mouseout",k)}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 q=new MapToolkit.Icon({image:MapToolkit.host+"/static/images/editor/via.png",iconSize:[10,10],iconAnchor:[5,5]}),s=new GMarker($P(0,
0),{icon:q,draggable:true,dragCrossMove:true,bouncy:false,zIndexProcess:function(){return-999999999}});s.hide();f.addOverlay(s);GEvent.addListener(s,"mouseout",function(){k();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<p.length;y++)if(p[y]==G){GEvent.clearInstanceListeners(G);f.removeOverlay(G);p.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;p[A]&&p[A].setLatLng(y);d.redraw()});if(A=="start")h=G;else if(A=="end")m=G;else p.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],n=y==G?d.endPoint:d.transitPoints[y],u=Q.distanceFrom(n);Q=Q.distanceFrom(v);n=n.distanceFrom(v);if(Q+n-u<C){A=y;C=Q+n-u}}return A},J=function(v){g=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(g){f.removeOverlay(g);GEvent.clearInstanceListeners(g)}if(h){f.removeOverlay(h);GEvent.clearInstanceListeners(h)}if(m){f.removeOverlay(m);GEvent.clearInstanceListeners(m)}for(var v=
0;v<p.length;v++){GEvent.clearInstanceListeners(p[v]);f.removeOverlay(p[v])}m=h=g=null;p=[]},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;k();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);i.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<g.getVertexCount();A++)v.push(g.getVertex(A));return v};d.getDistance=function(){return g?g.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(g){var v=g.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)}();

