
(function(){var apis={};var invoke=function(sApiId,sObjName,sFnName,oScope,args){if(!hasImplementation(sApiId,sObjName,sFnName)){throw'Method '+sFnName+' of object '+sObjName+' is not supported by API '+sApiId+'. Are you missing a script tag?';}
return apis[sApiId][sObjName][sFnName].apply(oScope,args);};var hasImplementation=function(sApiId,sObjName,sFnName){if(typeof(apis[sApiId])=='undefined'){throw'API '+sApiId+' not loaded. Are you missing a script tag?';}
if(typeof(apis[sApiId][sObjName])=='undefined'){throw'Object definition '+sObjName+' in API '+sApiId+' not loaded. Are you missing a script tag?';}
return typeof(apis[sApiId][sObjName][sFnName])=='function';};var mxn=window.mxn={register:function(sApiId,oApiImpl){if(!apis.hasOwnProperty(sApiId)){apis[sApiId]={};}
mxn.util.merge(apis[sApiId],oApiImpl);},addProxyMethods:function(func,aryMethods,bWithApiArg){for(var i=0;i<aryMethods.length;i++){var sMethodName=aryMethods[i];if(bWithApiArg){func.prototype[sMethodName]=new Function('return this.invoker.go(\''+sMethodName+'\', arguments, { overrideApi: true } );');}
else{func.prototype[sMethodName]=new Function('return this.invoker.go(\''+sMethodName+'\', arguments);');}}},addEvents:function(oEvtSrc,aEvtNames){for(var i=0;i<aEvtNames.length;i++){var sEvtName=aEvtNames[i];if(sEvtName in oEvtSrc){throw'Event or method '+sEvtName+' already declared.';}
oEvtSrc[sEvtName]=new mxn.Event(sEvtName,oEvtSrc);}}};mxn.Event=function(sEvtName,oEvtSource){var handlers=[];if(!sEvtName){throw'Event name must be provided';}
this.addHandler=function(fn,ctx){handlers.push({context:ctx,handler:fn});};this.removeHandler=function(fn,ctx){for(var i=0;i<handlers.length;i++){if(handlers[i].handler==fn&&handlers[i].context==ctx){handlers.splice(i,1);}}};this.removeAllHandlers=function(){handlers=[];};this.fire=function(oEvtArgs){var args=[sEvtName,oEvtSource,oEvtArgs];for(var i=0;i<handlers.length;i++){handlers[i].handler.apply(handlers[i].context,args);}};};mxn.Invoker=function(aobj,asClassName,afnApiIdGetter){var obj=aobj;var sClassName=asClassName;var fnApiIdGetter=afnApiIdGetter;var defOpts={overrideApi:false,context:null,fallback:null};this.go=function(sMethodName,args,oOptions){if(typeof(oOptions)=='undefined'){oOptions=defOpts;}
var sApiId=oOptions.overrideApi?args[0]:fnApiIdGetter.apply(obj);if(typeof(sApiId)!='string'){throw'API ID not available.';}
if(typeof(oOptions.context)!='undefined'&&oOptions.context!==null){args=Array.prototype.slice.apply(args);args.push(oOptions.context);}
if(typeof(oOptions.fallback)=='function'&&!hasImplementation(sApiId,sClassName,sMethodName)){return oOptions.fallback.apply(obj,args);}
else{return invoke(sApiId,sClassName,sMethodName,obj,args);}};};mxn.util={merge:function(oRecv,oGive){for(var sPropName in oGive){if(oGive.hasOwnProperty(sPropName)){if(!oRecv.hasOwnProperty(sPropName)){oRecv[sPropName]=oGive[sPropName];}
else{mxn.util.merge(oRecv[sPropName],oGive[sPropName]);}}}},$m:function(){var elements=[];for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof(element)=='string'){element=document.getElementById(element);}
if(arguments.length==1){return element;}
elements.push(element);}
return elements;},loadScript:function(src,callback){var script=document.createElement('script');script.type='text/javascript';script.src=src;if(callback){if(script.addEventListener){script.addEventListener('load',callback,true);}
else if(script.attachEvent){var done=false;script.attachEvent("onreadystatechange",function(){if(!done&&document.readyState==="complete"){done=true;callback();}});}}
var h=document.getElementsByTagName('head')[0];h.appendChild(script);return;},convertLatLonXY_Yahoo:function(point,level){var size=1<<(26-level);var pixel_per_degree=size/360.0;var pixel_per_radian=size/(2*Math.PI);var origin=new YCoordPoint(size/2,size/2);var answer=new YCoordPoint();answer.x=Math.floor(origin.x+point.lon*pixel_per_degree);var sin=Math.sin(point.lat*Math.PI/180.0);answer.y=Math.floor(origin.y+0.5*Math.log((1+sin)/(1-sin))*-pixel_per_radian);return answer;},loadStyle:function(href){var link=document.createElement('link');link.type='text/css';link.rel='stylesheet';link.href=href;document.getElementsByTagName('head')[0].appendChild(link);return;},getStyle:function(el,prop){var y;if(el.currentStyle){y=el.currentStyle[prop];}
else if(window.getComputedStyle){y=window.getComputedStyle(el,'').getPropertyValue(prop);}
return y;},lonToMetres:function(lon,lat){return lon*(111200*Math.cos(lat*(Math.PI/180)));},metresToLon:function(m,lat){return m/(111200*Math.cos(lat*(Math.PI/180)));},KMToMiles:function(km){return km/1.609344;},milesToKM:function(miles){return miles*1.609344;},getDegreesFromGoogleZoomLevel:function(pixels,zoom){return(360*pixels)/(Math.pow(2,zoom+8));},getGoogleZoomLevelFromDegrees:function(pixels,degrees){return mxn.util.logN((360*pixels)/degrees,2)-8;},logN:function(number,base){return Math.log(number)/Math.log(base);},getAvailableProviders:function(){var providers=[];for(var propertyName in apis){if(apis.hasOwnProperty(propertyName)){providers.push(propertyName);}}
return providers;}};mxn.util.Color=function(){if(arguments.length==3){this.red=arguments[0];this.green=arguments[1];this.blue=arguments[2];}
else if(arguments.length==1){this.setHexColor(arguments[0]);}};mxn.util.Color.prototype.reHex=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;mxn.util.Color.prototype.setHexColor=function(strHexColor){var match=strHexColor.match(this.reHex);if(match){strHexColor=match[1];}
else{throw'Invalid HEX color format, expected #000, 000, #000000 or 000000';}
if(strHexColor.length==3){strHexColor=strHexColor.replace(/\w/g,function(str){return str.concat(str);});}
this.red=parseInt(strHexColor.substr(0,2),16);this.green=parseInt(strHexColor.substr(2,2),16);this.blue=parseInt(strHexColor.substr(4,2),16);};mxn.util.Color.prototype.getHexColor=function(){var vals=[this.red.toString(16),this.green.toString(16),this.blue.toString(16)];for(var i=0;i<vals.length;i++){vals[i]=(vals[i].length==1)?'0'+vals[i]:vals[i];vals[i]=vals[i].toUpperCase();}
return vals.join('');};})();(function(){var $m=mxn.util.$m;var init=function(){this.invoker.go('init',[this.currentElement,this.api]);this.applyOptions();};var Mapstraction=mxn.Mapstraction=function(element,api,debug){if(!api){api=mxn.util.getAvailableProviders()[0];}
this.api=api;this.maps={};this.currentElement=$m(element);this.eventListeners=[];this.markers=[];this.layers=[];this.polylines=[];this.images=[];this.controls=[];this.loaded={};this.onload={};this.element=element;this.options={enableScrollWheelZoom:false,enableDragging:true};this.addControlsArgs={};this.invoker=new mxn.Invoker(this,'Mapstraction',function(){return this.api;});mxn.addEvents(this,['load','click','endPan','changeZoom','markerAdded','markerRemoved','polylineAdded','polylineRemoved']);init.apply(this);};Mapstraction.ROAD=1;Mapstraction.SATELLITE=2;Mapstraction.HYBRID=3;mxn.addProxyMethods(Mapstraction,['addLargeControls','addMapTypeControls','addOverlay','addSmallControls','applyOptions','getBounds','getCenter','getMapType','getPixelRatio','getZoom','getZoomLevelForBoundingBox','mousePosition','resizeTo','setBounds','setCenter','setCenterAndZoom','setMapType','setZoom','toggleTileLayer']);Mapstraction.prototype.setOptions=function(oOpts){mxn.util.merge(this.options,oOpts);this.applyOptions();};Mapstraction.prototype.setOption=function(sOptName,vVal){this.options[sOptName]=vVal;this.applyOptions();};Mapstraction.prototype.enableScrollWheelZoom=function(){this.setOption('enableScrollWheelZoom',true);};Mapstraction.prototype.dragging=function(on){this.setOption('enableDragging',on);};Mapstraction.prototype.swap=function(element,api){if(this.api===api){return;}
var center=this.getCenter();var zoom=this.getZoom();this.currentElement.style.visibility='hidden';this.currentElement.style.display='none';this.currentElement=$m(element);this.currentElement.style.visibility='visible';this.currentElement.style.display='block';this.api=api;if(this.maps[this.api]===undefined){init.apply(this);this.setCenterAndZoom(center,zoom);for(var i=0;i<this.markers.length;i++){this.addMarker(this.markers[i],true);}
for(var j=0;j<this.polylines.length;j++){this.addPolyline(this.polylines[j],true);}}
else{this.setCenterAndZoom(center,zoom);}
this.addControls(this.addControlsArgs);};Mapstraction.prototype.isLoaded=function(api){if(api===null){api=this.api;}
return this.loaded[api];};Mapstraction.prototype.setDebug=function(debug){if(debug!==null){this.debug=debug;}
return this.debug;};Mapstraction.prototype.clickHandler=function(lat,lon,me){this.callEventListeners('click',{location:new LatLonPoint(lat,lon)});};Mapstraction.prototype.moveendHandler=function(me){this.callEventListeners('moveend',{});};Mapstraction.prototype.addEventListener=function(){var listener={};listener.event_type=arguments[0];listener.callback_function=arguments[1];if(arguments.length==3){listener.back_compat_mode=false;listener.callback_object=arguments[2];}
else{listener.back_compat_mode=true;listener.callback_object=null;}
this.eventListeners.push(listener);};Mapstraction.prototype.callEventListeners=function(sEventType,oEventArgs){oEventArgs.source=this;for(var i=0;i<this.eventListeners.length;i++){var evLi=this.eventListeners[i];if(evLi.event_type==sEventType){if(evLi.back_compat_mode){if(evLi.event_type=='click'){evLi.callback_function(oEventArgs.location);}
else{evLi.callback_function();}}
else{var scope=evLi.callback_object||this;evLi.callback_function.call(scope,oEventArgs);}}}};Mapstraction.prototype.addControls=function(args){this.addControlsArgs=args;this.invoker.go('addControls',arguments);};Mapstraction.prototype.addMarker=function(marker,old){marker.mapstraction=this;marker.api=this.api;marker.location.api=this.api;marker.map=this.maps[this.api];var propMarker=this.invoker.go('addMarker',arguments);marker.setChild(propMarker);if(!old){this.markers.push(marker);}
this.markerAdded.fire({'marker':marker});};Mapstraction.prototype.addMarkerWithData=function(marker,data){marker.addData(data);this.addMarker(marker);};Mapstraction.prototype.addPolylineWithData=function(polyline,data){polyline.addData(data);this.addPolyline(polyline);};Mapstraction.prototype.removeMarker=function(marker){var current_marker;for(var i=0;i<this.markers.length;i++){current_marker=this.markers[i];if(marker==current_marker){this.invoker.go('removeMarker',arguments);marker.onmap=false;this.markers.splice(i,1);this.markerRemoved.fire({'marker':marker});break;}}};Mapstraction.prototype.removeAllMarkers=function(){var current_marker;while(this.markers.length>0){current_marker=this.markers.pop();this.invoker.go('removeMarker',[current_marker]);}};Mapstraction.prototype.declutterMarkers=function(opts){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.declutterMarkers(opts);});return;}
var map=this.maps[this.api];switch(this.api)
{case'multimap':map.declutterGroup(opts.groupName);break;case'  dummy':break;default:if(this.debug){alert(this.api+' not supported by Mapstraction.declutterMarkers');}}};Mapstraction.prototype.addPolyline=function(polyline,old){polyline.api=this.api;polyline.map=this.maps[this.api];var propPoly=this.invoker.go('addPolyline',arguments);polyline.setChild(propPoly);if(!old){this.polylines.push(polyline);}
this.polylineAdded.fire({'polyline':polyline});};var removePolylineImpl=function(polyline){this.invoker.go('removePolyline',arguments);polyline.onmap=false;this.polylineRemoved.fire({'polyline':polyline});};Mapstraction.prototype.removePolyline=function(polyline){var current_polyline;for(var i=0;i<this.polylines.length;i++){current_polyline=this.polylines[i];if(polyline==current_polyline){this.polylines.splice(i,1);removePolylineImpl.call(this,polyline);break;}}};Mapstraction.prototype.removeAllPolylines=function(){var current_polyline;while(this.polylines.length>0){current_polyline=this.polylines.pop();removePolylineImpl.call(this,current_polyline);}};Mapstraction.prototype.autoCenterAndZoom=function(){var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;var lat,lon;var checkMinMax=function(){if(lat>lat_max){lat_max=lat;}
if(lat<lat_min){lat_min=lat;}
if(lon>lon_max){lon_max=lon;}
if(lon<lon_min){lon_min=lon;}};for(var i=0;i<this.markers.length;i++){lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;checkMinMax();}
for(i=0;i<this.polylines.length;i++){for(var j=0;j<this.polylines[i].points.length;j++){lat=this.polylines[i].points[j].lat;lon=this.polylines[i].points[j].lon;checkMinMax();}}
this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max));};Mapstraction.prototype.centerAndZoomOnPoints=function(points){var bounds=new BoundingBox(points[0].lat,points[0].lon,points[0].lat,points[0].lon);for(var i=1,len=points.length;i<len;i++){bounds.extend(points[i]);}
this.setBounds(bounds);};Mapstraction.prototype.visibleCenterAndZoom=function(){var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;var lat,lon;var checkMinMax=function(){if(lat>lat_max){lat_max=lat;}
if(lat<lat_min){lat_min=lat;}
if(lon>lon_max){lon_max=lon;}
if(lon<lon_min){lon_min=lon;}};for(var i=0;i<this.markers.length;i++){if(this.markers[i].getAttribute("visible")){lat=this.markers[i].location.lat;lon=this.markers[i].location.lon;checkMinMax();}}
for(i=0;i<this.polylines.length;i++){if(this.polylines[i].getAttribute("visible")){for(j=0;j<this.polylines[i].points.length;j++){lat=this.polylines[i].points[j].lat;lon=this.polylines[i].points[j].lon;checkMinMax();}}}
this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max));};Mapstraction.prototype.polylineCenterAndZoom=function(radius){var lat_max=-90;var lat_min=90;var lon_max=-180;var lon_min=180;for(var i=0;i<mapstraction.polylines.length;i++)
{for(var j=0;j<mapstraction.polylines[i].points.length;j++)
{lat=mapstraction.polylines[i].points[j].lat;lon=mapstraction.polylines[i].points[j].lon;latConv=lonConv=radius;if(radius>0)
{latConv=(radius/mapstraction.polylines[i].points[j].latConv());lonConv=(radius/mapstraction.polylines[i].points[j].lonConv());}
if((lat+latConv)>lat_max){lat_max=(lat+latConv);}
if((lat-latConv)<lat_min){lat_min=(lat-latConv);}
if((lon+lonConv)>lon_max){lon_max=(lon+lonConv);}
if((lon-lonConv)<lon_min){lon_min=(lon-lonConv);}}}
this.setBounds(new BoundingBox(lat_min,lon_min,lat_max,lon_max));};Mapstraction.prototype.addImageOverlay=function(id,src,opacity,west,south,east,north){var b=document.createElement("img");b.style.display='block';b.setAttribute('id',id);b.setAttribute('src',src);b.style.position='absolute';b.style.zIndex=1;b.setAttribute('west',west);b.setAttribute('south',south);b.setAttribute('east',east);b.setAttribute('north',north);var oContext={imgElm:b};this.invoker.go('addImageOverlay',arguments,{context:oContext});};Mapstraction.prototype.setImageOpacity=function(id,opacity){if(opacity<0){opacity=0;}
if(opacity>=100){opacity=100;}
var c=opacity/100;var d=document.getElementById(id);if(typeof(d.style.filter)=='string'){d.style.filter='alpha(opacity:'+opacity+')';}
if(typeof(d.style.KHTMLOpacity)=='string'){d.style.KHTMLOpacity=c;}
if(typeof(d.style.MozOpacity)=='string'){d.style.MozOpacity=c;}
if(typeof(d.style.opacity)=='string'){d.style.opacity=c;}};Mapstraction.prototype.setImagePosition=function(id){var imgElement=document.getElementById(id);var oContext={latLng:{top:imgElement.getAttribute('north'),left:imgElement.getAttribute('west'),bottom:imgElement.getAttribute('south'),right:imgElement.getAttribute('east')},pixels:{top:0,right:0,bottom:0,left:0}};this.invoker.go('setImagePosition',arguments,{context:oContext});imgElement.style.top=oContext.pixels.top.toString()+'px';imgElement.style.left=oContext.pixels.left.toString()+'px';imgElement.style.width=(oContext.pixels.right-oContext.pixels.left).toString()+'px';imgElement.style.height=(oContext.pixels.bottom-oContext.pixels.top).toString()+'px';};Mapstraction.prototype.addJSON=function(json){var features;if(typeof(json)=="string"){features=eval('('+json+')');}else{features=json;}
features=features.features;var map=this.maps[this.api];var html="";var item;var polyline;var marker;var markers=[];if(features.type=="FeatureCollection"){this.addJSON(features.features);}
for(var i=0;i<features.length;i++){item=features[i];switch(item.geometry.type){case"Point":html="<strong>"+item.title+"</strong><p>"+item.description+"</p>";marker=new Marker(new LatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));markers.push(marker);this.addMarkerWithData(marker,{infoBubble:html,label:item.title,date:"new Date(\""+item.date+"\")",iconShadow:item.icon_shadow,marker:item.id,iconShadowSize:item.icon_shadow_size,icon:"http://boston.openguides.org/markers/AQUA.png",iconSize:item.icon_size,category:item.source_id,draggable:false,hover:false});break;case"Polygon":var points=[];polyline=new Polyline(points);mapstraction.addPolylineWithData(polyline,{fillColor:item.poly_color,date:"new Date(\""+item.date+"\")",category:item.source_id,width:item.line_width,opacity:item.line_opacity,color:item.line_color,polygon:true});markers.push(polyline);break;default:}}
return markers;};Mapstraction.prototype.addTileLayer=function(tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type){if(!tile_url){return;}
this.tileLayers=this.tileLayers||[];opacity=opacity||0.6;copyright_text=copyright_text||"Mapstraction";min_zoom=min_zoom||1;max_zoom=max_zoom||18;map_type=map_type||false;return this.invoker.go('addTileLayer',[tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type]);};Mapstraction.prototype.addFilter=function(field,operator,value){if(!this.filters){this.filters=[];}
this.filters.push([field,operator,value]);};Mapstraction.prototype.removeFilter=function(field,operator,value){if(!this.filters){return;}
var del;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&(!operator||(this.filters[f][1]==operator&&this.filters[f][2]==value))){this.filters.splice(f,1);f--;}}};Mapstraction.prototype.toggleFilter=function(field,operator,value){if(!this.filters){this.filters=[];}
var found=false;for(var f=0;f<this.filters.length;f++){if(this.filters[f][0]==field&&this.filters[f][1]==operator&&this.filters[f][2]==value){this.filters.splice(f,1);f--;found=true;}}
if(!found){this.addFilter(field,operator,value);}};Mapstraction.prototype.removeAllFilters=function(){this.filters=[];};Mapstraction.prototype.doFilter=function(showCallback,hideCallback){var map=this.maps[this.api];var visibleCount=0;var f;if(this.filters){switch(this.api){case'multimap':var mmfilters=[];for(f=0;f<this.filters.length;f++){mmfilters.push(new MMSearchFilter(this.filters[f][0],this.filters[f][1],this.filters[f][2]));}
map.setMarkerFilters(mmfilters);map.redrawMap();break;case'  dummy':break;default:var vis;for(var m=0;m<this.markers.length;m++){vis=true;for(f=0;f<this.filters.length;f++){if(!this.applyFilter(this.markers[m],this.filters[f])){vis=false;}}
if(vis){visibleCount++;if(showCallback){showCallback(this.markers[m]);}
else{this.markers[m].show();}}
else{if(hideCallback){hideCallback(this.markers[m]);}
else{this.markers[m].hide();}}
this.markers[m].setAttribute("visible",vis);}
break;}}
return visibleCount;};Mapstraction.prototype.applyFilter=function(o,f){var vis=true;switch(f[1]){case'ge':if(o.getAttribute(f[0])<f[2]){vis=false;}
break;case'le':if(o.getAttribute(f[0])>f[2]){vis=false;}
break;case'eq':if(o.getAttribute(f[0])==f[2]){vis=false;}
break;}
return vis;};Mapstraction.prototype.getAttributeExtremes=function(field){var min;var max;for(var m=0;m<this.markers.length;m++){if(!min||min>this.markers[m].getAttribute(field)){min=this.markers[m].getAttribute(field);}
if(!max||max<this.markers[m].getAttribute(field)){max=this.markers[m].getAttribute(field);}}
for(var p=0;m<this.polylines.length;m++){if(!min||min>this.polylines[p].getAttribute(field)){min=this.polylines[p].getAttribute(field);}
if(!max||max<this.polylines[p].getAttribute(field)){max=this.polylines[p].getAttribute(field);}}
return[min,max];};Mapstraction.prototype.getMap=function(){return this.maps[this.api];};var LatLonPoint=mxn.LatLonPoint=function(lat,lon){this.lat=lat;this.lon=lon;this.lng=lon;this.invoker=new mxn.Invoker(this,'LatLonPoint');};mxn.addProxyMethods(LatLonPoint,['fromProprietary','toProprietary'],true);LatLonPoint.prototype.toString=function(){return this.lat+', '+this.lon;};LatLonPoint.prototype.distance=function(otherPoint){var rads=Math.PI/180;var diffLat=(this.lat-otherPoint.lat)*rads;var diffLon=(this.lon-otherPoint.lon)*rads;var a=Math.sin(diffLat/2)*Math.sin(diffLat/2)+
Math.cos(this.lat*rads)*Math.cos(otherPoint.lat*rads)*Math.sin(diffLon/2)*Math.sin(diffLon/2);return 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371;};LatLonPoint.prototype.equals=function(otherPoint){return this.lat==otherPoint.lat&&this.lon==otherPoint.lon;};LatLonPoint.prototype.latConv=function(){return this.distance(new LatLonPoint(this.lat+0.1,this.lon))*10;};LatLonPoint.prototype.lonConv=function(){return this.distance(new LatLonPoint(this.lat,this.lon+0.1))*10;};var BoundingBox=mxn.BoundingBox=function(swlat,swlon,nelat,nelon){this.sw=new LatLonPoint(swlat,swlon);this.ne=new LatLonPoint(nelat,nelon);};BoundingBox.prototype.getSouthWest=function(){return this.sw;};BoundingBox.prototype.getNorthEast=function(){return this.ne;};BoundingBox.prototype.isEmpty=function(){return this.ne==this.sw;};BoundingBox.prototype.contains=function(point){return point.lat>=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon;};BoundingBox.prototype.toSpan=function(){return new LatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon));};BoundingBox.prototype.extend=function(point){if(this.sw.lat>point.lat){this.sw.lat=point.lat;}
if(this.sw.lon>point.lon){this.sw.lon=point.lon;}
if(this.ne.lat<point.lat){this.ne.lat=point.lat;}
if(this.ne.lon<point.lon){this.ne.lon=point.lon;}
return;};var Marker=mxn.Marker=function(point){this.api=null;this.location=point;this.onmap=false;this.proprietary_marker=false;this.attributes=[];this.invoker=new mxn.Invoker(this,'Marker',function(){return this.api;});mxn.addEvents(this,['openInfoBubble','closeInfoBubble','click']);};mxn.addProxyMethods(Marker,['fromProprietary','hide','openBubble','show','toProprietary','update']);Marker.prototype.setChild=function(some_proprietary_marker){this.proprietary_marker=some_proprietary_marker;some_proprietary_marker.mapstraction_marker=this;this.onmap=true;};Marker.prototype.setLabel=function(labelText){this.labelText=labelText;};Marker.prototype.addData=function(options){for(var sOptKey in options){if(options.hasOwnProperty(sOptKey)){switch(sOptKey){case'label':this.setLabel(options.label);break;case'infoBubble':this.setInfoBubble(options.infoBubble);break;case'icon':if(options.iconSize&&options.iconAnchor){this.setIcon(options.icon,options.iconSize,options.iconAnchor);}
else if(options.iconSize){this.setIcon(options.icon,options.iconSize);}
else{this.setIcon(options.icon);}
break;case'iconShadow':if(options.iconShadowSize){this.setShadowIcon(options.iconShadow,[options.iconShadowSize[0],options.iconShadowSize[1]]);}
else{this.setIcon(options.iconShadow);}
break;case'infoDiv':this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);break;case'draggable':this.setDraggable(options.draggable);break;case'hover':this.setHover(options.hover);this.setHoverIcon(options.hoverIcon);break;case'hoverIcon':this.setHoverIcon(options.hoverIcon);break;case'openBubble':this.openBubble();break;case'groupName':this.setGroupName(options.groupName);break;default:this.setAttribute(sOptKey,options[sOptKey]);break;}}}};Marker.prototype.setInfoBubble=function(infoBubble){this.infoBubble=infoBubble;};Marker.prototype.setInfoDiv=function(infoDiv,div){this.infoDiv=infoDiv;this.div=div;};Marker.prototype.setIcon=function(iconUrl,iconSize,iconAnchor){this.iconUrl=iconUrl;if(iconSize){this.iconSize=iconSize;}
if(iconAnchor){this.iconAnchor=iconAnchor;}};Marker.prototype.setIconSize=function(iconSize){if(iconSize){this.iconSize=iconSize;}};Marker.prototype.setIconAnchor=function(iconAnchor){if(iconAnchor){this.iconAnchor=iconAnchor;}};Marker.prototype.setShadowIcon=function(iconShadowUrl,iconShadowSize){this.iconShadowUrl=iconShadowUrl;if(iconShadowSize){this.iconShadowSize=iconShadowSize;}};Marker.prototype.setHoverIcon=function(hoverIconUrl){this.hoverIconUrl=hoverIconUrl;};Marker.prototype.setDraggable=function(draggable){this.draggable=draggable;};Marker.prototype.setHover=function(hover){this.hover=hover;};Marker.prototype.setGroupName=function(sGrpName){this.groupName=sGrpName;};Marker.prototype.setAttribute=function(key,value){this.attributes[key]=value;};Marker.prototype.getAttribute=function(key){return this.attributes[key];};var Polyline=mxn.Polyline=function(points){this.api=null;this.points=points;this.attributes=[];this.onmap=false;this.proprietary_polyline=false;this.pllID="mspll-"+new Date().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));this.invoker=new mxn.Invoker(this,'Polyline',function(){return this.api;});};mxn.addProxyMethods(Polyline,['fromProprietary','hide','show','toProprietary','update']);Polyline.prototype.addData=function(options){for(var sOpt in options){if(options.hasOwnProperty(sOpt)){switch(sOpt){case'color':this.setColor(options.color);break;case'width':this.setWidth(options.width);break;case'opacity':this.setOpacity(options.opacity);break;case'closed':this.setClosed(options.closed);break;case'fillColor':this.setFillColor(options.fillColor);break;default:this.setAttribute(sOpt,options[sOpt]);break;}}}};Polyline.prototype.setChild=function(some_proprietary_polyline){this.proprietary_polyline=some_proprietary_polyline;some_proprietary_polyline.mapstraction_polyline=this;this.onmap=true;};mxn.Polyline.prototype.setColor=function(color){if(color!==null){this.color=(color.length==7&&color[0]=="#")?color.toUpperCase():color;}else{this.color=null;}};Polyline.prototype.setWidth=function(width){this.width=width;};Polyline.prototype.setOpacity=function(opacity){this.opacity=opacity;};Polyline.prototype.setClosed=function(bClosed){this.closed=bClosed;};Polyline.prototype.setFillColor=function(sFillColor){this.fillColor=sFillColor;};Polyline.prototype.setAttribute=function(key,value){this.attributes[key]=value;};Polyline.prototype.getAttribute=function(key){return this.attributes[key];};Polyline.prototype.simplify=function(tolerance){var reduced=[];reduced[0]=this.points[0];var markerPoint=0;for(var i=1;i<this.points.length-1;i++){if(this.points[i].distance(this.points[markerPoint])>=tolerance)
{reduced[reduced.length]=this.points[i];markerPoint=i;}}
reduced[reduced.length]=this.points[this.points.length-1];this.points=reduced;};var Radius=mxn.Radius=function(center,quality){this.center=center;var latConv=center.latConv();var lonConv=center.lonConv();var rad=Math.PI/180;this.calcs=new Array();for(var i=0;i<360;i+=quality)
this.calcs.push([Math.cos(i*rad)/latConv,Math.sin(i*rad)/lonConv]);}
Radius.prototype.getPolyline=function(radius,colour){var points=Array();for(var i=0;i<this.calcs.length;i++){var point=new LatLonPoint(this.center.lat+(radius*this.calcs[i][0]),this.center.lon+(radius*this.calcs[i][1]));points.push(point);}
points.push(points[0]);var line=new Polyline(points);line.setColor(colour);return line;};})();(function(){var $m=mxn.util.$m;var init=function(){this.invoker.go('init',[this.callback,this.api,this.error_callback]);};var MapstractionGeocoder=mxn.MapstractionGeocoder=function(callback,api,error_callback){this.api=api;this.callback=callback;this.geocoders=new Object();if(error_callback==null){this.error_callback=this.geocode_error}else{this.error_callback=error_callback;}
this.invoker=new mxn.Invoker(this,'MapstractionGeocoder',function(){return this.api;});init.apply(this);}
mxn.addProxyMethods(MapstractionGeocoder,['geocode','geocode_callback',])
MapstractionGeocoder.prototype.geocode=function(address){this.invoker.go('geocode',arguments);}
MapstractionGeocoder.prototype.geocode_callback=function(response,mapstraction_geocoder){this.invoker.go('geocode_callback',arguments);}
MapstractionGeocoder.prototype.swap=function(api){if(this.api==api){return;}
this.api=api;if(this.geocoders[this.api]==undefined){this.addAPI($(element),api);}}
MapstractionGeocoder.prototype.geocode_error=function(response){alert("Sorry, we were unable to geocode that address");}})();(function(){function extend(subclass,superclass){function Dummy(){}
Dummy.prototype=superclass.prototype;subclass.prototype=new Dummy();subclass.prototype.constructor=subclass;subclass.superclass=superclass;subclass.superproto=superclass.prototype;}
mxn.MapstractionInteractive=function(element,api,debug){mxn.MapstractionInteractive.superclass.call(this,element,api,debug);mxn.addEvents(this,['markerChanged','polylineChanged','markerSelected','polylineSelected','markerUnselected','polylineUnselected']);var scripts=document.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){var match=scripts[i].src.replace(/%20/g,'').match(/^(.*?)(mxn|idelabmapstraction)\.js/);if(match!==null){this.src=match[1];break;}}
this.POINT="point";this.LINESTRING="linestring";this.POLYGON="polygon";this.ALLOWED_FEATURES=[this.POINT,this.LINESTRING,this.POLYGON];};var Interactive=mxn.MapstractionInteractive;extend(mxn.MapstractionInteractive,mxn.Mapstraction);mxn.addProxyMethods(mxn.MapstractionInteractive,['activateEdition','activateDelete','activateMarker','addFeature','deactivateEdition','iconURL','activatePolyline']);mxn.MapstractionInteractive.prototype.addWKTArray=function(features){var polygon;var wkt;for(var i=0;i<features.length;i++){polygon=false;switch(trim(features[i].substr(0,features[i].indexOf("("))).toLowerCase()){case"point":wkt=features[i].substr((features[i].indexOf("("))+1,(features[i].length-2-features[i].indexOf("("))).split(" ");var point=[];point.lat=parseFloat(wkt[1]);pointlon=parseFloat(wkt[0]);if(typeof(point.lat)=="undefined"||typeof(point.lat)=="undefined"){continue;}
else{this.addMarker(new Marker(new LatLonPoint(point.lat,point.lon)));}
break;case"polygon":polygon=true;case"linestring":var points=[];wkt=features[i].substr((features[i].indexOf("("))+2,(features[i].length-2-features[i].indexOf("("))).split(",");for(var j=0;j<wkt.length;i++){var aux=trim(wkt[j]).split(" ");var point=[];point.lat=parseFloat(aux[1]);point.lon=parseFloat(aux[0]);if(typeof(point.lat)=="undefined"||typeof(point.lat)=="undefined"){continue;}
else{points.push(new LatLonPoint(point.lat,point.lon));}}
var poly=new Polyline(features[i]);if(polygon){poly.setClosed(true);}
else{poly.setClosed(false);}
this.addPolyline(poly);break;default:return null;}}};mxn.MapstractionInteractive.prototype.addJSON=function(json){var features;if(typeof(json)=="string"){features=eval('('+json+')');}else{features=json;}
features=features.features;var map=this.maps[this.api];var polyline;var marker;var markers=[];var polygon=null;if(features.type=="FeatureCollection"){this.addJSON(features.features);}
for(var i=0;i<features.length;i++){item=features[i];polygon=false;switch(item.geometry.type){case"Point":marker=new mxn.Marker(new mxn.LatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));markers.push(marker);this.addMarkerWithData(marker,item.properties);break;case"Polygon":polygon=true;var points=item.geometry.coordinates[0];case"LineString":if(item.geometry.type=="LineString"){points=item.geometry.coordinates;}
var latlon=[];for(var j=0;j<points.length;j++){latlon.push(new mxn.LatLonPoint(points[j][1],points[j][0]));}
polyline=new mxn.Polyline(latlon);if(polygon){polyline.setClosed(true);}
mapstraction.addPolylineWithData(polyline,item.properties);markers.push(polyline);break;default:}}
return markers;};mxn.MapstractionInteractive.prototype.getJSON=function(){var json={};var aux,aux2,aux3;json.type="FeatureCollection";json.features=[];var marker_attributes=["label","infoBubble","icon","iconShadow","infoDiv","draggable","hover","hoverIcon","openBubble","groupName"];for(var i=0;i<this.markers.length;i++){aux={};aux.type="Feature";aux2={};aux2.type="Point";aux2.coordinates=[this.markers[i].location.lon,this.markers[i].location.lat];aux.geometry=aux2;aux.properties=this.markers[i].attributes;json.features.push(aux);}
for(i=0;i<this.polylines.length;i++){aux={};aux.type="Feature";aux2={};aux2.type=this.polylines[i].closed?"Polygon":"LineString";aux2.coordinates=[];aux3=[];for(var j=0;j<this.polylines[i].points.length;j++){aux3.push([this.polylines[i].points[j].lon,this.polylines[i].points[j].lat]);}
if(this.polylines[i].closed){aux2.coordinates[0]={};aux2.coordinates[0]=aux3;}else{aux2.coordinates=aux3;}
aux.geometry=aux2;aux.properties=this.polylines[i].attributes;json.features.push(aux);}
return json;};mxn.MapstractionInteractive.prototype.addFeature=function(feature,data){var allowed=false;for(var i in this.ALLOWED_FEATURES){if(this.ALLOWED_FEATURES[i]===feature){allowed=true;break;}}
if(!allowed){alert('This Feature is not Allowed');return;}
if(this.addingFeature){return alert("You can't add 2 features at same time!!!");}
this.addingFeature=true;this.invoker.go('addFeature',arguments);};mxn.MapstractionInteractive.prototype.activateEdition=function(){if(this.editionActive===true){return;}
this.editionActive=true;this.invoker.go('activateEdition',arguments);};mxn.MapstractionInteractive.prototype.deactivateEdition=function(){if(this.editionActive===false){return;}
this.editionActive=false;this.invoker.go('deactivateEdition',arguments);};mxn.MapstractionInteractive.prototype.addMarker=function(marker,old,update){marker.mapstraction=this;marker.api=this.api;marker.location.api=this.api;marker.map=this.maps[this.api];var propMarker=this.invoker.go('addMarker',arguments);marker.setChild(propMarker);if(!old){this.markers.push(marker);}
if(!update){this.markerAdded.fire({'marker':marker});}};mxn.MapstractionInteractive.prototype.removeMarker=function(marker,update){var current_marker;for(var i=0;i<this.markers.length;i++){current_marker=this.markers[i];if(marker==current_marker){this.invoker.go('removeMarker',arguments);marker.onmap=false;this.markers.splice(i,1);if(!update){this.markerRemoved.fire({'marker':marker});}
break;}}};mxn.Marker.prototype.updateProprietary=function(){this.mapstraction.removeMarker(this,true);this.mapstraction.addMarker(this,false,true);};mxn.MapstractionInteractive.prototype.addPolyline=function(polyline,old,update){polyline.mapstraction=this;polyline.api=this.api;polyline.map=this.maps[this.api];var propPoly=this.invoker.go('addPolyline',arguments);polyline.setChild(propPoly);if(!old){this.polylines.push(polyline);}
if(!update){this.polylineAdded.fire({'polyline':polyline});}};mxn.MapstractionInteractive.prototype.removePolyline=function(polyline,update){var current_polyline;for(var i=0;i<this.polylines.length;i++){current_polyline=this.polylines[i];if(polyline==current_polyline){this.polylines.splice(i,1);this.invoker.go('removePolyline',arguments);polyline.onmap=false;if(!update){this.polylineRemoved.fire({'polyline':polyline});}
break;}}};mxn.Polyline.prototype.updateProprietary=function(){this.mapstraction.removePolyline(this,true);this.mapstraction.addPolyline(this,false,true);};})();mxn.LatLonPoint.prototype.toOpenLayers=function(){var ollon=this.lon*20037508.34/180;var ollat=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);ollat=ollat*20037508.34/180;return new OpenLayers.LonLat(ollon,ollat);};mxn.Marker.prototype.toOpenLayers=function(){var size,anchor,icon,selected;if(this.iconSize){size=[this.iconSize[0].intValue(),this.iconSize[1].intValue()];}
else{size=[21,25];}
if(this.iconAnchor){anchor=[this.iconAnchor[0],this.iconAnchor[1]];}
else{anchor=[-(size[0]/2),-size[1]];}
if(this.iconUrl){icon=this.iconUrl;}
else{icon="http://openlayers.org/dev/img/marker-gold.png";}
var marker=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(this.location.toOpenLayers().lon,this.location.toOpenLayers().lat));marker.style={externalGraphic:icon,graphicHeight:size[1],graphicWidth:size[0],graphicXOffset:anchor[0],graphicYOffset:anchor[1]};if(this.infoBubble){var popup=new OpenLayers.Popup.Framed(null,this.location.toOpenLayers(),new OpenLayers.Size(100,100),this.infoBubble,true);popup=new OpenLayers.Popup.FramedCloud(null,this.location.toOpenLayers(),null,this.infoBubble,null,false);popup.autoSize=true;var theMap=this.map;theMap.addPopup(popup);popup.hide();marker.popup=popup;marker.hover=this.hover;}
if(this.hoverIconUrl){}
if(this.infoDiv){}
return marker;};mxn.Polyline.prototype.toOpenLayers=function(){var olpolyline;var olpoints=[];var ring;var style={strokeColor:this.color||"#000000",strokeOpacity:this.opacity||1,strokeWidth:this.width||3,fillColor:this.fillColor||"#000000",fillOpacity:this.getAttribute('fillOpacity')||0.2};for(var i=0,length=this.points.length;i<length;i++){olpoint=this.points[i].toOpenLayers();olpoints.push(new OpenLayers.Geometry.Point(olpoint.lon,olpoint.lat));}
if(this.closed){ring=new OpenLayers.Geometry.LinearRing(olpoints);ring=new OpenLayers.Geometry.Polygon(ring);}else{ring=new OpenLayers.Geometry.LineString(olpoints);}
olpolyline=new OpenLayers.Feature.Vector(ring,null,style);return olpolyline;};var GenericInteractivity=function(){this.Mapstraction={activateEdition:function(){var map=this.maps[this.api];var me=this;this.selectedMarker=null;if(typeof(this.handler)==="undefined"){this.handler=[];this.handler.activate=function(event,map,point){if(map.selectedMarker===null){return;}
map.selectedMarker.location=point.location;if(map.selectedMarker.attributes.polyline){map.selectedMarker.attributes.polyline.points.splice(map.selectedMarker.attributes.point,map.selectedMarker.attributes.splice,point.location);map.selectedMarker.attributes.polyline.updateProprietary();map.invoker.go('activatePolyline',[map.selectedMarker.attributes.polyline]);map.polylineChanged.fire({'polyline':map.selectedMarker.attributes.polyline});map.polylineUnselected.fire({'polyline':map.selectedMarker.attributes.polyline});}else{map.selectedMarker.setIcon(map.selectedMarker.oldIcon);map.selectedMarker.updateProprietary();map.markerChanged.fire({'marker':map.selectedMarker});map.markerUnselected.fire({'marker':map.selectedMarker});}
map.selectedMarker=null;};}
me.click.addHandler(this.handler.activate);for(var i in this.markers){this.invoker.go('activateMarker',[this.markers[i]]);}
for(i in this.polylines){this.invoker.go('activatePolyline',[this.polylines[i]]);}
document.onkeydown=function(e){vKeyCode=e.keyCode;if((vKeyCode==63272)||vKeyCode==46){if(me.selectedMarker!==null){if(me.selectedMarker.attributes.polyline){for(var i in me.selectedMarker.attributes.polyline.markers){me.removeMarker(me.selectedMarker.attributes.polyline.markers[i]);}
me.removePolyline(me.selectedMarker.attributes.polyline);}else{me.removeMarker(me.selectedMarker);}
me.selectedMarker=null;}}
if(vKeyCode==27&&me.selectedMarker!==null){if(me.selectedMarker.attributes.polyline){me.selectedMarker.setIcon(me.selectedMarker.oldIcon);me.polylineUnselected.fire({'polyline':me.selectedMarker.attributes.polyline});}else{me.selectedMarker.setIcon(me.selectedMarker.oldIcon);me.markerUnselected.fire({'marker':me.selectedMarker});}
me.selectedMarker.updateProprietary();me.selectedMarker=null;}};},activatePolyline:function(polyline){var me=this;var lat,lon;for(var i in polyline.markers){me.removeMarker(polyline.markers[i]);}
polyline.markers=[];for(var j in polyline.points){var mark=new mxn.Marker(new mxn.LatLonPoint(polyline.points[j].lat,polyline.points[j].lon));mark.attributes.polyline=polyline;mark.attributes.point=j;mark.attributes.splice=1;mark.setIcon(this.iconURL("edit-vertex"));mark.click.addHandler(function(event,marker){if(me.selectedMarker!==null){if(me.selectedMarker.attributes.polyline){me.selectedMarker.setIcon(me.iconURL("edit-vertex"));}else{me.selectedMarker.setIcon(null);}
me.selectedMarker.updateProprietary();me.selectedMarker=null;}
marker.oldIcon=marker.iconUrl;marker.setIcon(me.iconURL("select"));marker.updateProprietary();me.selectedMarker=marker;});me.addMarker(mark,false,true);polyline.markers.push(mark);if(j>0){lat=(polyline.points[j].lat+polyline.points[j-1].lat)/2;lon=(polyline.points[j].lon+polyline.points[j-1].lon)/2;middleMark=new mxn.Marker(new mxn.LatLonPoint(lat,lon));middleMark.attributes.polyline=polyline;middleMark.attributes.point=j;middleMark.attributes.splice=0;middleMark.setIcon(this.iconURL("add-vertex"));middleMark.click.addHandler(function(event,marker){if(me.selectedMarker!==null){if(me.selectedMarker.attributes.polyline){me.selectedMarker.setIcon(me.iconURL("edit-vertex"));me.polylineUnselected.fire({'polyline':me.selectedMarker.attributes.polyline});}else{me.selectedMarker.setIcon(null);me.markerUnselected.fire({'marker':me.selectedMarker});}
me.selectedMarker.updateProprietary();me.selectedMarker=null;}
marker.oldIcon=marker.iconUrl;marker.setIcon(me.iconURL("select"));marker.updateProprietary();me.selectedMarker=marker;me.polylineSelected.fire({'polyline':me.selectedMarker.attributes.polyline});});me.addMarker(middleMark,false,true);polyline.markers.push(middleMark);}
if(j==polyline.points.length-1&&polyline.closed===true){lat=(polyline.points[j].lat+polyline.points[0].lat)/2;lon=(polyline.points[j].lon+polyline.points[0].lon)/2;middleMark=new mxn.Marker(new mxn.LatLonPoint(lat,lon));middleMark.attributes.polyline=polyline;middleMark.attributes.point=j+1;middleMark.attributes.splice=0;middleMark.setIcon(this.iconURL("add-vertex"));middleMark.click.addHandler(function(event,marker){if(me.selectedMarker!==null){if(me.selectedMarker.attributes.polyline){me.selectedMarker.setIcon(me.iconURL("edit-vertex"));me.polylineUnselected.fire({'polyline':me.selectedMarker.attributes.polyline});}else{me.selectedMarker.setIcon(me.selectedMarker.oldIcon);me.markerUnselected.fire({'marker':me.selectedMarker});}
me.selectedMarker.updateProprietary();me.selectedMarker=null;}
marker.oldIcon=marker.iconUrl;marker.setIcon(me.iconURL("select"));marker.updateProprietary();me.selectedMarker=marker;me.polylineSelected.fire({'polyline':me.selectedMarker.attributes.polyline});});me.addMarker(middleMark,false,true);polyline.markers.push(middleMark);}}},activateMarker:function(activeMarker){if(typeof(activeMarker.handler)==="undefined"){activeMarker.handler=[];activeMarker.handler.activate=function(event,marker){var map=marker.mapstraction;if(map.selectedMarker!==null){if(map.selectedMarker.attributes.polyline){map.selectedMarker.setIcon(map.iconURL("edit-vertex"));map.polylineUnselected.fire({'polyline':map.selectedMarker.attributes.polyline});}else{map.selectedMarker.setIcon(map.selectedMarker.oldIcon);map.markerUnselected.fire({'marker':map.selectedMarker});}
map.selectedMarker.updateProprietary();map.selectedMarker=null;}
marker.oldIcon=marker.iconUrl;marker.setIcon(map.iconURL("select"));marker.updateProprietary();map.selectedMarker=marker;map.markerSelected.fire({'marker':map.selectedMarker});};}
activeMarker.click.addHandler(activeMarker.handler.activate);},deactivateEdition:function(){this.click.removeHandler(this.handler.activate);if(this.selectedMarker!==null&&this.selectedMarker.attributes.polyline===null){this.selectedMarker.setIcon(null);this.selectedMarker.updateProprietary();}
for(var i in this.polylines){for(var j in this.polylines[i].markers){this.removeMarker(this.polylines[i].markers[j]);}}
for(var i in this.markers){this.markers[i].click.removeHandler(this.markers[i].handler.activate);}},addFeature:function(feature,data){var me=this;switch(feature){case"point":var addMarker=function(event,map,point){var mymarker=new mxn.Marker(point.location);map.addMarkerWithData(mymarker,data);map.click.removeHandler(addMarker);me.addingFeature=false;if(me.editionActive){me.invoker.go('activateMarker',[mymarker]);}};me.click.addHandler(addMarker);break;case"linestring":case"polygon":var points=[];var markers=[];var poly=null;var addPoint=function(event,map,point){var marker=new mxn.Marker(point.location);markers.push(marker);marker.setIcon(me.iconURL("create"));marker.click.addHandler(function(event,map){for(var i in markers){me.removeMarker(markers[i]);}
me.click.removeHandler(addPoint);me.addingFeature=false;me.polylineAdded.fire({"polyline":poly});if(me.editionActive){if(me.handler){me.click.addHandler(me.handler.activate);}
me.invoker.go('activatePolyline',[poly]);}});map.addMarker(marker,false,true);points.push(point.location);if(poly===null&&points.length>1){poly=new mxn.Polyline(points);poly.addData(data);me.addPolyline(poly,false,true);}
if(feature=="polygon"&&points.length>2){poly.setClosed(true);}
if(poly!==null){poly.points=points;poly.updateProprietary();}};if(this.handler){this.click.removeHandler(this.handler.activate);if(this.selectedMarker!==null){if(me.selectedMarker.attributes.polyline){me.selectedMarker.setIcon(me.selectedMarker.oldIcon);me.polylineUnselected.fire({'polyline':me.selectedMarker.attributes.polyline});}else{me.selectedMarker.setIcon(me.selectedMarker.oldIcon);me.markerUnselected.fire({'marker':me.selectedMarker});}
me.selectedMarker.updateProprietary();me.selectedMarker=null;}}
this.click.addHandler(addPoint);break;}},iconURL:function(state){return this.src+"icons/default/default-"+state+".png";}};};var OpenLayersSettings=function(){this.Mapstraction={init:function(element,api){var me=this;this.maps[api]=new OpenLayers.Map(element.id,{maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543,numZoomLevels:18,units:'meters',projection:"EPSG:41001",eventListeners:{"moveend":function(e){me.endPan.fire();},"zoomend":function(e){me.changeZoom.fire();},"click":function(e){var lonlat=this.getLonLatFromViewPortPx(e.xy);me.clickHandler(lonlat.lat,lonlat.lon,me);}}});var map=this.maps[api];this.layers.osmmapnik=new OpenLayers.Layer.TMS('OSM Mapnik',["http://a.tile.openstreetmap.org/","http://b.tile.openstreetmap.org/","http://c.tile.openstreetmap.org/"],{type:'png',getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var limit=Math.pow(2,z);if(y<0||y>=limit){return null;}else{x=((x%limit)+limit)%limit;var path=z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}
return url+path;}},displayOutsideMaxExtent:true});this.layers.osm=new OpenLayers.Layer.TMS('OSM',["http://a.tah.openstreetmap.org/Tiles/tile.php/","http://b.tah.openstreetmap.org/Tiles/tile.php/","http://c.tah.openstreetmap.org/Tiles/tile.php/"],{type:'png',getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();var limit=Math.pow(2,z);if(y<0||y>=limit){return null;}else{x=((x%limit)+limit)%limit;var path=z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);}
return url+path;}},displayOutsideMaxExtent:true});var myStyles=new OpenLayers.StyleMap({"default":new OpenLayers.Style({pointRadius:5,fillColor:"#ffcc66",strokeColor:"#ff9933",strokeWidth:4,fillOpacity:0.5}),"select":new OpenLayers.Style({fillColor:"#66ccff",strokeColor:"#3399ff"})});var onPopupClose=function(evt){me.controls.select.unselect(this.feature);};var onMarkerSelect=function(feature){if(typeof(feature.mapstraction_marker)==="undefined"||!feature.mapstraction_marker.infoBubble){return;}
popup=new OpenLayers.Popup.FramedCloud("chicken",feature.geometry.getBounds().getCenterLonLat(),null,"<div style='font-size:.8em'>"+feature.mapstraction_marker.infoBubble+"</div>",null,true,onPopupClose);feature.popup=popup;popup.feature=feature;map.addPopup(popup);};var onMarkerUnselect=function(feature){if(typeof(feature.mapstraction_marker)==="undefined"||!feature.mapstraction_marker.infoBubble){return;}
map.removePopup(feature.popup);feature.popup.destroy();feature.popup=null;};this.maps[api].addLayer(this.layers.osmmapnik);this.maps[api].addLayer(this.layers.osm);this.layers.features=new OpenLayers.Layer.Vector('features');this.maps[api].addLayer(this.layers.features,{"styleMap":myStyles});this.controls=[];this.controls.draw_point=new OpenLayers.Control.DrawFeature(this.layers.features,OpenLayers.Handler.Point);this.maps[api].addControl(this.controls.draw_point);this.controls.draw_point.deactivate();this.controls.draw_linestring=new OpenLayers.Control.DrawFeature(this.layers.features,OpenLayers.Handler.Path);this.maps[api].addControl(this.controls.draw_linestring);this.controls.draw_linestring.deactivate();this.controls.draw_polygon=new OpenLayers.Control.DrawFeature(this.layers.features,OpenLayers.Handler.Polygon);this.maps[api].addControl(this.controls.draw_polygon);this.controls.draw_polygon.deactivate();this.controls.modify=new OpenLayers.Control.ModifyFeature(this.layers.features);this.maps[api].addControl(this.controls.modify);this.controls.modify.deactivate();this.controls.select=new OpenLayers.Control.SelectFeature(this.layers.features,{onSelect:onMarkerSelect,onUnselect:onMarkerUnselect});this.maps[api].addControl(this.controls.select);this.controls.select.activate();this.loaded[api]=true;},applyOptions:function(){var map=this.maps[this.api];if(this.options.enableScrollWheelZoom){map.enableContinuousZoom();map.enableScrollWheelZoom();}},resizeTo:function(width,height){this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].updateSize();},addControls:function(args){var map=this.maps[this.api];for(var i=0;i<map.controls.length;i++){if(map.controls[i].displayClass.indexOf("Pan")>0||map.controls[i].displayClass.indexOf("Zoom")>0||map.controls[i].displayClass.indexOf("Overview")>0||map.controls[i].displayClass.indexOf("LayerSwitcher")>0){map.controls[i].deactivate();map.removeControl(map.controls[i]);}}
if(args.zoom||args.pan){if(args.zoom=='large'){map.addControl(new OpenLayers.Control.PanZoomBar());}else{if(args.zoom){map.addControl(new OpenLayers.Control.ZoomPanel());}
if(args.pan){map.addControl(new OpenLayers.Control.PanPanel());}}}
if(args.overview){map.addControl(new OpenLayers.Control.OverviewMap());}
if(args.map_type){map.addControl(new OpenLayers.Control.LayerSwitcher());}},addSmallControls:function(){var map=this.maps[this.api];for(var i=0;i<map.controls.length;i++){if(map.controls[i].displayClass.indexOf("Pan")>0||map.controls[i].displayClass.indexOf("Zoom")>0||map.controls[i].displayClass.indexOf("LayerSwitcher")>0){map.controls[i].deactivate();map.removeControl(map.controls[i]);}}
map.addControl(new OpenLayers.Control.PanPanel());map.addControl(new OpenLayers.Control.ZoomPanel());this.addControlsArgs.pan=true;this.addControlsArgs.zoom='small';},addLargeControls:function(){var map=this.maps[this.api];for(var i=0;i<map.controls.length;i++){if(map.controls[i].displayClass.indexOf("Pan")>0||map.controls[i].displayClass.indexOf("Zoom")>0||map.controls[i].displayClass.indexOf("LayerSwitcher")>0){map.controls[i].deactivate();map.removeControl(map.controls[i]);}}
map.addControl(new OpenLayers.Control.PanZoomBar());this.addControlsArgs.zoom='large';},addMapTypeControls:function(){var map=this.maps[this.api];map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));},dragging:function(on){throw'Not implemented';},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);map.setCenter(pt,zoom);},addMarker:function(marker,old){var map=this.maps[this.api];var pin=marker.toProprietary(this.api);marker.setChild(pin);this.layers.features.addFeatures(pin);return pin;},removeMarker:function(marker){var map=this.maps[this.api];this.layers.features.removeFeatures([marker.proprietary_marker]);},removeAllMarkers:function(){var map=this.maps[this.api];this.layers.markers.clearMarkers();},declutterMarkers:function(opts){var map=this.maps[this.api];},addPolyline:function(polyline,old){var map=this.maps[this.api];var pl=polyline.toProprietary(this.api);polyline.setChild(pl);this.layers.features.addFeatures([pl]);return pl;},removePolyline:function(polyline){var map=this.maps[this.api];this.layers.features.removeFeatures([polyline.proprietary_polyline]);},getCenter:function(){var point;var map=this.maps[this.api];var pt=map.getCenter();if(map.getProjection()!="EPSG:4326"){pt.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));}
point=new mxn.LatLonPoint(pt.lat,pt.lon);return point;},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);if(options&&options.pan){map.panTo(pt);}
else{map.setCenter(pt);}},setZoom:function(zoom){var map=this.maps[this.api];map.zoomTo(zoom);},getZoom:function(){var map=this.maps[this.api];return map.zoom;},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var olbox=bbox.toProprietary(this.api);var zoom=map.getZoomForExtent(olbox);return zoom;},setMapType:function(type){throw'Not implemented';},getMapType:function(){throw'Not implemented';},getBounds:function(){var map=this.maps[this.api];var olbox=map.calculateBounds();if(map.getProjection()!="EPSG:4326"){olbox.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));}
return new mxn.BoundingBox(olbox.bottom,olbox.left,olbox.top,olbox.right);},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();var obounds=new OpenLayers.Bounds();obounds.extend(new mxn.LatLonPoint(sw.lat,sw.lon).toProprietary(this.api));obounds.extend(new mxn.LatLonPoint(ne.lat,ne.lon).toProprietary(this.api));map.zoomToExtent(obounds);},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){throw'Not implemented';},setImagePosition:function(id,oContext){throw'Not implemented';},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];map.addLayer(new OpenLayers.Layer.GeoRSS("GeoRSS Layer",url));},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){throw'Not implemented';},toggleTileLayer:function(tile_url){throw'Not implemented';},getPixelRatio:function(){throw'Not implemented';},mousePosition:function(element){var map=this.maps[this.api];var locDisp=document.getElementById(element);if(locDisp!==null){try{map.events.register('mousemove',map,function(e){var lonLat=map.getLonLatFromViewPortPx(e.xy);var lon=lonLat.lon*(180.0/20037508.34);var lat=lonLat.lat*(180.0/20037508.34);lat=(180/Math.PI)*(2*Math.atan(Math.exp(lat*Math.PI/180))-(Math.PI/2));var loc=numFormatFloat(lat,4)+' / '+numFormatFloat(lon,4);locDisp.innerHTML=loc;});locDisp.innerHTML='0.0000 / 0.0000';}catch(x){alert("Error: "+e);}}}};this.LatLonPoint={toProprietary:function(){var ollon=this.lon*20037508.34/180;var ollat=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);ollat=ollat*20037508.34/180;return new OpenLayers.LonLat(ollon,ollat);},fromProprietary:function(googlePoint){var lon=(this.lon/20037508.34)*180;var lat=(this.lat/20037508.34)*180;lat=180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180))-Math.PI/2);this.lon=lon;this.lat=lat;}};this.Marker={toProprietary:function(){var size,anchor,icon,selected;if(this.iconSize){size=[this.iconSize[0].intValue(),this.iconSize[1].intValue()];}
else{size=[21,25];}
if(this.iconAnchor){anchor=[this.iconAnchor[0],this.iconAnchor[1]];}
else{anchor=[-(size[0]/2),-size[1]];}
if(this.iconUrl){icon=this.iconUrl;}
else{icon="http://openlayers.org/dev/img/marker-gold.png";}
var marker=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(this.location.toProprietary(this.api).lon,this.location.toProprietary(this.api).lat));marker.style={externalGraphic:icon,graphicHeight:size[1],graphicWidth:size[0],graphicXOffset:anchor[0],graphicYOffset:anchor[1]};if(this.hoverIconUrl){}
if(this.infoDiv){}
return marker;},openBubble:function(){this.mapstraction.controls.select.select(this.proprietary_marker);},hide:function(){this.proprietary_marker.display(false);},show:function(){this.proprietary_marker.display(true);},update:function(){throw'Not implemented';}};this.Polyline={toProprietary:function(){var olpolyline;var olpoints=[];var ring;var style={strokeColor:this.color||"#000000",strokeOpacity:this.opacity||1,strokeWidth:this.width||3,fillColor:this.fillColor||"#000000",fillOpacity:this.getAttribute('fillOpacity')||0.2};for(var i=0,length=this.points.length;i<length;i++){olpoint=this.points[i].toProprietary(this.api);olpoints.push(new OpenLayers.Geometry.Point(olpoint.lon,olpoint.lat));}
if(this.closed||olpoints[0].equals(olpoints[length-1])){ring=new OpenLayers.Geometry.LinearRing(olpoints);ring=new OpenLayers.Geometry.Polygon(ring);}else{ring=new OpenLayers.Geometry.LineString(olpoints);}
olpolyline=new OpenLayers.Feature.Vector(ring,null,style);return olpolyline;},show:function(){this.proprietary_polyline.display(true);},hide:function(){this.proprietary_polyline.display(false);}};};var openLayers=new OpenLayersSettings();mxn.register('openlayers',openLayers);var OpenLayersInteractive=function(){this.Mapstraction={activateEdition:function(){var map=this.maps[this.api];var me=this;this.controls.modify.activate();function feature_modified(event_triggered){var geom=event_triggered.feature.geometry.clone();if(this.map.getProjection()!="EPSG:4326"){geom.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));}
switch(event_triggered.feature.geometry.CLASS_NAME.split(".")[2].toLowerCase()){case"point":if(event_triggered.feature.popup){me.controls.select.unselect(event_triggered.feature);}
event_triggered.feature.mapstraction_marker.location=new mxn.LatLonPoint(geom.y,geom.x);me.markerChanged.fire({'marker':event_triggered.feature.mapstraction_marker});break;case"linestring":var points=[];for(var i in geom.components){points[i]=new mxn.LatLonPoint(geom.components[i].y,geom.components[i].x);}
event_triggered.feature.mapstraction_polyline.points=points;me.polylineChanged.fire({'polyline':event_triggered.feature.mapstraction_polyline});break;case"polygon":var points=[];for(var i in geom.components[0].components){points[i]=new mxn.LatLonPoint(geom.components[0].components[i].y,geom.components[0].components[i].x);}
event_triggered.feature.mapstraction_polyline.points=points;me.polylineChanged.fire({'polyline':event_triggered.feature.mapstraction_polyline});break;}}
if(this.layers.features.events.listeners.featuremodified.length===0){this.layers.features.events.register("featuremodified",this.layers.feature,feature_modified);}
if(this.layers.features.events.listeners.featureselected.length===0){this.layers.features.events.register("featureselected",this.layers.feature,function(event_triggered){switch(event_triggered.feature.geometry.CLASS_NAME.split(".")[2].toLowerCase()){case"point":me.markerSelected.fire({'marker':event_triggered.feature.mapstraction_marker});break;case"linestring":case"polygon":me.polylineSelected.fire({'polyline':event_triggered.feature.mapstraction_polyline});break;}});this.layers.features.events.register("featureunselected",this.layers.feature,function(event_triggered){switch(event_triggered.feature.geometry.CLASS_NAME.split(".")[2].toLowerCase()){case"point":me.markerUnselected.fire({'marker':event_triggered.feature.mapstraction_marker});break;case"linestring":case"polygon":me.polylineUnselected.fire({'polyline':event_triggered.feature.mapstraction_polyline});break;}});}
document.onkeydown=function(e){vKeyCode=e.keyCode;if((vKeyCode==63272)||vKeyCode==46){var vector_to_remove=me.layers.features.selectedFeatures[0];if(typeof(vector_to_remove)!="undefined"){if(vector_to_remove.mapstraction_marker){me.removeMarker(vector_to_remove.mapstraction_marker);}else{me.removePolyline(vector_to_remove.mapstraction_polyline);}}
me.controls.modify.deactivate();me.controls.modify.activate();}};},deactivateEdition:function(){this.controls.modify.deactivate();this.layers.features.events.remove("featureselected");this.layers.features.events.remove("featureunselected");},addFeature:function(feature,data){var map=this.maps[this.api];var me=this;var poly;this.controls['draw_'+feature].activate();function feature_added(event_triggered){var geom=event_triggered.feature.geometry.clone();if(this.map.getProjection()!="EPSG:4326"){geom.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));}
switch(feature){case"point":var marker=new mxn.Marker(new mxn.LatLonPoint(geom.y,geom.x));me.addMarkerWithData(marker,data);break;case"polygon":var points=[];for(var i in geom.components[0].components){points[i]=new mxn.LatLonPoint(geom.components[0].components[i].y,geom.components[0].components[i].x);}
poly=new mxn.Polyline(points);poly.setClosed(true);me.addPolylineWithData(poly,data);break;case"linestring":var points=[];for(var i in geom.components){points[i]=new mxn.LatLonPoint(geom.components[i].y,geom.components[i].x);}
poly=new mxn.Polyline(points);me.addPolylineWithData(poly,data);break;}
event_triggered.feature.destroy();me.controls['draw_'+feature].deactivate();me.addingFeature=false;}
if(this.controls['draw_'+feature].events.listeners.featureadded.length===0){this.controls['draw_'+feature].events.register('featureadded',this.controls['draw_'+feature],feature_added);}}};};var openlayers=new OpenLayersInteractive();mxn.register('openlayers',openlayers);var metodosCartociudad=function(){};metodosCartociudad.prototype={ajaxRequest:function(url,type,postParams){var proxy_url='proxy.php?c_path='+encodeURIComponent(url);var xmlDoc="";var xmlhttp=null;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();if(typeof xmlhttp.overrideMimeType!='undefined'){xmlhttp.overrideMimeType('text/xml');}}
else
if(window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
else{alert('Navegador incompatible');}
xmlhttp.open(type.method,proxy_url,type.async);xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");xmlhttp.setRequestHeader("Cache-Control","no-cache");xmlhttp.send(postParams);if(!type.async){xmlDoc=xmlhttp.responseXML.documentElement;return xmlDoc;}},findCoordenadas:function(xmlDoc,address){if(OpenLayers.Ajax.getElementsByTagNameNS(xmlDoc,'http://www.opengis.net/gml','gml','Envelope')[0]){var bbox=OpenLayers.Ajax.getElementsByTagNameNS(xmlDoc,'http://www.opengis.net/gml','gml','Envelope')[0].firstChild;while(bbox.nodeType!=1){bbox=bbox.nextSibling;}
var bounds=[];bounds[0]=bbox.firstChild.nodeValue;bbox=bbox.nextSibling;while(bbox.nodeType!=1){bbox=bbox.nextSibling;}
bounds[1]=bbox.firstChild.nodeValue;address.bounds=new OpenLayers.Bounds(bounds[0],bounds[1]);}
if(OpenLayers.Ajax.getElementsByTagNameNS(xmlDoc,'http://www.opengis.net/gml','gml','Point')[0]){var pos=OpenLayers.Ajax.getElementsByTagNameNS(xmlDoc,'http://www.opengis.net/gml','gml','Point')[0].firstChild;while(pos.nodeType!=1){pos=pos.nextSibling;}
pos=pos.firstChild;pos.nodeValue=pos.nodeValue.replace(/\s/g,",");var coordenadas=pos.nodeValue.split(",");address.point=new OpenLayers.LonLat(coordenadas[0],coordenadas[1]);address.error=0;}
return address;},sanitizeInput:function(input){input=input.replace(/\s/g,"%20");input=input.replace(/á/g,"%E1");input=input.replace(/é/g,"%E9");input=input.replace(/í/g,"%ED");input=input.replace(/ó/g,"%F3");input=input.replace(/ú/g,"%FA");input=input.replace(/ñ/g,"%F1");input=input.replace(/,/g,"");return input;},normalizeStreetType:function(input){input=input.replace(/(c\/|c\.|c\/\.|calle)/i,"CALLE");input=input.replace(/(av.*|avenida)/i,"AVDA");input=input.replace(/(pl.*|pz.*|plaza)/i,"PLAZA");input=input.replace(/(gta.*|glorieta)/i,"GTA");input=input.replace(/(ps.*|p\.º|paseo)/i,"PASEO");input=input.replace(/(ctra.*|carretera)/i,"CTRA");return input;},limpiarSalida:function(input){input=input.replace(/%20/g," ");input=input.replace(/%E1/g,"á");input=input.replace(/%E9/g,"é");input=input.replace(/%ED/g,"í");input=input.replace(/%F3/g,"ó");input=input.replace(/%FA/g,"ú");input=input.replace(/%F1/g,"ñ");input=input.replace("CALLE","C/");input=input.replace("AVDA","Avda.");input=input.replace("PLAZA","Pza.");input=input.replace("GTA","Gta.");input=input.replace("PASEO","Ps.");input=input.replace("CTRA","Ctra.");return input;},addressToMapstraction:function(address){if(address.point&&address.point!==''){address.point=new mxn.LatLonPoint(address.point.lat,address.point.lon);}
if(address.bounds&&address.bounds!==''){address.bounds=new mxn.BoundingBox(address.bounds.bottom,address.bounds.left,address.bounds.top,address.bounds.right);}
if(address.region&&address.region!==''){address.region=this.limpiarSalida(address.region);}
else{address.region='';}
if(address.locality&&address.locality!==''){address.locality=this.limpiarSalida(address.locality);}
else{address.locality='';}
if(address.street&&address.street!==''){address.street=this.limpiarSalida(address.street);if(address.streetType&&address.streetType!==''){address.streetType=this.limpiarSalida(address.streetType);}
else{address.streetType='';}}
else{address.street='';}
if(address.portal&&address.portal!==''){address.portal=this.limpiarSalida(address.portal);}
else{address.portal='';}
if(address.CP&&address.CP!==''){address.CP='CP. '+address.CP;}
else{address.CP='';}},capitalizar:function(entrada){entrada=entrada.toLowerCase();var letras=entrada.split('');letras[0]=letras[0].toUpperCase();entrada=letras.join('');return entrada;},separarDireccion:function(address){var myRexp01=/\s*(calle|c\/|c\.|c\/\.|av\w*\.*|pl\w*\.*|pz\w*\.*|gta\.*|glorieta|ps\.*|p\.*º|paseo|ctra\.*|carretera)*\s*([^,]*)?\s*,?\s*(?:c\.*p\.*|cod\.*pos\.*)*\s*(\d{5})?\s*,?\s*(?:municipio:)*\s*([^,]*)?\s*,?\s*([^,]*)?\s*/i;var myRexp02=/\s*([^,]*)\s+(?:n\.*|nº|num\.*)*\s*(\d{1,4})*\s*$/;var myRexp03=/(?:c\.*p\.*|cod\.*pos\.*)*\s*(\d{5})/;var myRexp04=/(?:municipio:)\s*([^,]*)\s*,?\s*([^,]*)/;var campos=address.address.match(myRexp01);address.streetType=campos[1];if(campos[2]&&campos[2]!==''){var aux;if(campos[2].match(myRexp04)){aux=campos[2].match(myRexp04);campos[5]=aux[2];campos[4]=aux[1];}
else{if(campos[2].match(myRexp03)){aux=campos[2].match(myRexp03);campos[3]=aux[1];}
else{if(campos[2].match(myRexp02)){aux=campos[2].match(myRexp02);address.portal=aux[2];address.street=aux[1];}}}}
address.region=campos[5];if(address.region&&address.region!==''){address.region=this.capitalizar(address.region);}
address.locality=campos[4];if(address.locality&&address.locality!==''){address.locality=this.capitalizar(address.locality);}
address.CP=campos[3];},queryNomenclator:function(address){if(address.address&&address.address!==''){this.separarDireccion(address);}
if(address.region&&address.region!==''){address.region=this.sanitizeInput(address.region);}
if(address.locality&&address.locality!==''){address.locality=this.sanitizeInput(address.locality);}
if(address.street&&address.street!==''){address.street=this.sanitizeInput(address.street);}
if(address.portal&&address.portal!==''){address.portal=this.sanitizeInput(address.portal);}
if(address.streetType&&address.streetType!==''){address.streetType=this.normalizeStreetType(address.streetType);}
var wfsCP="wfs-codigo/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&NAMESPACE=xmlns(app=http://www.deegree.org/app)&TYPENAME=app:Entidad&FILTER=";var wfsMunicipio="wfs-municipio/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&NAMESPACE=xmlns(app=http://www.deegree.org/app)&TYPENAME=app:Entidad&FILTER=";var wfsVial="wfs-vial/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&NAMESPACE=xmlns(app=http://www.deegree.org/app)&TYPENAME=app:Entidad&FILTER=";var wfsPortal="wfs-portal/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&NAMESPACE=xmlns(app=http://www.deegree.org/app)&TYPENAME=app:Entidad&FILTER=";var xml,url,filtro,errorCode;var requestType={};if(address.locality&&address.locality!==''){filtro="%3CFilter%3E";if(address.region&&address.region!==''){filtro+="%3CAnd%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EnombreEntidad/nombre%3C/PropertyName%3E%3CLiteral%3E"+address.locality+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EentidadLocal/provincia%3C/PropertyName%3E%3CLiteral%3E"+address.region+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/And%3E%3C/Filter%3E";}
else{filtro+="%3CPropertyIsEqualTo%3E%3CPropertyName%3EnombreEntidad/nombre%3C/PropertyName%3E%3CLiteral%3E"+address.locality+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E";}
url=wfsMunicipio+filtro;address.error=3;}
else if(address.CP&&address.CP!==''){filtro="%3CFilter%3E%3CPropertyIsLike%20wildCard=%22*%22%20singleChar=%22_%22%20escapeChar=%22!%22%3E%3CPropertyName%3EnombreEntidad/nombre%3C/PropertyName%3E%3CLiteral%3E"+address.CP+"%3C/Literal%3E%3C/PropertyIsLike%3E%3C/Filter%3E";url=wfsCP+filtro;address.error=4;}
else{address.error=1;return address;}
requestType.method='GET';requestType.async=false;xml=this.ajaxRequest(url,requestType);if(xml.getElementsByTagName('provincia')[0]){if(!address.locality||address.locality===''){address.locality=xml.getElementsByTagName('municipio')[0].firstChild.nodeValue;address.locality=this.sanitizeInput(address.locality);}
if(!address.region||address.region===''){address.region=xml.getElementsByTagName('provincia')[0].firstChild.nodeValue;address.region=this.sanitizeInput(address.region);}
address.error=0;}
if(!address.street||address.street===''){this.findCoordenadas(xml,address);}
else{if(address.error===0){filtro="%3CFilter%3E%3CAnd%3E%3CPropertyIsLike%20wildCard=%22*%22%20singleChar=%22_%22%20escapeChar=%22!%22%3E%3CPropertyName%3EnombreEntidad/nombre%3C/PropertyName%3E%3CLiteral%3E*"+address.street+"*%3C/Literal%3E%3C/PropertyIsLike%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EentidadLocal/provincia%3C/PropertyName%3E%3CLiteral%3E"+address.region+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EentidadLocal/municipio%3C/PropertyName%3E%3CLiteral%3E"+address.locality+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E";if(address.streetType){filtro+="%3CPropertyIsEqualTo%3E%3CPropertyName%3EtipoEntidad/tipo%3C/PropertyName%3E%3CLiteral%3E"+address.streetType+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/And%3E%3C/Filter%3E";}
else{filtro+="%3C/And%3E%3C/Filter%3E";}
url=wfsVial+filtro;xml=this.ajaxRequest(url,requestType);if(address.portal&&address.portal!==''){if(xml.getElementsByTagName('Entidad')[0]){address.entidad=xml.getElementsByTagName('Entidad')[0].getAttribute("fid");filtro="%3CFilter%3E%3CAnd%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EnombreEntidad/nombre%3C/PropertyName%3E%3CLiteral%3E"+address.portal+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EentidadRelacionada/idEntidad%3C/PropertyName%3E%3CLiteral%3E"+address.entidad+"%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/And%3E%3C/Filter%3E";url=wfsPortal+filtro;xml=this.ajaxRequest(url,requestType);address.error=6;this.findCoordenadas(xml,address);}
else{address.error=5;}}
else{address.error=2;return address;}}
else{return address;}}},queryRoute:function(addresses){var postParams="request=<?xml version='1.0' encoding='UTF-8' standalone='yes'?><Execute service='WPS' version='0.4.0' store='false' status='false' xmlns='http://www.opengeospatial.net/wps' xmlns:pak='http://www.opengis.net/examples/packet' xmlns:ows='http://www.opengeospatial.net/ows' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.opengeospatial.net/wps ..%5CwpsExecute.xsd' xmlns:om='http://www.opengis.net/om' xmlns:gml='http://www.opengis.net/gml'> <ows:Identifier>com.ign.process.geometry.RouteFinder</ows:Identifier><DataInputs><Input><ows:Identifier>details</ows:Identifier><ows:Title>Distancia</ows:Title>";postParams+="<LiteralValue dataType='xs:boolean'>true</LiteralValue></Input><Input><ows:Identifier>wayPointList</ows:Identifier><ows:Title>WayPoints</ows:Title>";postParams+="<ComplexValue><wayPointList>";for(var i=0;i<addresses.length;i++){postParams+="<wayPoint><gml:Point><gml:coord><gml:X>"+addresses[i].point.lon+"</gml:X><gml:Y>"+addresses[i].point.lat+"</gml:Y></gml:coord></gml:Point></wayPoint>";}
postParams+="</wayPointList></ComplexValue></Input></DataInputs><ProcessOutputs><Output><ows:Identifier>result</ows:Identifier><ows:Title>LineString</ows:Title><ows:Abstract>GML describiendo una feature de Linestring.</ows:Abstract><ComplexOutput defaultFormat='text/XML' defaultSchema='http://geoserver.itc.nl:8080/wps/schemas/gml/2.1.2/gmlpacket.xsd'><SupportedComplexData><Schema>http://schemas.opengis.net/gml/2.1.2/feature.xsd</Schema></SupportedComplexData></ComplexOutput></Output><Output><ows:Identifier>route</ows:Identifier><ows:Title>Ruta</ows:Title><ows:Abstract>Ruta</ows:Abstract><ComplexOutput defaultFormat='text/XML' defaultSchema='http://www.idee.es/complexValues.xsd'><SupportedComplexData><Schema>http://www.idee.es/complexValues.xsd</Schema></SupportedComplexData></ComplexOutput></Output><Output><ows:Identifier>wayPoints</ows:Identifier><ows:Title>Puntos</ows:Title><ows:Abstract>Lista de puntos</ows:Abstract><ComplexOutput defaultFormat='text/XML' defaultSchema='http://www.idee.es/wayPointsValues.xsd'><SupportedComplexData><Schema>http://www.idee.es/wayPointsValues.xsd</Schema></SupportedComplexData></ComplexOutput></Output></ProcessOutputs></Execute>";var url="visor/proxy.do?urlValor=http://localhost:8080/wps/WebProcessingService";var requestType={};requestType.method='POST';requestType.async=false;var xmlDoc=this.ajaxRequest(url,requestType,postParams);var rutaWPS={};if(OpenLayers.Ajax.getElementsByTagNameNS(xmlDoc,'http://www.opengis.net/gml','gml','Coordinates')[0]){var stringWPS='';var aux='';for(i=0;i<addresses.length-1;i++){aux=OpenLayers.Ajax.getElementsByTagNameNS(xmlDoc,'http://www.opengis.net/gml','gml','Coordinates')[i].firstChild.nodeValue;stringWPS+=aux;}
stringWPS=stringWPS.replace(/,\s/g,',');stringWPS=stringWPS.replace(/\s(?=$)/,'');stringWPS=stringWPS.split(/\s/);rutaWPS.points=[];for(i=0;i<stringWPS.length;i++){aux=stringWPS[i].split(',');var point=new OpenLayers.Geometry.Point(aux[0],aux[1]);rutaWPS.points.push(point);}
var linea=new OpenLayers.Geometry.LineString(rutaWPS.points);rutaWPS.bounds=linea.getBounds();var nodosCoste=xmlDoc.getElementsByTagName('coste');var coste=0;for(i=0;i<nodosCoste.length;i++){coste+='+'+nodosCoste[i].firstChild.nodeValue;}
coste=eval(coste);rutaWPS.distance=parseInt(coste,10);rutaWPS.error=0;return rutaWPS;}
else{rutaWPS.error=7;return rutaWPS;}}};var metodosFlamingo={addEvent:function(elm,evType,fn,useCapture){if(elm.addEventListener){elm.addEventListener(evType,fn,useCapture);return true;}else if(elm.attachEvent){var r=elm.attachEvent('on'+evType,fn);return r;}else{elm['on'+evType]=fn;}},FireEvent:function(element,event){var evt;if(document.createEventObject){evt=document.createEventObject();return element.fireEvent('on'+event,evt);}
else{evt=document.createEvent("HTMLEvents");evt.initEvent(event,true,true);return!element.dispatchEvent(evt);}},getMovie:function(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}};function flamingo_onConfigComplete(){var app=metodosFlamingo.getMovie("flamingo");metodosFlamingo.FireEvent(app,"click");}
var cartociudad=new OpenLayersSettings();cartociudad.Mapstraction.init=function(element,api){var me=this;var layers=this.layers;var controls;var map;this.maps[api]=new OpenLayers.Map(element.id,{maxResolution:0.02197265625,numZoomLevels:15,projection:'EPSG:4326',units:'dd',eventListeners:{"moveend":function(e){me.endPan.fire();},"zoomend":function(e){me.changeZoom.fire();},"click":function(e){var lonlat=this.getLonLatFromViewPortPx(e.xy);me.clickHandler(lonlat.lat,lonlat.lon,me);}}});map=this.maps[api];layers.cartociudad=new OpenLayers.Layer.WMS('Cartociudad IDEE','http://www.cartociudad.es/wms-c/CARTOCIUDAD/CARTOCIUDAD?',{layers:'Todas',format:'image/png'});layers.pnoa=new OpenLayers.Layer.WMS('PNOA','http://www.idee.es/wms/PNOA/PNOA?',{layers:'pnoa',format:'image/jpeg'});map.addLayer(layers.cartociudad);map.addLayer(layers.pnoa);if(!map.setCenter()){map.setCenter(new OpenLayers.LonLat(-3.251,40),0);}
var onPopupClose=function(evt){me.controls.select.unselect(this.feature);};var onMarkerSelect=function(feature){if(typeof(feature.mapstraction_marker)==="undefined"||!feature.mapstraction_marker.infoBubble){return;}
popup=new OpenLayers.Popup.FramedCloud("chicken",feature.geometry.getBounds().getCenterLonLat(),null,"<div style='font-size:.8em'>"+feature.mapstraction_marker.infoBubble+"</div>",null,true,onPopupClose);feature.popup=popup;popup.feature=feature;map.addPopup(popup);};var onMarkerUnselect=function(feature){if(typeof(feature.mapstraction_marker)==="undefined"||!feature.mapstraction_marker.infoBubble){return;}
map.removePopup(feature.popup);feature.popup.destroy();feature.popup=null;};layers.features=new OpenLayers.Layer.Vector('features');map.addLayer(layers.features);controls=[];controls.draw_point=new OpenLayers.Control.DrawFeature(layers.features,OpenLayers.Handler.Point);map.addControl(controls.draw_point);controls.draw_point.deactivate();controls.draw_linestring=new OpenLayers.Control.DrawFeature(layers.features,OpenLayers.Handler.Path);map.addControl(controls.draw_linestring);controls.draw_linestring.deactivate();controls.draw_polygon=new OpenLayers.Control.DrawFeature(layers.features,OpenLayers.Handler.Polygon);map.addControl(controls.draw_polygon);controls.draw_polygon.deactivate();controls.modify=new OpenLayers.Control.ModifyFeature(layers.features);map.addControl(controls.modify);controls.modify.deactivate();controls.select=new OpenLayers.Control.SelectFeature(this.layers.features,{onSelect:onMarkerSelect,onUnselect:onMarkerUnselect});map.addControl(controls.select);controls.select.activate();this.controls=controls;this.loaded[api]=true;};cartociudad.Mapstraction.setCenterAndZoom=function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);var cartzoom=zoom-5;map.setCenter(pt,cartzoom);};cartociudad.Mapstraction.getZoom=function(point,zoom){var map=this.maps[this.api];return(map.zoom+5);};cartociudad.Mapstraction.setZoom=function(zoom){var map=this.maps[this.api];map.zoomTo(zoom-5);};cartociudad.LatLonPoint.toProprietary=function(){var calon=this.lon;var calat=this.lat;return new OpenLayers.LonLat(calon,calat);};cartociudad.LatLonPoint.fromProprietary=function(googlePoint){var mlon=this.lon;var mlat=this.lat;return new LatLonPoint(mlat,mlon);};mxn.register('cartociudad',cartociudad);mxn.register('cartociudad',{MapstractionGeocoder:{init:function(element,api){this.geocoders[api]=new metodosCartociudad();},geocode:function(address){var return_location={};var mapstraction_geodocer=this;address.error=0;this.geocoders[this.api].queryNomenclator(address);if(address.error!==0){this.error_callback(address);}
else{this.geocoders[this.api].addressToMapstraction(address);this.callback(address,this);}},geocode_callback:function(response,mapstraction_geocoder){var return_location={};}}})
var cartociudad=new OpenLayersInteractive();mxn.register('cartociudad',cartociudad);mxn.register('cloudmade',{Mapstraction:{init:function(element,api){var me=this;var cloudmade=new CM.Tiles.CloudMade.Web({key:cloudmade_key});this.maps[api]=new CM.Map(element,cloudmade);this.loaded[api]=true;},applyOptions:function(){var map=this.maps[this.api];if(this.options.enableScrollWheelZoom){map.enableScrollWheelZoom();}},resizeTo:function(width,height){this.maps[this.api].checkResize();},addControls:function(args){var map=this.maps[this.api];var c=this.addControlsArgs;switch(c.zoom){case'large':this.addLargeControls();break;case'small':this.addSmallControls();break;}
if(c.map_type){this.addMapTypeControls();}
if(c.scale){map.addControl(new CM.ScaleControl());this.addControlsArgs.scale=true;}},addSmallControls:function(){var map=this.maps[this.api];map.addControl(new CM.SmallMapControl());this.addControlsArgs.zoom='small';},addLargeControls:function(){var map=this.maps[this.api];map.addControl(new CM.LargeMapControl());this.addControlsArgs.zoom='large';},addMapTypeControls:function(){var map=this.maps[this.api];map.addControl(new CM.TileLayerControl());this.addControlsArgs.map_type=true;},dragging:function(on){var map=this.maps[this.api];if(on){map.enableDragging();}else{map.disableDragging();}},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);map.setCenter(pt,zoom);},addMarker:function(marker,old){var map=this.maps[this.api];var pin=marker.toProprietary(this.api);map.addOverlay(pin);return pin;},removeMarker:function(marker){var map=this.maps[this.api];map.removeOverlay(marker.proprietary_marker);},removeAllMarkers:function(){},declutterMarkers:function(opts){var map=this.maps[this.api];},addPolyline:function(polyline,old){var map=this.maps[this.api];var pl=polyline.toProprietary(this.api);map.addOverlay(pl);return pl;},removePolyline:function(polyline){var map=this.maps[this.api];map.removeOverlay(polyline.proprietary_polyline);},getCenter:function(){var map=this.maps[this.api];var pt=map.getCenter();return new mxn.LatLonPoint(pt.lat(),pt.lng());},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);if(options!==null&&options.pan){map.panTo(pt);}
else{map.setCenter(pt);}},setZoom:function(zoom){var map=this.maps[this.api];map.setZoom(zoom);},getZoom:function(){var map=this.maps[this.api];return map.getZoom();},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var zoom=map.getBoundsZoomLevel(new CM.LatLngBounds(sw.toProprietary(this.api),ne.toProprietary(this.api)));return zoom;},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:break;case mxn.Mapstraction.SATELLITE:break;case mxn.Mapstraction.HYBRID:break;default:}},getMapType:function(){var map=this.maps[this.api];return mxn.Mapstraction.ROAD;},getBounds:function(){var map=this.maps[this.api];var box=map.getBounds();var sw=box.getSouthWest();var ne=box.getNorthEast();return new mxn.BoundingBox(sw.lat(),sw.lng(),ne.lat(),ne.lng());},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();map.zoomToBounds(new CM.LatLngBounds(sw.toProprietary(this.api),ne.toProprietary(this.api)));},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){var map=this.maps[this.api];},setImagePosition:function(id,oContext){var map=this.maps[this.api];var topLeftPoint;var bottomRightPoint;},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){var map=this.maps[this.api];},toggleTileLayer:function(tile_url){var map=this.maps[this.api];},getPixelRatio:function(){var map=this.maps[this.api];},mousePosition:function(element){var map=this.maps[this.api];}},LatLonPoint:{toProprietary:function(){var cll=new CM.LatLng(this.lat,this.lon);return cll;},fromProprietary:function(point){return new mxn.LatLonPoint(point.lat(),point.lng());}},Marker:{toProprietary:function(){var pt=this.location.toProprietary(this.api);var options={};if(this.iconUrl){var cicon=new CM.Icon();cicon.image=this.iconUrl;if(this.iconSize){cicon.iconSize=new CM.Size(this.iconSize[0],this.iconSize[1]);if(this.iconAnchor){cicon.iconAnchor=new CM.Point(this.iconAnchor[0],this.iconAnchor[1]);}}
if(this.iconShadowUrl){cicon.shadow=this.iconShadowUrl;if(this.iconShadowSize){cicon.shadowSize=new CM.Size(this.iconShadowSize[0],this.iconShadowSize[1]);}}
options.icon=cicon;}
if(this.labelText){options.title=this.labelText;}
var cmarker=new CM.Marker(pt,options);if(this.infoBubble){cmarker.bindInfoWindow(this.infoBubble);}
return cmarker;},openBubble:function(){var pin=this.proprietary_marker;pin.openInfoWindow(this.infoBubble);},hide:function(){var pin=this.proprietary_marker;pin.hide();},show:function(){var pin=this.proprietary_marker;pin.show();},update:function(){}},Polyline:{toProprietary:function(){var pts=[];var poly;for(var i=0,length=this.points.length;i<length;i++){pts.push(this.points[i].toProprietary(this.api));}
if(this.closed||pts[0].equals(pts[pts.length-1])){poly=new CM.Polygon(pts,this.color,this.width,this.opacity,this.fillColor||"#5462E3",this.opacity||"0.3");}else{poly=new CM.Polyline(pts,this.color,this.width,this.opacity);}
return poly;},show:function(){this.proprietary_polyline.show();},hide:function(){this.proprietary_polyline.hide();}}});mxn.register('geocommons',{Mapstraction:{init:function(element,api){var me=this;this.element=element;Maker.maker_host='http://maker.geocommons.com';Maker.finder_host='http://finder.geocommons.com';Maker.core_host='http://geocommons.com';},applyOptions:function(){var map=this.maps[this.api];},resizeTo:function(width,height){var map=this.maps[this.api];map.setSize(width,height);},addControls:function(args){var map=this.maps[this.api];map.showControl("Zoom",args.zoom||false);map.showControl("Layers",args.layers||false);map.showControl("Styles",args.styles||false);map.showControl("Basemap",args.map_type||false);map.showControl("Legend",args.legend||false,"open");},addSmallControls:function(){var map=this.maps[this.api];showControl("Zoom",args.zoom);showControl("Legend",args.legend,"open");},addLargeControls:function(){var map=this.maps[this.api];showControl("Zoom",args.zoom);showControl("Layers",args.layers);showControl("Legend",args.legend,"open");},addMapTypeControls:function(){var map=this.maps[this.api];},dragging:function(on){var map=this.maps[this.api];},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];map.setCenterZoom(point.lat,point.lon,zoom);},getCenter:function(){var map=this.maps[this.api];var point=map.getCenterZoom()[0];return mxn.LatLonPoint(point.lat,point.lon);},setCenter:function(point,options){var map=this.maps[this.api];map.setCenter(point.lat,point.lon);},setZoom:function(zoom){var map=this.maps[this.api];map.setZoom(zoom);},getZoom:function(){var map=this.maps[this.api];return map.getZoom();},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var zoom;return zoom;},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:map.setMapProvider("OpenStreetMap (road)");break;case mxn.Mapstraction.SATELLITE:map.setMapProvider("BlueMarble");break;case mxn.Mapstraction.HYBRID:map.setMapProvider("Google Hybrid");break;default:map.setMapProvider(type);}},getMapType:function(){var map=this.maps[this.api];},getBounds:function(){var map=this.maps[this.api];var extent=map.getExtent();return new mxn.BoundingBox(extent.northWest.lat,extent.southEast.lon,extent.southEast.lat,extent.northWest.lon);},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();map.setExtent(ne.lat,sw.lat,ne.lon,sw.lon);},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){var map=this.maps[this.api];},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];var me=this;Maker.load_map(this.element.id,url);setTimeout(function(){me.maps[me.api]=swfobject.getObjectById(FlashMap.dom_id);},500);},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){var map=this.maps[this.api];},toggleTileLayer:function(tile_url){var map=this.maps[this.api];},getPixelRatio:function(){var map=this.maps[this.api];},mousePosition:function(element){var map=this.maps[this.api];}},LatLonPoint:{toProprietary:function(){},fromProprietary:function(googlePoint){}},Marker:{toProprietary:function(){},openBubble:function(){},hide:function(){},show:function(){},update:function(){}},Polyline:{toProprietary:function(){},show:function(){},hide:function(){}}});var GoogleSettings=function(){this.Mapstraction={init:function(element,api){var me=this;if(GMap2){if(GBrowserIsCompatible()){this.maps[api]=new GMap2(element);GEvent.addListener(this.maps[api],'click',function(marker,location){if(marker&&marker.mapstraction_marker){marker.mapstraction_marker.click.fire();}
else if(location){me.click.fire({'location':new mxn.LatLonPoint(location.y,location.x)});}
if(location){me.clickHandler(location.y,location.x,location,me);}});GEvent.addListener(this.maps[api],'moveend',function(){me.moveendHandler(me);me.endPan.fire();});GEvent.addListener(this.maps[api],'zoomend',function(){me.changeZoom.fire();});this.loaded[api]=true;me.load.fire();}
else{alert('browser not compatible with Google Maps');}}
else{alert(api+' map script not imported');}},applyOptions:function(){var map=this.maps[this.api];if(this.options.enableScrollWheelZoom){map.enableContinuousZoom();map.enableScrollWheelZoom();}},resizeTo:function(width,height){this.currentElement.style.width=width;this.currentElement.style.height=height;this.maps[this.api].checkResize();},addControls:function(args){var map=this.maps[this.api];if(this.controls){while((ctl=this.controls.pop())){map.removeControl(ctl);}}
else{this.controls=[];}
c=this.controls;if(args.zoom||args.pan){if(args.zoom=='large'){c.unshift(new GLargeMapControl());map.addControl(c[0]);}else{c.unshift(new GSmallMapControl());map.addControl(c[0]);}}
if(args.scale){c.unshift(new GScaleControl());map.addControl(c[0]);}
if(args.overview){c.unshift(new GOverviewMapControl());map.addControl(c[0]);}
if(args.map_type){c.unshift(new GMapTypeControl());map.addControl(c[0]);}},addSmallControls:function(){var map=this.maps[this.api];map.addControl(new GSmallMapControl());this.addControlsArgs.zoom='small';},addLargeControls:function(){var map=this.maps[this.api];map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());this.addControlsArgs.overview=true;this.addControlsArgs.map_type=true;map.addControl(new GLargeMapControl());map.addControl(new GScaleControl());this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';this.addControlsArgs.scale=true;},addMapTypeControls:function(){var map=this.maps[this.api];map.addControl(new GMapTypeControl());},dragging:function(on){var map=this.maps[this.api];if(on){map.enableDragging();}else{map.disableDragging();}},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);map.setCenter(pt,zoom);},addMarker:function(marker,old){var map=this.maps[this.api];var gpin=marker.toProprietary(this.api);map.addOverlay(gpin);GEvent.addListener(gpin,'infowindowopen',function(){marker.openInfoBubble.fire();});GEvent.addListener(gpin,'infowindowclose',function(){marker.closeInfoBubble.fire();});return gpin;},removeMarker:function(marker){var map=this.maps[this.api];map.removeOverlay(marker.proprietary_marker);},removeAllMarkers:function(){var map=this.maps[this.api];map.clearOverlays();},declutterMarkers:function(opts){throw'Not implemented';},addPolyline:function(polyline,old){var map=this.maps[this.api];gpolyline=polyline.toProprietary(this.api);map.addOverlay(gpolyline);return gpolyline;},removePolyline:function(polyline){var map=this.maps[this.api];map.removeOverlay(polyline.proprietary_polyline);},getCenter:function(){var map=this.maps[this.api];var pt=map.getCenter();var point=new mxn.LatLonPoint(pt.lat(),pt.lng());return point;},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);if(options&&options.pan)
{map.panTo(pt);}
else{map.setCenter(pt);}},setZoom:function(zoom){var map=this.maps[this.api];map.setZoom(zoom);},getZoom:function(){var map=this.maps[this.api];return map.getZoom();},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var gbox=new GLatLngBounds(sw.toProprietary(this.api),ne.toProprietary(this.api));var zoom=map.getBoundsZoomLevel(gbox);return zoom;},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:map.setMapType(G_NORMAL_MAP);break;case mxn.Mapstraction.SATELLITE:map.setMapType(G_SATELLITE_MAP);break;case mxn.Mapstraction.HYBRID:map.setMapType(G_HYBRID_MAP);break;default:map.setMapType(G_NORMAL_MAP);}},getMapType:function(){var map=this.maps[this.api];var type=map.getCurrentMapType();switch(type){case G_NORMAL_MAP:return mxn.Mapstraction.ROAD;case G_SATELLITE_MAP:return mxn.Mapstraction.SATELLITE;case G_HYBRID_MAP:return mxn.Mapstraction.HYBRID;default:return null;}},getBounds:function(){var map=this.maps[this.api];var ne,sw,nw,se;var gbox=map.getBounds();sw=gbox.getSouthWest();ne=gbox.getNorthEast();return new mxn.BoundingBox(sw.lat(),sw.lng(),ne.lat(),ne.lng());},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();var gbounds=new GLatLngBounds(new GLatLng(sw.lat,sw.lon),new GLatLng(ne.lat,ne.lon));map.setCenter(gbounds.getCenter(),map.getBoundsZoomLevel(gbounds));},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){var map=this.maps[this.api];map.getPane(G_MAP_MAP_PANE).appendChild(oContext.imgElm);this.setImageOpacity(id,opacity);this.setImagePosition(id);GEvent.bind(map,"zoomend",this,function(){this.setImagePosition(id);});GEvent.bind(map,"moveend",this,function(){this.setImagePosition(id);});},setImagePosition:function(id,oContext){var map=this.maps[this.api];var topLeftPoint;var bottomRightPoint;topLeftPoint=map.fromLatLngToDivPixel(new GLatLng(oContext.latLng.top,oContext.latLng.left));bottomRightPoint=map.fromLatLngToDivPixel(new GLatLng(oContext.latLng.bottom,oContext.latLng.right));oContext.pixels.top=topLeftPoint.y;oContext.pixels.left=topLeftPoint.x;oContext.pixels.bottom=bottomRightPoint.y;oContext.pixels.right=bottomRightPoint.x;},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];var geoXML=new GGeoXml(url);map.addOverlay(geoXML);if(autoCenterAndZoom){geoXML.gotoDefaultViewport(map);}},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){var copyright=new GCopyright(1,new GLatLngBounds(new GLatLng(-90,-180),new GLatLng(90,180)),0,"copyleft");var copyrightCollection=new GCopyrightCollection(copyright_text);copyrightCollection.addCopyright(copyright);var tilelayers=[];tilelayers[0]=new GTileLayer(copyrightCollection,min_zoom,max_zoom);tilelayers[0].isPng=function(){return true;};tilelayers[0].getOpacity=function(){return opacity;};tilelayers[0].getTileUrl=function(a,b){url=tile_url;url=url.replace(/\{Z\}/,b);url=url.replace(/\{X\}/,a.x);url=url.replace(/\{Y\}/,a.y);return url;};tileLayerOverlay=new GTileLayerOverlay(tilelayers[0]);this.tileLayers.push([tile_url,tileLayerOverlay,true]);this.maps[this.api].addOverlay(tileLayerOverlay);return tileLayerOverlay;},toggleTileLayer:function(tile_url){for(var f=0;f<this.tileLayers.length;f++){if(this.tileLayers[f][0]==tile_url){if(this.tileLayers[f][2]){this.maps[this.api].removeOverlay(this.tileLayers[f][1]);this.tileLayers[f][2]=false;}
else{this.maps[this.api].addOverlay(this.tileLayers[f][1]);this.tileLayers[f][2]=true;}}}},getPixelRatio:function(){var map=this.maps[this.api];var projection=G_NORMAL_MAP.getProjection();var centerPoint=map.getCenter();var zoom=map.getZoom();var centerPixel=projection.fromLatLngToPixel(centerPoint,zoom);var distancePoint=projection.fromPixelToLatLng(new GPoint(centerPixel.x+3,centerPixel.y+4),zoom);return 10000/distancePoint.distanceFrom(centerPoint);},mousePosition:function(element){var locDisp=document.getElementById(element);if(locDisp!==null){var map=this.maps[this.api];GEvent.addListener(map,'mousemove',function(point){var loc=point.lat().toFixed(4)+' / '+point.lng().toFixed(4);locDisp.innerHTML=loc;});locDisp.innerHTML='0.0000 / 0.0000';}}};this.LatLonPoint={toProprietary:function(){return new GLatLng(this.lat,this.lon);},fromProprietary:function(googlePoint){this.lat=googlePoint.lat();this.lon=googlePoint.lng();}};this.Marker={toProprietary:function(){var options={};if(this.labelText){options.title=this.labelText;}
if(this.iconUrl){var icon=new GIcon(G_DEFAULT_ICON,this.iconUrl);icon.printImage=icon.mozPrintImage=icon.image;if(this.iconSize){icon.iconSize=new GSize(this.iconSize[0],this.iconSize[1]);var anchor;if(this.iconAnchor){anchor=new GPoint(this.iconAnchor[0],this.iconAnchor[1]);}
else{anchor=new GPoint(this.iconSize[0]/2,this.iconSize[1]/2);}
icon.iconAnchor=anchor;}
if(this.iconShadowUrl){icon.shadow=this.iconShadowUrl;if(this.iconShadowSize){icon.shadowSize=new GSize(this.iconShadowSize[0],this.iconShadowSize[1]);}}
options.icon=icon;}
options.draggable=true;var gmarker=new GMarker(this.location.toProprietary('google'),options);if(!this.draggable){gmarker.disableDragging();}
if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action="mouseover";}
else{event_action="click";}
GEvent.addListener(gmarker,event_action,function(){gmarker.openInfoWindowHtml(theInfo,{maxWidth:100});});}
if(this.hoverIconUrl){GEvent.addListener(gmarker,"mouseover",function(){gmarker.setImage(this.hoverIconUrl);});GEvent.addListener(gmarker,"mouseout",function(){gmarker.setImage(this.iconUrl);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_action;if(this.hover){event_action="mouseover";}
else{event_action="click";}
GEvent.addListener(gmarker,event_action,function(){document.getElementById(div).innerHTML=theInfo;});}
return gmarker;},openBubble:function(){var gpin=this.proprietary_marker;gpin.openInfoWindowHtml(this.infoBubble);},hide:function(){this.proprietary_marker.hide();},show:function(){this.proprietary_marker.show();},update:function(){point=new mxn.LatLonPoint();point.fromGoogle(this.proprietary_marker.getPoint());this.location=point;}};this.Polyline={toProprietary:function(){var gpoints=[];var gpoly;for(var i=0,length=this.points.length;i<length;i++){gpoints.push(this.points[i].toProprietary('google'));}
if(this.closed||gpoints[0].equals(gpoints[length-1])){if(!gpoints[0].equals(gpoints[length-1])){gpoints.push(gpoints[0]);}
gpoly=new GPolygon(gpoints,this.color,this.width||4,this.opacity,this.fillColor||"#5462E3",this.opacity||"0.3");}else{gpoly=new GPolyline(gpoints,this.color,this.width||4,this.opacity);}
return gpoly;},show:function(){throw'Not implemented';},hide:function(){throw'Not implemented';}};};var google2D=new GoogleSettings();mxn.register('google',google2D);mxn.register('google',{MapstractionGeocoder:{init:function(element,api){var me=this;me.geocoders[api]=new GClientGeocoder();},geocode:function(address){var return_location={};var mapstraction_geocoder=this;if(address.address==null||address.address=="")
address.address=address.street+", "+address.locality+", "+address.region+", "+address.country
this.geocoders[this.api].getLocations(address.address,function(response){mapstraction_geocoder.geocode_callback(response,mapstraction_geocoder);});},geocode_callback:function(response,mapstraction_geocoder){var return_location={};if(!response||response.Status.code!=200){mapstraction_geocoder.error_callback(response);}else{return_location.street="";return_location.locality="";return_location.region="";return_location.country="";var place=response.Placemark[0];if(place.AddressDetails.Country.AdministrativeArea!=null){return_location.region=place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea!=null){if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality!=null){return_location.locality=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare!=null)
return_location.street=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;}}}
return_location.country=place.AddressDetails.Country.CountryNameCode;return_location.point=new mxn.LatLonPoint(place.Point.coordinates[1],place.Point.coordinates[0]);mapstraction_geocoder.callback(return_location);}}}})
mxn.register('google',{Mapstraction:{activateEdition:function(){var me=this;this.selectedFeature=null;if(typeof(this.handler)==="undefined"){this.handler=[];this.handler.activate=function(){if(me.selectedFeature!==null){if(me.selectedFeature.mapstraction_marker){me.selectedFeature.setImage(me.selectedFeature.mapstraction_marker.oldIcon);me.selectedFeature.mapstraction_marker.iconUrl=me.selectedFeature.mapstraction_marker.oldIcon;me.markerUnselected.fire({'marker':me.selectedFeature.mapstraction_marker});}else{me.selectedFeature.setStrokeStyle({"color":me.selectedFeature.mapstraction_polyline.oldColor});me.selectedFeature.mapstraction_polyline.color=me.selectedFeature.mapstraction_polyline.oldColor;me.polylineUnselected.fire({'polyline':me.selectedFeature.mapstraction_polyline});}}
me.selectedFeature=null;};}
this.click.addHandler(this.handler.activate);for(var i in this.markers){this.invoker.go('activateMarker',[this.markers[i]]);}
for(var j in this.polylines){this.invoker.go('activatePolyline',[this.polylines[j]]);}
document.onkeydown=function(e){vKeyCode=e.keyCode;if((vKeyCode==63272)||vKeyCode==46){if(me.selectedFeature!==null){if(me.selectedFeature.mapstraction_marker){me.removeMarker(me.selectedFeature.mapstraction_marker);}else{me.removePolyline(me.selectedFeature.mapstraction_polyline);}}
me.selectedFeature=null;}};},deactivateEdition:function(){this.click.fire();this.click.removeHandler(this.handler.activate);for(var i=0;i<this.markers.length;i++){this.markers[i].proprietary_marker.disableDragging();this.markers[i].click.removeHandler(this.markers[i].handler.activate);GEvent.clearListeners(this.markers[i].proprietary_marker,"dragend");}
for(var j in this.polylines){GEvent.clearListeners(this.polylines[j].proprietary_polyline,"mouseover");GEvent.clearListeners(this.polylines[j].proprietary_polyline,"mouseout");GEvent.clearListeners(this.polylines[j].proprietary_polyline,"lineupdated");GEvent.clearListeners(this.polylines[j].proprietary_polyline,"endline");GEvent.clearListeners(this.polylines[j].proprietary_polyline,"click");}},addFeature:function(feature,data){var map=this.maps[this.api];var me=this;switch(feature){case"point":var listener=GEvent.addListener(map,"click",function(overlay,latlng){if(latlng){GEvent.removeListener(listener);var marker=new mxn.Marker(new mxn.LatLonPoint(latlng.lat(),latlng.lng()));me.addMarkerWithData(marker,data);me.addingFeature=false;if(me.editionActive){me.invoker.go('activateMarker',[marker]);}}});break;case"polygon":case"linestring":var gpoly=new GPolyline([]);var poly=new mxn.Polyline([]);if(feature=="polygon"){poly.setClosed(true);}
map.addOverlay(gpoly);gpoly.enableDrawing({});GEvent.addListener(gpoly,"endline",function(){var points=[];me.addingFeature=false;for(var i=0;i<gpoly.getVertexCount();i++){var point=gpoly.getVertex(i);points.push(new mxn.LatLonPoint(point.lat(),point.lng()));}
poly.points=points;me.addPolylineWithData(poly,data);map.removeOverlay(gpoly);me.addingFeature=false;if(me.editionActive){me.invoker.go('activatePolyline',[poly]);}});break;}},activateMarker:function(marker){var me=this;marker.proprietary_marker.enableDragging();GEvent.addListener(marker.proprietary_marker,"dragend",function(newPoint){marker.location=new mxn.LatLonPoint(newPoint.lat(),newPoint.lng());me.markerChanged.fire({'marker':this.mapstraction_marker});});if(typeof(marker.handler==="undefined")){marker.handler=[];marker.handler.activate=function(event,marker){if(me.selectedFeature!==null){if(me.selectedFeature.mapstraction_marker){me.selectedFeature.setImage(me.selectedFeature.mapstraction_marker.oldIcon);me.selectedFeature.mapstraction_marker.iconUrl=me.selectedFeature.mapstraction_marker.oldIcon;me.markerUnselected.fire({'marker':me.selectedFeature.mapstraction_marker});}else{me.selectedFeature.setStrokeStyle({"color":me.selectedFeature.mapstraction_polyline.oldColor});me.selectedFeature.mapstraction_polyline.color=me.selectedFeature.mapstraction_polyline.oldColor;me.polylineUnselected.fire({'polyline':me.selectedFeature.mapstraction_polyline});}}
me.selectedFeature=marker.proprietary_marker;me.markerSelected.fire({'marker':me.selectedFeature.mapstraction_marker});if(typeof(marker.iconUrl)==="undefined"){marker.oldIcon="http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";}else{marker.oldIcon=marker.iconUrl;}
marker.proprietary_marker.setImage("http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png");marker.iconUrl="http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png";};}
marker.click.addHandler(marker.handler.activate);},activatePolyline:function(poly){var me=this;GEvent.addListener(poly.proprietary_polyline,"mouseover",function(){this.enableEditing();});GEvent.addListener(poly.proprietary_polyline,"mouseout",function(){this.disableEditing();});GEvent.addListener(poly.proprietary_polyline,"lineupdated",function(){var points=[];var equals=true;for(var i=0;i<this.getVertexCount();i++){var point=this.getVertex(i);var mapstractionPoint=new mxn.LatLonPoint(point.lat(),point.lng());points.push(mapstractionPoint);if(typeof(this.mapstraction_polyline.points[i])==="undefined"||!this.mapstraction_polyline.points[i].equals(mapstractionPoint)){equals=false;}}
if(!equals){this.mapstraction_polyline.points=points;me.polylineChanged.fire({'polyline':this.mapstraction_polyline});}});GEvent.addListener(poly.proprietary_polyline,"click",function(){if(me.selectedFeature!==null){if(me.selectedFeature.mapstraction_marker){me.selectedFeature.setImage(me.selectedFeature.mapstraction_marker.oldIcon);me.selectedFeature.mapstraction_marker.iconUrl=me.selectedFeature.mapstraction_marker.oldIcon;me.markerUnselected.fire({'marker':me.selectedFeature.mapstraction_marker});}else{me.selectedFeature.setStrokeStyle({"color":me.selectedFeature.mapstraction_polyline.oldColor});me.selectedFeature.mapstraction_polyline.color=me.selectedFeature.mapstraction_polyline.oldColor;me.polylineUnselected.fire({'polyline':me.selectedFeature.mapstraction_polyline});}}
me.selectedFeature=this;if(typeof(me.selectedFeature.mapstraction_polyline.color)==="undefined"){me.selectedFeature.mapstraction_polyline.oldColor="#0000FF";}else{me.selectedFeature.mapstraction_polyline.oldColor=me.selectedFeature.mapstraction_polyline.color;}
me.selectedFeature.mapstraction_polyline.color="#00FF00";me.selectedFeature.setStrokeStyle({"color":"#00FF00"});me.polylineSelected.fire({'polyline':me.selectedFeature.mapstraction_polyline});});}}});mxn.register('google3D',{Mapstraction:{init:function(element,api){var me=this;this.maps[api]=null;google.earth.createInstance(element,function initCallback(object){me.maps[api]=object;me.maps[api].getWindow().setVisibility(true);initMap();},function failureCallback(object){alert('failure creatin map');});},applyOptions:function(){var map=this.maps[this.api];},resizeTo:function(width,height){},addControls:function(args){var map=this.maps[this.api];},addSmallControls:function(){var map=this.maps[this.api];},addLargeControls:function(){var map=this.maps[this.api];},addMapTypeControls:function(){var map=this.maps[this.api];},dragging:function(on){var map=this.maps[this.api];},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);var lookAt=map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);lookAt.setLatitude(point.lat);lookAt.setLongitude(point.lon);lookAt.setRange(lookAt.getRange()/7.0);map.getView().setAbstractView(lookAt);},addMarker:function(marker,old){var map=this.maps[this.api];var pin=marker.toProprietary(this.api);return pin;},removeMarker:function(marker){var map=this.maps[this.api];},removeAllMarkers:function(){var map=this.maps[this.api];},declutterMarkers:function(opts){var map=this.maps[this.api];},addPolyline:function(polyline,old){var map=this.maps[this.api];var pl=polyline.toProprietary(this.api);return pl;},removePolyline:function(polyline){var map=this.maps[this.api];},getCenter:function(){var point;var map=this.maps[this.api];var lookAt=map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);point=new mxn.LatLonPoint(lookAt.getLatitude(),lookAt.getLongitude());return point;},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);if(options&&options.pan){}
else{}},setZoom:function(zoom){var map=this.maps[this.api];},getZoom:function(){var map=this.maps[this.api];var zoom=5;return zoom;},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var zoom;return zoom;},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:break;case mxn.Mapstraction.SATELLITE:break;case mxn.Mapstraction.HYBRID:break;default:}},getMapType:function(){var map=this.maps[this.api];},getBounds:function(){var map=this.maps[this.api];},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){var map=this.maps[this.api];},setImagePosition:function(id,oContext){var map=this.maps[this.api];var topLeftPoint;var bottomRightPoint;},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){var map=this.maps[this.api];var me=this;google.earth.fetchKml(map,tile_url,function(kmlObject){if(kmlObject)
{map.getFeatures().appendChild(kmlObject);me.tileLayers.push([tile_url,kmlObject,true]);}
else
{alert('Fichero KML.incorrecto');}});},toggleTileLayer:function(tile_url){var map=this.maps[this.api];for(var f=0;f<this.tileLayers.length;f++){if(this.tileLayers[f][0]==tile_url){if(this.tileLayers[f][2]){map.getFeatures().removeChild(this.tileLayers[f][1]);this.tileLayers[f][2]=false;}
else{map.getFeatures().appendChild(this.tileLayers[f][1]);this.tileLayers[f][2]=true;}}}},getPixelRatio:function(){var map=this.maps[this.api];},mousePosition:function(element){var map=this.maps[this.api];}},LatLonPoint:{toProprietary:function(){},fromProprietary:function(googlePoint){}},Marker:{toProprietary:function(){},openBubble:function(){},hide:function(){},show:function(){},update:function(){}},Polyline:{toProprietary:function(){},show:function(){},hide:function(){}}});var MicrosoftSettings=function(){this.Mapstraction={init:function(element,api){var me=this;me.onShape=null;if(VEMap){this.maps[api]=new VEMap(element.id);this.maps[api].AttachEvent('onmouseover',function(event){var mmarker=me.maps[api].GetShapeByID(event.elementID);me.onShape=mmarker.mapstraction_marker;});this.maps[api].AttachEvent('onmouseout',function(event){me.onShape=null;});this.maps[api].AttachEvent('onclick',function(event){if(me.onShape===null){var location;if(typeof(event.mapX)=="undefined"){location=event.latLong;}else{var x=event.mapX;var y=event.mapY;var pixel=new VEPixel(x,y);location=me.maps[api].PixelToLatLong(pixel);}
me.clickHandler(location.Latitude,location.Longitude,me);me.click.fire({'location':new mxn.LatLonPoint(location.Latitude,location.Longitude)});}else{me.onShape.click.fire();me.onShape=null;}});this.maps[api].AttachEvent('onendzoom',function(event){me.changeZoom.fire();});this.maps[api].AttachEvent('onchangeview',function(event){me.endPan.fire();});this.maps[api].LoadMap();document.getElementById("MSVE_obliqueNotification").style.visibility="hidden";this.loaded[api]=true;me.load.fire();}
else{alert(api+' map script not imported');}},applyOptions:function(){var map=this.maps[this.api];if(this.options.enableScrollWheelZoom){map.enableContinuousZoom();map.enableScrollWheelZoom();}},resizeTo:function(width,height){this.maps[this.api].Resize(width,height);},addControls:function(args){var map=this.maps[this.api];if(args.pan){map.SetDashboardSize(VEDashboardSize.Normal);}
else{map.SetDashboardSize(VEDashboardSize.Tiny);}
if(args.zoom=='large'){map.SetDashboardSize(VEDashboardSize.Small);}
else if(args.zoom=='small'){map.SetDashboardSize(VEDashboardSize.Tiny);}
else{map.HideDashboard();map.HideScalebar();}},addSmallControls:function(){var map=this.maps[this.api];map.SetDashboardSize(VEDashboardSize.Tiny);this.addControlsArgs.pan=true;this.addControlsArgs.zoom='small';},addLargeControls:function(){var map=this.maps[this.api];map.SetDashboardSize(VEDashboardSize.Normal);this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';},addMapTypeControls:function(){var map=this.maps[this.api];map.addTypeControl();},dragging:function(on){var map=this.maps[this.api];if(on){map.enableDragMap();}
else{map.disableDragMap();}},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);var vzoom=zoom;map.SetCenterAndZoom(new VELatLong(point.lat,point.lon),vzoom);},addMarker:function(marker,old){var map=this.maps[this.api];var pin=marker.toProprietary(this.api);map.AddShape(pin);return pin;},removeMarker:function(marker){var map=this.maps[this.api];map.DeleteShape(marker.proprietary_marker);},removeAllMarkers:function(){var map=this.maps[this.api];map.DeleteAllShapes();},declutterMarkers:function(opts){var map=this.maps[this.api];},addPolyline:function(polyline,old){var map=this.maps[this.api];var pl=polyline.toProprietary(this.api);pl.HideIcon();map.AddShape(pl);return pl;},removePolyline:function(polyline){var map=this.maps[this.api];map.DeleteShape(polyline.proprietary_polyline);},getCenter:function(){var map=this.maps[this.api];var LL=map.GetCenter();var point=new mxn.LatLonPoint(LL.Latitude,LL.Longitude);return point;},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);map.SetCenter(new VELatLong(point.lat,point.lon));},setZoom:function(zoom){var map=this.maps[this.api];map.SetZoomLevel(zoom);},getZoom:function(){var map=this.maps[this.api];var zoom=map.GetZoomLevel();return zoom;},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var zoom;return zoom;},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:map.SetMapStyle(VEMapStyle.Road);break;case mxn.Mapstraction.SATELLITE:map.SetMapStyle(VEMapStyle.Aerial);break;case mxn.Mapstraction.HYBRID:map.SetMapStyle(VEMapStyle.Hybrid);break;default:map.SetMapStyle(VEMapStyle.Road);}},getMapType:function(){var map=this.maps[this.api];var mode=map.GetMapStyle();switch(mode){case VEMapStyle.Aerial:return mxn.Mapstraction.SATELLITE;case VEMapStyle.Road:return mxn.Mapstraction.ROAD;case VEMapStyle.Hybrid:return mxn.Mapstraction.HYBRID;default:return null;}},getBounds:function(){var map=this.maps[this.api];view=map.GetMapView();var topleft=view.TopLeftLatLong;var bottomright=view.BottomRightLatLong;return new mxn.BoundingBox(bottomright.Latitude,topleft.Longitude,topleft.Latitude,bottomright.Longitude);},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();var rec=new VELatLongRectangle(new VELatLong(ne.lat,ne.lon),new VELatLong(sw.lat,sw.lon));map.SetMapView(rec);},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){var map=this.maps[this.api];},setImagePosition:function(id,oContext){var map=this.maps[this.api];var topLeftPoint;var bottomRightPoint;},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];var layer=new VEShapeLayer();var mlayerspec=new VEShapeSourceSpecification(VEDataType.GeoRSS,url,layer);map.ImportShapeLayerData(mlayerspec)},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){var map=this.maps[this.api];var tileSourceSpec=new VETileSourceSpecification(tile_url,tile_url);tileSourceSpec.Opacity=opacity;tileSourceSpec.MinZoom=min_zoom;tileSourceSpec.MaxZoom=max_zoom;this.tileLayers.push([tile_url,tileSourceSpec.ID,true]);map.AddTileLayer(tileSourceSpec,true);},toggleTileLayer:function(tile_url){var map=this.maps[this.api];for(var f=0;f<this.tileLayers.length;f++){if(this.tileLayers[f][0]==tile_url){if(this.tileLayers[f][2]){map.HideTileLayer(this.tileLayers[f][1]);this.tileLayers[f][2]=false;}
else{map.ShowTileLayer(this.tileLayers[f][1]);this.tileLayers[f][2]=true;}}}},getPixelRatio:function(){throw'Not implemented';},mousePosition:function(element){throw'Not implemented';}};this.LatLonPoint={toProprietary:function(){return new VELatLong(this.lat,this.lon);},fromProprietary:function(mpoint){this.lat=mpoint.Latitude;this.lon=mpoint.Longitude;}};this.Marker={toProprietary:function(){var mmarker=new VEShape(VEShapeType.Pushpin,this.location.toProprietary('microsoft'));if(this.infoBubble){mmarker.SetDescription(this.infoBubble);}
if(this.labelText){mmarker.setTitle(this.labelText);}
if(this.iconUrl){var icon=new VECustomIconSpecification();icon.Image=this.iconUrl;mmarker.SetCustomIcon(icon);}
return mmarker;},openBubble:function(){var mmarker=this.proprietary_marker;map.ClearInfoBoxStyles();mmarker.SetTitle(this.infoBubble);},hide:function(){this.proprietary_marker.Hide();},show:function(){this.proprietary_marker.Show();},update:function(){throw'Not implemented';}};this.Polyline={toProprietary:function(){var mpoints=[];var mpolyline;for(var i=0,length=this.points.length;i<length;i++)
{mpoints.push(this.points[i].toProprietary('microsoft'));}
if(this.closed||this.points[0].equals(this.points[length-1])){mpolyline=new VEShape(VEShapeType.Polygon,mpoints);}else{mpolyline=new VEShape(VEShapeType.Polyline,mpoints);}
if(this.color){var color=new mxn.util.Color(this.color);var opacity=(typeof(this.opacity)=='undefined'||this.opacity===null)?1.0:this.opacity;var vecolor=new VEColor(color.red,color.green,color.blue,opacity);mpolyline.SetLineColor(vecolor);}
if(this.fillColor){var color=new mxn.util.Color(this.fillColor);var opacity=(typeof(this.opacity)=='undefined'||this.opacity===null)?0.5:this.opacity;var vecolor=new VEColor(color.red,color.green,color.blue,opacity);mpolyline.SetFillColor(vecolor);}
if(this.width){mpolyline.SetLineWidth(this.width);}
return mpolyline;},show:function(){this.proprietary_polyline.Show();},hide:function(){this.proprietary_polyline.Hide();}};};var microsoft2D=new MicrosoftSettings();mxn.register('microsoft',microsoft2D);var microsoft3D=new MicrosoftSettings();microsoft3D.Mapstraction.init=function(element,api){var me=this;me.onShape=null;if(VEMap){this.maps[api]=new VEMap(element.id);this.maps[api].AttachEvent('onmouseover',function(event){var mmarker=me.maps[api].GetShapeByID(event.elementID);me.onShape=mmarker.mapstraction_marker;});this.maps[api].AttachEvent('onmouseout',function(event){me.onShape=null;});this.maps[api].AttachEvent('onclick',function(event){if(me.onShape===null){var location;if(typeof(event.mapX)=="undefined"){location=event.latLong;}else{var x=event.mapX;var y=event.mapY;var pixel=new VEPixel(x,y);location=me.maps[api].PixelToLatLong(pixel);}
me.clickHandler(location.Latitude,location.Longitude,me);me.click.fire({'location':new mxn.LatLonPoint(location.Latitude,location.Longitude)});}else{me.onShape.click.fire();me.onShape=null;}});this.maps[api].AttachEvent('onendzoom',function(event){me.moveendHandler(me);me.changeZoom.fire();});this.maps[api].AttachEvent('onchangeview',function(event){me.endPan.fire();});this.maps[api].LoadMap();this.maps[api].SetMapMode(VEMapMode.Mode3D);document.getElementById("MSVE_obliqueNotification").style.visibility="hidden";this.loaded[api]=true;me.load.fire();}
else{alert(api+' map script not imported');}};mxn.register('microsoft3D',microsoft3D);var microsoft2D=new GenericInteractivity();microsoft2D.Mapstraction.iconURL=function(state){return this.src+"icons/microsoft/microsoft-"+state+".png";};mxn.register('microsoft',microsoft2D);var microsoft3D=new GenericInteractivity();microsoft3D.Mapstraction.iconURL=function(state){return this.src+"icons/microsoft/microsoft-"+state+".png";};mxn.register('microsoft3D',microsoft3D);mxn.register('worldwind',{Mapstraction:{init:function(element,api){var me=this;element.innerHTML='<applet id="wwjApplet" name="wwjApplet" mayscript code="org.jdesktop.applet.util.JNLPAppletLauncher" width=100% height=100%"'+'archive="http://idelab.uva.es/public/idelabmapstraction/scripts/idelabmapstraction/downloads/1.0/jar/applet-launcher.jar, http://idelab.uva.es/public/idelabmapstraction/scripts/idelabmapstraction/downloads/1.0/jar/worldwind.jar, http://idelab.uva.es/public/idelabmapstraction/scripts/idelabmapstraction/downloads/1.0/jar/WWJApplet.jar, http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar, http://download.java.net/media/gluegen/webstart/gluegen-rt.jar">'+'<param name="jnlp_href" value="http://mvn.idelab.uva.es/idelabmapstraction/downloads/1.0/jar//WWJApplet.jnlp">'+'<param name="codebase_lookup" value="false">'+'<param name="subapplet.classname" value="gov.nasa.worldwind.examples.applet.WWJApplet">'+'<param name="subapplet.displayname" value="WWJ Applet">'+'<param name="noddraw.check" value="true">'+'<param name="progressbar" value="true">'+'<param name="jnlpNumExtensions" value="1">'+'<param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp">'+'<param name="InitialLatitude" value="40">'+'<param name="InitialLongitude" value="-3">'+'<param name="InitialAltitude" value="5113000">'+'<param name="InitialHeading" value="0">'+'<param name="InitialPitch" value="0">'+'/applet>'
var theApplet=document.getElementById('wwjApplet');try{theApplet=theApplet.getSubApplet();}catch(e){}
this.maps[this.api]=theApplet;},applyOptions:function(){var map=this.maps[this.api];},resizeTo:function(width,height){},addControls:function(args){var map=this.maps[this.api];},addSmallControls:function(){var map=this.maps[this.api];},addLargeControls:function(){var map=this.maps[this.api];},addMapTypeControls:function(){var map=this.maps[this.api];},dragging:function(on){var map=this.maps[this.api];},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);},addMarker:function(marker,old){var map=this.maps[this.api];var pin=marker.toProprietary(this.api);return pin;},removeMarker:function(marker){var map=this.maps[this.api];},removeAllMarkers:function(){var map=this.maps[this.api];},declutterMarkers:function(opts){var map=this.maps[this.api];},addPolyline:function(polyline,old){var map=this.maps[this.api];var pl=polyline.toProprietary(this.api);return pl;},removePolyline:function(polyline){var map=this.maps[this.api];},getCenter:function(){var point;var map=this.maps[this.api];return point;},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);if(options&&options['pan']){}
else{}},setZoom:function(zoom){var map=this.maps[this.api];},getZoom:function(){var map=this.maps[this.api];var zoom;return zoom;},getZoomLevelForBoundingBox:function(bbox){var map=this.maps[this.api];var ne=bbox.getNorthEast();var sw=bbox.getSouthWest();var zoom;return zoom;},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:break;case mxn.Mapstraction.SATELLITE:break;case mxn.Mapstraction.HYBRID:break;default:}},getMapType:function(){var map=this.maps[this.api];},getBounds:function(){var map=this.maps[this.api];},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){var map=this.maps[this.api];},setImagePosition:function(id,oContext){var map=this.maps[this.api];var topLeftPoint;var bottomRightPoint;},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){var map=this.maps[this.api];map.addTileLayer(tile_url);this.tileLayers.push([tile_url,tile_url,true]);},toggleTileLayer:function(tile_url){var map=this.maps[this.api];map.toggleTileLayer(tile_url);},getPixelRatio:function(){var map=this.maps[this.api];},mousePosition:function(element){var map=this.maps[this.api];}},LatLonPoint:{toProprietary:function(){},fromProprietary:function(googlePoint){}},Marker:{toProprietary:function(){},openBubble:function(){},hide:function(){},show:function(){},update:function(){}},Polyline:{toProprietary:function(){},show:function(){},hide:function(){}}});mxn.register('yahoo',{Mapstraction:{init:function(element,api){var me=this;if(YMap){this.maps[api]=new YMap(element);YEvent.Capture(this.maps[api],EventsList.MouseClick,function(event,location){me.clickHandler(location.Lat,location.Lon,location,me);me.click.fire({'location':new mxn.LatLonPoint(location.Lat,location.Lon)});});YEvent.Capture(this.maps[api],EventsList.changeZoom,function(){me.moveendHandler(me);me.changeZoom.fire();});YEvent.Capture(this.maps[api],EventsList.endPan,function(){me.moveendHandler(me);me.endPan.fire();});YEvent.Capture(this.maps[api],EventsList.endAutoPan,function(){me.endPan.fire();});this.loaded[api]=true;me.load.fire();}
else{alert(api+' map script not imported');}},applyOptions:function(){if(this.options.enableScrollWheelZoom){map.enableContinuousZoom();map.enableScrollWheelZoom();}},resizeTo:function(width,height){this.maps[this.api].resizeTo(new YSize(width,height));},addControls:function(args){var map=this.maps[this.api];if(args.pan){map.addPanControl();}
else{map.addPanControl();map.removePanControl();}
if(args.zoom=='large'){map.addZoomLong();}
else if(args.zoom=='small'){map.addZoomShort();}
else{map.removeZoomScale();}},addSmallControls:function(){var map=this.maps[this.api];map.addPanControl();map.addZoomShort();this.addControlsArgs.pan=true;this.addControlsArgs.zoom='small';},addLargeControls:function(){var map=this.maps[this.api];map.addPanControl();map.addZoomLong();this.addControlsArgs.pan=true;this.addControlsArgs.zoom='large';},addMapTypeControls:function(){var map=this.maps[this.api];map.addTypeControl();},dragging:function(on){var map=this.maps[this.api];if(on){map.enableDragMap();}else{map.disableDragMap();}},setCenterAndZoom:function(point,zoom){var map=this.maps[this.api];var pt=point.toProprietary(this.api);var yzoom=18-zoom;map.drawZoomAndCenter(pt,yzoom);},addMarker:function(marker,old){var map=this.maps[this.api];var pin=marker.toProprietary(this.api);map.addOverlay(pin);YEvent.Capture(pin,EventsList.MouseClick,function(){marker.click.fire();});YEvent.Capture(pin,EventsList.openSmartWindow,function(){marker.openInfoBubble.fire();});YEvent.Capture(pin,EventsList.closeSmartWindow,function(){marker.closeInfoBubble.fire();});return pin;},removeMarker:function(marker){var map=this.maps[this.api];map.removeOverlay(marker.proprietary_marker);},removeAllMarkers:function(){var map=this.maps[this.api];map.removeMarkersAll();},declutterMarkers:function(opts){throw'Not implemented';},addPolyline:function(polyline,old){var map=this.maps[this.api];var pl=polyline.toProprietary(this.api);map.addOverlay(pl);return pl;},removePolyline:function(polyline){var map=this.maps[this.api];map.removeOverlay(polyline.proprietary_polyline);},getCenter:function(){var map=this.maps[this.api];var pt=map.getCenterLatLon();var point=new mxn.LatLonPoint(pt.Lat,pt.Lon);return point;},setCenter:function(point,options){var map=this.maps[this.api];var pt=point.toProprietary(this.api);map.panToLatLon(pt);},setZoom:function(zoom){var map=this.maps[this.api];var yzoom=18-zoom;map.setZoomLevel(yzoom);},getZoom:function(){var map=this.maps[this.api];return 18-map.getZoomLevel();},getZoomLevelForBoundingBox:function(bbox){throw'Not implemented';},setMapType:function(type){var map=this.maps[this.api];switch(type){case mxn.Mapstraction.ROAD:map.setMapType(YAHOO_MAP_REG);break;case mxn.Mapstraction.SATELLITE:map.setMapType(YAHOO_MAP_SAT);break;case mxn.Mapstraction.HYBRID:map.setMapType(YAHOO_MAP_HYB);break;default:map.setMapType(YAHOO_MAP_REG);}},getMapType:function(){var map=this.maps[this.api];var type=map.getCurrentMapType();switch(type){case YAHOO_MAP_REG:return mxn.Mapstraction.ROAD;case YAHOO_MAP_SAT:return mxn.Mapstraction.SATELLITE;case YAHOO_MAP_HYB:return mxn.Mapstraction.HYBRID;default:return null;}},getBounds:function(){var map=this.maps[this.api];var ybox=map.getBoundsLatLon();return new mxn.BoundingBox(ybox.LatMin,ybox.LonMin,ybox.LatMax,ybox.LonMax);},setBounds:function(bounds){var map=this.maps[this.api];var sw=bounds.getSouthWest();var ne=bounds.getNorthEast();if(sw.lon>ne.lon){sw.lon-=360;}
var center=new YGeoPoint((sw.lat+ne.lat)/2,(ne.lon+sw.lon)/2);var container=map.getContainerSize();for(var zoom=1;zoom<=17;zoom++){var sw_pix=mxn.util.convertLatLonXY_Yahoo(sw,zoom);var ne_pix=mxn.util.convertLatLonXY_Yahoo(ne,zoom);if(sw_pix.x>ne_pix.x){sw_pix.x-=(1<<(26-zoom));}
if(Math.abs(ne_pix.x-sw_pix.x)<=container.width&&Math.abs(ne_pix.y-sw_pix.y)<=container.height){map.drawZoomAndCenter(center,zoom);break;}}},addImageOverlay:function(id,src,opacity,west,south,east,north,oContext){throw'Not implemented';},setImagePosition:function(id){throw'Not implemented';},addOverlay:function(url,autoCenterAndZoom){var map=this.maps[this.api];map.addOverlay(new YGeoRSS(url));},addTileLayer:function(tile_url,opacity,copyright_text,min_zoom,max_zoom){throw'Not implemented';},toggleTileLayer:function(tile_url){throw'Not implemented';},getPixelRatio:function(){throw'Not implemented';},mousePosition:function(element){throw'Not implemented';}},LatLonPoint:{toProprietary:function(){return new YGeoPoint(this.lat,this.lon);},fromProprietary:function(yahooPoint){this.lat=yahooPoint.Lat;this.lon=yahooPoint.Lon;}},Marker:{toProprietary:function(){var ymarker;var size;if(this.iconSize){size=new YSize(this.iconSize[0],this.iconSize[1]);}
if(this.iconUrl){if(this.iconSize){ymarker=new YMarker(this.location.toProprietary('yahoo'),new YImage(this.iconUrl,size));}else{ymarker=new YMarker(this.location.toProprietary('yahoo'),new YImage(this.iconUrl));}}
else{if(this.iconSize){ymarker=new YMarker(this.location.toProprietary('yahoo'),null,size);}else{ymarker=new YMarker(this.location.toProprietary('yahoo'));}}
if(this.labelText){ymarker.addLabel(this.labelText);}
if(this.infoBubble){var theInfo=this.infoBubble;var event_action;if(this.hover){event_action=EventsList.MouseOver;}
else{event_action=EventsList.MouseClick;}
YEvent.Capture(ymarker,event_action,function(){ymarker.openSmartWindow(theInfo);});}
if(this.infoDiv){var theInfo=this.infoDiv;var div=this.div;var event_div;var event_action;if(this.hover){event_action=EventsList.MouseOver;}
else{event_action=EventsList.MouseClick;}
YEvent.Capture(ymarker,event_action,function(){document.getElementById(div).innerHTML=theInfo;});}
return ymarker;},openBubble:function(){var ypin=this.proprietary_marker;ypin.openSmartWindow(this.infoBubble);},hide:function(){this.proprietary_marker.hide();},show:function(){this.proprietary_marker.unhide();},update:function(){throw'Not implemented';}},Polyline:{toProprietary:function(){var ypolyline;var ypoints=[];for(var i=0,length=this.points.length;i<length;i++){ypoints.push(this.points[i].toProprietary(this.api));}
if(this.closed&&!this.points[0].equals(this.points[this.points.length-1])){ypoints.push(ypoints[0]);ypolyline=new YPolyline(ypoints,this.color,this.width,this.opacity);}else{ypolyline=new YPolyline(ypoints,this.color,this.width,this.opacity);}
return ypolyline;},show:function(){throw'Not implemented';},hide:function(){throw'Not implemented';}}});var yahoo=new GenericInteractivity();yahoo.Mapstraction.iconURL=function(state){return this.src+"icons/yahoo/yahoo-"+state+".png";};mxn.register('yahoo',yahoo);