googlemaps-v3-utility-library
Version:
Google Maps API V3 Utility Library
47 lines (46 loc) • 18.6 kB
JavaScript
(function(){/*
http://google-maps-utility-library-v3.googlecode.com
*/
var h,i=Math.PI/180,l=0;window.ags_jsonp=window.ags_jsonp||{};var n=google.maps,o,q,r,s={V:null,R:false},t={},u={};function v(a,b,c){var d=b===""?0:a.indexOf(b);return a.substring(d+b.length,c===""?a.length:a.indexOf(c,d+b.length))}function x(a,b,c){if(a&&b){var d;for(d in a)if(c||!(d in b))b[d]=a[d]}return b}function y(){n.event.trigger.apply(this,arguments)}function aa(a,b){var c="";if(a)c+=a.getTime()-a.getTimezoneOffset()*6E4;if(b)c+=", "+(b.getTime()-b.getTimezoneOffset()*6E4);return c}
function ba(a){var b="";for(var c in a)if(a.hasOwnProperty(c)){if(b.length>0)b+=";";b+=c+":"+a[c]}return b}function ca(){if(typeof XMLHttpRequest==="undefined"){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(b){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(c){}throw new Error("This browser does not support XMLHttpRequest.");}else return new XMLHttpRequest}
var z="esriGeometryPoint",A="esriGeometryMultipoint",B="esriGeometryPolyline",C="esriGeometryPolygon",D="esriGeometryEnvelope";
function da(a){var b=a;if(a&&a.splice&&a.length>0)b=a[0];if(b instanceof n.LatLng||b instanceof n.Marker)return a&&a.splice&&a.length>1?A:z;else if(b instanceof n.Polyline)return B;else if(b instanceof n.Polygon)return C;else if(b instanceof n.LatLngBounds)return D;else if(b.x!==undefined&&b.y!==undefined)return z;else if(b.points)return A;else if(b.paths)return B;else if(b.rings)return C;return null}
function E(a){var b=a;if(a&&a.splice&&a.length>0)b=a[0];if(b&&b.splice&&b.length>0)b=b[0];if(b instanceof n.LatLng||b instanceof n.Marker||b instanceof n.Polyline||b instanceof n.Polygon||b instanceof n.LatLngBounds)return true;return false}function F(a,b){for(var c=[],d,e=0,f=a.getLength();e<f;e++){d=a.getAt(e);c.push("["+d.lng()+","+d.lat()+"]")}b&&c.length>0&&c.push("["+a.getAt(0).lng()+","+a.getAt(0).lat()+"]");return c.join(",")}
function G(a){var b;if(typeof a==="object")if(a&&a.splice){b=[];for(var c=0,d=a.length;c<d;c++)b.push(G(a[c]));return"["+b.join(",")+"]"}else if(E(a)){var e;d="{";switch(da(a)){case z:e=a&&a.splice?a[0]:a;if(e instanceof n.Marker)e=e.getPosition();d+="x:"+e.lng()+",y:"+e.lat();break;case A:c=[];for(b=0;b<a.length;b++){e=a[b]instanceof n.Marker?a[b].getPosition():a[b];c.push("["+e.lng()+","+e.lat()+"]")}d+="points: ["+c.join(",")+"]";break;case B:c=[];a=a&&a.splice?a:[a];for(b=0;b<a.length;b++)c.push("["+
F(a[b].getPath())+"]");d+="paths:["+c.join(",")+"]";break;case C:c=[];e=a&&a.splice?a[0]:a;a=e.getPaths();for(b=0;b<a.getLength();b++)c.push("["+F(a.getAt(b),true)+"]");d+="rings:["+c.join(",")+"]";break;case D:e=a&&a.splice?a[0]:a;d+="xmin:"+e.getSouthWest().lng()+",ymin:"+e.getSouthWest().lat()+",xmax:"+e.getNorthEast().lng()+",ymax:"+e.getNorthEast().lat();break}d+=", spatialReference:{wkid:4326}";d+="}";return d}else if(a.toJSON)return a.toJSON();else{b="";for(c in a)if(a.hasOwnProperty(c)){if(b.length>
0)b+=", ";b+=c+":"+G(a[c])}return"{"+b+"}"}return a.toString()}function H(a){var b="";if(a){a.f=a.f||"json";for(var c in a)if(a.hasOwnProperty(c)&&a[c]!==null&&a[c]!==undefined){var d=G(a[c]);b+=(b.length>0?"&":"")+(c+"="+(escape?escape(d):encodeURIComponent(d)))}}return b}function ea(a,b){for(var c=[],d=2,e=arguments.length;d<e;d++)c.push(arguments[d]);return function(){a.apply(b,c)}}function fa(a,b,c){b.L?a.push(b.copyrightText):n.event.addListenerOnce(b,"load",function(){I(c)})}
function I(a){var b=null;if(a){var c=a.controls[n.ControlPosition.BOTTOM_RIGHT];if(c)for(var d=0,e=c.getLength();d<e;d++)if(c.getAt(d).id==="agsCopyrights"){b=c.getAt(d);break}if(!b){b=document.createElement("div");b.style.fontFamily="Arial,sans-serif";b.style.fontSize="10px";b.style.textAlign="right";b.id="agsCopyrights";a.controls[n.ControlPosition.BOTTOM_RIGHT].push(b);n.event.addListener(a,"maptypeid_changed",function(){I(a)})}var f=a.agsOverlays;c=[];if(f){d=0;for(e=f.getLength();d<e;d++)fa(c,
f.getAt(d).U,a)}var j=a.overlayMapTypes;if(j){d=0;for(e=j.getLength();d<e;d++)f=j.getAt(d)}f=a.mapTypes.get(a.getMapTypeId());b.innerHTML=c.join("<br/>")}}
function J(a,b,c,d){var e="ags_jsonp_"+l++ +"_"+Math.floor(Math.random()*1E6),f=null;b=b||{};b[c||"callback"]="ags_jsonp."+e;b=H(b);var j=document.getElementsByTagName("head")[0];if(!j)throw new Error("document must have header tag");window.ags_jsonp[e]=function(){window.ags_jsonp[e]&&delete window.ags_jsonp[e];f&&j.removeChild(f);f=null;d.apply(null,arguments);y(u,"jsonpend",e)};if((b+a).length<2E3&&!s.R){f=document.createElement("script");f.src=a+(a.indexOf("?")===-1?"?":"&")+b;f.id=e;j.appendChild(f)}else{c=
window.location;c=c.protocol+"//"+c.hostname+(!c.port||c.port===80?"":":"+c.port+"/");var k=true;if(a.toLowerCase().indexOf(c.toLowerCase())!==-1)k=false;if(s.R)k=true;if(k&&!s.V)throw new Error("No proxyUrl property in Config is defined");var g=ca();g.onreadystatechange=function(){if(g.readyState===4)if(g.status===200)eval(g.responseText);else throw new Error("Error code "+g.status);};g.open("POST",k?s.V+"?"+a:a,true);g.setRequestHeader("Content-Type","application/x-www-form-urlencoded");g.send(b)}y(u,
"jsonpstart",e);return e}u.ka=function(a,b,c,d){J(a,b,c,d)};u.Q=function(a,b){if(b&&b.splice)for(var c,d=0,e=b.length;d<e;d++)if((c=b[d])&&c.splice)u.Q(a,c);else E(c)&&c.setMap(a)};u.ma=function(a,b){u.Q(null,a);if(b)a.length=0};function K(a){a=a||{};this.wkid=a.wkid;this.wkt=a.wkt}K.prototype.forward=function(a){return a};K.prototype.q=function(a){return a};K.prototype.p=function(){return 360};K.prototype.toJSON=function(){return"{"+(this.wkid?" wkid:"+this.wkid:"wkt: '"+this.wkt+"'")+"}"};
function L(a){a=a||{};K.call(this,a)}L.prototype=new K;function M(a){a=a||{};K.call(this,a);var b=a.J,c=a.N*i,d=a.O*i,e=a.K*i;this.a=a.r/a.unit;this.e=a.n*i;this.i=a.H;this.j=a.I;a=1/b;b=2*a-a*a;this.d=Math.sqrt(b);a=this.k(c,b);b=this.k(d,b);e=N(this,e,this.d);c=N(this,c,this.d);d=N(this,d,this.d);this.b=Math.log(a/b)/Math.log(c/d);this.F=a/(this.b*Math.pow(c,this.b));this.h=this.t(this.a,this.F,e,this.b)}M.prototype=new K;
M.prototype.k=function(a,b){var c=Math.sin(a);return Math.cos(a)/Math.sqrt(1-b*c*c)};function N(a,b,c){a=c*Math.sin(b);return Math.tan(Math.PI/4-b/2)/Math.pow((1-a)/(1+a),c/2)}h=M.prototype;h.t=function(a,b,c,d){return a*b*Math.pow(c,d)};h.s=function(a,b,c){c=b*Math.sin(c);return Math.PI/2-2*Math.atan(a*Math.pow((1-c)/(1+c),b/2))};h.M=function(a,b,c){var d=0;c=c;for(var e=this.s(a,b,c);Math.abs(e-c)>1.0E-9&&d<10;){d++;c=e;e=this.s(a,b,c)}return e};
h.forward=function(a){var b=a[0]*i;a=this.t(this.a,this.F,N(this,a[1]*i,this.d),this.b);b=this.b*(b-this.e);return[this.i+a*Math.sin(b),this.j+this.h-a*Math.cos(b)]};h.q=function(a){var b=a[0]-this.i,c=a[1]-this.j;a=Math.atan(b/(this.h-c));b=Math.pow((this.b>0?1:-1)*Math.sqrt(b*b+(this.h-c)*(this.h-c))/(this.a*this.F),1/this.b);return[(a/this.b+this.e)/i,this.M(b,this.d,Math.PI/2-2*Math.atan(b))/i]};h.p=function(){return Math.PI*2*this.a};
function O(a){a=a||{};K.call(this,a);this.a=a.r/a.unit;var b=a.J;this.z=a.ga;var c=a.K*i;this.e=a.n*i;this.i=a.H;this.j=a.I;a=1/b;this.c=2*a-a*a;this.w=this.c*this.c;this.G=this.w*this.c;this.m=this.c/(1-this.c);this.P=this.k(c,this.a,this.c,this.w,this.G)}O.prototype=new K;O.prototype.k=function(a,b,c,d,e){return b*((1-c/4-3*d/64-5*e/256)*a-(3*c/8+3*d/32+45*e/1024)*Math.sin(2*a)+(15*d/256+45*e/1024)*Math.sin(4*a)-35*e/3072*Math.sin(6*a))};
O.prototype.forward=function(a){var b=a[1]*i,c=a[0]*i;a=this.a/Math.sqrt(1-this.c*Math.pow(Math.sin(b),2));var d=Math.pow(Math.tan(b),2),e=this.m*Math.pow(Math.cos(b),2);c=(c-this.e)*Math.cos(b);var f=this.k(b,this.a,this.c,this.w,this.G);return[this.i+this.z*a*(c+(1-d+e)*Math.pow(c,3)/6+(5-18*d+d*d+72*e-58*this.m)*Math.pow(c,5)/120),this.j+this.z*(f-this.P)+a*Math.tan(b)*(c*c/2+(5-d+9*e+4*e*e)*Math.pow(c,4)/120+(61-58*d+d*d+600*e-330*this.m)*Math.pow(c,6)/720)]};
O.prototype.q=function(a){var b=a[0],c=a[1];a=(1-Math.sqrt(1-this.c))/(1+Math.sqrt(1-this.c));c=(this.P+(c-this.j)/this.z)/(this.a*(1-this.c/4-3*this.w/64-5*this.G/256));a=c+(3*a/2-27*Math.pow(a,3)/32)*Math.sin(2*c)+(21*a*a/16-55*Math.pow(a,4)/32)*Math.sin(4*c)+151*Math.pow(a,3)/6*Math.sin(6*c)+1097*Math.pow(a,4)/512*Math.sin(8*c);c=this.m*Math.pow(Math.cos(a),2);var d=Math.pow(Math.tan(a),2),e=this.a/Math.sqrt(1-this.c*Math.pow(Math.sin(a),2)),f=this.a*(1-this.c)/Math.pow(1-this.c*Math.pow(Math.sin(a),
2),1.5);b=(b-this.i)/(e*this.z);e=a-e*Math.tan(a)/f*(b*b/2-(5+3*d+10*c-4*c*c-9*this.m)*Math.pow(b,4)/24+(61+90*d+28*c+45*d*d-252*this.m-3*c*c)*Math.pow(b,6)/720);return[(this.e+(b-(1+2*d+c)*Math.pow(b,3)/6+(5-2*c+28*d-3*c*c+8*this.m+24*d*d)*Math.pow(b,5)/120)/Math.cos(a))/i,e/i]};O.prototype.p=function(){return Math.PI*2*this.a};function P(a){a=a||{};K.call(this,a);this.a=(a.r||6378137)/(a.unit||1);this.e=(a.n||0)*i}P.prototype=new K;
P.prototype.forward=function(a){var b=a[1]*i;return[this.a*(a[0]*i-this.e),this.a/2*Math.log((1+Math.sin(b))/(1-Math.sin(b)))]};P.prototype.q=function(a){return[(a[0]/this.a+this.e)/i,(Math.PI/2-2*Math.atan(Math.exp(-a[1]/this.a)))/i]};P.prototype.p=function(){return Math.PI*2*this.a};
function Q(a){a=a||{};K.call(this,a);var b=a.J,c=a.N*i,d=a.O*i,e=a.K*i;this.a=a.r/a.unit;this.e=a.n*i;this.i=a.H;this.j=a.I;a=1/b;b=2*a-a*a;this.d=Math.sqrt(b);a=this.k(c,b);b=this.k(d,b);c=R(this,c,this.d);d=R(this,d,this.d);e=R(this,e,this.d);this.b=(a*a-b*b)/(d-c);this.D=a*a+this.b*c;this.h=this.t(this.a,this.D,this.b,e)}Q.prototype=new K;Q.prototype.k=function(a,b){var c=Math.sin(a);return Math.cos(a)/Math.sqrt(1-b*c*c)};
function R(a,b,c){a=c*Math.sin(b);return(1-c*c)*(Math.sin(b)/(1-a*a)-1/(2*c)*Math.log((1-a)/(1+a)))}h=Q.prototype;h.t=function(a,b,c,d){return a*Math.sqrt(b-c*d)/c};h.s=function(a,b,c){var d=b*Math.sin(c);return c+(1-d*d)*(1-d*d)/(2*Math.cos(c))*(a/(1-b*b)-Math.sin(c)/(1-d*d)+Math.log((1-d)/(1+d))/(2*b))};h.M=function(a,b,c){var d=0;c=c;for(var e=this.s(a,b,c);Math.abs(e-c)>1.0E-8&&d<10;){d++;c=e;e=this.s(a,b,c)}return e};
h.forward=function(a){var b=a[0]*i;a=this.t(this.a,this.D,this.b,R(this,a[1]*i,this.d));b=this.b*(b-this.e);return[this.i+a*Math.sin(b),this.j+this.h-a*Math.cos(b)]};h.q=function(a){var b=a[0]-this.i;a=a[1]-this.j;var c=Math.sqrt(b*b+(this.h-a)*(this.h-a)),d=this.b>0?1:-1;c=(this.D-c*c*this.b*this.b/(this.a*this.a))/this.b;return[(Math.atan(d*b/(d*this.h-d*a))/this.b+this.e)/i,this.M(c,this.d,Math.asin(c/2))/i]};h.p=function(){return Math.PI*2*this.a};h.p=function(){return Math.PI*2*this.a};o=new L({wkid:4326});
q=new L({wkid:4269});r=new P({wkid:102113,r:6378137,n:0,unit:1});t={"4326":o,"4269":q,"102113":r,"102100":new P({wkid:102100,r:6378137,n:0,unit:1})};
u.fa=function(a,b){var c=t[""+a];if(c)return c;if(b instanceof K)c=t[""+a]=b;else{c=b||a;var d={wkt:a};if(a===parseInt(a,10))d={wkid:a};var e=v(c,'PROJECTION["','"]'),f=v(c,"SPHEROID[","]").split(",");if(e!==""){d.unit=parseFloat(v(v(c,"PROJECTION",""),"UNIT[","]").split(",")[1]);d.r=parseFloat(f[1]);d.J=parseFloat(f[2]);d.K=parseFloat(v(c,'"Latitude_Of_Origin",',"]"));d.n=parseFloat(v(c,'"Central_Meridian",',"]"));d.H=parseFloat(v(c,'"False_Easting",',"]"));d.I=parseFloat(v(c,'"False_Northing",',
"]"))}switch(e){case "":c=new K(d);break;case "Lambert_Conformal_Conic":d.N=parseFloat(v(c,'"Standard_Parallel_1",',"]"));d.O=parseFloat(v(c,'"Standard_Parallel_2",',"]"));c=new M(d);break;case "Transverse_Mercator":d.ga=parseFloat(v(c,'"Scale_Factor",',"]"));c=new O(d);break;case "Albers":d.N=parseFloat(v(c,'"Standard_Parallel_1",',"]"));d.O=parseFloat(v(c,'"Standard_Parallel_2",',"]"));c=new Q(d);break;default:throw new Error(e+" not supported");}if(c)t[""+a]=c}return c};
function S(a){this.url=a;this.definition=null}function T(a,b){this.url=a;this.L=false;var c=a.split("/");this.name=c[c.length-2].replace(/_/g," ");b=b||{};if(b.Y){var d=this;window.setTimeout(function(){U(d)},b.Y*1E3)}else U(this)}function U(a){J(a.url,{},"",function(b){ga(a,b)})}
function ga(a,b){if(b.error)throw new Error(b.error.message);x(b,a);a.spatialReference=b.spatialReference.wkt?u.fa(b.spatialReference.wkt):t[b.spatialReference.wkid];if(b.tables!==undefined)J(a.url+"/layers",{},"",function(c){V(a,c);J(a.url+"/legend",{},"",function(d){var e=a.layers;if(d.layers){var f,j,k,g;j=0;for(k=d.layers.length;j<k;j++){g=d.layers[j];f=e[g.layerId];x(g,f)}}W(a)})});else{V(a,b);W(a)}}function W(a){a.L=true;y(a,"load")}
function V(a,b){var c=[],d=[];a.layers=c;if(b.tables)a.tables=d;var e,f,j,k;f=0;for(j=b.layers.length;f<j;f++){k=b.layers[f];e=new S(a.url+"/"+k.id);x(k,e);e.visible=e.defaultVisibility;c.push(e)}if(b.tables){f=0;for(j=b.tables.length;f<j;f++){k=b.tables[f];e=new S(a.url+"/"+k.id);x(k,e);d.push(e)}}f=0;for(j=c.length;f<j;f++){e=c[f];if(e.subLayerIds){e.subLayers=[];d=0;for(k=e.subLayerIds.length;d<k;d++){var g;a:{g=e.subLayerIds[d];var p=a.layers;if(p)for(var m=0,w=p.length;m<w;m++){if(g===p[m].id){g=
p[m];break a}if(g&&typeof g==="string"&&p[m].name.toLowerCase()===g.toLowerCase()){g=p[m];break a}}g=null}e.subLayers.push(g);g.la=e}}}}function ha(a){var b={};if(a.layers)for(var c=0,d=a.layers.length;c<d;c++){var e=a.layers[c];if(e.definition)b[String(e.id)]=e.definition}return b}
function ia(a){var b=[];if(a.layers){var c,d,e;d=0;for(e=a.layers.length;d<e;d++){c=a.layers[d];if(c.subLayers)for(var f=0,j=c.subLayers.length;f<j;f++)if(c.subLayers[f].visible===false){c.visible=false;break}}d=0;for(e=a.layers.length;d<e;d++){c=a.layers[d];c.subLayers&&c.subLayers.length>0||c.visible===true&&b.push(c.id)}}return b}
function ja(a,b,c,d){if(b&&b.bounds){var e={};e.f=b.f;var f=b.bounds,j=f.getSouthWest().lng(),k=f.getNorthEast().lng();if(j>k)j-=180;e.bbox=""+j+","+f.getSouthWest().lat()+","+k+","+f.getNorthEast().lat();e.size=""+b.width+","+b.height;e.dpi=b.dpi;if(b.imageSR)e.imageSR=b.imageSR.wkid?b.imageSR.wkid:"{wkt:"+b.imageSR.wkt+"}";e.bboxSR="4326";e.format=b.format;f=b.layerDefinitions;if(f===undefined)f=ha(a);e.layerDefs=ba(f);f=b.layerIds;j=b.layerOption||"show";if(f===undefined)f=ia(a);if(f.length>0)e.layers=
j+":"+f.join(",");else if(a.L&&c){c({href:null});return}e.transparent=b.transparent===false?false:true;if(b.time)e.time=aa(b.time,b.ia);e.$=b.$;if(e.f==="image")return a.url+"/export?"+H(e);else J(a.url+"/export",e,"",function(g){if(g.extent){var p,m=g.extent,w=t[m.spatialReference.wkid||m.spatialReference.wkt];w=w||o;p=w.q([m.xmin,m.ymin]);m=w.q([m.xmax,m.ymax]);p=new n.LatLngBounds(new n.LatLng(p[1],p[0]),new n.LatLng(m[1],m[0]));g.bounds=p;delete g.extent;c(g)}else{g=g.error;d&&g&&g.error&&d(g.error)}})}}
function X(a){this.aa=a?a.lods:null;this.C=a?t[a.spatialReference.wkid||a.spatialReference.wkt]:r;if(!this.C)throw new Error("unsupported Spatial Reference");this.W=a?a.lods[0].resolution:156543.033928;this.minZoom=Math.floor(Math.log(this.C.p()/this.W/256)/Math.LN2+0.5);this.maxZoom=a?this.minZoom+this.aa.length-1:20;if(n.Size)this.na=a?new n.Size(a.cols,a.rows):new n.Size(256,256);this.X=Math.pow(2,this.minZoom)*this.W;this.da=a?a.origin.x:-2.0037508342787E7;this.ea=a?a.origin.y:2.0037508342787E7;
if(a)for(var b,c=0;c<a.lods.length-1;c++){b=a.lods[c].resolution/a.lods[c+1].resolution;if(b>2.001||b<1.999)throw new Error("This type of map cache is not supported in V3. \nScale ratio between zoom levels must be 2");}}X.prototype.fromLatLngToPoint=function(a,b){if(!a||isNaN(a.lat())||isNaN(a.lng()))return null;var c=this.C.forward([a.lng(),a.lat()]),d=b||new n.Point(0,0);d.x=(c[0]-this.da)/this.X;d.y=(this.ea-c[1])/this.X;return d};X.prototype.fromLatLngToPoint=X.prototype.fromLatLngToPoint;new X;
function Y(a,b){b=b||{};this.U=a instanceof T?a:new T(a);this.minZoom=b.minZoom;this.maxZoom=b.maxZoom;this.ca=b.opacity||1;this.Z=b.ja||{};this.A=this.v=false;this.o=this.g=null;b.map&&this.setMap(b.map);this.l=null;this.u=[]}Y.prototype=new n.OverlayView;
Y.prototype.onAdd=function(){var a=this;this.u.push(n.event.addListener(this.getMap(),"bounds_changed",ea(this.B,this)));this.u.push(n.event.addListener(this.getMap(),"dragstart",function(){a.T=true}));this.u.push(n.event.addListener(this.getMap(),"dragend",function(){a.T=false}));var b=this.getMap();b.agsOverlays=b.agsOverlays||new n.MVCArray;b.agsOverlays.push(this);I(b);this.l=b};Y.prototype.onAdd=Y.prototype.onAdd;
Y.prototype.onRemove=function(){for(var a=0,b=this.u.length;a<b;a++)n.event.removeListener(this.u[a]);this.g&&this.g.setMap(null);b=this.l;var c=b.agsOverlays;if(c){a=0;for(var d=c.getLength();a<d;a++)if(c.getAt(a)==this){c.removeAt(a);break}}I(b);this.l=null};Y.prototype.onRemove=Y.prototype.onRemove;Y.prototype.draw=function(){if(!this.v||this.A===true)this.B()};Y.prototype.draw=Y.prototype.draw;
Y.prototype.B=function(){if(this.v===true)this.A=true;else{var a=this.getMap(),b=a?a.getBounds():null;if(b){var c=this.Z;c.bounds=b;b=r;var d=a.getDiv();c.width=d.offsetWidth;c.height=d.offsetHeight;if(!(d.offsetWidth==0||d.offsetHeight==0)){if((a=a.getProjection())&&a instanceof X)b=a.C;c.imageSR=b;y(this,"drawstart");var e=this;this.v=true;if(!this.T&&this.g){this.g.setMap(null);this.g=null}ja(this.U,c,function(f){e.v=false;if(e.A===true){e.A=false;e.B()}else{if(f.href){if(e.g){e.g.setMap(null);
e.g=null}e.g=new Z(f.bounds,f.href,e.l,e.ca)}y(e,"drawend")}})}}}};function Z(a,b,c,d){this.S=a;this.ha=b;this.l=c;this.o=null;this.ba=d;this.setMap(c)}Z.prototype=new n.OverlayView;
Z.prototype.onAdd=function(){var a=document.createElement("DIV");a.style.border="none";a.style.borderWidth="0px";a.style.position="absolute";var b=this.l.getDiv();a.style.width=b.offsetWidth+"px";a.style.height=b.offsetHeight+"px";a.style.backgroundImage="url("+this.ha+")";this.o=a;b=this.getPanes();var c=this.ba;c=Math.min(Math.max(c,0),1);if(a){var d=a.style;if(typeof d.opacity!=="undefined")d.opacity=c;if(typeof d.filters!=="undefined")d.filters.alpha.opacity=Math.floor(100*c);if(typeof d.filter!==
"undefined")d.filter="alpha(opacity:"+Math.floor(c*100)+")"}b.overlayLayer.appendChild(a)};Z.prototype.draw=function(){var a=this.getProjection(),b=a.fromLatLngToDivPixel(this.S.getSouthWest());a=a.fromLatLngToDivPixel(this.S.getNorthEast());var c=this.o;c.style.left=b.x+"px";c.style.top=a.y+"px"};Z.prototype.onRemove=function(){this.o.parentNode.removeChild(this.o);this.o=null};function $(a){this.l=a;I(a)}$.prototype.B=function(){I(this.l)};window.onload=function(){var a={zoom:4,center:new google.maps.LatLng(40,-100),mapTypeId:google.maps.MapTypeId.ROADMAP,streetViewControl:true};a=new google.maps.Map(document.getElementById("map_canvas"),a);new $(a);(new Y("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer",{opacity:0.5})).setMap(a)};})()