(function(){function g(a,c){c=this.options=r(c,s);var b=this,d,e=b.X=l("jomc jomc-open",[l("jomc-intermediate",[d=b.da=l("jomc-inner"),this.button=l("jomc-button jomc-button-"+(c.keepOpen?"locked":"open"),[" "],{onclick:j(b,g.prototype.pa),title:c.keepOpen?c.buttonCloseText:c.buttonKeepOpenText})])]),f=b.ea=new h.Rectangle,k=b.V=new h.Rectangle;b.map=a;d.style.height=Math.min(Math.round(a.getDiv().offsetHeight/2),c.maxHeight)+"px";d.style.width=Math.min(Math.round(a.getDiv().offsetWidth/2),c.maxWidth)+
"px";d=b.W=new h.Map(d);window.mapTypes=d.mapTypes=a.mapTypes;d.setOptions(c.mapOptions);f.setOptions(c.polyOptions);f.setMap(d);k.setOptions(c.dragPolyOptions);h.event.addDomListener(e,"mouseover",j(b,g.prototype.show));h.event.addDomListener(e,"mouseout",j(e,function(i){if(!i)i=window.event;for(i=i[i.toElement?"toElement":"relatedTarget"];i;){if(i==this)return;i=i.parentNode}b.fa();b.aa()}));h.event.addListener(a,"bounds_changed",j(b,g.prototype.ba));h.event.addListener(a,"maptypeid_changed",j(b,
g.prototype.ba));h.event.addListener(d,"dblclick",j(b,g.prototype.ma));h.event.addListener(f,"mousedown",j(b,g.prototype.na));h.event.addListener(d,"dragstart",j(b,g.prototype.oa));b.ka=setInterval(j(b,function(){var i=this.X;if(this.map.getDiv()&&a.getDiv().firstChild){this.map.getDiv().firstChild.appendChild(i);this.ba();clearInterval(this.ka)}}),50);if(!b.options.keepOpen)b.R=setTimeout(j(b,g.prototype.aa),3E3)}function q(a,c,b,d,e){a=document.createElement(a||"div");if(c)a.className=c;if(b)for(var f=
0;f<b.length;f++){c=b[f];if(typeof c=="string"||typeof c=="number")a.innerHTML+=c;else try{a.appendChild(b[f])}catch(k){}}if(d)for(f in d)if(f.match(/^on/)&&typeof d[f]=="function")a[f]=d[f];else a.setAttribute(f,d[f]);if(e)for(f in e)a.style[f]=e[f];return a}function l(a,c,b,d){return q("div",a,c,b,d)}function j(a,c,b){return function(){return c.apply(a,b?b:arguments)}}function r(){for(var a={},c=arguments||[],b=0;b<c.length;b++){var d=c[b],e;for(e in d)if(typeof a[e]=="undefined")a[e]=d[e]}return a}
function m(a,c){if(a){if(a.currentStyle)return a.currentStyle[c];var b;try{b=document.defaultView.getComputedStyle(a,null).getPropertyValue(c.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}))}catch(d){b=a.style[c]}return b}}var h=google.maps,s={polyOptions:{strokeColor:"#7777cc",strokeOpacity:0.6,strokeWeight:3,fillColor:"#7777cc",fillOpacity:0.3,clickable:1},dragPolyOptions:{strokeColor:"#7777cc",strokeOpacity:0.3,strokeWeight:3,fillOpacity:0},maxHeight:110,maxWidth:110,buttonOpenText:"Click para abrir",
buttonKeepOpenText:"Click to keep open",buttonCloseText:"Click para cerrar"},o=/\b(jomc-button-)(open|locked|closed)\b/g,t=q("link",null,null,{rel:"stylesheet",href:"jOverviewMapControlV3.css",type:"text/css"});document.getElementsByTagName("head")[0].appendChild(t);g.prototype.show=function(){var a=this.options,c=this.X,b=this.da,d=this.map,e=Math.min(Math.round(d.getDiv().offsetHeight/2),a.maxHeight);d=Math.min(Math.round(d.getDiv().offsetWidth/2),a.maxWidth);var f=Math.round(e/25),k=Math.round(d/
25),i=parseInt(m(b,"height")),n=parseInt(m(b,"width")),p=this.button;this.R&&clearTimeout(this.R);c.className=c.className.replace(/\bjomc-closed\b/g,"jomc-open");if(i<e){i+=f;b.style.height=i+"px"}if(n<d){n+=k;b.style.width=n+"px"}if(i<e||n<d)this.R=setTimeout(j(this,g.prototype.show),10);else{b.style.height=e+"px";b.style.width=d+"px";this.ba();if(!a.keepOpen){p.setAttribute("title",a.buttonKeepOpenText);p.className=p.className.replace(o,"$1open")}}};g.prototype.aa=function(){var a=this.options,
c=this.X,b=this.da,d=this.map,e=Math.min(Math.round(d.getDiv().offsetHeight/2),a.maxHeight);d=Math.min(Math.round(d.getDiv().offsetWidth/2),a.maxWidth);e=Math.round(e/25);d=Math.round(d/25);var f=parseInt(m(b,"height")),k=parseInt(m(b,"width")),i=this.button;if(!a.keepOpen){this.R&&clearTimeout(this.R);if(this.Y){h.event.removeListener(this.Y);this.V.setMap(null)}if(f>0){f-=e;b.style.height=f+"px"}if(k>0){k-=d;b.style.width=k+"px"}if(f>0||k>0)this.R=setTimeout(j(this,g.prototype.aa),10);else{b.style.height=
b.style.width="0px";c.className=c.className.replace(/\bjomc-open\b/g,"jomc-closed");i.setAttribute("title",a.buttonOpenText);i.className=i.className.replace(o,"$1closed")}}};g.prototype.ba=function(){var a=this.map,c=this.W,b=this.ea,d=a.getBounds();a={center:a.getCenter(),mapTypeId:a.getMapTypeId(),disableDefaultUI:1,draggable:1};var e=this.da;h.event.trigger(c,"resize");e.style.right=e.style.bottom="0";c.setOptions(a);c.fitBounds(d||new h.LatLngBounds(new h.LatLng(-90,-180),new h.LatLng(90,180)));
b.setBounds(d)};g.prototype.na=function(a){var c=this.W,b=this.ea,d=this.V;c.setOptions({draggable:0});this.ca=a.latLng;d.setOptions({bounds:b.getBounds(),map:c});this.Y=h.event.addListener(c,"mousemove",j(this,g.prototype.ha));this.ja=h.event.addListener(d,"mouseup",j(this,g.prototype.fa))};g.prototype.oa=function(){var a=this.W,c=this.ea,b=this.V;this.ca=a.getCenter();b.setOptions({bounds:c.getBounds(),map:a});this.Y=h.event.addListener(a,"drag",j(this,g.prototype.ha));this.ja=h.event.addListener(a,
"dragend",j(this,g.prototype.fa))};g.prototype.ha=function(a){var c=this.W,b=this.V,d=c.getProjection();a=a?a.latLng:c.getCenter();c=d.fromLatLngToPoint(this.ca);var e=d.fromLatLngToPoint(a);c=new h.Point(e.x-c.x,e.y-c.y);var f=b.getBounds();e=d.fromLatLngToPoint(f.getSouthWest());f=d.fromLatLngToPoint(f.getNorthEast());e=d.fromPointToLatLng(new h.Point(e.x+c.x,e.y+c.y));d=d.fromPointToLatLng(new h.Point(f.x+c.x,f.y+c.y));d=new h.LatLngBounds(e,d);b.setBounds(d);this.ca=a};g.prototype.fa=function(){var a=
this.W,c=this.Y,b=this.ja,d=this.V;c&&h.event.removeListener(c);b&&h.event.removeListener(b);d.getMap()&&this.map.panTo(d.getBounds().getCenter());d.setMap(null);a.setOptions({draggable:1})};g.prototype.la=function(){return this.X.className.match(/\bjomc-open\b/)};g.prototype.pa=function(){var a=this.options,c=this.button;if(this.la())if(a.keepOpen){a.keepOpen=0;this.aa()}else{a.keepOpen=1;c.setAttribute("title",a.buttonCloseText);c.className=c.className.replace(o,"$1locked")}else this.show()};g.prototype.ma=
function(a){this.map.panTo(a.latLng)};window.jeremy||(window.jeremy={});window.jeremy.jOverviewMapControl=g;window.jeremy.jOverviewMapControl.prototype=g.prototype})();

