/*
 WEB-GIS PRO-GOROD ver. 0.1.8. All rights reserved.
*/
var swfobject=function(){function f(){if(!O){try{var b=r.getElementsByTagName("body")[0].appendChild(C("span"));b.parentNode.removeChild(b)}catch(c){return}O=true;b=U.length;for(var e=0;e<b;e++)U[e]()}}function d(b){if(O)b();else U[U.length]=b}function m(b){if(typeof H.addEventListener!=v)H.addEventListener("load",b,false);else if(typeof r.addEventListener!=v)r.addEventListener("load",b,false);else if(typeof H.attachEvent!=v)P(H,"onload",b);else if(typeof H.onload=="function"){var c=H.onload;H.onload=
function(){c();b()}}else H.onload=b}function w(){da?s():l()}function s(){var b=r.getElementsByTagName("body")[0],c=C(F);c.setAttribute("type",V);var e=b.appendChild(c);if(e){var h=0;(function(){if(typeof e.GetVariable!=v){var j=e.GetVariable("$version");if(j){j=j.split(" ")[1].split(",");k.pv=[parseInt(j[0],10),parseInt(j[1],10),parseInt(j[2],10)]}}else if(h<10){h++;setTimeout(arguments.callee,10);return}b.removeChild(c);e=null;l()})()}else l()}function l(){var b=L.length;if(b>0)for(var c=0;c<b;c++){var e=
L[c].id,h=L[c].callbackFn,j={success:false,id:e};if(k.pv[0]>0){var p=x(e);if(p)if(a(L[c].swfVersion)&&!(k.wk&&k.wk<312)){u(e,true);if(h){j.success=true;j.ref=G(e);h(j)}}else if(L[c].expressInstall&&I()){j={};j.data=L[c].expressInstall;j.width=p.getAttribute("width")||"0";j.height=p.getAttribute("height")||"0";if(p.getAttribute("class"))j.styleclass=p.getAttribute("class");if(p.getAttribute("align"))j.align=p.getAttribute("align");var q={};p=p.getElementsByTagName("param");for(var B=p.length,E=0;E<
B;E++)if(p[E].getAttribute("name").toLowerCase()!="movie")q[p[E].getAttribute("name")]=p[E].getAttribute("value");D(j,q,e,h)}else{y(p);h&&h(j)}}else{u(e,true);if(h){if((e=G(e))&&typeof e.SetVariable!=v){j.success=true;j.ref=e}h(j)}}}}function G(b){var c=null;if((b=x(b))&&b.nodeName=="OBJECT")if(typeof b.SetVariable!=v)c=b;else if(b=b.getElementsByTagName(F)[0])c=b;return c}function I(){return!W&&a("6.0.65")&&(k.win||k.mac)&&!(k.wk&&k.wk<312)}function D(b,c,e,h){W=true;ba=h||null;ea={success:false,
id:e};var j=x(e);if(j){if(j.nodeName=="OBJECT"){S=z(j);X=null}else{S=j;X=e}b.id=fa;if(typeof b.width==v||!/%$/.test(b.width)&&parseInt(b.width,10)<310)b.width="310";if(typeof b.height==v||!/%$/.test(b.height)&&parseInt(b.height,10)<137)b.height="137";r.title=r.title.slice(0,47)+" - Flash Player Installation";h=k.ie&&k.win?"ActiveX":"PlugIn";h="MMredirectURL="+H.location.toString().replace(/&/g,"%26")+"&MMplayerType="+h+"&MMdoctitle="+r.title;if(typeof c.flashvars!=v)c.flashvars+="&"+h;else c.flashvars=
h;if(k.ie&&k.win&&j.readyState!=4){h=C("div");e+="SWFObjectNew";h.setAttribute("id",e);j.parentNode.insertBefore(h,j);j.style.display="none";(function(){j.readyState==4?j.parentNode.removeChild(j):setTimeout(arguments.callee,10)})()}A(b,c,e)}}function y(b){if(k.ie&&k.win&&b.readyState!=4){var c=C("div");b.parentNode.insertBefore(c,b);c.parentNode.replaceChild(z(b),c);b.style.display="none";(function(){b.readyState==4?b.parentNode.removeChild(b):setTimeout(arguments.callee,10)})()}else b.parentNode.replaceChild(z(b),
b)}function z(b){var c=C("div");if(k.win&&k.ie)c.innerHTML=b.innerHTML;else if(b=b.getElementsByTagName(F)[0])if(b=b.childNodes)for(var e=b.length,h=0;h<e;h++)!(b[h].nodeType==1&&b[h].nodeName=="PARAM")&&b[h].nodeType!=8&&c.appendChild(b[h].cloneNode(true));return c}function A(b,c,e){var h,j=x(e);if(k.wk&&k.wk<312)return h;if(j){if(typeof b.id==v)b.id=e;if(k.ie&&k.win){var p="";for(var q in b)if(b[q]!=Object.prototype[q])if(q.toLowerCase()=="data")c.movie=b[q];else if(q.toLowerCase()=="styleclass")p+=
' class="'+b[q]+'"';else if(q.toLowerCase()!="classid")p+=" "+q+'="'+b[q]+'"';q="";for(var B in c)if(c[B]!=Object.prototype[B])q+='<param name="'+B+'" value="'+c[B]+'" />';j.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+p+">"+q+"</object>";Y[Y.length]=b.id;h=x(b.id)}else{B=C(F);B.setAttribute("type",V);for(p in b)if(b[p]!=Object.prototype[p])if(p.toLowerCase()=="styleclass")B.setAttribute("class",b[p]);else p.toLowerCase()!="classid"&&B.setAttribute(p,b[p]);for(var E in c)c[E]!=
Object.prototype[E]&&E.toLowerCase()!="movie"&&o(B,E,c[E]);j.parentNode.replaceChild(B,j);h=B}}return h}function o(b,c,e){var h=C("param");h.setAttribute("name",c);h.setAttribute("value",e);b.appendChild(h)}function n(b){var c=x(b);if(c&&c.nodeName=="OBJECT")if(k.ie&&k.win){c.style.display="none";(function(){c.readyState==4?t(b):setTimeout(arguments.callee,10)})()}else c.parentNode.removeChild(c)}function t(b){if(b=x(b)){for(var c in b)if(typeof b[c]=="function")b[c]=null;b.parentNode.removeChild(b)}}
function x(b){var c=null;try{c=r.getElementById(b)}catch(e){}return c}function C(b){return r.createElement(b)}function P(b,c,e){b.attachEvent(c,e);R[R.length]=[b,c,e]}function a(b){var c=k.pv;b=b.split(".");b[0]=parseInt(b[0],10);b[1]=parseInt(b[1],10)||0;b[2]=parseInt(b[2],10)||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false}function g(b,c,e,h){if(!(k.ie&&k.mac)){var j=r.getElementsByTagName("head")[0];if(j){e=e&&typeof e=="string"?e:"screen";if(h)ca=J=null;
if(!J||ca!=e){h=C("style");h.setAttribute("type","text/css");h.setAttribute("media",e);J=j.appendChild(h);if(k.ie&&k.win&&typeof r.styleSheets!=v&&r.styleSheets.length>0)J=r.styleSheets[r.styleSheets.length-1];ca=e}if(k.ie&&k.win)J&&typeof J.addRule==F&&J.addRule(b,c);else J&&typeof r.createTextNode!=v&&J.appendChild(r.createTextNode(b+" {"+c+"}"))}}}function u(b,c){if(ga){c=c?"visible":"hidden";if(O&&x(b))x(b).style.visibility=c;else g("#"+b,"visibility:"+c)}}function Q(b){return/[\\\"<>\.;]/.exec(b)!=
null&&typeof encodeURIComponent!=v?encodeURIComponent(b):b}var v="undefined",F="object",V="application/x-shockwave-flash",fa="SWFObjectExprInst",H=window,r=document,M=navigator,da=false,U=[w],L=[],Y=[],R=[],S,X,ba,ea,O=false,W=false,J,ca,ga=true,k=function(){var b=typeof r.getElementById!=v&&typeof r.getElementsByTagName!=v&&typeof r.createElement!=v,c=M.userAgent.toLowerCase(),e=M.platform.toLowerCase(),h=e?/win/.test(e):/win/.test(c);e=e?/mac/.test(e):/mac/.test(c);c=/webkit/.test(c)?parseFloat(c.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,
"$1")):false;var j=!+"\u000b1",p=[0,0,0],q=null;if(typeof M.plugins!=v&&typeof M.plugins["Shockwave Flash"]==F){if((q=M.plugins["Shockwave Flash"].description)&&!(typeof M.mimeTypes!=v&&M.mimeTypes[V]&&!M.mimeTypes[V].enabledPlugin)){da=true;j=false;q=q.replace(/^.*\s+(\S+\s+\S+$)/,"$1");p[0]=parseInt(q.replace(/^(.*)\..*$/,"$1"),10);p[1]=parseInt(q.replace(/^.*\.(.*)\s.*$/,"$1"),10);p[2]=/[a-zA-Z]/.test(q)?parseInt(q.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else if(typeof H.ActiveXObject!=v)try{var B=
new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(B)if(q=B.GetVariable("$version")){j=true;q=q.split(" ")[1].split(",");p=[parseInt(q[0],10),parseInt(q[1],10),parseInt(q[2],10)]}}catch(E){}return{w3:b,pv:p,wk:c,ie:j,win:h,mac:e}}();(function(){if(k.w3){if(typeof r.readyState!=v&&r.readyState=="complete"||typeof r.readyState==v&&(r.getElementsByTagName("body")[0]||r.body))f();if(!O){typeof r.addEventListener!=v&&r.addEventListener("DOMContentLoaded",f,false);if(k.ie&&k.win){r.attachEvent("onreadystatechange",
function(){if(r.readyState=="complete"){r.detachEvent("onreadystatechange",arguments.callee);f()}});H==top&&function(){if(!O){try{r.documentElement.doScroll("left")}catch(b){setTimeout(arguments.callee,0);return}f()}}()}k.wk&&function(){O||(/loaded|complete/.test(r.readyState)?f():setTimeout(arguments.callee,0))}();m(f)}}})();(function(){k.ie&&k.win&&window.attachEvent("onunload",function(){for(var b=R.length,c=0;c<b;c++)R[c][0].detachEvent(R[c][1],R[c][2]);b=Y.length;for(c=0;c<b;c++)n(Y[c]);for(var e in k)k[e]=
null;k=null;for(var h in swfobject)swfobject[h]=null;swfobject=null})})();return{registerObject:function(b,c,e,h){if(k.w3&&b&&c){var j={};j.id=b;j.swfVersion=c;j.expressInstall=e;j.callbackFn=h;L[L.length]=j;u(b,false)}else h&&h({success:false,id:b})},getObjectById:function(b){if(k.w3)return G(b)},embedSWF:function(b,c,e,h,j,p,q,B,E,T){var Z={success:false,id:c};if(k.w3&&!(k.wk&&k.wk<312)&&b&&c&&e&&h&&j){u(c,false);d(function(){e+="";h+="";var N={};if(E&&typeof E===F)for(var K in E)N[K]=E[K];N.data=
b;N.width=e;N.height=h;K={};if(B&&typeof B===F)for(var $ in B)K[$]=B[$];if(q&&typeof q===F)for(var aa in q)if(typeof K.flashvars!=v)K.flashvars+="&"+aa+"="+q[aa];else K.flashvars=aa+"="+q[aa];if(a(j)){$=A(N,K,c);N.id==c&&u(c,true);Z.success=true;Z.ref=$}else if(p&&I()){N.data=p;D(N,K,c,T);return}else u(c,true);T&&T(Z)})}else T&&T(Z)},switchOffAutoHideShow:function(){ga=false},ua:k,getFlashPlayerVersion:function(){return{major:k.pv[0],minor:k.pv[1],release:k.pv[2]}},hasFlashPlayerVersion:a,createSWF:function(b,
c,e){if(k.w3)return A(b,c,e)},showExpressInstall:function(b,c,e,h){k.w3&&I()&&D(b,c,e,h)},removeSWF:function(b){k.w3&&n(b)},createCSS:function(b,c,e,h){k.w3&&g(b,c,e,h)},addDomLoadEvent:d,addLoadEvent:m,getQueryParamValue:function(b){var c=r.location.search||r.location.hash;if(c){if(/\?/.test(c))c=c.split("?")[1];if(b==null)return Q(c);c=c.split("&");for(var e=0;e<c.length;e++)if(c[e].substring(0,c[e].indexOf("="))==b)return Q(c[e].substring(c[e].indexOf("=")+1))}return""},expressInstallCallback:function(){if(W){var b=
x(fa);if(b&&S){b.parentNode.replaceChild(S,b);if(X){u(X,true);if(k.ie&&k.win)S.style.display="block"}ba&&ba(ea)}W=false}}}}(),json_parse=function(){var f,d,m={'"':'"',"\\":"\\","/":"/",b:"\u0008",f:"\u000c",n:"\n",r:"\r",t:"\t"},w,s=function(n){throw{name:"SyntaxError",message:n,at:f,text:w};},l=function(n){n&&n!==d&&s("Expected '"+n+"' instead of '"+d+"'");d=w.charAt(f);f+=1;return d},G=function(){var n;n="";if(d==="-"){n="-";l("-")}for(;d>="0"&&d<="9";){n+=d;l()}if(d===".")for(n+=".";l()&&d>="0"&&
d<="9";)n+=d;if(d==="e"||d==="E"){n+=d;l();if(d==="-"||d==="+"){n+=d;l()}for(;d>="0"&&d<="9";){n+=d;l()}}n=+n;if(isNaN(n))s("Bad number");else return n},I=function(){var n,t,x="",C;if(d==='"')for(;l();)if(d==='"'){l();return x}else if(d==="\\"){l();if(d==="u"){for(t=C=0;t<4;t+=1){n=parseInt(l(),16);if(!isFinite(n))break;C=C*16+n}x+=String.fromCharCode(C)}else if(typeof m[d]==="string")x+=m[d];else break}else x+=d;s("Bad string")},D=function(){for(;d&&d<=" ";)l()},y=function(){switch(d){case "t":l("t");
l("r");l("u");l("e");return true;case "f":l("f");l("a");l("l");l("s");l("e");return false;case "n":l("n");l("u");l("l");l("l");return null}s("Unexpected '"+d+"'")},z,A=function(){var n=[];if(d==="["){l("[");D();if(d==="]"){l("]");return n}for(;d;){n.push(z());D();if(d==="]"){l("]");return n}l(",");D()}}s("Bad array")},o=function(){var n,t={};if(d==="{"){l("{");D();if(d==="}"){l("}");return t}for(;d;){n=I();D();l(":");Object.hasOwnProperty.call(t,n)&&s('Duplicate key "'+n+'"');t[n]=z();D();if(d===
"}"){l("}");return t}l(",");D()}}s("Bad object")};z=function(){D();switch(d){case "{":return o();case "[":return A();case '"':return I();case "-":return G();default:return d>="0"&&d<="9"?G():y()}};return function(n,t){w=n;f=0;d=" ";n=z();D();d&&s("Syntax error");return typeof t==="function"?function x(C,P){var a,g,u=C[P];if(u&&typeof u==="object")for(a in u)if(Object.hasOwnProperty.call(u,a)){g=x(u,a);if(g!==undefined)u[a]=g;else delete u[a]}return t.call(C,P,u)}({"":n},""):n}}();
function Map(f){function d(){if(!f)throw"Map DOM object is not defined in constructor";if(typeof f=="string")throw"String is passed as argument to constructor";if(!swfobject)throw"SWF builder object is not defined in constructor";m()}function m(){var a=document.createElement("div");a.id="ProGorodMap";f.appendChild(a);var g={key:P},u={id:a.id,name:a.id};swfobject.switchOffAutoHideShow();swfobject.embedSWF("http://flash.tmcrussia.com/releases/0.1.8/Main.swf",a.id,"100%","100%","10.0","js/swfobject/expressInstall.swf",g,{wmode:"opaque",
align:"left",scale:"default",allowscriptaccess:"always"},u);FlashBridge.flashObj=document.getElementById(a.id);FlashBridge.mapObj=x;w(FlashBridge.flashObj)}function w(a){if(a){addHandler(a,"mouseover",s);addHandler(a,"mouseout",l)}}function s(){window.addEventListener&&window.addEventListener("DOMMouseScroll",G,false);window.onmousewheel=document.onmousewheel=G}function l(){window.removeEventListener&&window.removeEventListener("DOMMouseScroll",G,false);window.onmousewheel=document.onmousewheel=function(){}}
function G(a){navigator.appVersion.toLowerCase().indexOf("mac");navigator.appVersion.toLowerCase().indexOf("win");var g=0;if(!a)a=window.event;if(a.wheelDelta)g=a.wheelDelta/120;else if(a.detail)g=-a.detail/3;g&&I(g);a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();a.cancelBubble=true;a.cancel=true;a.returnValue=false}function I(a){FlashBridge.sendFlash("SendMouseWheelEvent",a)}function D(a){switch(a.type){case "point":o.points.push({lon:a.lon,lat:a.lat});break;case "polyline":o.polylines.push(a.points);
break;case "polygone":o.polygones.push(a.points);break;case "rectangle":o.rectangles.push(a.points);break;case "freeHand":o.freeHands.push(a.points);break}}function y(a){switch(a.type){case "point":delete o.points[a.id];break;case "polyline":delete o.polylines[a.id];break;case "polygone":delete o.polygones[a.id];break;case "rectangle":delete o.rectangles[a.id];break;case "freeHand":delete o.freeHands[a.id];break}}var z={lon:4187521,lat:7473956,z:10},A={slider:{enable:true,elements:{plus:"",minus:"",
level:"",activeLevel:""}}},o={points:[],polylines:[],polygones:[],rectangles:[],freeHands:[]},n=[],t=[],x=this,C=false,P="e16a5f67e5cc3887282038bf6bc27657";bboxCallback=null;this.tileSize=256;this.freeHandCallBack=this.rectangleCallBack=this.polygoneCallBack=this.polylineCallBack=this.pointCallBack=null;this.getControls=function(){return A};this.getCode=function(){return P};this.getCords=function(){return z};this.updateCords=function(a){this.setCenter(a.lon,a.lat,a.z);typeof bboxCallback=="function"&&
bboxCallback(a)};this.setCenter=function(a,g,u){if(a&&g&&u){z.lon=a;z.lat=g;z.z=u}};this.setControl=function(a,g){a=a.toString();if(a.indexOf("slider")==-1)A[a]=typeof g=="string"&&g.toString()!=""?{arg:g.toString()}:{};else for(el in g)A.slider.elements[el]=g[el]};this.unsetControl=function(a){a.toString();if(A[a]!=undefined)A[a].enable=false};this.sendAjaxCallBack=function(a){var g=t[a.id];g!=undefined&&g(a.response);t[a.id]=null};this.sendCallBackGeometry=function(a){switch(a){case "point":typeof this.pointCallBack==
"function"&&this.pointCallBack(o.points);break;case "polyline":typeof this.polylineCallBack=="function"&&this.polylineCallBack(o.polylines);break;case "polygone":typeof this.polygoneCallBack=="function"&&this.polygoneCallBack(o.polygones);break;case "rectangle":typeof this.rectangleCallBack=="function"&&this.rectangleCallBack(o.rectangles);break;case "freeHand":typeof this.freeHandCallBack=="function"&&this.freeHandCallBack(o.freeHands);break}};this.createGeometry=function(a,g){if(g){D(a);this.sendCallBackGeometry(a.type)}else if(C){D(a);
FlashBridge.sendFlash("CreateGeometry",a);this.sendCallBackGeometry(a.type)}else n.push(a)};this.deleteGeometry=function(a){if(typeof a=="string"&&a=="all"){for(el in o)for(var g=0;g<o[el].length;g++){var u={type:el.substring(0,el.length-1),id:g};y(u);FlashBridge.sendFlash("DeleteGeometry",u)}return true}else if(typeof a=="object"&&a.type!=undefined)if(a.id!=undefined){y(a);FlashBridge.sendFlash("DeleteGeometry",a)}else{var Q=this.getGeometry(a);for(g=0;g<Q.length;g++){u={type:a.type,id:g};y(u);FlashBridge.sendFlash("DeleteGeometry",
u)}}};this.getGeometry=function(a){var g=null;if(a=="all")return o;switch(a.type){case "point":g=o.points;break;case "polyline":g=o.polylines;break;case "polygone":g=o.polygones;break;case "rectangle":g=o.rectangles;break;case "freeHand":g=o.freeHands;break}if(g&&a.id!=undefined)g=g[a.id];return g};this.updateGeometry=function(a){switch(a.type){case "point":o.points[a.id]={lon:a.lon,lat:a.lat};break;case "polyline":o.polylines[a.id]=a.cords;break;case "polygone":o.polygones[a.id]=a.cords;break;case "rectangle":o.rectangles[a.id]=
a.cords;break;case "freeHand":o.freeHands[a.id]=a.cords;break}this.sendCallBackGeometry(a.type)};this.addPointToGeometry=function(a){var g;if(a.type=="polyline")g=o.polylines[a.id];else if(a.type=="polygone")g=o.polygones[a.id];if(g!=undefined){g.push({lon:a.lon,lat:a.lat});FlashBridge.sendFlash("AddPointToGeometry",a);this.sendCallBackGeometry(a.type)}};this.updatePoint=function(a){var g;if(a.type=="polyline")g=o.polylines[a.id][a.pointId];else if(a.type=="poligone")g=o.poligones[a.id][a.pointId];
else if(a.type=="point")g=o.points[a.id];if(g){if(a.lon&&a.lat){g.lon=a.lon;g.lat=a.lat}FlashBridge.sendFlash("UpdatePoint",a);this.sendCallBackGeometry(a.type)}};this.setStyle=function(a){a&&a.type&&FlashBridge.sendFlash("SetStyle",a)};this.getPreSetGeometry=function(){return n};this.search=function(a,g){function u(F){Q++;if(F!=404){F=json_parse(F);if(F[0].poi_id)v.pois=F;else v.objects=F;Q==2&&typeof g=="function"&&g(v)}}a=a.toString();var Q=0;x=this;var v={objects:null,pois:null};this.ajax({type:"search",
func:"address",str:a,callBack:u});this.ajax({type:"search",func:"poi",str:a,callBack:u})};this.ajax=function(a){var g=t.length;a.id=g;FlashBridge.sendFlash("SendRequest",a);t[g]=a.callBack};this.sendControls=function(){var a=this.getControls();FlashBridge.sendFlash("SendControls",a)};this.sendBbox=function(){var a=this.getCords();FlashBridge.sendFlash("SendBBox",a)};this.updateMap=function(a){this.setCenter(a.lon,a.lat,a.zoom);this.sendBbox()};this.createMap=function(a){if(a&&typeof a=="boolean")C=
a;if(C){this.sendControls();for(this.sendBbox();n.length;)this.createGeometry(n.splice(0,1)[0])}};this.getBboxCords=function(a){if(typeof a=="function"){bboxCallback=a;FlashBridge.sendFlash("GetBboxCords",true)}};d()}Map.prototype.getCords=function(){return this.getCords()};function FlashBridge(){}FlashBridge.mapObj=null;FlashBridge.flashObj=null;
FlashBridge.receiveFlash=function(f,d){if(this.mapObj!=null&&f!=""&&d!=null){var m=this.mapObj;switch(f.toString()){case "SwfReady":m.createMap(d);break;case "UpdateZoomMap":m.updateMap(d);break;case "addGeometry":m.createGeometry(d,true);break;case "updateGeometry":m.updateGeometry(d);break;case "updateCords":m.updateCords(d);break;case "ReceiveRequest":m.sendAjaxCallBack(d);break}}};
FlashBridge.sendFlash=function(f,d){if(this.mapObj!=null&&this.flashObj!=null&&f!=""&&d!=null){var m=this.flashObj;switch(f.toString()){case "SendControls":m.SendControls(d);break;case "SendBBox":m.SendBBox(d);break;case "DeleteGeometry":m.DeleteGeometry(d);break;case "CreateGeometry":m.AddGeometry(d);break;case "AddPointToGeometry":m.AddPointToGeometry(d);break;case "UpdatePoint":m.UpdatePoint(d);break;case "SetStyle":m.SetStyle(d);break;case "GetBboxCords":m.GetBboxCords();break;case "SendMouseWheelEvent":m.SendMouseWheelEvent(d);
break;case "SendRequest":m.SendRequest(d);break}}};function addHandler(f,d,m){if(typeof f.addEventListener!="undefined")f.addEventListener(d,m,false);else if(typeof f.attachEvent!="undefined")f.attachEvent("on"+d,m);else throw"Incompatible browser";}function removeHandler(f,d,m){if(typeof f.removeEventListener!="undefined")f.removeEventListener(d,m,false);else if(typeof f.detachEvent!="undefined")f.detachEvent("on"+d,m);else throw"Incompatible browser";}var PI=3.14159265358979;
function deg_rad(f){return f*(PI/180)}function deg_decimal(f){return f/PI*180}function merc_x(f){return 6378137*deg_rad(f)}function from_merc_x(f){return deg_decimal(f/6378137)}function merc_y(f){if(f>89.5)f=89.5;if(f<-89.5)f=-89.5;var d=Math.sqrt(0.006694380004260925);f=deg_rad(f);var m=Math.sin(f);m=d*m;m=Math.pow((1-m)/(1+m),0.5*d);d=Math.tan(0.5*(PI*0.5-f))/m;return 0-6378137*Math.log(d)}
function from_merc_y(f){var d=Math.sqrt(0.006694380004260925);f=Math.exp(-f/6378137);var m,w,s;m=0.5*d;w=1.5707963267948966-2*Math.atan(f);var l=15;for(s=0.1;Math.abs(s)>1.0E-7&&--l>0;){s=d*Math.sin(w);s=1.5707963267948966-2*Math.atan(f*Math.pow((1-s)/(1+s),m))-w;w+=s}return deg_decimal(w)}
function distVincenty(f,d,m,w){var s={},l={};s.lon=deg_rad(f);s.lat=deg_rad(d);l.lon=deg_rad(m);l.lat=deg_rad(w);f=1/298.257223563;d=l.lon-s.lon;s=Math.atan((1-f)*Math.tan(s.lat));w=Math.atan((1-f)*Math.tan(l.lat));l=Math.sin(s);s=Math.cos(s);m=Math.sin(w);w=Math.cos(w);for(var G=d,I=2*Math.PI,D=20;Math.abs(G-I)>1.0E-12&&--D>0;){var y=Math.sin(G),z=Math.cos(G),A=Math.sqrt(w*y*w*y+(s*m-l*w*z)*(s*m-l*w*z));if(A==0)return 0;z=l*m+s*w*z;var o=Math.atan2(A,z),n=s*w*y/A,t=1-n*n;y=z-2*l*m/t;if(isNaN(y))y=
0;var x=f/16*t*(4+f*(4-3*t));I=G;G=d+(1-x)*f*n*(o+x*A*(y+x*z*(-1+2*y*y)))}if(D==0)return NaN;t=t*2.723316066819453E11/4.0408299984087055E13;f=t/1024*(256+t*(-128+t*(74-47*t)));A=6356752.3142*(1+t/16384*(4096+t*(-768+t*(320-175*t))))*(o-f*A*(y+f/4*(z*(-1+2*y*y)-f/6*y*(-3+4*A*A)*(-3+4*y*y))));return A=A.toFixed(3)}Array.prototype.find=function(f){var d=false;for(i=0;i<this.length;i++)if(typeof f=="function"){if(f.test(this[i])){d||(d=[]);d.push(i)}}else if(this[i]===f){d||(d=[]);d.push(i)}return d};
