Revert "Export"
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-geo-1.0a4 / docs / jquery.geo-1.0a3.min.js
1 document.createElement("canvas").getContext||function(){function e(){return this.context_||(this.context_=new s(this))}function r(h,n){var q=K.call(arguments,2);return function(){return h.apply(n,q.concat(K.call(arguments)))}}function p(h){h.namespaces.g_vml_||h.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");h.namespaces.g_o_||h.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!h.styleSheets.ex_canvas_){h=h.createStyleSheet();h.owningElement.id=
2 "ex_canvas_";h.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function a(h){var n=h.srcElement;switch(h.propertyName){case "width":n.getContext().clearRect();n.style.width=n.attributes.width.nodeValue+"px";n.firstChild.style.width=n.clientWidth+"px";break;case "height":n.getContext().clearRect();n.style.height=n.attributes.height.nodeValue+"px";n.firstChild.style.height=n.clientHeight+"px"}}function c(h){h=h.srcElement;if(h.firstChild){h.firstChild.style.width=
3 h.clientWidth+"px";h.firstChild.style.height=h.clientHeight+"px"}}function b(){return[[1,0,0],[0,1,0],[0,0,1]]}function d(h,n){for(var q=b(),u=0;u<3;u++)for(var z=0;z<3;z++){for(var v=0,L=0;L<3;L++)v+=h[u][L]*n[L][z];q[u][z]=v}return q}function g(h,n){n.fillStyle=h.fillStyle;n.lineCap=h.lineCap;n.lineJoin=h.lineJoin;n.lineWidth=h.lineWidth;n.miterLimit=h.miterLimit;n.shadowBlur=h.shadowBlur;n.shadowColor=h.shadowColor;n.shadowOffsetX=h.shadowOffsetX;n.shadowOffsetY=h.shadowOffsetY;n.strokeStyle=h.strokeStyle;
4 n.globalAlpha=h.globalAlpha;n.font=h.font;n.textAlign=h.textAlign;n.textBaseline=h.textBaseline;n.arcScaleX_=h.arcScaleX_;n.arcScaleY_=h.arcScaleY_;n.lineScale_=h.lineScale_}function f(h){var n=h.indexOf("(",3),q=h.indexOf(")",n+1);n=h.substring(n+1,q).split(",");if(n.length!=4||h.charAt(3)!="a")n[3]=1;return n}function m(h,n,q){return Math.min(q,Math.max(n,h))}function l(h,n,q){q<0&&q++;q>1&&q--;return 6*q<1?h+(n-h)*6*q:2*q<1?n:3*q<2?h+(n-h)*(2/3-q)*6:h}function o(h){if(h in O)return O[h];var n,
5 q=1;h=String(h);if(h.charAt(0)=="#")n=h;else if(/^rgb/.test(h)){q=f(h);n="#";for(var u,z=0;z<3;z++){u=q[z].indexOf("%")!=-1?Math.floor(parseFloat(q[z])/100*255):+q[z];n+=F[m(u,0,255)]}q=+q[3]}else if(/^hsl/.test(h)){z=q=f(h);n=parseFloat(z[0])/360%360;n<0&&n++;u=m(parseFloat(z[1])/100,0,1);z=m(parseFloat(z[2])/100,0,1);if(u==0)u=z=n=z;else{var v=z<0.5?z*(1+u):z+u-z*u,L=2*z-v;u=l(L,v,n+1/3);z=l(L,v,n);n=l(L,v,n-1/3)}n="#"+F[Math.floor(u*255)]+F[Math.floor(z*255)]+F[Math.floor(n*255)];q=q[3]}else n=
6 h;return O[h]={color:n,alpha:q}}function s(h){this.m_=b();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=D*1;this.globalAlpha=1;this.canvas=h;var n="width:"+h.clientWidth+"px;height:"+h.clientHeight+"px;overflow:hidden;position:absolute",q=h.ownerDocument.createElement("div");q.style.cssText=n;h.appendChild(q);n=q.cloneNode(false);n.style.backgroundColor="red";n.style.filter="alpha(opacity=0)";
7 h.appendChild(n);this.element_=q;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}function x(h,n,q,u){h.currentPath_.push({type:"bezierCurveTo",cp1x:n.x,cp1y:n.y,cp2x:q.x,cp2y:q.y,x:u.x,y:u.y});h.currentX_=u.x;h.currentY_=u.y}function t(h,n,q){h=h.m_;return{x:D*(n*h[0][0]+q*h[1][0]+h[2][0])-J,y:D*(n*h[0][1]+q*h[1][1]+h[2][1])-J}}function A(h,n,q){if(isFinite(n[0][0])&&isFinite(n[0][1])&&isFinite(n[1][0])&&isFinite(n[1][1])&&isFinite(n[2][0])&&isFinite(n[2][1])){h.m_=n;if(q)h.lineScale_=E(G(n[0][0]*
8 n[1][1]-n[0][1]*n[1][0]))}}function B(h){this.code=this[h];this.message=h+": DOM Exception "+this.code}var C=Math,y=C.round,H=C.sin,I=C.cos,G=C.abs,E=C.sqrt,D=10,J=D/2;navigator.userAgent.match(/MSIE ([\d.]+)?/);var K=Array.prototype.slice;p(document);C={init:function(h){h=h||document;h.createElement("canvas");h.attachEvent("onreadystatechange",r(this.init_,this,h))},init_:function(h){h=h.getElementsByTagName("canvas");for(var n=0;n<h.length;n++)this.initElement(h[n])},initElement:function(h){if(!h.getContext){h.getContext=
9 e;p(h.ownerDocument);h.innerHTML="";h.attachEvent("onpropertychange",a);h.attachEvent("onresize",c);var n=h.attributes;if(n.width&&n.width.specified)h.style.width=n.width.nodeValue+"px";else h.width=h.clientWidth;if(n.height&&n.height.specified)h.style.height=n.height.nodeValue+"px";else h.height=h.clientHeight}return h}};C.init();for(var F=[],w=0;w<16;w++)for(var M=0;M<16;M++)F[w*16+M]=w.toString(16)+M.toString(16);var O={},P={butt:"flat",round:"round"};w=s.prototype;w.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);
10 this.textMeasureEl_=null}this.element_.innerHTML=""};w.beginPath=function(){this.currentPath_=[]};w.moveTo=function(h,n){var q=t(this,h,n);this.currentPath_.push({type:"moveTo",x:q.x,y:q.y});this.currentX_=q.x;this.currentY_=q.y};w.lineTo=function(h,n){var q=t(this,h,n);this.currentPath_.push({type:"lineTo",x:q.x,y:q.y});this.currentX_=q.x;this.currentY_=q.y};w.bezierCurveTo=function(h,n,q,u,z,v){z=t(this,z,v);h=t(this,h,n);q=t(this,q,u);x(this,h,q,z)};w.quadraticCurveTo=function(h,n,q,u){h=t(this,
11 h,n);q=t(this,q,u);u={x:this.currentX_+2/3*(h.x-this.currentX_),y:this.currentY_+2/3*(h.y-this.currentY_)};x(this,u,{x:u.x+(q.x-this.currentX_)/3,y:u.y+(q.y-this.currentY_)/3},q)};w.arc=function(h,n,q,u,z,v){q*=D;var L=v?"at":"wa",N=h+I(u)*q-J,Q=n+H(u)*q-J;u=h+I(z)*q-J;z=n+H(z)*q-J;if(N==u&&!v)N+=0.125;h=t(this,h,n);N=t(this,N,Q);u=t(this,u,z);this.currentPath_.push({type:L,x:h.x,y:h.y,radius:q,xStart:N.x,yStart:N.y,xEnd:u.x,yEnd:u.y})};w.stroke=function(h){var n=[];n.push("<g_vml_:shape",' filled="',
12 !!h,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0,0"',' coordsize="',D*10,",",D*10,'"',' stroked="',!h,'"',' path="');for(var q={x:null,y:null},u={x:null,y:null},z=0;z<this.currentPath_.length;z++){var v=this.currentPath_[z];switch(v.type){case "moveTo":n.push(" m ",y(v.x),",",y(v.y));break;case "lineTo":n.push(" l ",y(v.x),",",y(v.y));break;case "close":n.push(" x ");v=null;break;case "bezierCurveTo":n.push(" c ",y(v.cp1x),",",y(v.cp1y),",",y(v.cp2x),",",y(v.cp2y),
13 ",",y(v.x),",",y(v.y));break;case "at":case "wa":n.push(" ",v.type," ",y(v.x-this.arcScaleX_*v.radius),",",y(v.y-this.arcScaleY_*v.radius)," ",y(v.x+this.arcScaleX_*v.radius),",",y(v.y+this.arcScaleY_*v.radius)," ",y(v.xStart),",",y(v.yStart)," ",y(v.xEnd),",",y(v.yEnd))}if(v){if(q.x==null||v.x<q.x)q.x=v.x;if(u.x==null||v.x>u.x)u.x=v.x;if(q.y==null||v.y<q.y)q.y=v.y;if(u.y==null||v.y>u.y)u.y=v.y}}n.push(' ">');if(h){h=o(this.fillStyle);n.push('<g_vml_:fill color="',h.color,'" opacity="',h.alpha*this.globalAlpha,
14 '" />')}else{q=o(this.strokeStyle);h=q.color;q=q.alpha*this.globalAlpha;u=this.lineScale_*this.lineWidth;if(u<1)q*=u;n.push("<g_vml_:stroke",' opacity="',q,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',P[this.lineCap]||"square",'"',' weight="',u,'px"',' color="',h,'" />')}n.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",n.join(""))};w.fill=function(){this.stroke(true)};w.closePath=function(){this.currentPath_.push({type:"close"})};w.save=
15 function(){var h={};g(this,h);this.aStack_.push(h);this.mStack_.push(this.m_);this.m_=d(b(),this.m_)};w.restore=function(){if(this.aStack_.length){g(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};w.translate=function(h,n){A(this,d([[1,0,0],[0,1,0],[h,n,1]],this.m_),false)};w.scale=function(h,n){this.arcScaleX_*=h;this.arcScaleY_*=n;A(this,d([[h,0,0],[0,n,0],[0,0,1]],this.m_),true)};w=B.prototype=Error();w.INDEX_SIZE_ERR=1;w.DOMSTRING_SIZE_ERR=2;w.HIERARCHY_REQUEST_ERR=3;w.WRONG_DOCUMENT_ERR=
16 4;w.INVALID_CHARACTER_ERR=5;w.NO_DATA_ALLOWED_ERR=6;w.NO_MODIFICATION_ALLOWED_ERR=7;w.NOT_FOUND_ERR=8;w.NOT_SUPPORTED_ERR=9;w.INUSE_ATTRIBUTE_ERR=10;w.INVALID_STATE_ERR=11;w.SYNTAX_ERR=12;w.INVALID_MODIFICATION_ERR=13;w.NAMESPACE_ERR=14;w.INVALID_ACCESS_ERR=15;w.VALIDATION_ERR=16;w.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=C;CanvasRenderingContext2D=s;DOMException=B}();
17 (function(e){function r(a){var c=[].slice.call(arguments,1),b=0;a=e.event.fix(a||window.event);a.type="mousewheel";if(a.wheelDelta)b=a.wheelDelta/120;if(a.detail)b=-a.detail/3;c.unshift(a,b);return e.event.handle.apply(this,c)}var p=["DOMMouseScroll","mousewheel"];e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=p.length;a;)this.addEventListener(p[--a],r,false);else this.onmousewheel=r},teardown:function(){if(this.removeEventListener)for(var a=p.length;a;)this.removeEventListener(p[--a],
18 r,false);else this.onmousewheel=null}};e.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
19 $.widget||function(e,r){var p=Array.prototype.slice,a=e.cleanData;e.cleanData=function(c){for(var b=0,d;(d=c[b])!=null;b++)e(d).triggerHandler("remove");a(c)};e.widget=function(c,b,d){var g=c.split(".")[0],f;c=c.split(".")[1];f=g+"-"+c;if(!d){d=b;b=e.Widget}e.expr[":"][f]=function(l){return!!e.data(l,c)};e[g]=e[g]||{};e[g][c]=e.extend(function(l,o){if(!this._createWidget)return new e[g][c](l,o);arguments.length&&this._createWidget(l,o)},e[g][c]);var m=new b;m.options=e.extend(true,{},m.options);e.each(d,
20 function(l,o){if(e.isFunction(o))d[l]=function(){var s=function(t){return b.prototype[t].apply(this,p.call(arguments,1))},x=function(t,A){return b.prototype[t].apply(this,A)};return function(){var t=this._super,A=this._superApply,B;this._super=s;this._superApply=x;B=o.apply(this,arguments);this._super=t;this._superApply=A;return B}}()});e[g][c].prototype=e.extend(true,m,{namespace:g,widgetName:c,widgetEventPrefix:c,widgetBaseClass:f},d);e.widget.bridge(c,e[g][c])};e.widget.bridge=function(c,b){e.fn[c]=
21 function(d){var g=typeof d==="string",f=p.call(arguments,1),m=this;d=!g&&f.length?e.extend.apply(null,[true,d].concat(f)):d;g?this.each(function(){var l=e.data(this,c);if(!l)return e.error("cannot call methods on "+c+" prior to initialization; attempted to call method '"+d+"'");if(!e.isFunction(l[d])||d.charAt(0)==="_")return e.error("no such method '"+d+"' for "+c+" widget instance");var o=l[d].apply(l,f);if(o!==l&&o!==r){m=o;return false}}):this.each(function(){var l=e.data(this,c);l?l.option(d||
22 {})._init():b(d,this)});return m}};e.Widget=function(c,b){if(!this._createWidget)return new e[namespace][name](c,b);arguments.length&&this._createWidget(c,b)};e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false},_createWidget:function(c,b){b=e(b||this.defaultElement||this)[0];this.element=e(b);this.options=e.extend(true,{},this.options,this._getCreateOptions(),c);this.bindings=e();this.hoverable=e();this.focusable=e();if(b!==this){e.data(b,this.widgetName,
23 this);this._bind({remove:"destroy"})}this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]},_create:e.noop,_init:e.noop,destroy:function(){this._destroy();this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled");this.bindings.unbind("."+this.widgetName);this.hoverable.removeClass("ui-state-hover");
24 this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(c,b){var d=c;if(arguments.length===0)return e.extend({},this.options);if(typeof c==="string"){if(b===r)return this.options[c];d={};d[c]=b}this._setOptions(d);return this},_setOptions:function(c){var b=this;e.each(c,function(d,g){b._setOption(d,g)});return this},_setOption:function(c,b){this.options[c]=b;if(c==="disabled"){this.widget().toggleClass(this.widgetBaseClass+"-disabled ui-state-disabled",
25 !!b).attr("aria-disabled",b);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_bind:function(c,b){if(b){c=e(c);this.bindings=this.bindings.add(c)}else{b=c;c=this.element}var d=this;e.each(b,function(g,f){c.bind(g+"."+d.widgetName,function(){if(!(d.options.disabled===true||e(this).hasClass("ui-state-disabled")))return(typeof f===
26 "string"?d[f]:f).apply(d,arguments)})})},_hoverable:function(c){this.hoverable=this.hoverable.add(c);this._bind(c,{mouseenter:function(b){e(b.currentTarget).addClass("ui-state-hover")},mouseleave:function(b){e(b.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(c){this.focusable=this.focusable.add(c);this._bind(c,{focusin:function(b){e(b.currentTarget).addClass("ui-state-focus")},focusout:function(b){e(b.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(c,b,d){var g=
27 this.options[c];b=e.Event(b);b.type=(c===this.widgetEventPrefix?c:this.widgetEventPrefix+c).toLowerCase();d=d||{};if(b.originalEvent){c=e.event.props.length;for(var f;c;){f=e.event.props[--c];b[f]=b.originalEvent[f]}}this.element.trigger(b,d);d=e.isArray(d)?[b].concat(d):[b,d];return!(e.isFunction(g)&&g.apply(this.element[0],d)===false||b.isDefaultPrevented())}}}(jQuery);
28 (function(e,r,p){var a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY;e.geo={_allCoordinates:function(b){b=this._flatten(b);for(var d=0,g=[];d<b.length;d++){var f=b[d].coordinates,m=f&&e.isArray(f[0]),l=m&&e.isArray(f[0][0]),o;if(!(l&&e.isArray(f[0][0][0]))){if(!l){m||(f=[f]);f=[f]}f=[f]}for(m=0;m<f.length;m++)for(l=0;l<f[m].length;l++)for(o=0;o<f[m][l].length;o++)g.push(f[m][l][o])}return g},center:function(b,d){if(!d&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);var g=[(b[0]+b[2])/2,(b[1]+b[3])/
29 2];return!d&&e.geo.proj?e.geo.proj.toGeodetic(g):g},expandBy:function(b,d,g){if(e.geo.proj)b=e.geo.proj.fromGeodetic(b);b=[b[0]-d,b[1]-g,b[2]+d,b[3]+g];return e.geo.proj?e.geo.proj.toGeodetic(b):b},height:function(b,d){if(!d&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);return b[3]-b[1]},_in:function(b,d){return b[0]<=d[0]&&b[1]<=d[1]&&b[2]>=d[2]&&b[3]>=d[3]},_bboxDisjoint:function(b,d){return d[0]>b[2]||d[2]<b[0]||d[1]>b[3]||d[3]<b[1]},reaspect:function(b,d,g){if(!g&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);
30 var f=this.width(b,true),m=this.height(b,true);g=this.center(b,true);if(f!=0&&m!=0&&d>0){if(f/m>d){b=f/2;f=b/d}else{f=m/2;b=f*d}b=[g[0]-b,g[1]-f,g[0]+b,g[1]+f]}return e.geo.proj?e.geo.proj.toGeodetic(b):b},scaleBy:function(b,d,g){if(!g&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);var f=this.center(b,true),m=(b[2]-b[0])*d/2;b=(b[3]-b[1])*d/2;b=[f[0]-m,f[1]-b,f[0]+m,f[1]+b];return!g&&e.geo.proj?e.geo.proj.toGeodetic(b):b},width:function(b,d){if(!d&&e.geo.proj)b=e.geo.proj.fromGeodetic(b);return b[2]-b[0]},
31 bbox:function(b,d){if(b)if(b.bbox)result=!d&&e.geo.proj?e.geo.proj.fromGeodetic(b.bbox):b.bbox;else{result=[a,a,c,c];var g=this._allCoordinates(b),f=0;if(g.length==0)return p;if(e.geo.proj)g=e.geo.proj.fromGeodetic(g);for(;f<g.length;f++){result[0]=Math.min(g[f][0],result[0]);result[1]=Math.min(g[f][1],result[1]);result[2]=Math.max(g[f][0],result[2]);result[3]=Math.max(g[f][1],result[3])}}else return p;return e.geo.proj?e.geo.proj.toGeodetic(result):result},centroid:function(b,d){switch(b.type){case "Point":return e.extend({},
32 b);case "LineString":case "Polygon":var g=0,f=[0,0],m=e.merge([],b.type=="Polygon"?b.coordinates[0]:b.coordinates),l=1,o,s;if(!d&&e.geo.proj)m=e.geo.proj.fromGeodetic(m);for(;l<=m.length;l++){o=l%m.length;s=m[l-1][0]*m[o][1]-m[o][0]*m[l-1][1];g+=s;f[0]+=(m[l-1][0]+m[o][0])*s;f[1]+=(m[l-1][1]+m[o][1])*s}if(g==0)if(m.length>0){f[0]=m[0][0];f[1]=m[0][1];return{type:"Point",coordinates:!d&&e.geo.proj?e.geo.proj.toGeodetic(f):f}}else break;g*=3;f[0]/=g;f[1]/=g;return{type:"Point",coordinates:!d&&e.geo.proj?
33 e.geo.proj.toGeodetic(f):f}}return p},contains:function(b,d){if(b.type!="Polygon")return false;switch(d.type){case "Point":return this._containsPolygonPoint(b.coordinates,d.coordinates);case "LineString":return this._containsPolygonLineString(b.coordinates,d.coordinates);case "Polygon":return this._containsPolygonLineString(b.coordinates,d.coordinates[0]);default:return false}},_containsPolygonPoint:function(b,d){if(b.length==0||b[0].length<4)return false;for(var g=0,f=b[0][0],m=1,l;m<b[0].length;m++){l=
34 b[0][m];if(f[1]<=d[1]&&d[1]<l[1]||l[1]<=d[1]&&d[1]<f[1]&&(d[0]<f[0]||d[0]<l[0])){f=f[0]+(l[0]-f[0])*(d[1]-f[1])/(l[1]-f[1]);f>d[0]&&g++}f=l}return g%2==1},_containsPolygonLineString:function(b,d){for(var g=0;g<d.length;g++)if(!this._containsPolygonPoint(b,d[g]))return false;return true},distance:function(b,d,g){var f=!g&&e.geo.proj?e.geo.proj.fromGeodetic(b.coordinates):b.coordinates;g=!g&&e.geo.proj?e.geo.proj.fromGeodetic(d.coordinates):d.coordinates;switch(b.type){case "Point":switch(d.type){case "Point":return this._distancePointPoint(g,
35 f);case "LineString":return this._distanceLineStringPoint(g,f);case "Polygon":return this._containsPolygonPoint(g,f)?0:this._distanceLineStringPoint(g[0],f);default:return p}case "LineString":switch(d.type){case "Point":return this._distanceLineStringPoint(f,g);case "LineString":return this._distanceLineStringLineString(f,g);case "Polygon":return this._containsPolygonLineString(g,f)?0:this._distanceLineStringLineString(g[0],f);default:return p}case "Polygon":switch(d.type){case "Point":return this._containsPolygonPoint(f,
36 g)?0:this._distanceLineStringPoint(f[0],g);case "LineString":return this._containsPolygonLineString(f,g)?0:this._distanceLineStringLineString(f[0],g);case "Polygon":return this._containsPolygonLineString(f,g[0])?0:this._distanceLineStringLineString(f[0],g[0]);default:return p}}},_distancePointPoint:function(b,d){var g=d[0]-b[0],f=d[1]-b[1];return Math.sqrt(g*g+f*f)},_distanceLineStringPoint:function(b,d){var g=a;if(b.length>0){var f=b[0],m=d[0]-f[0],l=d[1]-f[1];if(b.length==1)return Math.sqrt(m*m+
37 l*l);else for(var o=1;o<b.length;o++){var s=b[o],x=d[0]-s[0],t=d[1]-s[1];f=this._distanceSegmentPoint(s[0]-f[0],s[1]-f[1],m,l,x,t);if(f==0)return 0;if(f<g)g=f;f=s;m=x;l=t}}return Math.sqrt(g)},_distanceSegmentPoint:function(b,d,g,f,m,l){var o=b*g+d*f;if(o<=0)return g*g+f*f;b=b*b+d*d;if(o>=b)return m*m+l*l;return g*g+f*f-o*o/b},_distanceLineStringLineString:function(b,d){for(var g=a,f=0;f<d.length;f++)g=Math.min(g,this._distanceLineStringPoint(b,d[f]));return g},_flatten:function(b){var d=[],g=0;switch(b.type){case "Feature":e.merge(d,
38 this._flatten(b.geometry));break;case "FeatureCollection":for(;g<b.features.length;g++)e.merge(d,this._flatten(b.features[g].geometry));break;case "GeometryCollection":for(;g<b.geometries.length;g++)e.merge(d,this._flatten(b.geometries[g]));break;default:d[0]=b}return d},_WKT:function(){function b(f){if(f&&f.length){for(var m=[],l=0;l<f.length;l++)m.push(f[l].join(" "));return"("+m+")"}else return"EMPTY"}function d(f){if(f&&f.length){for(var m=[],l=0;l<f.length;l++)m.push(b(f[l]));return"("+m+")"}else return"EMTPY"}
39 function g(f){if(f&&f.type)switch(f.type){case "Point":return"POINT "+(f.coordinates&&f.coordinates.length?"("+f.coordinates.join(" ")+")":"EMPTY");case "LineString":return"LINESTRING "+b(f.coordinates);case "Polygon":return"POLYGON "+d(f.coordinates);case "MultiPoint":return"MULTIPOINT "+b(f.coordinates);case "MultiLineString":return"MULTILINSTRING "+d(f.coordinates);case "MultiPolygon":if((f=f.coordinates)&&f.length){for(var m=[],l=0;l<f.length;l++)m.push(d(f[l]));f="("+m+")"}else f="EMPTY";return"MULTIPOLYGON "+
40 f;case "GeometryCollection":if((f=f.geometries)&&f.length){m=[];for(l=0;l<f.length;l++)m.push(g(f[l]));f="("+f+")"}else f="EMPTY";return"GEOMETRYCOLLECTION "+f;default:return""}else return""}return{stringify:g,parse:function(f){f=e.trim(f);var m=f.indexOf(" ");switch(f.substr(0,m).toUpperCase()){case "POINT":return(f=f.substr(m+1).match(/\(\s*([\d\.-]+)\s+([\d\.-]+)\s*\)/))&&f.length>=2?{type:"Point",coordinates:[parseFloat(f[1]),parseFloat(f[2])]}:null}}}}(),proj:function(){return{fromGeodeticPos:function(b){if(!b)debugger;
41 return[6378137*b[0]*0.017453292519943295,6378137*Math.log(Math.tan(0.7853981633974483+b[1]*0.017453292519943295/2))]},fromGeodetic:function(b){var d=e.isArray(b[0]),g=this.fromGeodeticPos;if(!d&&b.length==4){d=g([b[0],b[1]]);b=g([b[2],b[3]]);return[d[0],d[1],b[0],b[1]]}else{var f=d&&e.isArray(b[0][0]),m=f&&e.isArray(b[0][0][0]),l=[],o,s,x;if(!m){if(!f){d||(b=[b]);b=[b]}b=[b]}for(o=0;o<b.length;o++){l[o]=[];for(s=0;s<b[o].length;s++){l[o][s]=[];for(x=0;x<b[o][s].length;x++)l[o][s][x]=g(b[o][s][x])}}return m?
42 l:f?l[0]:d?l[0][0]:l[0][0][0]}},toGeodeticPos:function(b){return[b[0]/6378137*57.29577951308232,(1.5707963267948966-2*Math.atan(1/Math.exp(b[1]/6378137)))*57.29577951308232]},toGeodetic:function(b){var d=e.isArray(b[0]),g=this.toGeodeticPos;if(!d&&b.length==4){d=g([b[0],b[1]]);b=g([b[2],b[3]]);return[d[0],d[1],b[0],b[1]]}else{var f=d&&e.isArray(b[0][0]),m=f&&e.isArray(b[0][0][0]),l=[];if(!m){if(!f){d||(b=[b]);b=[b]}b=[b]}for(i=0;i<b.length;i++){l[i]=[];for(j=0;j<b[i].length;j++){l[i][j]=[];for(k=
43 0;k<b[i][j].length;k++)l[i][j][k]=g(b[i][j][k])}}return m?l:f?l[0]:d?l[0][0]:l[0][0][0]}}}}(),_serviceTypes:{}}})(jQuery,this);
44 (function(e,r){var p=function(){for(var a=5,c=document.createElement("div"),b=c.all||[];c.innerHTML="<!--[if gt IE "+ ++a+"]><br><![endif]--\>",b[0];);return a>6?a:!a}();e.widget("geo.geographics",{_$elem:r,_options:{},_trueCanvas:true,_width:0,_height:0,_$canvas:r,_context:r,options:{style:{borderRadius:"8px",color:"#7f0000",fillOpacity:0.2,height:"8px",opacity:1,strokeOpacity:1,strokeWidth:"2px",visibility:"visible",width:"8px"}},_create:function(){this._$elem=this.element;this._options=this.options;
45 this._$elem.css({display:"inline-block",overflow:"hidden",textAlign:"left"});this._$elem.css("position")=="static"&&this._$elem.css("position","relative");this._width=this._$elem.width();this._height=this._$elem.height();if(!(this._width&&this._height)){this._width=parseInt(this._$elem.css("width"));this._height=parseInt(this._$elem.css("height"))}if(document.createElement("canvas").getContext){this._$elem.append('<canvas width="'+this._width+'" height="'+this._height+'" style="position:absolute; left:0; top:0; width:'+
46 this._width+"px; height:"+this._height+'px;"></canvas>');this._$canvas=this._$elem.children(":last");this._context=this._$canvas[0].getContext("2d")}else if(p<=8){this._trueCanvas=false;this._$elem.append('<div width="'+this._width+'" height="'+this._height+'" style="position:absolute; left:0; top:0; width:'+this._width+"px; height:"+this._height+'px; margin:0; padding:0;"></div>');this._$canvas=this._$elem.children(":last");G_vmlCanvasManager.initElement(this._$canvas[0]);this._context=this._$canvas[0].getContext("2d");
47 this._$canvas.children().css({backgroundColor:"transparent",width:this._width,height:this._height})}},_setOption:function(a,c){if(a=="style")c=e.extend({},this._options.style,c);e.Widget.prototype._setOption.apply(this,arguments)},destroy:function(){e.Widget.prototype.destroy.apply(this,arguments);this._$elem.html("")},clear:function(){this._context.clearRect(0,0,this._width,this._height)},drawArc:function(a,c,b,d){d=this._getGraphicStyle(d);if(d.visibility!="hidden"&&d.opacity>0&&d.widthValue>0&&
48 d.heightValue>0){var g=Math.min(d.widthValue,d.heightValue)/2;c=c*Math.PI/180;b=b*Math.PI/180;this._context.save();this._context.translate(a[0],a[1]);d.widthValue>d.heightValue?this._context.scale(d.widthValue/d.heightValue,1):this._context.scale(1,d.heightValue/d.widthValue);this._context.beginPath();this._context.arc(0,0,g,c,b,false);this._trueCanvas&&this._context.restore();if(d.doFill){this._context.fillStyle=d.fill;this._context.globalAlpha=d.opacity*d.fillOpacity;this._context.fill()}if(d.doStroke){this._context.lineJoin=
49 "round";this._context.lineWidth=d.strokeWidthValue;this._context.strokeStyle=d.stroke;this._context.globalAlpha=d.opacity*d.strokeOpacity;this._context.stroke()}this._trueCanvas||this._context.restore()}},drawPoint:function(a,c){c=this._getGraphicStyle(c);if(c.widthValue==c.heightValue&&c.heightValue==c.borderRadiusValue)this.drawArc(a,0,360,c);else if(c.visibility!="hidden"&&c.opacity>0){c.borderRadiusValue=Math.min(Math.min(c.widthValue,c.heightValue)/2,c.borderRadiusValue);a[0]-=c.widthValue/2;
50 a[1]-=c.heightValue/2;this._context.beginPath();this._context.moveTo(a[0]+c.borderRadiusValue,a[1]);this._context.lineTo(a[0]+c.widthValue-c.borderRadiusValue,a[1]);this._context.quadraticCurveTo(a[0]+c.widthValue,a[1],a[0]+c.widthValue,a[1]+c.borderRadiusValue);this._context.lineTo(a[0]+c.widthValue,a[1]+c.heightValue-c.borderRadiusValue);this._context.quadraticCurveTo(a[0]+c.widthValue,a[1]+c.heightValue,a[0]+c.widthValue-c.borderRadiusValue,a[1]+c.heightValue);this._context.lineTo(a[0]+c.borderRadiusValue,
51 a[1]+c.heightValue);this._context.quadraticCurveTo(a[0],a[1]+c.heightValue,a[0],a[1]+c.heightValue-c.borderRadiusValue);this._context.lineTo(a[0],a[1]+c.borderRadiusValue);this._context.quadraticCurveTo(a[0],a[1],a[0]+c.borderRadiusValue,a[1]);this._context.closePath();if(c.doFill){this._context.fillStyle=c.fill;this._context.globalAlpha=c.opacity*c.fillOpacity;this._context.fill()}if(c.doStroke){this._context.lineJoin="round";this._context.lineWidth=c.strokeWidthValue;this._context.strokeStyle=c.stroke;
52 this._context.globalAlpha=c.opacity*c.strokeOpacity;this._context.stroke()}}},drawLineString:function(a,c){this._drawLines([a],false,c)},drawPolygon:function(a,c){this._drawLines(a,true,c)},drawBbox:function(a,c){this._drawLines([[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]],[a[0],a[1]]]],true,c)},_getGraphicStyle:function(a){function c(b){b=parseInt(b);return+b+""===b?+b:b}a=e.extend({},this._options.style,a);a.borderRadiusValue=c(a.borderRadius);a.fill=a.fill||a.color;a.doFill=a.fill&&a.fillOpacity>
53 0;a.stroke=a.stroke||a.color;a.strokeWidthValue=c(a.strokeWidth);a.doStroke=a.stroke&&a.strokeOpacity>0&&a.strokeWidthValue>0;a.widthValue=c(a.width);a.heightValue=c(a.height);return a},_drawLines:function(a,c,b){if(!(!a||!a.length||a[0].length<2)){b=this._getGraphicStyle(b);var d,g;if(b.visibility!="hidden"&&b.opacity>0){this._context.beginPath();this._context.moveTo(a[0][0][0],a[0][0][1]);for(d=0;d<a.length;d++)for(g=0;g<a[d].length;g++)this._context.lineTo(a[d][g][0],a[d][g][1]);c&&this._context.closePath();
54 if(c&&b.doFill){this._context.fillStyle=b.fill;this._context.globalAlpha=b.opacity*b.fillOpacity;this._context.fill()}if(b.doStroke){this._context.lineCap=this._context.lineJoin="round";this._context.lineWidth=b.strokeWidthValue;this._context.strokeStyle=b.stroke;this._context.globalAlpha=b.opacity*b.strokeOpacity;this._context.stroke()}}}}})})(jQuery);
55 (function(e,r){var p=function(){for(var a=5,c=document.createElement("div"),b=c.all||[];c.innerHTML="<!--[if gt IE "+ ++a+"]><br><![endif]--\>",b[0];);return a>6?a:!a}();e.widget("geo.geomap",{_$elem:r,_created:false,_contentBounds:{},_$contentFrame:r,_$existingChildren:r,_$servicesContainer:r,_$drawContainer:r,_$shapesContainer:r,_$textContainer:r,_$textContent:r,_$eventTarget:r,_dpi:96,_currentServices:[],_center:r,_pixelSize:r,_centerMax:r,_pixelSizeMax:r,_wheelZoomFactor:1.18920711500273,_wheelTimeout:null,
56 _wheelLevel:0,_zoomFactor:2,_mouseDown:r,_inOp:r,_toolPan:r,_shiftZoom:r,_anchor:r,_current:r,_downDate:r,_moveDate:r,_clickDate:r,_lastMove:r,_lastDrag:r,_windowHandler:null,_resizeTimeout:null,_panning:r,_velocity:r,_friction:r,_supportTouch:r,_softDblClick:r,_isTap:r,_isDbltap:r,_drawTimeout:null,_drawPixels:[],_drawCoords:[],_graphicShapes:[],_initOptions:{},_options:{},options:e.extend({},{bbox:[-180,-85,180,85],bboxMax:[-180,-85,180,85],center:[0,0],cursors:{pan:"move",zoom:"crosshair",drawPoint:"crosshair",
57 drawLineString:"crosshair",drawPolygon:"crosshair"},drawStyle:{},shapeStyle:{},mode:"pan",services:[{"class":"osm",type:"tiled",getUrl:function(a){return"http://tile.openstreetmap.org/"+a.zoom+"/"+a.tile.column+"/"+a.tile.row+".png"},attr:"&copy; OpenStreetMap &amp; contributors, CC-BY-SA"}],tilingScheme:{tileWidth:256,tileHeight:256,levels:18,basePixelSize:156543.03392799935,origin:[-2.0037508342787E7,2.0037508342787E7]},zoom:0,pixelSize:0}),_createWidget:function(a,c){this._$elem=e(c);if(!this._$elem.is("[data-geo-service]")){this._$elem.attr("data-geo-map",
58 "data-geo-map");this._graphicShapes=[];this._initOptions=a||{};this._forcePosition(this._$elem);this._$elem.css("text-align","left");var b=this._findMapSize();this._contentBounds={x:parseInt(this._$elem.css("padding-left")),y:parseInt(this._$elem.css("padding-top")),width:b.width,height:b.height};this._createChildren();this._center=this._centerMax=[0,0];this.options.pixelSize=this._pixelSize=this._pixelSizeMax=156543.03392799935;this._mouseDown=this._inOp=this._toolPan=this._shiftZoom=this._panning=
59 this._isTap=this._isDbltap=false;this._anchor=this._current=this._lastMove=this._lastDrag=this._velocity=[0,0];this._friction=[0.8,0.8];this._downDate=this._moveDate=this._clickDate=0}e.Widget.prototype._createWidget.apply(this,arguments)},_create:function(){if(!this._$elem.is("[data-geo-service]")){this._options=this.options;this._softDblClick=(this._supportTouch="ontouchend"in document)||p==7;var a=this._supportTouch?"touchstart":"mousedown",c=this._supportTouch?"touchend touchcancel":"mouseup",
60 b=this._supportTouch?"touchmove":"mousemove";e(document).keydown(e.proxy(this._document_keydown,this));this._$eventTarget.dblclick(e.proxy(this._eventTarget_dblclick,this));this._$eventTarget.bind(a,e.proxy(this._eventTarget_touchstart,this));a=this._$eventTarget[0].setCapture?this._$eventTarget:e(document);a.bind(b,e.proxy(this._dragTarget_touchmove,this));a.bind(c,e.proxy(this._dragTarget_touchstop,this));this._$eventTarget.mousewheel(e.proxy(this._eventTarget_mousewheel,this));var d=this;this._windowHandler=
61 function(){d._resizeTimeout&&clearTimeout(d._resizeTimeout);this._resizeTimeout=setTimeout(function(){d._created&&d._$elem.geomap("resize")},500)};e(window).resize(this._windowHandler);this._$drawContainer.geographics({style:this._initOptions.drawStyle||{}});this._options.drawStyle=this._$drawContainer.geographics("option","style");this._$shapesContainer.geographics({style:this._initOptions.shapeStyle||{}});this._options.shapeStyle=this._$shapesContainer.geographics("option","style");if(this._initOptions){this._initOptions.bbox&&
62 this._setOption("bbox",this._initOptions.bbox,false);this._initOptions.center&&this._setOption("center",this._initOptions.center,false);this._initOptions.zoom&&this._setZoom(this._initOptions.zoom,false,false)}this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]);this._createServices();this._refresh();this._created=true}},_setOption:function(a,c,b){if(!(this._$elem.is("[data-geo-service]")||a=="pixelSize")){b=b===r||b;switch(a){case "bbox":if(e.geo.proj){c=e.geo.proj.fromGeodetic([[c[0],
63 c[1]],[c[2],c[3]]]);c=[c[0][0],c[0][1],c[1][0],c[1][1]]}this._setBbox(c,false,b);c=this._getBbox();if(e.geo.proj){c=e.geo.proj.toGeodetic([[c[0],c[1]],[c[2],c[3]]]);c=[c[0][0],c[0][1],c[1][0],c[1][1]]}break;case "center":this._setCenterAndSize(e.geo.proj?e.geo.proj.fromGeodetic([[c[0],c[1]]])[0]:c,this._pixelSize,false,b);break;case "drawStyle":if(this._$drawContainer){this._$drawContainer.geographics("option","style",c);c=this._$drawContainer.geographics("option","style")}break;case "shapeStyle":if(this._$shapesContainer){this._$shapesContainer.geographics("option",
64 "style",c);c=this._$shapesContainer.geographics("option","style")}break;case "mode":this._$drawContainer.geographics("clear");this._$eventTarget.css("cursor",this._options.cursors[c]);break;case "zoom":this._setZoom(c,false,b)}e.Widget.prototype._setOption.apply(this,arguments);switch(a){case "services":this._createServices();b&&this._refresh();break;case "shapeStyle":if(b){this._$shapesContainer.geographics("clear");this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes)}}}},
65 destroy:function(){if(this._$elem.is("[data-geo-map]")){this._created=false;e(window).unbind("resize",this._windowHandler);for(var a=0;a<this._currentServices.length;a++){this._currentServices[a].serviceContainer.geomap("destroy");e.geo._serviceTypes[this._currentServices[a].type].destroy(this,this._$servicesContainer,this._currentServices[a])}this._$shapesContainer.geographics("destroy");this._$drawContainer.geographics("destroy");this._$existingChildren.detach();this._$elem.html("");this._$elem.append(this._$existingChildren);
66 this._$elem.removeAttr("data-geo-map")}e.Widget.prototype.destroy.apply(this,arguments)},toMap:function(a){a=this._toMap(a);return e.geo.proj?e.geo.proj.toGeodetic(a):a},toPixel:function(a,c,b){a=e.geo.proj?e.geo.proj.fromGeodetic(a):a;return this._toPixel(a,c,b)},opacity:function(a,c){if(this._$elem.is("[data-geo-service]"))this._$elem.closest("[data-geo-map]").geomap("opacity",a,this._$elem);else if(a>=0||a<=1)for(var b=0;b<this._currentServices.length;b++){var d=this._currentServices[b];if(!c||
67 d.serviceContainer[0]==c[0]){this._options.services[b].opacity=d.opacity=a;e.geo._serviceTypes[d.type].opacity(this,d)}}},toggle:function(a,c){if(this._$elem.is("[data-geo-service]"))this._$elem.closest("[data-geo-map]").geomap("toggle",a,this._$elem);else for(var b=0;b<this._currentServices.length;b++){var d=this._currentServices[b];if(!c||d.serviceContainer[0]==c[0]){if(a===r)a=d.visibility===r||d.visibility==="visible"?false:true;this._options.services[b].visibility=d.visibility=a?"visible":"hidden";
68 e.geo._serviceTypes[d.type].toggle(this,d);a&&e.geo._serviceTypes[d.type].refresh(this,d)}}},zoom:function(a){a!=null&&this._setZoom(this._options.zoom+a,false,true)},refresh:function(){this._refresh()},resize:function(){var a=this._findMapSize(),c=a.width/2-this._contentBounds.width/2,b=a.height/2-this._contentBounds.height/2,d;this._contentBounds={x:parseInt(this._$elem.css("padding-left")),y:parseInt(this._$elem.css("padding-top")),width:a.width,height:a.height};this._$contentFrame.css({width:a.width,
69 height:a.height});this._$servicesContainer.css({width:a.width,height:a.height});this._$eventTarget.css({width:a.width,height:a.height});var g=this._$shapesContainer.geographics("option","style");this._$shapesContainer.geographics("destroy");this._$drawContainer.geographics("destroy");for(d=0;d<this._currentServices.length;d++)e.geo._serviceTypes[this._currentServices[d].type].resize(this,this._currentServices[d]);this._$drawContainer.css({width:a.width,height:a.height});this._$drawContainer.geographics();
70 this._$shapesContainer.css({width:a.width,height:a.height});this._$shapesContainer.geographics({style:g});for(d=0;d<this._drawPixels.length;d++){this._drawPixels[d][0]+=c;this._drawPixels[d][1]+=b}this._setCenterAndSize(this._center,this._pixelSize,false,true)},append:function(a,c,b){if(a){var d=0;a=a.type=="FeatureCollection"?a.features:e.isArray(a)?a:[a];if(typeof c==="boolean"){b=c;c=null}for(;d<a.length;d++){if(a[d].type!="Point"){var g=e.geo.bbox(a[d]);if(e.geo.proj)g=e.geo.proj.fromGeodetic(g);
71 e.data(a[d],"geoBbox",g)}this._graphicShapes.push({shape:a[d],style:c})}if(b===r||b)this._refresh()}},empty:function(a){e.each(this._graphicShapes,function(){e.removeData(this,"geoBbox")});this._graphicShapes=[];if(a===r||a)this._refresh()},find:function(a,c){this.toPixel(a.coordinates);var b=this._pixelSize*c,d=[],g;e.each(this._graphicShapes,function(){if(this.shape.type=="Point")e.geo.distance(this.shape,a)<=b&&d.push(this.shape);else{var f=e.data(this.shape,"geoBbox");f={type:"Polygon",coordinates:[[[f[0],
72 f[1]],[f[0],f[3]],[f[2],f[3]],[f[2],f[1]],[f[0],f[1]]]]};var m={type:"Point",coordinates:e.geo.proj?e.geo.proj.fromGeodetic(a.coordinates):a.coordinates};if(e.geo.distance(f,m,true)<=b){f=e.geo._flatten(this.shape);for(g=0;g<f.length;g++)if(e.geo.distance(f[g],a)<=b){d.push(this.shape);break}}}});return d},remove:function(a,c){var b=this;e.each(this._graphicShapes,function(d){if(this.shape==a){e.removeData(a,"geoBbox");var g=b._graphicShapes.slice(d+1);b._graphicShapes.length=d;b._graphicShapes.push.apply(b._graphicShapes,
73 g);return false}});if(c===r||c)this._refresh()},_getBbox:function(a,c){a=a||this._center;c=c||this._pixelSize;var b=this._contentBounds.width/2*c,d=this._contentBounds.height/2*c;return[a[0]-b,a[1]-d,a[0]+b,a[1]+d]},_setBbox:function(a,c,b){var d=[a[0]+(a[2]-a[0])/2,a[1]+(a[3]-a[1])/2];a=Math.max(e.geo.width(a,true)/this._contentBounds.width,e.geo.height(a,true)/this._contentBounds.height);if(this._options.tilingScheme)a=this._getTiledPixelSize(this._getTiledZoom(a));this._setCenterAndSize(d,a,c,
74 b)},_getBboxMax:function(){var a=this._contentBounds.width/2*this._pixelSizeMax,c=this._contentBounds.height/2*this._pixelSizeMax;return[this._centerMax[0]-a,this._centerMax[1]-c,this._centerMax[0]+a,this._centerMax[1]+c]},_getCenter:function(){return this._center},_getContentBounds:function(){return this._contentBounds},_getServicesContainer:function(){return this._$servicesContainer},_getZoom:function(){if(this._options.tilingScheme)return this._getTiledZoom(this._pixelSize);else{var a=this._contentBounds.width/
75 this._contentBounds.height,c=e.geo.reaspect(this._getBbox(),a,true);a=e.geo.reaspect(this._getBboxMax(),a,true);return Math.log(e.geo.width(a,true)/e.geo.width(c,true))/Math.log(this._zoomFactor)}},_setZoom:function(a,c,b){a=Math.max(a,0);if(this._options.tilingScheme)this._setCenterAndSize(this._center,this._getTiledPixelSize(a),c,b);else{a=e.geo.scaleBy(this._getBboxMax(),1/Math.pow(this._zoomFactor,a),true);this._setCenterAndSize(this._center,Math.max(e.geo.width(a,true)/this._contentBounds.width,
76 e.geo.height(a,true)/this._contentBounds.height),c,b)}},_createChildren:function(){this._$existingChildren=this._$elem.children().detach();this._forcePosition(this._$existingChildren);this._$existingChildren.css("-moz-user-select","none");this._$elem.prepend("<div style='position:absolute; left:"+this._contentBounds.x+"px; top:"+this._contentBounds.y+"px; width:"+this._contentBounds.width+"px; height:"+this._contentBounds.height+"px; margin:0; padding:0; overflow:hidden; -khtml-user-select:none; -moz-user-select:none; -webkit-user-select:none; user-select:none;' unselectable='on'></div>");
77 this._$eventTarget=this._$contentFrame=this._$elem.children(":first");this._$contentFrame.append('<div style="position:absolute; left:0; top:0; width:'+this._contentBounds.width+"px; height:"+this._contentBounds.height+'px; margin:0; padding:0;"></div>');this._$servicesContainer=this._$contentFrame.children(":last");this._$contentFrame.append('<div style="position:absolute; left:0; top:0; width:'+this._contentBounds.width+"px; height:"+this._contentBounds.height+'px; margin:0; padding:0;"></div>');
78 this._$shapesContainer=this._$contentFrame.children(":last");this._$contentFrame.append('<div style="position:absolute; left:0; top:0; width:'+this._contentBounds.width+"px; height:"+this._contentBounds.height+'px; margin:0; padding:0;"></div>');this._$drawContainer=this._$contentFrame.children(":last");this._$contentFrame.append('<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute; left:0; top:0px; max-width:128px; display:none;"><div style="margin:.2em;"></div></div>');
79 this._$textContainer=this._$contentFrame.children(":last");this._$textContent=this._$textContainer.children();this._$contentFrame.append(this._$existingChildren)},_createServices:function(){var a;for(a=0;a<this._currentServices.length;a++){this._currentServices[a].serviceContainer.geomap("destroy");e.geo._serviceTypes[this._currentServices[a].type].destroy(this,this._$servicesContainer,this._currentServices[a])}this._currentServices=[];for(a=0;a<this._options.services.length;a++){this._currentServices[a]=
80 this._options.services[a];this._currentServices[a].serviceContainer=e.geo._serviceTypes[this._currentServices[a].type].create(this,this._$servicesContainer,this._currentServices[a],a).geomap()}},_refreshDrawing:function(){this._$drawContainer.geographics("clear");if(this._drawPixels.length>0){var a=this._options.mode,c=this._drawPixels;if(a=="drawPolygon")c=[c];this._$drawContainer.geographics(a,c)}},_resetDrawing:function(){this._drawPixels=[];this._drawCoords=[];this._$drawContainer.geographics("clear")},
81 _refreshShapes:function(a,c,b,d,g){var f,m,l,o,s,x=this._getBbox(d,g),t=this;for(f=0;f<c.length;f++){l=c[f].shape||c[f];l=l.geometry||l;m=e.data(l,"geoBbox");if(!(m&&e.geo._bboxDisjoint(x,m))){o=e.isArray(b)?b[f].style:b;switch(l.type){case "Point":this._$shapesContainer.geographics("drawPoint",this.toPixel(l.coordinates,d,g),o);break;case "LineString":this._$shapesContainer.geographics("drawLineString",this.toPixel(l.coordinates,d,g),o);break;case "Polygon":s=[];e.each(l.coordinates,function(A){s[A]=
82 t.toPixel(this,d,g)});this._$shapesContainer.geographics("drawPolygon",s,o);break;case "MultiPoint":for(m=0;m<l.coordinates;m++)this._$shapesContainer.geographics("drawPoint",this.toPixel(l.coordinates[m],d,g),o);break;case "MultiLineString":for(m=0;m<l.coordinates;m++)this._$shapesContainer.geographics("drawLineString",this.toPixel(l.coordinates[m],d,g),o);break;case "MultiPolygon":for(m=0;m<l.coordinates;m++){s=[];e.each(l.coordinates[m],function(A){s[A]=t.toPixel(this,d,g)});this._$shapesContainer.geographics("drawPolygon",
83 s,o)}break;case "GeometryCollection":t._refreshShapes(a,l.geometries,o,d,g)}}}},_findMapSize:function(){for(var a={width:0,height:0},c=this._$elem;c.size()&&!(a.width>0&&a.height>0);){a={width:c.width(),height:c.height()};if(a.width<=0||a.height<=0)a={width:parseInt(c.css("width")),height:parseInt(c.css("height"))};c=c.parent()}return a},_forcePosition:function(a){var c=a.css("position");c!="relative"&&c!="absolute"&&c!="fixed"&&a.css("position","relative")},_getTiledPixelSize:function(a){var c=this._options.tilingScheme;
84 if(c!=null){if(a===0)return c.pixelSizes!=null?c.pixelSizes[0]:c.basePixelSize;a=Math.round(a);a=Math.max(a,0);a=Math.min(a,(c.pixelSizes!=null?c.pixelSizes.length:c.levels)-1);return c.pixelSizes!=null?c.pixelSizes[a]:c.basePixelSize/Math.pow(2,a)}else return NaN},_getTiledZoom:function(a){var c=this._options.tilingScheme;if(c.pixelSizes!=null){a=Math.floor(a*1E3);for(var b=(c.pixelSizes!=null?c.pixelSizes.length:c.levels)-1;b>=0;b--)if(Math.floor(c.pixelSizes[b]*1E3)>=a)return b;return 0}else return Math.max(Math.round(Math.log(c.basePixelSize/
85 a)/Math.log(2)),0)},_getZoomCenterAndSize:function(a,c,b){if(this._options.tilingScheme){c=this._getTiledZoom(this._pixelSize)+c;c=this._getTiledPixelSize(c)}else{c=Math.pow(b,-c);c=this._pixelSize*c}b=c/this._pixelSize;a=this._toMap(a);b=[(this._center[0]-a[0])*b,(this._center[1]-a[1])*b];return{pixelSize:c,center:[a[0]+b[0],a[1]+b[1]]}},_mouseWheelFinish:function(){this._wheelTimeout=null;if(this._wheelLevel!=0){var a=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._wheelZoomFactor);
86 this._setCenterAndSize(a.center,a.pixelSize,true,true);this._wheelLevel=0}else this._refresh()},_panEnd:function(){this._velocity=[this._velocity[0]>0?Math.floor(this._velocity[0]*this._friction[0]):Math.ceil(this._velocity[0]*this._friction[0]),this._velocity[1]>0?Math.floor(this._velocity[1]*this._friction[1]):Math.ceil(this._velocity[1]*this._friction[1])];if(Math.abs(this._velocity[0])<4&&Math.abs(this._velocity[1])<4)this._panFinalize();else{this._current=[this._current[0]+this._velocity[0],
87 this._current[1]+this._velocity[1]];this._panMove();setTimeout(e.proxy(this._panEnd,this),30)}},_panFinalize:function(){if(this._panning){this._velocity=[0,0];var a=-(this._current[0]-this._anchor[0])*this._pixelSize,c=(this._current[1]-this._anchor[1])*this._pixelSize;this._$shapesContainer.css({left:0,top:0});this._setCenterAndSize([this._center[0]+a,this._center[1]+c],this._pixelSize,true,true);this._inOp=false;this._anchor=this._current;this._toolPan=this._panning=false;this._$eventTarget.css("cursor",
88 this._options.cursors[this._options.mode])}},_panMove:function(){var a=this._current[0]-this._lastDrag[0],c=this._current[1]-this._lastDrag[1],b=0,d;if(this._toolPan||a>3||a<-3||c>3||c<-3){if(!this._toolPan){this._toolPan=true;this._$eventTarget.css("cursor",this._options.cursors.pan)}if(this._mouseDown)this._velocity=[a,c];if(a!=0||c!=0){this._panning=true;this._lastDrag=this._current;for(b=0;b<this._options.services.length;b++){d=this._options.services[b];e.geo._serviceTypes[d.type].interactivePan(this,
89 d,a,c)}this._$shapesContainer.css({left:function(g,f){return parseInt(f)+a},top:function(g,f){return parseInt(f)+c}});for(b=0;b<this._drawPixels.length;b++){this._drawPixels[b][0]+=a;this._drawPixels[b][1]+=c}this._refreshDrawing()}}},_refresh:function(){for(var a=0;a<this._options.services.length;a++){var c=this._options.services[a];!this._mouseDown&&e.geo._serviceTypes[c.type]!=null&&e.geo._serviceTypes[c.type].refresh(this,c)}if(this._$shapesContainer){this._$shapesContainer.geographics("clear");
90 this._graphicShapes.length>0&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes)}},_setCenterAndSize:function(a,c,b,d){if(this._pixelSize!=c){this._$shapesContainer.geographics("clear");for(var g=0;g<this._options.services.length;g++){var f=this._options.services[g];e.geo._serviceTypes[f.type].interactiveScale(this,f,a,c)}}this._center=a;this.options.pixelSize=this._pixelSize=c;if(e.geo.proj){a=this._getBbox();a=e.geo.proj.toGeodetic([[a[0],a[1]],[a[2],a[3]]]);a=[a[0][0],
91 a[0][1],a[1][0],a[1][1]];this._options.bbox=a;this._options.center=e.geo.proj.toGeodetic([[this._center[0],this._center[1]]])[0]}else{this._options.bbox=this._getBbox();this._options.center=this._center}this._options.zoom=this._getZoom();if(this._drawCoords.length>0)this._drawPixels=this._toPixel(this._drawCoords);b&&this._trigger("bboxchange",window.event,{bbox:this._options.bbox});if(d){this._refresh();this._refreshDrawing()}},_toMap:function(a,c,b){var d=e.isArray(a[0]);d||(a=[a]);c=c||this._center;
92 b=b||this._pixelSize;var g=this._contentBounds.width,f=this._contentBounds.height,m=g/2*b;b=f/2*b;var l=[c[0]-m,c[1]-b,c[0]+m,c[1]+b],o=e.geo.width(l,true)/g,s=e.geo.height(l,true)/f,x=[];e.each(a,function(t){x[t]=[l[0]+this[0]*o,l[3]-this[1]*s]});return d?x:x[0]},_toPixel:function(a,c,b){var d=e.isArray(a[0]);d||(a=[a]);c=c||this._center;b=b||this._pixelSize;var g=this._contentBounds.width,f=this._contentBounds.height,m=g/2*b;b=f/2*b;var l=[c[0]-m,c[1]-b,c[0]+m,c[1]+b],o=e.geo.width(l,true),s=e.geo.height(l,
93 true),x=[];e.each(a,function(t){x[t]=[Math.round((this[0]-l[0])*g/o),Math.round((l[3]-this[1])*f/s)]});return d?x:x[0]},_zoomTo:function(a,c,b,d){c=c<0?0:c;var g=this._getTiledPixelSize(c);if(isNaN(g)){c=e.geo._scaleBy(this._getBboxMax(),1/Math.pow(this._zoomFactor,c),true);c=Math.max(e.geo.width(c,true)/this._contentBounds.width,e.geo.height(c,true)/this._contentBounds.height);this._setCenterAndSize(a,c,b,d)}else this._setCenterAndSize(a,g,b,d)},_document_keydown:function(a){var c=this._drawCoords.length;
94 if(c>0&&a.which==27)if(c<=2){this._resetDrawing();this._inOp=false}else{this._drawCoords[c-2]=e.merge([],this._drawCoords[c-1]);this._drawPixels[c-2]=e.merge([],this._drawPixels[c-1]);this._drawCoords.length--;this._drawPixels.length--;this._refreshDrawing()}},_eventTarget_dblclick_zoom:function(a){this._trigger("dblclick",a,{type:"Point",coordinates:this.toMap(this._current)});if(!a.isDefaultPrevented()){a=this._getZoomCenterAndSize(this._current,1,this._zoomFactor);this._setCenterAndSize(a.center,
95 a.pixelSize,true,true)}},_eventTarget_dblclick:function(a){this._panFinalize();if(this._drawTimeout){window.clearTimeout(this._drawTimeout);this._drawTimeout=null}e(a.currentTarget).offset();switch(this._options.mode){case "pan":case "drawPoint":this._eventTarget_dblclick_zoom(a);break;case "drawLineString":if(this._drawCoords.length>1&&!(this._drawCoords[0][0]==this._drawCoords[1][0]&&this._drawCoords[0][1]==this._drawCoords[1][1])){this._drawCoords.length--;this._trigger("shape",a,{type:"LineString",
96 coordinates:e.geo.proj?e.geo.proj.toGeodetic(this._drawCoords):this._drawCoords})}else this._eventTarget_dblclick_zoom(a);this._resetDrawing();break;case "drawPolygon":if(this._drawCoords.length>1&&!(this._drawCoords[0][0]==this._drawCoords[1][0]&&this._drawCoords[0][1]==this._drawCoords[1][1])){var c=this._drawCoords.length-1;if(c>2){this._drawCoords[c]=e.merge([],this._drawCoords[0]);this._trigger("shape",a,{type:"Polygon",coordinates:[e.geo.proj?e.geo.proj.toGeodetic(this._drawCoords):this._drawCoords]})}}else this._eventTarget_dblclick_zoom(a);
97 this._resetDrawing()}this._inOp=false},_eventTarget_touchstart:function(a){if(!(!this._supportTouch&&a.which!=1)){this._panFinalize();this._mouseWheelFinish();var c=e(a.currentTarget).offset();this._current=this._supportTouch?[a.originalEvent.changedTouches[0].pageX-c.left,a.originalEvent.changedTouches[0].pageY-c.top]:[a.pageX-c.left,a.pageY-c.top];if(this._softDblClick){c=e.now();if(c-this._downDate<750){if(this._isTap){var b=this._current[0]-this._anchor[0],d=this._current[1]-this._anchor[1];if(Math.sqrt(b*
98 b+d*d)>10)this._isTap=false;else this._current=this._anchor}this._isDbltap=this._isDbltap?false:this._isTap}else this._isDbltap=false;this._isTap=true;this._downDate=c}this._mouseDown=true;this._anchor=this._current;if(!this._inOp&&a.shiftKey){this._shiftZoom=true;this._$eventTarget.css("cursor",this._options.cursors.zoom)}else{this._inOp=true;switch(this._options.mode){case "pan":case "drawPoint":case "drawLineString":case "drawPolygon":this._lastDrag=this._current;a.currentTarget.setCapture&&a.currentTarget.setCapture()}}if(this._inOp){a.preventDefault();
99 return false}}},_dragTarget_touchmove:function(a){var c=this._$eventTarget.offset(),b=this._drawCoords.length;c=this._supportTouch?[a.originalEvent.changedTouches[0].pageX-c.left,a.originalEvent.changedTouches[0].pageY-c.top]:[a.pageX-c.left,a.pageY-c.top];if(c[0]===this._lastMove[0]&&c[1]===this._lastMove[1])if(this._inOp){a.preventDefault();return false}if(this._softDblClick)this._isDbltap=this._isTap=false;if(this._mouseDown){this._current=c;this._moveDate=e.now()}switch(this._shiftZoom?"zoom":
100 this._options.mode){case "zoom":if(this._mouseDown){this._$drawContainer.geographics("clear");this._$drawContainer.geographics("drawBbox",[this._anchor[0],this._anchor[1],c[0],c[1]])}else this._trigger("move",a,{type:"Point",coordinates:this.toMap(c)});break;case "pan":case "drawPoint":this._mouseDown||this._toolPan?this._panMove():this._trigger("move",a,{type:"Point",coordinates:this.toMap(c)});break;case "drawLineString":case "drawPolygon":if(this._mouseDown||this._toolPan)this._panMove();else{if(b>
101 0){this._drawCoords[b-1]=this._toMap(c);this._drawPixels[b-1]=c;this._refreshDrawing()}this._trigger("move",a,{type:"Point",coordinates:this.toMap(c)})}}this._lastMove=c;if(this._inOp){a.preventDefault();return false}},_dragTarget_touchstop:function(a){!this._mouseDown&&p==7&&this._eventTarget_touchstart(a);var c=this._mouseDown,b=this._toolPan,d=this._$eventTarget.offset(),g=this._shiftZoom?"zoom":this._options.mode,f,m;f=this._supportTouch?[a.originalEvent.changedTouches[0].pageX-d.left,a.originalEvent.changedTouches[0].pageY-
102 d.top]:[a.pageX-d.left,a.pageY-d.top];d=f[0]-this._anchor[0];m=f[1]-this._anchor[1];this._$eventTarget.css("cursor",this._options.cursors[this._options.mode]);this._shiftZoom=this._mouseDown=this._toolPan=false;document.releaseCapture&&document.releaseCapture();if(c){c=e.now();this._current=f;switch(g){case "zoom":if(d>0||m>0){b=this._pixelSize*6;g=this._toMap([[Math.min(this._anchor[0],f[0]),Math.max(this._anchor[1],f[1])],[Math.max(this._anchor[0],f[0]),Math.min(this._anchor[1],f[1])]]);g=[g[0][0],
103 g[0][1],g[1][0],g[1][1]];if(g[2]-g[0]<b&&g[3]-g[1]<b)g=e.geo.scaleBy(this._getBbox(e.geo.center(g,true)),0.5,true);this._setBbox(g,true,true)}this._resetDrawing();break;case "pan":if(b)this._panEnd();else if(c-this._clickDate>100){this._trigger("click",a,{type:"Point",coordinates:this.toMap(f)});this._inOp=false}break;case "drawPoint":if(this._drawTimeout){window.clearTimeout(this._drawTimeout);this._drawTimeout=null}if(b)this._panFinalize();else if(c-this._clickDate>100){var l=this;this._drawTimeout=
104 setTimeout(function(){if(l._drawTimeout){l._trigger("shape",a,{type:"Point",coordinates:l.toMap(f)});l._inOp=false;l._drawTimeout=false}},250)}break;case "drawLineString":case "drawPolygon":if(b)this._panFinalize();else{b=this._drawCoords.length==0?0:this._drawCoords.length-1;this._drawCoords[b]=this._toMap(f);this._drawPixels[b]=f;if(b<2||!(this._drawCoords[b][0]==this._drawCoords[b-1][0]&&this._drawCoords[b][1]==this._drawCoords[b-1][1])){this._drawCoords[b+1]=this._toMap(f);this._drawPixels[b+
105 1]=f}this._refreshDrawing()}}this._clickDate=c;if(this._softDblClick&&this._isDbltap){this._isDbltap=this._isTap=false;this._$eventTarget.trigger("dblclick",a)}}if(this._inOp){a.preventDefault();return false}},_eventTarget_mousewheel:function(a,c){a.preventDefault();this._panFinalize();if(this._mouseDown)return false;if(c!=0){if(this._wheelTimeout){window.clearTimeout(this._wheelTimeout);this._wheelTimeout=null}else{var b=e(a.currentTarget).offset();this._anchor=[a.pageX-b.left,a.pageY-b.top]}this._wheelLevel+=
106 c;b=this._getZoomCenterAndSize(this._anchor,this._wheelLevel,this._wheelZoomFactor);this._$shapesContainer.geographics("clear");for(i=0;i<this._options.services.length;i++){var d=this._options.services[i];e.geo._serviceTypes[d.type].interactiveScale(this,d,b.center,b.pixelSize)}this._$shapesContainer.geographics("clear");this._graphicShapes.length>0&&this._graphicShapes.length<256&&this._refreshShapes(this._$shapesContainer,this._graphicShapes,this._graphicShapes,b.center,b.pixelSize);if(this._drawCoords.length>
107 0){this._drawPixels=this._toPixel(this._drawCoords,b.center,b.pixelSize);this._refreshDrawing()}var g=this;this._wheelTimeout=window.setTimeout(function(){g._mouseWheelFinish()},1E3)}return false}})})(jQuery);
108 (function(e,r){e.geo._serviceTypes.tiled=function(){return{create:function(p,a,c){p=e.data(c,"geoServiceState");if(!p){p={loadCount:0,reloadTiles:false};a.append('<div data-geo-service="tiled"'+(c.id?' id="'+c.id+'"':"")+(c["class"]?' class="'+c["class"]+'"':"")+' style="position:absolute; left:0; top:0; width:8px; height:8px; margin:0; padding:0; display:'+(c.visibility===r||c.visibility==="visible"?"block":"none")+';"></div>');p.serviceContainer=a.children(":last");e.data(c,"geoServiceState",p)}return p.serviceContainer},
109 destroy:function(p,a,c){e.data(c,"geoServiceState").serviceContainer.remove();e.removeData(c,"geoServiceState")},interactivePan:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d){this._cancelUnloaded(p,a);d.serviceContainer.children().css({left:function(w,M){return parseInt(M)+c},top:function(w,M){return parseInt(M)+b}});if(a&&(a.visibility===r||a.visibility==="visible")){var g=p._pixelSize,f=d.serviceContainer,m=f.children("[data-pixelSize='"+g+"']"),l=p._getContentBounds(),o=p.options.tilingScheme,
110 s=o.tileWidth,x=o.tileHeight,t=l.width/2*g,A=l.height/2*g,B=m.position(),C=m.data("scaleOrigin").split(",");l=parseInt(C[0])-B.left;B=parseInt(C[1])-B.top;var y=p._getCenter();C=[y[0]+l*g,y[1]-B*g];var H=Math.floor((C[0]-t-o.origin[0])/(g*s));l=Math.floor((o.origin[1]-(C[1]+A))/(g*x));B=Math.ceil((C[0]+t-o.origin[0])/(g*s));C=Math.ceil((o.origin[1]-(C[1]-A))/(g*x));var I=p._getBboxMax(),G=p._getTiledPixelSize(0),E=G/g,D=Math.floor((I[0]-o.origin[0])/(G*s))*E;I=Math.floor((o.origin[1]-I[3])/(G*x))*
111 E;t=Math.round((o.origin[0]+D*s*g-(y[0]-t))/g);A=Math.round((y[1]+A-(o.origin[1]-I*x*g))/g);var J=a.opacity===r?1:a.opacity;for(y=H;y<B;y++)for(H=l;H<C;H++){G=""+y+","+H;E=m.children("[data-tile='"+G+"']").removeAttr("data-dirty");if(E.size()===0){var K=[o.origin[0]+y*s*g,o.origin[1]-H*x*g],F=[o.origin[0]+((y+1)*s-1)*g,o.origin[1]-((H+1)*x-1)*g];K=a.getUrl({bbox:[K[0],K[1],F[0],F[1]],width:s,height:x,zoom:p._getZoom(),tile:{row:H,column:y},index:Math.abs(H+y)});d.loadCount++;if(d.reloadTiles&&E.size()>
112 0)E.attr("src",K);else{E="<img style='position:absolute; left:"+((y-D)*100+(t-t%s)/s*100)+"%; top:"+((H-I)*100+(A-A%x)/x*100)+"%; ";if(e("body")[0].filters===r)E+="width: 100%; height: 100%;";E+="margin:0; padding:0; -khtml-user-select:none; -moz-user-select:none; -webkit-user-select:none; user-select:none; display:none;' unselectable='on' data-tile='"+G+"' />";m.append(E);E=m.children(":last");E.load(function(w){J<1?e(w.target).fadeTo(0,J):e(w.target).show();d.loadCount--;if(d.loadCount<=0){f.children(":not([data-pixelSize='"+
113 g+"'])").remove();d.loadCount=0}}).error(function(w){e(w.target).remove();d.loadCount--;if(d.loadCount<=0){f.children(":not([data-pixelSize='"+g+"'])").remove();d.loadCount=0}}).attr("src",K)}}}}}},interactiveScale:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,a);a=p.options.tilingScheme;var g=a.tileWidth,f=a.tileHeight;d.serviceContainer.children().each(function(){var m=e(this),l=m.attr("data-pixelSize")/b;l=Math.round(l*
114 1E3)/1E3;var o=m.data("scaleOrigin").split(",");o=p._toMap([o[0],o[1]]);o=p._toPixel(o,c,b);m.css({left:Math.round(o[0])+"px",top:Math.round(o[1])+"px",width:g*l,height:f*l});e("body")[0].filters!==r&&m.children().each(function(){e(this).css("filter","progid:DXImageTransform.Microsoft.Matrix(FilterType=bilinear,M11="+l+",M22="+l+",sizingmethod='auto expand')")})})}},refresh:function(p,a){var c=e.data(a,"geoServiceState");if(c&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,
115 a);var b=p._getBbox(),d=p._pixelSize,g=c.serviceContainer;p._getContentBounds();var f=p.options.tilingScheme,m=f.tileWidth,l=f.tileHeight,o=Math.floor((b[0]-f.origin[0])/(d*m)),s=Math.floor((f.origin[1]-b[3])/(d*l)),x=Math.ceil((b[2]-f.origin[0])/(d*m)),t=Math.ceil((f.origin[1]-b[1])/(d*l)),A=p._getBboxMax(),B=p._getTiledPixelSize(0),C=B/d,y=Math.floor((A[0]-f.origin[0])/(B*m))*C,H=Math.floor((f.origin[1]-A[3])/(B*l))*C,I=Math.round((f.origin[0]+y*m*d-b[0])/d),G=Math.round((b[3]-(f.origin[1]-H*l*
116 d))/d);b=g.children().show();A=b.filter("[data-pixelSize='"+d+"']").appendTo(g);var E=a.opacity===r?1:a.opacity;c.reloadTiles&&b.find("img").attr("data-dirty","true");if(A.size()){A.css({left:I%m+"px",top:G%l+"px"}).data("scaleOrigin",I%m+","+G%l);A.children().each(function(){var F=e(this),w=F.attr("data-tile").split(",");F.css({left:Math.round((parseInt(w[0])-y)*100+(I-I%m)/m*100)+"%",top:Math.round((parseInt(w[1])-H)*100+(G-G%l)/l*100)+"%"});E<1&&F.fadeTo(0,E)})}else{g.append("<div style='position:absolute; left:"+
117 I%m+"px; top:"+G%l+"px; width:"+m+"px; height:"+l+"px; margin:0; padding:0;' data-pixelSize='"+d+"'></div>");A=g.children(":last").data("scaleOrigin",I%m+","+G%l)}for(o=o;o<x;o++)for(B=s;B<t;B++){C=""+o+","+B;var D=A.children("[data-tile='"+C+"']").removeAttr("data-dirty");if(D.size()===0||c.reloadTiles){var J=[f.origin[0]+o*m*d,f.origin[1]-B*l*d],K=[f.origin[0]+((o+1)*m-1)*d,f.origin[1]-((B+1)*l-1)*d];J=a.getUrl({bbox:[J[0],J[1],K[0],K[1]],width:m,height:l,zoom:p._getZoom(),tile:{row:B,column:o},
118 index:Math.abs(B+o)});c.loadCount++;if(c.reloadTiles&&D.size()>0)D.attr("src",J);else{D="<img style='position:absolute; left:"+((o-y)*100+(I-I%m)/m*100)+"%; top:"+((B-H)*100+(G-G%l)/l*100)+"%; ";if(e("body")[0].filters===r)D+="width: 100%; height: 100%;";D+="margin:0; padding:0; -khtml-user-select:none; -moz-user-select:none; -webkit-user-select:none; user-select:none; display:none;' unselectable='on' data-tile='"+C+"' />";A.append(D);D=A.children(":last");D.load(function(F){E<1?e(F.target).fadeTo(0,
119 E):e(F.target).show();c.loadCount--;if(c.loadCount<=0){g.children(":not([data-pixelSize='"+d+"'])").remove();c.loadCount=0}}).error(function(F){e(F.target).remove();c.loadCount--;if(c.loadCount<=0){g.children(":not([data-pixelSize='"+d+"'])").remove();c.loadCount=0}}).attr("src",J)}}}b.find("[data-dirty]").remove();c.reloadTiles=false}},resize:function(){},opacity:function(p,a){e.data(a,"geoServiceState").serviceContainer.find("img").stop(true).fadeTo("fast",a.opacity)},toggle:function(p,a){e.data(a,
120 "geoServiceState").serviceContainer.css("display",a.visibility==="visible"?"block":"none")},_cancelUnloaded:function(p,a){var c=e.data(a,"geoServiceState");if(c&&c.loadCount>0)for(c.serviceContainer.find("img:hidden").remove();c.loadCount>0;)c.loadCount--}}}()})(jQuery);
121 (function(e,r){e.geo._serviceTypes.shingled=function(){return{create:function(p,a,c){p=e.data(c,"geoServiceState");if(!p){p={loadCount:0};a.append('<div data-geo-service="shingled"'+(c.id?' id="'+c.id+'"':"")+(c["class"]?' class="'+c["class"]+'"':"")+' style="position:absolute; left:0; top:0; width:16px; height:16px; margin:0; padding:0; display:'+(c.visibility===r||c.visibility==="visible"?"block":"none")+';"></div>');p.serviceContainer=a.children(":last");e.data(c,"geoServiceState",p)}return p.serviceContainer},
122 destroy:function(p,a,c){e.data(c,"geoServiceState").serviceContainer.remove();e.removeData(c,"geoServiceState")},interactivePan:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d){this._cancelUnloaded(p,a);p=d.serviceContainer.children("[data-pixelSize='"+p._pixelSize+"']");a=p.children("div");if(!a.length){p.children("img").wrap('<div style="position:absolute; left:0; top:0; width:100%; height:100%;"></div>');a=p.children("div")}a.css({left:function(g,f){return parseInt(f)+c},top:function(g,
123 f){return parseInt(f)+b}})}},interactiveScale:function(p,a,c,b){var d=e.data(a,"geoServiceState");if(d){this._cancelUnloaded(p,a);a=d.serviceContainer;p=p._getContentBounds();var g=p.width,f=p.height,m=g/2,l=f/2;a.children().each(function(){var o=e(this),s=o.attr("data-pixelSize"),x=s/b;o.css({width:g*x,height:f*x}).children("img").each(function(){var t=e(this),A=t.data("center");t.css({left:(Math.round((A[0]-c[0])/s)-m)*x+"px",top:(Math.round((c[1]-A[1])/s)-l)*x+"px"})})})}},refresh:function(p,a){var c=
124 e.data(a,"geoServiceState");if(c&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,a);var b=p._getBbox(),d=p._pixelSize,g=c.serviceContainer,f=p._getContentBounds(),m=f.width,l=f.height,o=m/2,s=l/2;f=g.children('[data-pixelSize="'+d+'"]');var x=a.opacity===r?1:a.opacity;if(!f.size()){g.append('<div style="position:absolute; left:'+o+"px; top:"+s+"px; width:"+m+"px; height:"+l+'px; margin:0; padding:0;" data-pixelSize="'+d+'"></div>');f=g.children(":last")}f.children("img").each(function(){var t=
125 e(this),A=t.data("center"),B=p._getCenter();t.css({left:Math.round((A[0]-B[0])/d)-o+"px",top:Math.round((B[1]-A[1])/d)-s+"px"})});x<1&&g.find("img").attr("data-keepAlive","0");b=a.getUrl({bbox:b,width:m,height:l,zoom:p._getZoom(),tile:null,index:0});c.loadCount++;f.append('<img style="position:absolute; left:-'+o+"px; top:-"+s+'px; width:100%; height:100%; margin:0; padding:0; -khtml-user-select:none; -moz-user-select:none; -webkit-user-select:none; user-select:none; display:none;" unselectable="on" />');
126 f.children(":last").data("center",p._getCenter()).load(function(t){x<1?e(t.target).fadeTo(0,x):e(t.target).show();c.loadCount--;if(c.loadCount<=0){g.children(':not([data-pixelSize="'+d+'"])').remove();t=g.find('[data-pixelSize="'+d+'"]>div');if(t.size()>0){var A=t.position();t.children("img").each(function(){var B=e(this),C=A.left+parseInt(B.css("left")),y=A.top+parseInt(B.css("top"));B.css({left:C+"px",top:y+"px"})}).unwrap();t.remove()}c.loadCount=0}}).error(function(t){e(t.target).remove();c.loadCount--;
127 if(c.loadCount<=0){g.children(":not([data-pixelSize='"+d+"'])").remove();c.loadCount=0}}).attr("src",b)}},resize:function(p,a){var c=e.data(a,"geoServiceState");if(c&&a&&(a.visibility===r||a.visibility==="visible")){this._cancelUnloaded(p,a);c=shingledServicesState[a.id];var b=c.serviceContainer,d=p._getContentBounds();c=d.width/2;d=d.height/2;b=b.children();b.attr("data-pixelSize","0");b.css({left:c+"px",top:d+"px"})}},opacity:function(p,a){e.data(a,"geoServiceState").serviceContainer.find("img").stop(true).fadeTo("fast",
128 a.opacity)},toggle:function(p,a){e.data(a,"geoServiceState").serviceContainer.css("display",a.visibility==="visible"?"block":"none")},_cancelUnloaded:function(p,a){var c=e.data(a,"geoServiceState");if(c&&c.loadCount>0)for(c.serviceContainer.find("img:hidden").remove();c.loadCount>0;)c.loadCount--}}}()})(jQuery);