diff --git a/lib/router.php b/lib/router.php index eff88bb462..ca895c8bb6 100644 --- a/lib/router.php +++ b/lib/router.php @@ -55,14 +55,14 @@ class StatusNet_URL_Mapper extends Net_URL_Mapper $result = null; if (Event::handle('StartConnectPath', array(&$path, &$defaults, &$rules, &$result))) { $result = parent::connect($path, $defaults, $rules); - if (array_key_exists('action', $defaults)) { - $action = $defaults['action']; - } elseif (array_key_exists('action', $rules)) { - $action = $rules['action']; - } else { - $action = null; - } - $this->_mapAction($action, $result); + if (array_key_exists('action', $defaults)) { + $action = $defaults['action']; + } elseif (array_key_exists('action', $rules)) { + $action = $rules['action']; + } else { + $action = null; + } + $this->_mapAction($action, $result); Event::handle('EndConnectPath', array($path, $defaults, $rules, $result)); } return $result; @@ -70,31 +70,31 @@ class StatusNet_URL_Mapper extends Net_URL_Mapper protected function _mapAction($action, $path) { - if (!array_key_exists($action, $this->_actionToPath)) { - $this->_actionToPath[$action] = array(); - } - $this->_actionToPath[$action][] = $path; - return; + if (!array_key_exists($action, $this->_actionToPath)) { + $this->_actionToPath[$action] = array(); + } + $this->_actionToPath[$action][] = $path; + return; } public function generate($values = array(), $qstring = array(), $anchor = '') { - if (!array_key_exists('action', $values)) { - return parent::generate($values, $qstring, $anchor); - } + if (!array_key_exists('action', $values)) { + return parent::generate($values, $qstring, $anchor); + } - $action = $values['action']; + $action = $values['action']; - if (!array_key_exists($action, $this->_actionToPath)) { - return parent::generate($values, $qstring, $anchor); - } + if (!array_key_exists($action, $this->_actionToPath)) { + return parent::generate($values, $qstring, $anchor); + } - $oldPaths = $this->paths; - $this->paths = $this->_actionToPath[$action]; - $result = parent::generate($values, $qstring, $anchor); - $this->paths = $oldPaths; + $oldPaths = $this->paths; + $this->paths = $this->_actionToPath[$action]; + $result = parent::generate($values, $qstring, $anchor); + $this->paths = $oldPaths; - return $result; + return $result; } } @@ -127,19 +127,19 @@ class Router function __construct() { if (empty($this->m)) { - if (!common_config('router', 'cache')) { + if (!common_config('router', 'cache')) { $this->m = $this->initialize(); - } else { - $k = self::cacheKey(); - $c = Cache::instance(); - $m = $c->get($k); - if (!empty($m)) { - $this->m = $m; - } else { - $this->m = $this->initialize(); - $c->set($k, $this->m); - } - } + } else { + $k = self::cacheKey(); + $c = Cache::instance(); + $m = $c->get($k); + if (!empty($m)) { + $this->m = $m; + } else { + $this->m = $this->initialize(); + $c->set($k, $this->m); + } + } } } @@ -199,7 +199,7 @@ class Router 'deleteuser', 'geocode', 'version', - ); + ); foreach ($main as $a) { $m->connect('main/'.$a, array('action' => $a)); @@ -222,8 +222,8 @@ class Router array('action' => 'publicxrds')); $m->connect('.well-known/host-meta', array('action' => 'hostmeta')); - $m->connect('main/xrd', - array('action' => 'userxrd')); + $m->connect('main/xrd', + array('action' => 'userxrd')); // these take a code @@ -248,19 +248,19 @@ class Router } $m->connect('settings/oauthapps/show/:id', - array('action' => 'showapplication'), - array('id' => '[0-9]+') + array('action' => 'showapplication'), + array('id' => '[0-9]+') ); $m->connect('settings/oauthapps/new', - array('action' => 'newapplication') + array('action' => 'newapplication') ); $m->connect('settings/oauthapps/edit/:id', - array('action' => 'editapplication'), - array('id' => '[0-9]+') + array('action' => 'editapplication'), + array('id' => '[0-9]+') ); $m->connect('settings/oauthapps/delete/:id', - array('action' => 'deleteapplication'), - array('id' => '[0-9]+') + array('action' => 'deleteapplication'), + array('id' => '[0-9]+') ); // search @@ -951,14 +951,14 @@ class Router $qpos = strpos($url, '?'); if ($qpos !== false) { $url = substr($url, 0, $qpos+1) . - str_replace('?', '&', substr($url, $qpos+1)); + str_replace('?', '&', substr($url, $qpos+1)); // @fixme this is a hacky workaround for http_build_query in the // lower-level code and bad configs that set the default separator // to & instead of &. Encoded &s in parameters will not be // affected. $url = substr($url, 0, $qpos+1) . - str_replace('&', '&', substr($url, $qpos+1)); + str_replace('&', '&', substr($url, $qpos+1)); } diff --git a/lib/xrd.php b/lib/xrd.php index c8cffed9cd..9c6d9f3ab7 100644 --- a/lib/xrd.php +++ b/lib/xrd.php @@ -130,14 +130,24 @@ class XRD foreach ($this->links as $link) { $titles = array(); + $properties = array(); if (isset($link['title'])) { $titles = $link['title']; unset($link['title']); } + if (isset($link['property'])) { + $properties = $link['property']; + unset($link['property']); + } $xs->elementStart('Link', $link); foreach ($titles as $title) { $xs->element('Title', null, $title); } + foreach ($properties as $property) { + $xs->element('Property', + array('type' => $property['type']), + $property['value']); + } $xs->elementEnd('Link'); } diff --git a/lib/xrdaction.php b/lib/xrdaction.php index 43826b32bb..4377eab943 100644 --- a/lib/xrdaction.php +++ b/lib/xrdaction.php @@ -53,54 +53,67 @@ class XrdAction extends Action $xrd->subject = self::normalize($this->uri); } - if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) { + if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) { - // Possible aliases for the user + // Possible aliases for the user - $uris = array($this->user->uri, $profile->profileurl); + $uris = array($this->user->uri, $profile->profileurl); - // FIXME: Webfinger generation code should live somewhere on its own + // FIXME: Webfinger generation code should live somewhere on its own - $path = common_config('site', 'path'); + $path = common_config('site', 'path'); - if (empty($path)) { - $uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server')); - } + if (empty($path)) { + $uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server')); + } - foreach ($uris as $uri) { - if ($uri != $xrd->subject) { - $xrd->alias[] = $uri; - } - } + foreach ($uris as $uri) { + if ($uri != $xrd->subject) { + $xrd->alias[] = $uri; + } + } - Event::handle('EndXrdActionAliases', array(&$xrd, $this->user)); - } + Event::handle('EndXrdActionAliases', array(&$xrd, $this->user)); + } - if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) { + if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) { - $xrd->links[] = array('rel' => self::PROFILEPAGE, - 'type' => 'text/html', - 'href' => $profile->profileurl); + $xrd->links[] = array('rel' => self::PROFILEPAGE, + 'type' => 'text/html', + 'href' => $profile->profileurl); - // hCard - $xrd->links[] = array('rel' => self::HCARD, - 'type' => 'text/html', - 'href' => common_local_url('hcard', array('nickname' => $nick))); + // hCard + $xrd->links[] = array('rel' => self::HCARD, + 'type' => 'text/html', + 'href' => common_local_url('hcard', array('nickname' => $nick))); - // XFN - $xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11', - 'type' => 'text/html', - 'href' => $profile->profileurl); - // FOAF - $xrd->links[] = array('rel' => 'describedby', - 'type' => 'application/rdf+xml', - 'href' => common_local_url('foaf', - array('nickname' => $nick))); + // XFN + $xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11', + 'type' => 'text/html', + 'href' => $profile->profileurl); + // FOAF + $xrd->links[] = array('rel' => 'describedby', + 'type' => 'application/rdf+xml', + 'href' => common_local_url('foaf', + array('nickname' => $nick))); + $xrd->links[] = array('rel' => 'http://apinamespace.org/atom', + 'type' => 'application/atomsvc+xml', + 'href' => common_local_url('ApiAtomService', array('id' => $nick))); - Event::handle('EndXrdActionLinks', array(&$xrd, $this->user)); - } - + if (common_config('site', 'fancy')) { + $apiRoot = common_path('api/', true); + } else { + $apiRoot = common_path('index.php/api/', true); + } + + $xrd->links[] = array('rel' => 'http://apinamespace.org/twitter', + 'href' => $apiRoot, + 'property' => array(array('type' => 'http://apinamespace.org/twitter/username', + 'value' => $nick))); + + Event::handle('EndXrdActionLinks', array(&$xrd, $this->user)); + } header('Content-type: application/xrd+xml'); print $xrd->toXML(); diff --git a/plugins/InProcessCache/InProcessCachePlugin.php b/plugins/InProcessCache/InProcessCachePlugin.php new file mode 100644 index 0000000000..1b6fbcdbea --- /dev/null +++ b/plugins/InProcessCache/InProcessCachePlugin.php @@ -0,0 +1,197 @@ +. + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Extra level of caching + * + * This plugin adds an extra level of in-process caching to any regular + * cache system like APC, XCache, or Memcache. + * + * Note that since most caching plugins return false for StartCache* + * methods, you should add this plugin before them, i.e. + * + * addPlugin('InProcessCache'); + * addPlugin('XCache'); + * + * @category Cache + * @package StatusNet + * @author Evan Prodromou + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class InProcessCachePlugin extends Plugin +{ + private $_items = array(); + private $_hits = array(); + + /** + * Get an item from the cache + * + * Called before other cache systems are called (iif this + * plugin was loaded correctly, see class comment). If we + * have the data, return it, and don't hit the other cache + * systems. + * + * @param string &$key Key to fetch + * @param mixed &$value Resulting value or false for miss + * + * @return boolean false if found, else true + */ + + function onStartCacheGet(&$key, &$value) + { + if (array_key_exists($key, $this->_items)) { + $value = $this->_items[$key]; + if (array_key_exists($key, $this->_hits)) { + $this->_hits[$key]++; + } else { + $this->_hits[$key] = 1; + } + Event::handle('EndCacheGet', array($key, &$value)); + return false; + } + return true; + } + + /** + * Called at the end of a cache get + * + * If we don't already have the data, we cache it. This + * keeps us from having to call the external cache if the + * key is requested again. + * + * @param string $key Key to fetch + * @param mixed &$value Resulting value or false for miss + * + * @return boolean hook value, true + */ + + function onEndCacheGet($key, &$value) + { + if (!array_key_exists($key, $this->_items) || + $this->_items[$key] != $value) { + $this->_items[$key] = $value; + } + return true; + } + + /** + * Called at the end of setting a cache element + * + * Always set the cache element; may overwrite existing + * data. + * + * @param string $key Key to fetch + * @param mixed $value Resulting value or false for miss + * @param integer $flag ignored + * @param integer $expiry ignored + * + * @return boolean true + */ + + function onEndCacheSet($key, $value, $flag, $expiry) + { + $this->_items[$key] = $value; + return true; + } + + /** + * Called at the end of deleting a cache element + * + * If stuff's deleted from the other cache, we + * delete it too. + * + * @param string &$key Key to delete + * @param boolean &$success Success flag; ignored + * + * @return boolean true + */ + + function onStartCacheDelete(&$key, &$success) + { + if (array_key_exists($key, $this->_items)) { + unset($this->_items[$key]); + } + return true; + } + + /** + * Version info + * + * @param array &$versions Array of version blocks + * + * @return boolean true + */ + + function onPluginVersion(&$versions) + { + $url = 'http://status.net/wiki/Plugin:InProcessCache'; + + $versions[] = array('name' => 'InProcessCache', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => $url, + 'description' => + _m('Additional in-process cache for plugins.')); + return true; + } + + /** + * Cleanup function; called at end of process + * + * If the inprocess/stats config value is true, we dump + * stats to the log file + * + * @return boolean true + */ + + function cleanup() + { + if (common_config('inprocess', 'stats')) { + $this->log(LOG_INFO, "cache size: " . + count($this->_items)); + $sum = 0; + foreach ($this->_hits as $hitcount) { + $sum += $hitcount; + } + $this->log(LOG_INFO, $sum . " hits on " . + count($this->_hits) . " keys"); + } + return true; + } +} diff --git a/plugins/Mapstraction/Makefile b/plugins/Mapstraction/Makefile new file mode 100644 index 0000000000..3b13135ee0 --- /dev/null +++ b/plugins/Mapstraction/Makefile @@ -0,0 +1,14 @@ +.fake: clean all + +TARGETS=usermap-mxn-openlayers.min.js + +CORE=js/mxn.js js/mxn.core.js +USERMAP=usermap.js + +all: $(TARGETS) + +clean: + rm -f $(TARGETS) + +usermap-mxn-openlayers.min.js: $(CORE) js/mxn.openlayers.core.js $(USERMAP) + cat $+ | yui-compressor -o $@ --type=js diff --git a/plugins/Mapstraction/MapstractionPlugin.php b/plugins/Mapstraction/MapstractionPlugin.php index 5ad25763e7..020c0818ad 100644 --- a/plugins/Mapstraction/MapstractionPlugin.php +++ b/plugins/Mapstraction/MapstractionPlugin.php @@ -128,8 +128,8 @@ class MapstractionPlugin extends Plugin $action->script('http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6'); break; case 'openlayers': - // XXX: is this not nice...? - $action->script('http://openlayers.org/api/OpenLayers.js'); + // Use our included stripped & minified OpenLayers. + $action->script(common_path('plugins/Mapstraction/OpenLayers/OpenLayers.js')); break; case 'yahoo': $action->script(sprintf('http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=%s', @@ -140,11 +140,19 @@ class MapstractionPlugin extends Plugin return true; } - $action->script(sprintf('%s?(%s)', - common_path('plugins/Mapstraction/js/mxn.js'), - $this->provider)); + if ($this->provider == 'openlayers') { + // We have an optimized path for our default case. + // + // Note that OpenLayers.js needs to be separate, or it won't + // be able to find its UI images and styles. + $action->script(common_path('plugins/Mapstraction/usermap-mxn-openlayers.min.js')); + } else { + $action->script(sprintf('%s?(%s)', + common_path('plugins/Mapstraction/js/mxn.js'), + $this->provider)); - $action->script(common_path('plugins/Mapstraction/usermap.js')); + $action->script(common_path('plugins/Mapstraction/usermap.js')); + } $action->inlineScript(sprintf('var _provider = "%s";', $this->provider)); diff --git a/plugins/Mapstraction/OpenLayers/Makefile b/plugins/Mapstraction/OpenLayers/Makefile new file mode 100644 index 0000000000..6d2ef7eacd --- /dev/null +++ b/plugins/Mapstraction/OpenLayers/Makefile @@ -0,0 +1,15 @@ +.fake: clean all + +TARGET=OpenLayers.js +SOURCEDIR=OpenLayers-2.10/ +HERE=`pwd` + +all: $(TARGET) + +clean: + rm -f $(TARGET) + +$(TARGET): statusnet.cfg + cp -f statusnet.cfg $(SOURCEDIR)/build/statusnet.cfg + (cd $(SOURCEDIR)/build && ./build.py statusnet.cfg) + yui-compressor $(SOURCEDIR)/build/OpenLayers.js -o $(TARGET) diff --git a/plugins/Mapstraction/OpenLayers/OpenLayers.js b/plugins/Mapstraction/OpenLayers/OpenLayers.js new file mode 100644 index 0000000000..ea42b1db4e --- /dev/null +++ b/plugins/Mapstraction/OpenLayers/OpenLayers.js @@ -0,0 +1 @@ +var OpenLayers={singleFile:true};(function(){var j=(typeof OpenLayers=="object"&&OpenLayers.singleFile);var a;window.OpenLayers={_scriptName:(!j)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){if(a!=undefined){return a}a="";var r=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var n=document.getElementsByTagName("script");for(var p=0,h=n.length;p<\/script>"}else{var m=document.createElement("script");m.src=l+k[d];var f=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;f.appendChild(m)}}if(e){document.write(b.join(""))}}})();OpenLayers.VERSION_NUMBER="OpenLayers 2.10 -- $Revision: 10721 $";OpenLayers.String={startsWith:function(b,a){return(b.indexOf(a)==0)},contains:function(b,a){return(b.indexOf(a)!=-1)},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},camelize:function(f){var d=f.split("-");var b=d[0];for(var c=1,a=d.length;c0){b=parseFloat(a.toPrecision(c))}return b},format:function(c,a,g,i){a=(typeof a!="undefined")?a:0;g=(typeof g!="undefined")?g:OpenLayers.Number.thousandsSeparator;i=(typeof i!="undefined")?i:OpenLayers.Number.decimalSeparator;if(a!=null){c=parseFloat(c.toFixed(a))}var b=c.toString().split(".");if(b.length==1&&a==null){a=0}var d=b[0];if(g){var e=/(-?[0-9]+)([0-9]{3})/;while(e.test(d)){d=d.replace(e,"$1"+g+"$2")}}var f;if(a==0){f=d}else{var h=b.length>1?b[1]:"0";if(a!=null){h=h+new Array(a-h.length+1).join("0")}f=d+i+h}return f}};if(!Number.prototype.limitSigDigs){Number.prototype.limitSigDigs=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Number.limitSigDigs"}));return OpenLayers.Number.limitSigDigs(this,a)}}OpenLayers.Function={bind:function(c,b){var a=Array.prototype.slice.apply(arguments,[2]);return function(){var d=a.concat(Array.prototype.slice.apply(arguments,[0]));return c.apply(b,d)}},bindAsEventListener:function(b,a){return function(c){return b.call(a,c||window.event)}},False:function(){return false},True:function(){return true}};if(!Function.prototype.bind){Function.prototype.bind=function(){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bind"}));Array.prototype.unshift.apply(arguments,[this]);return OpenLayers.Function.bind.apply(null,arguments)}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"OpenLayers.Function.bindAsEventListener"}));return OpenLayers.Function.bindAsEventListener(this,a)}}OpenLayers.Array={filter:function(g,f,b){var d=[];if(Array.prototype.filter){d=g.filter(f,b)}else{var a=g.length;if(typeof f!="function"){throw new TypeError()}for(var c=0;c1){b=d.prototype.initialize;d.prototype.initialize=function(){};c=new d();if(b===undefined){delete d.prototype.initialize}else{d.prototype.initialize=b}}g=d.prototype}else{g=d}OpenLayers.Util.extend(c,g)}e.prototype=c;return e};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments)}}};OpenLayers.Class.inherit=function(){var d=arguments[0];var e=new d(OpenLayers.Class.isPrototype);for(var c=1,a=arguments.length;c=0;a--){if(c[a]==b){c.splice(a,1)}}return c};OpenLayers.Util.clearArray=function(a){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{newMethod:"array = []"}));a.length=0};OpenLayers.Util.indexOf=function(d,c){if(typeof d.indexOf=="function"){return d.indexOf(c)}else{for(var b=0,a=d.length;b=0&&parseFloat(b)<1){e.style.filter="alpha(opacity="+(b*100)+")";e.style.opacity=b}else{if(parseFloat(b)==1){e.style.filter="";e.style.opacity=""}}};OpenLayers.Util.createDiv=function(a,i,h,f,e,c,b,g){var d=document.createElement("div");if(f){d.style.backgroundImage="url("+f+")"}if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!e){e="absolute"}OpenLayers.Util.modifyDOMElement(d,a,i,h,e,c,b,g);return d};OpenLayers.Util.createImage=function(a,h,g,e,d,c,f,i){var b=document.createElement("img");if(!a){a=OpenLayers.Util.createUniqueID("OpenLayersDiv")}if(!d){d="relative"}OpenLayers.Util.modifyDOMElement(b,a,h,g,d,c,null,f);if(i){b.style.display="none";OpenLayers.Event.observe(b,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,b));OpenLayers.Event.observe(b,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,b))}b.style.alt=a;b.galleryImg="no";if(e){b.src=e}return b};OpenLayers.Util.setOpacity=function(b,a){OpenLayers.Util.modifyDOMElement(b,null,null,null,null,null,null,a)};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.display=""}OpenLayers.Element.removeClass(this,"olImageLoadError")};OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var d=this.urls;if(d&&d instanceof Array&&d.length>1){var e=this.src.toString();var c,a;for(a=0;c=d[a];a++){if(e.indexOf(c)!=-1){break}}var f=Math.floor(d.length*Math.random());var b=d[f];a=0;while(b==c&&a++<4){f=Math.floor(d.length*Math.random());b=d[f]}this.src=e.replace(c,b)}else{this.src=this.src}}else{OpenLayers.Element.addClass(this,"olImageLoadError")}this.style.display=""};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var d=navigator.appVersion.split("MSIE");var a=parseFloat(d[1]);var b=false;try{b=!!(document.body.filters)}catch(c){}OpenLayers.Util.alphaHackNeeded=(b&&(a>=5.5)&&(a<7))}return OpenLayers.Util.alphaHackNeeded};OpenLayers.Util.modifyAlphaImageDiv=function(a,b,j,i,g,f,c,d,h){OpenLayers.Util.modifyDOMElement(a,b,j,i,f,null,null,h);var e=a.childNodes[0];if(g){e.src=g}OpenLayers.Util.modifyDOMElement(e,a.id+"_innerImage",null,i,"relative",c);if(OpenLayers.Util.alphaHack()){if(a.style.display!="none"){a.style.display="inline-block"}if(d==null){d="scale"}a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.src+"', sizingMethod='"+d+"')";if(parseFloat(a.style.opacity)>=0&&parseFloat(a.style.opacity)<1){a.style.filter+=" alpha(opacity="+a.style.opacity*100+")"}e.style.filter="alpha(opacity=0)"}};OpenLayers.Util.createAlphaImageDiv=function(b,j,i,g,f,c,d,h,k){var a=OpenLayers.Util.createDiv();var e=OpenLayers.Util.createImage(null,null,null,null,null,null,null,false);a.appendChild(e);if(k){e.style.display="none";OpenLayers.Event.observe(e,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,a));OpenLayers.Event.observe(e,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,a))}OpenLayers.Util.modifyAlphaImageDiv(a,b,j,i,g,f,c,d,h);return a};OpenLayers.Util.upperCaseObject=function(b){var a={};for(var c in b){a[c.toUpperCase()]=b[c]}return a};OpenLayers.Util.applyDefaults=function(d,c){d=d||{};var b=typeof window.Event=="function"&&c instanceof window.Event;for(var a in c){if(d[a]===undefined||(!b&&c.hasOwnProperty&&c.hasOwnProperty(a)&&!d.hasOwnProperty(a))){d[a]=c[a]}}if(!b&&c&&c.hasOwnProperty&&c.hasOwnProperty("toString")&&!d.hasOwnProperty("toString")){d.toString=c.toString}return d};OpenLayers.Util.getParameterString=function(c){var b=[];for(var h in c){var g=c[h];if((g!=null)&&(typeof g!="function")){var d;if(typeof g=="object"&&g.constructor==Array){var e=[];var i;for(var a=0,f=g.length;a0)){if(!b){b=0}if(a[b].childNodes.length>1){return a.childNodes[1].nodeValue}else{if(a[b].childNodes.length==1){return a[b].firstChild.nodeValue}}}else{return""}};OpenLayers.Util.getXmlNodeValue=function(a){var b=null;OpenLayers.Util.Try(function(){b=a.text;if(!b){b=a.textContent}if(!b){b=a.firstChild.nodeValue}},function(){b=a.textContent});return b};OpenLayers.Util.mouseLeft=function(a,c){var b=(a.relatedTarget)?a.relatedTarget:a.toElement;while(b!=c&&b!=null){b=b.parentNode}return(b!=c)};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(b,a){if(a==null){a=OpenLayers.Util.DEFAULT_PRECISION}var b;if(a==0){b=parseFloat(b)}else{b=parseFloat(parseFloat(b).toPrecision(a))}return b};OpenLayers.Util.rad=function(a){return a*Math.PI/180};OpenLayers.Util.deg=function(a){return a*180/Math.PI};OpenLayers.Util.VincentyConstants={a:6378137,b:6356752.3142,f:1/298.257223563};OpenLayers.Util.distVincenty=function(g,e){var k=OpenLayers.Util.VincentyConstants;var M=k.a,K=k.b,G=k.f;var n=OpenLayers.Util.rad(e.lon-g.lon);var J=Math.atan((1-G)*Math.tan(OpenLayers.Util.rad(g.lat)));var I=Math.atan((1-G)*Math.tan(OpenLayers.Util.rad(e.lat)));var m=Math.sin(J),i=Math.cos(J);var l=Math.sin(I),h=Math.cos(I);var r=n,o=2*Math.PI;var q=20;while(Math.abs(r-o)>1e-12&&--q>0){var z=Math.sin(r),c=Math.cos(r);var N=Math.sqrt((h*z)*(h*z)+(i*l-m*h*c)*(i*l-m*h*c));if(N==0){return 0}var E=m*l+i*h*c;var y=Math.atan2(N,E);var j=Math.asin(i*h*z/N);var F=Math.cos(j)*Math.cos(j);var p=E-2*m*l/F;var v=G/16*F*(4+G*(4-3*F));o=r;r=n+(1-v)*G*Math.sin(j)*(y+v*N*(p+v*E*(-1+2*p*p)))}if(q==0){return NaN}var u=F*(M*M-K*K)/(K*K);var x=1+u/16384*(4096+u*(-768+u*(320-175*u)));var w=u/1024*(256+u*(-128+u*(74-47*u)));var D=w*N*(p+w/4*(E*(-1+2*p*p)-w/6*p*(-3+4*N*N)*(-3+4*p*p)));var t=K*x*(y-D);var H=t.toFixed(3)/1000;return H};OpenLayers.Util.destinationVincenty=function(l,P,E){var o=OpenLayers.Util;var i=o.VincentyConstants;var Q=i.a,O=i.b,J=i.f;var N=l.lon;var g=l.lat;var q=E;var D=o.rad(P);var G=Math.sin(D);var h=Math.cos(D);var F=(1-J)*Math.tan(o.rad(g));var c=1/Math.sqrt((1+F*F)),j=F*c;var p=Math.atan2(F,h);var y=c*G;var I=1-y*y;var t=I*(Q*Q-O*O)/(O*O);var x=1+t/16384*(4096+t*(-768+t*(320-175*t)));var v=t/1024*(256+t*(-128+t*(74-47*t)));var w=q/(O*x),K=2*Math.PI;while(Math.abs(w-K)>1e-12){var m=Math.cos(2*p+w);var R=Math.sin(w);var H=Math.cos(w);var z=v*R*(m+v/4*(H*(-1+2*m*m)-v/6*m*(-3+4*R*R)*(-3+4*m*m)));K=w;w=q/(O*x)+z}var M=j*R-c*H*h;var d=Math.atan2(j*H+c*R*h,(1-J)*Math.sqrt(y*y+M*M));var n=Math.atan2(R*G,c*H-j*R*h);var r=J/16*I*(4+J*(4-3*I));var k=n-(1-r)*J*y*(w+r*R*(m+r*H*(-1+2*m*m)));var e=Math.atan2(y,-M);return new OpenLayers.LonLat(N+o.deg(k),o.deg(d))};OpenLayers.Util.getParameters=function(b){b=b||window.location.href;var a="";if(OpenLayers.String.contains(b,"?")){var c=b.indexOf("?")+1;var e=OpenLayers.String.contains(b,"#")?b.indexOf("#"):b.length;a=b.substring(c,e)}var l={};var d=a.split(/[&;]/);for(var g=0,h=d.length;g1)?(1/b):b;return a};OpenLayers.Util.getResolutionFromScale=function(d,a){var b;if(d){if(a==null){a="degrees"}var c=OpenLayers.Util.normalizeScale(d);b=1/(c*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH)}return b};OpenLayers.Util.getScaleFromResolution=function(b,a){if(a==null){a="degrees"}var c=b*OpenLayers.INCHES_PER_UNIT[a]*OpenLayers.DOTS_PER_INCH;return c};OpenLayers.Util.safeStopPropagation=function(a){OpenLayers.Event.stop(a,true)};OpenLayers.Util.pagePosition=function(f){var a=0,d=0;var b=f;var g=f;while(b){if(b==document.body){if(OpenLayers.Element.getStyle(g,"position")=="absolute"){break}}a+=b.offsetTop||0;d+=b.offsetLeft||0;g=b;try{b=b.offsetParent}catch(c){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{elemId:b.id}));break}}b=f;while(b){a-=b.scrollTop||0;d-=b.scrollLeft||0;b=b.parentNode}return[d,a]};OpenLayers.Util.isEquivalentUrl=function(f,e,c){c=c||{};OpenLayers.Util.applyDefaults(c,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var b=OpenLayers.Util.createUrlObject(f,c);var a=OpenLayers.Util.createUrlObject(e,c);for(var d in b){if(d!=="args"){if(b[d]!=a[d]){return false}}}for(var d in b.args){if(b.args[d]!=a.args[d]){return false}delete a.args[d]}for(var d in a.args){return false}return true};OpenLayers.Util.createUrlObject=function(c,k){k=k||{};if(!(/^\w+:\/\//).test(c)){var g=window.location;var e=g.port?":"+g.port:"";var h=g.protocol+"//"+g.host.split(":").shift()+e;if(c.indexOf("/")===0){c=h+c}else{var f=g.pathname.split("/");f.pop();c=h+f.join("/")+"/"+c}}if(k.ignoreCase){c=c.toLowerCase()}var i=document.createElement("a");i.href=c;var d={};d.host=i.host.split(":").shift();d.protocol=i.protocol;if(k.ignorePort80){d.port=(i.port=="80"||i.port=="0")?"":i.port}else{d.port=(i.port==""||i.port=="0")?"80":i.port}d.hash=(k.ignoreHash||i.hash==="#")?"":i.hash;var b=i.search;if(!b){var j=c.indexOf("?");b=(j!=-1)?c.substr(j):""}d.args=OpenLayers.Util.getParameters(b);d.pathname=(i.pathname.charAt(0)=="/")?i.pathname:"/"+i.pathname;return d};OpenLayers.Util.removeTail=function(b){var c=null;var a=b.indexOf("?");var d=b.indexOf("#");if(a==-1){c=(d!=-1)?b.substr(0,d):b}else{c=(d!=-1)?b.substr(0,Math.min(a,d)):b.substr(0,a)}return c};OpenLayers.Util.getBrowserName=function(){var b="";var a=navigator.userAgent.toLowerCase();if(a.indexOf("opera")!=-1){b="opera"}else{if(a.indexOf("msie")!=-1){b="msie"}else{if(a.indexOf("safari")!=-1){b="safari"}else{if(a.indexOf("mozilla")!=-1){if(a.indexOf("firefox")!=-1){b="firefox"}else{b="mozilla"}}}}}return b};OpenLayers.Util.getRenderedDimensions=function(b,o,p){var k,e;var a=document.createElement("div");a.style.visibility="hidden";var n=(p&&p.containerElement)?p.containerElement:document.body;if(o){if(o.w){k=o.w;a.style.width=k+"px"}else{if(o.h){e=o.h;a.style.height=e+"px"}}}if(p&&p.displayClass){a.className=p.displayClass}var f=document.createElement("div");f.innerHTML=b;f.style.overflow="visible";if(f.childNodes){for(var d=0,c=f.childNodes.length;d=0){if(a<10){a="0"+a}f+=a+"'";if(e.indexOf("dms")>=0){if(g<10){g="0"+g}f+=g+'"'}}if(b=="lon"){f+=h<0?OpenLayers.i18n("W"):OpenLayers.i18n("E")}else{f+=h<0?OpenLayers.i18n("S"):OpenLayers.i18n("N")}return f};OpenLayers.Element={visible:function(a){return OpenLayers.Util.getElement(a).style.display!="none"},toggle:function(){for(var c=0,a=arguments.length;c"+this.contentDiv.innerHTML+"";var h=(this.map)?this.map.layerContainerDiv:document.body;var i=OpenLayers.Util.getRenderedDimensions(e,null,{displayClass:this.displayClass,containerElement:h});var g=this.getSafeContentSize(i);var f=null;if(g.equals(i)){f=i}else{var b=new OpenLayers.Size();b.w=(g.w(e.w-this.map.paddingForPopups.right)){c.x=e.w-this.map.paddingForPopups.right-this.size.w}}if(d.y(e.h-this.map.paddingForPopups.bottom)){c.y=e.h-this.map.paddingForPopups.bottom-this.size.h}}var b=d.x-c.x;var a=d.y-c.y;this.map.pan(b,a)},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({mousedown:this.onmousedown,mousemove:this.onmousemove,mouseup:this.onmouseup,click:this.onclick,mouseout:this.onmouseout,dblclick:this.ondblclick,scope:this})},onmousedown:function(a){this.mousedown=true;OpenLayers.Event.stop(a,true)},onmousemove:function(a){if(this.mousedown){OpenLayers.Event.stop(a,true)}},onmouseup:function(a){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(a,true)}},onclick:function(a){OpenLayers.Event.stop(a,true)},onmouseout:function(a){this.mousedown=false},ondblclick:function(a){OpenLayers.Event.stop(a,true)},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,centerLonLat:null,initialize:function(d,a,b,c){if(d!=null){this.left=OpenLayers.Util.toFloat(d)}if(a!=null){this.bottom=OpenLayers.Util.toFloat(a)}if(b!=null){this.right=OpenLayers.Util.toFloat(b)}if(c!=null){this.top=OpenLayers.Util.toFloat(c)}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top)},equals:function(b){var a=false;if(b!=null){a=((this.left==b.left)&&(this.right==b.right)&&(this.top==b.top)&&(this.bottom==b.bottom))}return a},toString:function(){return("left-bottom=("+this.left+","+this.bottom+") right-top=("+this.right+","+this.top+")")},toArray:function(a){if(a===true){return[this.bottom,this.left,this.top,this.right]}else{return[this.left,this.bottom,this.right,this.top]}},toBBOX:function(b,e){if(b==null){b=6}var g=Math.pow(10,b);var f=Math.round(this.left*g)/g;var d=Math.round(this.bottom*g)/g;var c=Math.round(this.right*g)/g;var a=Math.round(this.top*g)/g;if(e===true){return d+","+f+","+a+","+c}else{return f+","+d+","+c+","+a}},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])])},getWidth:function(){return(this.right-this.left)},getHeight:function(){return(this.top-this.bottom)},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight())},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2)},getCenterLonLat:function(){if(!this.centerLonLat){this.centerLonLat=new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2)}return this.centerLonLat},scale:function(e,c){if(c==null){c=this.getCenterLonLat()}var a,h;if(c.CLASS_NAME=="OpenLayers.LonLat"){a=c.lon;h=c.lat}else{a=c.x;h=c.y}var g=(this.left-a)*e+a;var b=(this.bottom-h)*e+h;var d=(this.right-a)*e+a;var f=(this.top-h)*e+h;return new OpenLayers.Bounds(g,b,d,f)},add:function(a,c){if((a==null)||(c==null)){var b=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Bounds(this.left+a,this.bottom+c,this.right+a,this.top+c)},extend:function(a){var b=null;if(a){switch(a.CLASS_NAME){case"OpenLayers.LonLat":b=new OpenLayers.Bounds(a.lon,a.lat,a.lon,a.lat);break;case"OpenLayers.Geometry.Point":b=new OpenLayers.Bounds(a.x,a.y,a.x,a.y);break;case"OpenLayers.Bounds":b=a;break}if(b){this.centerLonLat=null;if((this.left==null)||(b.leftthis.right)){this.right=b.right}if((this.top==null)||(b.top>this.top)){this.top=b.top}}}},containsLonLat:function(b,a){return this.contains(b.lon,b.lat,a)},containsPixel:function(b,a){return this.contains(b.x,b.y,a)},contains:function(b,d,a){if(a==null){a=true}if(b==null||d==null){return false}b=OpenLayers.Util.toFloat(b);d=OpenLayers.Util.toFloat(d);var c=false;if(a){c=((b>=this.left)&&(b<=this.right)&&(d>=this.bottom)&&(d<=this.top))}else{c=((b>this.left)&&(bthis.bottom)&&(d=this.bottom)&&(e.bottom<=this.top))||((this.bottom>=e.bottom)&&(this.bottom<=e.top)));var f=(((e.top>=this.bottom)&&(e.top<=this.top))||((this.top>e.bottom)&&(this.top=this.left)&&(e.left<=this.right))||((this.left>=e.left)&&(this.left<=e.right)));var a=(((e.right>=this.left)&&(e.right<=this.right))||((this.right>=e.left)&&(this.right<=e.right)));d=((g||f)&&(c||a))}return d},containsBounds:function(g,b,a){if(b==null){b=false}if(a==null){a=true}var c=this.contains(g.left,g.bottom,a);var d=this.contains(g.right,g.bottom,a);var f=this.contains(g.left,g.top,a);var e=this.contains(g.right,g.top,a);return(b)?(c||d||f||e):(c&&d&&f&&e)},determineQuadrant:function(c){var b="";var a=this.getCenterLonLat();b+=(c.lat=a.right&&e.right>a.right){e=e.add(-a.getWidth(),0)}}return e},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(b){var a=b.split(",");return OpenLayers.Bounds.fromArray(a)};OpenLayers.Bounds.fromArray=function(a){return new OpenLayers.Bounds(parseFloat(a[0]),parseFloat(a[1]),parseFloat(a[2]),parseFloat(a[3]))};OpenLayers.Bounds.fromSize=function(a){return new OpenLayers.Bounds(0,a.h,a.w,0)};OpenLayers.Bounds.oppositeQuadrant=function(a){var b="";b+=(a.charAt(0)=="t")?"b":"t";b+=(a.charAt(1)=="l")?"r":"l";return b};OpenLayers.LonLat=OpenLayers.Class({lon:0,lat:0,initialize:function(b,a){this.lon=OpenLayers.Util.toFloat(b);this.lat=OpenLayers.Util.toFloat(a)},toString:function(){return("lon="+this.lon+",lat="+this.lat)},toShortString:function(){return(this.lon+", "+this.lat)},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat)},add:function(c,a){if((c==null)||(a==null)){var b=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.LonLat(this.lon+OpenLayers.Util.toFloat(c),this.lat+OpenLayers.Util.toFloat(a))},equals:function(b){var a=false;if(b!=null){a=((this.lon==b.lon&&this.lat==b.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(b.lon)&&isNaN(b.lat)))}return a},transform:function(c,b){var a=OpenLayers.Projection.transform({x:this.lon,y:this.lat},c,b);this.lon=a.x;this.lat=a.y;return this},wrapDateLine:function(a){var b=this.clone();if(a){while(b.lona.right){b.lon-=a.getWidth()}}return b},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(b){var a=b.split(",");return new OpenLayers.LonLat(a[0],a[1])};OpenLayers.Pixel=OpenLayers.Class({x:0,y:0,initialize:function(a,b){this.x=parseFloat(a);this.y=parseFloat(b)},toString:function(){return("x="+this.x+",y="+this.y)},clone:function(){return new OpenLayers.Pixel(this.x,this.y)},equals:function(a){var b=false;if(a!=null){b=((this.x==a.x&&this.y==a.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(a.x)&&isNaN(a.y)))}return b},add:function(a,c){if((a==null)||(c==null)){var b=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(b);return null}return new OpenLayers.Pixel(this.x+a,this.y+c)},offset:function(a){var b=this.clone();if(a){b=this.add(a.x,a.y)}return b},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Control=OpenLayers.Class({id:null,map:null,div:null,type:null,allowSelection:false,displayClass:"",title:"",autoActivate:false,active:null,handler:null,eventListeners:null,events:null,EVENT_TYPES:["activate","deactivate"],initialize:function(a){this.displayClass=this.CLASS_NAME.replace("OpenLayers.","ol").replace(/\./g,"");OpenLayers.Util.extend(this,a);this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);if(this.eventListeners instanceof Object){this.events.on(this.eventListeners)}if(this.id==null){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")}},destroy:function(){if(this.events){if(this.eventListeners){this.events.un(this.eventListeners)}this.events.destroy();this.events=null}this.eventListeners=null;if(this.handler){this.handler.destroy();this.handler=null}if(this.handlers){for(var a in this.handlers){if(this.handlers.hasOwnProperty(a)&&typeof this.handlers[a].destroy=="function"){this.handlers[a].destroy()}}this.handlers=null}if(this.map){this.map.removeControl(this);this.map=null}},setMap:function(a){this.map=a;if(this.handler){this.handler.setMap(a)}},draw:function(a){if(this.div==null){this.div=OpenLayers.Util.createDiv(this.id);this.div.className=this.displayClass;if(!this.allowSelection){this.div.className+=" olControlNoSelect";this.div.setAttribute("unselectable","on",0);this.div.onselectstart=OpenLayers.Function.False}if(this.title!=""){this.div.title=this.title}}if(a!=null){this.position=a.clone()}this.moveTo(this.position);return this.div},moveTo:function(a){if((a!=null)&&(this.div!=null)){this.div.style.left=a.x+"px";this.div.style.top=a.y+"px"}},activate:function(){if(this.active){return false}if(this.handler){this.handler.activate()}this.active=true;if(this.map){OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("activate");return true},deactivate:function(){if(this.active){if(this.handler){this.handler.deactivate()}this.active=false;if(this.map){OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass.replace(/ /g,"")+"Active")}this.events.triggerEvent("deactivate");return true}return false},CLASS_NAME:"OpenLayers.Control"});OpenLayers.Control.TYPE_BUTTON=1;OpenLayers.Control.TYPE_TOGGLE=2;OpenLayers.Control.TYPE_TOOL=3;OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode()}return OpenLayers.Lang.code},setCode:function(b){var d;if(!b){b=(OpenLayers.Util.getBrowserName()=="msie")?navigator.userLanguage:navigator.language}var c=b.split("-");c[0]=c[0].toLowerCase();if(typeof OpenLayers.Lang[c[0]]=="object"){d=c[0]}if(c[1]){var a=c[0]+"-"+c[1].toUpperCase();if(typeof OpenLayers.Lang[a]=="object"){d=a}}if(!d){OpenLayers.Console.warn("Failed to find OpenLayers.Lang."+c.join("-")+" dictionary, falling back to default language");d=OpenLayers.Lang.defaultCode}OpenLayers.Lang.code=d},translate:function(b,a){var d=OpenLayers.Lang[OpenLayers.Lang.getCode()];var c=d[b];if(!c){c=b}if(a){c=OpenLayers.String.format(c,a)}return c}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(h,d,g,c,b,f,e){var a=[h,d,g,c,f,e];OpenLayers.Popup.prototype.initialize.apply(this,a);this.anchor=(b!=null)?b:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)}},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments)},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments)},moveTo:function(c){var b=this.relativePosition;this.relativePosition=this.calculateRelativePosition(c);var d=this.calculateNewPx(c);var a=new Array(d);OpenLayers.Popup.prototype.moveTo.apply(this,a);if(this.relativePosition!=b){this.updateRelativePosition()}},setSize:function(b){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var a=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(a)}},calculateRelativePosition:function(b){var d=this.map.getLonLatFromLayerPx(b);var c=this.map.getExtent();var a=c.determineQuadrant(d);return OpenLayers.Bounds.oppositeQuadrant(a)},updateRelativePosition:function(){},calculateNewPx:function(b){var e=b.offset(this.anchor.offset);var a=this.size||this.contentSize;var d=(this.relativePosition.charAt(0)=="t");e.y+=(d)?-(a.h+this.anchor.size.h):this.anchor.size.h;var c=(this.relativePosition.charAt(1)=="l");e.x+=(c)?-(a.w+this.anchor.size.w):this.anchor.size.w;return e},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(a){this.easing=(a)?a:OpenLayers.Easing.Expo.easeOut},start:function(c,b,d,a){this.playing=true;this.begin=c;this.finish=b;this.duration=d;this.callbacks=a.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null}if(this.callbacks&&this.callbacks.start){this.callbacks.start.call(this,this.begin)}this.interval=window.setInterval(OpenLayers.Function.bind(this.play,this),this.INTERVAL)},stop:function(){if(!this.playing){return}if(this.callbacks&&this.callbacks.done){this.callbacks.done.call(this,this.finish)}window.clearInterval(this.interval);this.interval=null;this.playing=false},play:function(){var g={};for(var d in this.begin){var a=this.begin[d];var e=this.finish[d];if(a==null||e==null||isNaN(a)||isNaN(e)){OpenLayers.Console.error("invalid value for Tween")}var h=e-a;g[d]=this.easing.apply(this,[this.time,a,h,this.duration])}this.time++;if(this.callbacks&&this.callbacks.eachStep){this.callbacks.eachStep.call(this,g)}if(this.time>this.duration){this.stop()}},CLASS_NAME:"OpenLayers.Tween"});OpenLayers.Easing={CLASS_NAME:"OpenLayers.Easing"};OpenLayers.Easing.Linear={easeIn:function(e,a,g,f){return g*e/f+a},easeOut:function(e,a,g,f){return g*e/f+a},easeInOut:function(e,a,g,f){return g*e/f+a},CLASS_NAME:"OpenLayers.Easing.Linear"};OpenLayers.Easing.Expo={easeIn:function(e,a,g,f){return(e==0)?a:g*Math.pow(2,10*(e/f-1))+a},easeOut:function(e,a,g,f){return(e==f)?a+g:g*(-Math.pow(2,-10*e/f)+1)+a},easeInOut:function(e,a,g,f){if(e==0){return a}if(e==f){return a+g}if((e/=f/2)<1){return g/2*Math.pow(2,10*(e-1))+a}return g/2*(-Math.pow(2,-10*--e)+2)+a},CLASS_NAME:"OpenLayers.Easing.Expo"};OpenLayers.Easing.Quad={easeIn:function(e,a,g,f){return g*(e/=f)*e+a},easeOut:function(e,a,g,f){return -g*(e/=f)*(e-2)+a},easeInOut:function(e,a,g,f){if((e/=f/2)<1){return g/2*e*e+a}return -g/2*((--e)*(e-2)-1)+a},CLASS_NAME:"OpenLayers.Easing.Quad"};OpenLayers.Control.ArgParser=OpenLayers.Class(OpenLayers.Control,{center:null,zoom:null,layers:null,displayProjection:null,initialize:function(a){OpenLayers.Control.prototype.initialize.apply(this,arguments)},setMap:function(e){OpenLayers.Control.prototype.setMap.apply(this,arguments);for(var c=0,a=this.map.controls.length;c=0;--a){this._removeButton(this.buttons[a])}},doubleClick:function(a){OpenLayers.Event.stop(a);return false},buttonDown:function(a){if(!OpenLayers.Event.isLeftClick(a)){return}switch(this.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break}OpenLayers.Event.stop(a)},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(a){return a.target||a.srcElement},isLeftClick:function(a){return(((a.which)&&(a.which==1))||((a.button)&&(a.button==1)))},isRightClick:function(a){return(((a.which)&&(a.which==3))||((a.button)&&(a.button==2)))},stop:function(b,a){if(!a){if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}if(b.stopPropagation){b.stopPropagation()}else{b.cancelBubble=true}},findElement:function(c,b){var a=OpenLayers.Event.element(c);while(a.parentNode&&(!a.tagName||(a.tagName.toUpperCase()!=b.toUpperCase()))){a=a.parentNode}return a},observe:function(b,d,c,a){var e=OpenLayers.Util.getElement(b);a=a||false;if(d=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||e.attachEvent)){d="keydown"}if(!this.observers){this.observers={}}if(!e._eventCacheID){var f="eventCacheID_";if(e.id){f=e.id+"_"+f}e._eventCacheID=OpenLayers.Util.createUniqueID(f)}var g=e._eventCacheID;if(!this.observers[g]){this.observers[g]=[]}this.observers[g].push({element:e,name:d,observer:c,useCapture:a});if(e.addEventListener){e.addEventListener(d,c,a)}else{if(e.attachEvent){e.attachEvent("on"+d,c)}}},stopObservingElement:function(a){var b=OpenLayers.Util.getElement(a);var c=b._eventCacheID;this._removeElementObservers(OpenLayers.Event.observers[c])},_removeElementObservers:function(e){if(e){for(var b=e.length-1;b>=0;b--){var c=e[b];var a=new Array(c.element,c.name,c.observer,c.useCapture);var d=OpenLayers.Event.stopObserving.apply(this,a)}}},stopObserving:function(h,a,g,b){b=b||false;var f=OpenLayers.Util.getElement(h);var d=f._eventCacheID;if(a=="keypress"){if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||f.detachEvent){a="keydown"}}var k=false;var c=OpenLayers.Event.observers[d];if(c){var e=0;while(!k&&e
To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.

Most likely, this is because the Google Maps library script was either not included, or does not contain the correct API key for your site.

Developers: For help getting this working correctly, click here",getLayerWarning:"The ${layerType} Layer was unable to load correctly.

To get rid of this message, select a new BaseLayer in the layer switcher in the upper-right corner.

Most likely, this is because the ${layerLib} library script was not correctly included.

Developers: For help getting this working correctly, click here",scale:"Scale = 1 : ${scaleDenom}",W:"W",E:"E",N:"N",S:"S",graticule:"Graticule",layerAlreadyAdded:"You tried to add the layer: ${layerName} to the map, but it has already been added",reprojectDeprecated:"You are using the 'reproject' option on the ${layerName} layer. This option is deprecated: its use was designed to support displaying data over commercial basemaps, but that functionality should now be achieved by using Spherical Mercator support. More information is available from http://trac.openlayers.org/wiki/SphericalMercator.",methodDeprecated:"This method has been deprecated and will be removed in 3.0. Please use ${newMethod} instead.",boundsAddError:"You must pass both x and y values to the add function.",lonlatAddError:"You must pass both lon and lat values to the add function.",pixelAddError:"You must pass both x and y values to the add function.",unsupportedGeometryType:"Unsupported geometry type: ${geomType}",pagePositionFailed:"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",filterEvaluateNotImplemented:"evaluate is not implemented for this filter type.",end:""};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(g,c,f,b,a,e,d){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments)},draw:function(a){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div},updateRelativePosition:function(){this.setRicoCorners()},setSize:function(a){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners()},setBackgroundColor:function(a){if(a!=undefined){this.backgroundColor=a}if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor)}}},setOpacity:function(a){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,a);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity)}}},setBorder:function(a){this.border=0},setRicoCorners:function(){var a=this.getCornersToRound(this.relativePosition);var b={corners:a,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,b);this.rounded=true}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,b);this.setBackgroundColor();this.setOpacity()}},getCornersToRound:function(){var a=["tl","tr","bl","br"];var b=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(a,b);return a.join(" ")},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(b,a){OpenLayers.Util.extend(this,a);this.projCode=b;if(window.Proj4js){this.proj=new Proj4js.Proj(b)}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode},getUnits:function(){return this.proj?this.proj.units:null},toString:function(){return this.getCode()},equals:function(a){if(a&&a.getCode){return this.getCode()==a.getCode()}else{return false}},destroy:function(){delete this.proj;delete this.projCode},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(c,b,a){if(!OpenLayers.Projection.transforms[c]){OpenLayers.Projection.transforms[c]={}}OpenLayers.Projection.transforms[c][b]=a};OpenLayers.Projection.transform=function(a,c,b){if(c.proj&&b.proj){a=Proj4js.transform(c.proj,b.proj,a)}else{if(c&&b&&OpenLayers.Projection.transforms[c.getCode()]&&OpenLayers.Projection.transforms[c.getCode()][b.getCode()]){OpenLayers.Projection.transforms[c.getCode()][b.getCode()](a)}}return a};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(d,a,e,b,c){this.layer=d;this.position=a.clone();this.bounds=e.clone();this.url=b;this.size=c.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES)},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload")}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null},clone:function(a){if(a==null){a=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size)}OpenLayers.Util.applyDefaults(a,this);return a},draw:function(){var a=this.layer.maxExtent;var b=(a&&this.bounds.intersectsBounds(a,false));this.shouldDraw=(b||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw},moveTo:function(b,a,c){if(c==null){c=true}this.bounds=b.clone();this.position=a.clone();if(c){this.draw()}},clear:function(){},getBoundsFromBaseLayer:function(a){var f=OpenLayers.i18n("reprojectDeprecated",{layerName:this.layer.name});OpenLayers.Console.warn(f);var d=this.layer.map.getLonLatFromLayerPx(a);var c=a.clone();c.x+=this.size.w;c.y+=this.size.h;var b=this.layer.map.getLonLatFromLayerPx(c);if(d.lon>b.lon){if(d.lon<0){d.lon=-180-(d.lon+180)}else{b.lon=180+b.lon+180}}var e=new OpenLayers.Bounds(d.lon,b.lat,b.lon,d.lat);return e},showTile:function(){if(this.shouldDraw){this.show()}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(d,b,a){OpenLayers.Util.extend(this,a);this.control=d;this.callbacks=b;var c=this.map||d.map;if(c){this.setMap(c)}this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},setMap:function(a){this.map=a},checkModifiers:function(a){if(this.keyMask==null){return true}var b=(a.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(a.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(a.altKey?OpenLayers.Handler.MOD_ALT:0);return(b==this.keyMask)},activate:function(){if(this.active){return false}var c=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var b=0,a=c.length;b=0;--a){this.controls[a].destroy()}this.controls=null}if(this.layers!=null){for(var a=this.layers.length-1;a>=0;--a){this.layers[a].destroy(false)}this.layers=null}if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv)}this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null}this.events.destroy();this.events=null},setOptions:function(a){OpenLayers.Util.extend(this,a)},getTileSize:function(){return this.tileSize},getBy:function(e,c,a){var d=(typeof a.test=="function");var b=OpenLayers.Array.filter(this[e],function(f){return f[c]==a||(d&&a.test(f[c]))});return b},getLayersBy:function(b,a){return this.getBy("layers",b,a)},getLayersByName:function(a){return this.getLayersBy("name",a)},getLayersByClass:function(a){return this.getLayersBy("CLASS_NAME",a)},getControlsBy:function(b,a){return this.getBy("controls",b,a)},getControlsByClass:function(a){return this.getControlsBy("CLASS_NAME",a)},getLayer:function(e){var b=null;for(var d=0,a=this.layers.length;dthis.layers.length){b=this.layers.length}}if(e!=b){this.layers.splice(e,1);this.layers.splice(b,0,d);for(var c=0,a=this.layers.length;c=0;--b){this.removePopup(this.popups[b])}}a.map=this;this.popups.push(a);var c=a.draw();if(c){c.style.zIndex=this.Z_INDEX_BASE.Popup+this.popups.length;this.layerContainerDiv.appendChild(c)}},removePopup:function(a){OpenLayers.Util.removeItem(this.popups,a);if(a.div){try{this.layerContainerDiv.removeChild(a.div)}catch(b){}}a.map=null},getSize:function(){var a=null;if(this.size!=null){a=this.size.clone()}return a},updateSize:function(){var c=this.getCurrentSize();if(c&&!isNaN(c.h)&&!isNaN(c.w)){this.events.clearMouseCache();var f=this.getSize();if(f==null){this.size=f=c}if(!c.equals(f)){this.size=c;for(var d=0,b=this.layers.length;dthis.restrictedExtent.getWidth()){g=new OpenLayers.LonLat(p.lon,g.lat)}else{if(o.leftthis.restrictedExtent.right){g=g.add(this.restrictedExtent.right-o.right,0)}}}if(o.getHeight()>this.restrictedExtent.getHeight()){g=new OpenLayers.LonLat(g.lon,p.lat)}else{if(o.bottomthis.restrictedExtent.top){g=g.add(0,this.restrictedExtent.top-o.top)}}}}}var b=c||((this.isValidZoomLevel(n))&&(n!=this.getZoom()));var e=(this.isValidLonLat(g))&&(!g.equals(this.center));if(b||e||!m){if(!this.dragging&&!h){this.events.triggerEvent("movestart")}if(e){if((!b)&&(this.center)){this.centerLayerContainer(g)}this.center=g.clone()}if((b)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px"}if(b){this.zoom=n;this.resolution=this.getResolutionForZoom(n);this.viewRequestID++}var a=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(a,b,m);if(m){this.baseLayer.events.triggerEvent("move")}else{this.baseLayer.events.triggerEvent("moveend",{zoomChanged:b})}}a=this.baseLayer.getExtent();for(var f=0,k=this.layers.length;f=0)&&(a0){a=this.layers[0].getResolution()}}return a},getUnits:function(){var a=null;if(this.baseLayer!=null){a=this.baseLayer.units}return a},getScale:function(){var c=null;if(this.baseLayer!=null){var b=this.getResolution();var a=this.baseLayer.units;c=OpenLayers.Util.getScaleFromResolution(b,a)}return c},getZoomForExtent:function(c,b){var a=null;if(this.baseLayer!=null){a=this.baseLayer.getZoomForExtent(c,b)}return a},getResolutionForZoom:function(b){var a=null;if(this.baseLayer){a=this.baseLayer.getResolutionForZoom(b)}return a},getZoomForResolution:function(a,c){var b=null;if(this.baseLayer!=null){b=this.baseLayer.getZoomForResolution(a,c)}return b},zoomTo:function(a){if(this.isValidZoomLevel(a)){this.setCenter(null,a)}},zoomIn:function(){this.zoomTo(this.getZoom()+1)},zoomOut:function(){this.zoomTo(this.getZoom()-1)},zoomToExtent:function(d,c){var b=d.getCenterLonLat();if(this.baseLayer.wrapDateLine){var a=this.getMaxExtent();d=d.clone();while(d.rightOpenLayers.IMAGE_RELOAD_ATTEMPTS){c.call(this)}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(a,this))},checkImgURL:function(){if(this.layer){var a=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(a,this.url)){this.hide()}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return}var d=1;if(this.backBufferTile.resolution){d=this.backBufferTile.resolution/this.layer.getResolution()}if(d!=this.lastRatio){if(this.layer.transitionEffect=="resize"){var c=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var b=new OpenLayers.Size(this.backBufferTile.size.w*d,this.backBufferTile.size.h*d);var a=this.layer.map.getLayerPxFromLonLat(c);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,a,b);var e=this.backBufferTile.imageSize;e=new OpenLayers.Size(e.w*d,e.h*d);var f=this.backBufferTile.imageOffset;if(f){f=new OpenLayers.Pixel(f.x*d,f.y*d)}OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,f,e);this.backBufferTile.show()}}else{if(this.layer.singleTile){this.backBufferTile.show()}else{this.backBufferTile.hide()}}this.lastRatio=d},show:function(){this.frame.style.display="";if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft}}},hide:function(){this.frame.style.display="none"},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(a,c,b){this.layer=a;this.lonlat=c;this.data=(b!=null)?b:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup)}}if(this.layer!=null&&this.marker!=null){this.layer.removeMarker(this.marker)}this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null}if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null}},onScreen:function(){var b=false;if((this.layer!=null)&&(this.layer.map!=null)){var a=this.layer.map.getExtent();b=a.containsLonLat(this.lonlat)}return b},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon)}return this.marker},destroyMarker:function(){this.marker.destroy()},createPopup:function(b){if(this.lonlat!=null){var c=this.id+"_popup";var a=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(c,this.lonlat,this.data.popupSize,this.data.popupContentHTML,a,b)}if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow}this.popup.feature=this}return this.popup},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(d){this.down=d.xy;return true}}},mousedown:null,mouseup:function(b){var a=true;if(this.checkModifiers(b)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(b)){a=this.rightclick(b)}return a},rightclick:function(b){if(this.passesTolerance(b)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback("dblrightclick",[b]);return !this.stopDouble}else{var a=this["double"]?OpenLayers.Util.extend({},b):this.callback("rightclick",[b]);var c=OpenLayers.Function.bind(this.delayedRightCall,this,a);this.rightclickTimerId=window.setTimeout(c,this.delay)}}return !this.stopSingle},delayedRightCall:function(a){this.rightclickTimerId=null;if(a){this.callback("rightclick",[a])}return !this.stopSingle},dblclick:function(a){if(this.passesTolerance(a)){if(this["double"]){this.callback("dblclick",[a])}this.clearTimer()}return !this.stopDouble},click:function(b){if(this.passesTolerance(b)){if(this.timerId!=null){this.clearTimer()}else{var a=this.single?OpenLayers.Util.extend({},b):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,a),this.delay)}}return !this.stopSingle},passesTolerance:function(b){var c=true;if(this.pixelTolerance!=null&&this.down){var a=Math.sqrt(Math.pow(this.down.x-b.xy.x,2)+Math.pow(this.down.y-b.xy.y,2));if(a>this.pixelTolerance){c=false}}return c},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null}if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null}},delayedCall:function(a){this.timerId=null;if(a){this.callback("click",[a])}},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;a=true}return a},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,documentDrag:false,documentEvents:null,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments)},down:function(a){},move:function(a){},up:function(a){},out:function(a){},mousedown:function(b){var a=true;this.dragging=false;if(this.checkModifiers(b)&&OpenLayers.Event.isLeftClick(b)){this.started=true;this.start=b.xy;this.last=b.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(b);this.callback("down",[b.xy]);OpenLayers.Event.stop(b);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:OpenLayers.Function.True}document.onselectstart=OpenLayers.Function.False;a=!this.stopDown}else{this.started=false;this.start=null;this.last=null}return a},mousemove:function(a){if(this.started&&!this.timeoutId&&(a.xy.x!=this.last.x||a.xy.y!=this.last.y)){if(this.documentDrag===true&&this.documentEvents){if(a.element===document){this.adjustXY(a);this.setEvent(a)}else{this.destroyDocumentEvents()}}if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval)}this.dragging=true;this.move(a);this.callback("move",[a.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=OpenLayers.Function.False}this.last=this.evt.xy}return true},removeTimeout:function(){this.timeoutId=null},mouseup:function(b){if(this.started){if(this.documentDrag===true&&this.documentEvents){this.adjustXY(b);this.destroyDocumentEvents()}var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(b);this.callback("up",[b.xy]);if(a){this.callback("done",[b.xy])}document.onselectstart=this.oldOnselectstart}return true},mouseout:function(b){if(this.started&&OpenLayers.Util.mouseLeft(b,this.map.div)){if(this.documentDrag===true){this.documentEvents=new OpenLayers.Events(this,document,null,null,{includeXY:true});this.documentEvents.on({mousemove:this.mousemove,mouseup:this.mouseup});OpenLayers.Element.addClass(document.body,"olDragDown")}else{var a=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(b);this.callback("out",[]);if(a){this.callback("done",[b.xy])}if(document.onselectstart){document.onselectstart=this.oldOnselectstart}}}return true},click:function(a){return(this.start==this.last)},activate:function(){var a=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;a=true}return a},deactivate:function(){var a=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;a=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown")}return a},adjustXY:function(a){var b=OpenLayers.Util.pagePosition(this.map.div);a.xy.x-=b[0];a.xy.y-=b[1]},destroyDocumentEvents:function(){OpenLayers.Element.removeClass(document.body,"olDragDown");this.documentEvents.destroy();this.documentEvents=null},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,interval:0,delta:0,cumulative:true,initialize:function(c,b,a){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this)},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null},onWheelEvent:function(k){if(!this.map||!this.checkModifiers(k)){return}var g=false;var m=false;var f=false;var b=OpenLayers.Event.element(k);while((b!=null)&&!f&&!g){if(!g){try{if(b.currentStyle){c=b.currentStyle.overflow}else{var a=document.defaultView.getComputedStyle(b,null);var c=a.getPropertyValue("overflow")}g=(c&&(c=="auto")||(c=="scroll"))}catch(d){}}if(!m){for(var h=0,j=this.map.layers.length;h=0){this.initResolutions();break}}}},onMapResize:function(){},redraw:function(){var b=false;if(this.map){this.inRange=this.calculateInRange();var c=this.getExtent();if(c&&this.inRange&&this.visibility){var a=true;this.moveTo(c,a,false);this.events.triggerEvent("moveend",{zoomChanged:a});b=true}}return b},moveTo:function(b,a,c){var d=this.visibility;if(!this.isBaseLayer){d=d&&this.inRange}this.display(d)},setMap:function(b){if(this.map==null){this.map=b;this.maxExtent=this.maxExtent||this.map.maxExtent;this.minExtent=this.minExtent||this.map.minExtent;this.projection=this.projection||this.map.projection;if(typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)}this.units=this.projection.getUnits()||this.units||this.map.units;this.initResolutions();if(!this.isBaseLayer){this.inRange=this.calculateInRange();var a=((this.visibility)&&(this.inRange));this.div.style.display=a?"":"none"}this.setTileSize()}},afterAdd:function(){},removeMap:function(a){},getImageSize:function(a){return(this.imageSize||this.tileSize)},setTileSize:function(a){var b=(a)?a:((this.tileSize)?this.tileSize:this.map.getTileSize());this.tileSize=b;if(this.gutter){this.imageOffset=new OpenLayers.Pixel(-this.gutter,-this.gutter);this.imageSize=new OpenLayers.Size(b.w+(2*this.gutter),b.h+(2*this.gutter))}},getVisibility:function(){return this.visibility},setVisibility:function(a){if(a!=this.visibility){this.visibility=a;this.display(a);this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"visibility"})}this.events.triggerEvent("visibilitychanged")}},display:function(a){if(a!=(this.div.style.display!="none")){this.div.style.display=(a&&this.calculateInRange())?"block":"none"}},calculateInRange:function(){var b=false;if(this.alwaysInRange){b=true}else{if(this.map){var a=this.map.getResolution();b=((a>=this.minResolution)&&(a<=this.maxResolution))}}return b},setIsBaseLayer:function(a){if(a!=this.isBaseLayer){this.isBaseLayer=a;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this})}}},initResolutions:function(){var e,a;var f={},d=true;for(e=0,a=this.RESOLUTION_PROPERTIES.length;e=e){d=j;k=f}if(j<=e){b=j;c=f;break}}var h=d-b;if(h>0){n=k+((d-e)/h)}else{n=k}}else{var l;var m=Number.POSITIVE_INFINITY;for(var f=0,g=this.resolutions.length;fm){break}m=l}else{if(this.resolutions[f]d){this.zoomBox.style.width=Math.max(1,c-e.xOffset)+"px"}if(f.y>b){this.zoomBox.style.height=Math.max(1,a-e.yOffset)+"px"}}},endBox:function(b){var a;if(Math.abs(this.dragHandler.start.x-b.x)>5||Math.abs(this.dragHandler.start.y-b.y)>5){var g=this.dragHandler.start;var f=Math.min(g.y,b.y);var c=Math.max(g.y,b.y);var e=Math.min(g.x,b.x);var d=Math.max(g.x,b.x);a=new OpenLayers.Bounds(e,c,d,f)}else{a=this.dragHandler.start.clone()}this.removeBox();this.callback("done",[a])},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox")},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true}else{return false}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true}else{return false}},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var a=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var c=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var b=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:a,yOffset:c,newBoxModel:b}}return this.boxCharacteristics},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Layer.HTTPRequest=OpenLayers.Class(OpenLayers.Layer,{URL_HASH_FACTOR:(Math.sqrt(5)-1)/2,url:null,params:null,reproject:false,initialize:function(d,c,e,b){var a=arguments;a=[d,b];OpenLayers.Layer.prototype.initialize.apply(this,a);this.url=c;this.params=OpenLayers.Util.extend({},e)},destroy:function(){this.url=null;this.params=null;OpenLayers.Layer.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.HTTPRequest(this.name,this.url,this.params,this.getOptions())}a=OpenLayers.Layer.prototype.clone.apply(this,[a]);return a},setUrl:function(a){this.url=a},mergeNewParams:function(b){this.params=OpenLayers.Util.extend(this.params,b);var a=this.redraw();if(this.map!=null){this.map.events.triggerEvent("changelayer",{layer:this,property:"params"})}return a},redraw:function(a){if(a){return this.mergeNewParams({_olSalt:Math.random()})}else{return OpenLayers.Layer.prototype.redraw.apply(this,[])}},selectUrl:function(e,d){var c=1;for(var b=0,a=e.length;b0){this.removeMarker(this.markers[0])}}},drawMarker:function(a){var b=this.map.getLayerPxFromLonLat(a.lonlat);if(b==null){a.display(false)}else{if(!a.isDrawn()){var c=a.draw(b);this.div.appendChild(c)}else{if(a.icon){a.icon.moveTo(b)}}}},getDataExtent:function(){var b=null;if(this.markers&&(this.markers.length>0)){var b=new OpenLayers.Bounds();for(var d=0,a=this.markers.length;d0){c.push(",")}j=f[e].geometry;h=j.CLASS_NAME.split(".")[2].toLowerCase();if(!this.extract[h]){return null}if(this.internalProjection&&this.externalProjection){j=j.clone();j.transform(this.internalProjection,this.externalProjection)}d=this.extract[h].apply(this,[j]);c.push(h.toUpperCase()+"("+d+")")}if(b){c.push(")")}return c.join("")},extract:{point:function(a){return a.x+" "+a.y},multipoint:function(c){var d=[];for(var b=0,a=c.components.length;b=i.bottom-j*this.buffer)||t=0)&&(c=0)){f=this.grid[j][c]}if((f!=null)&&(!f.queued)){b.unshift(f);f.queued=true;l=0;g=j;a=c}else{k=(k+1)%4;l++}}for(var d=0,e=b.length;d-this.tileSize.w*(b-1)){this.shiftColumn(true)}else{if(d.x<-this.tileSize.w*b){this.shiftColumn(false)}else{if(d.y>-this.tileSize.h*(b-1)){this.shiftRow(true)}else{if(d.y<-this.tileSize.h*b){this.shiftRow(false)}else{break}}}}}},shiftRow:function(n){var c=(n)?0:(this.grid.length-1);var b=this.grid;var f=b[c];var e=this.map.getResolution();var h=(n)?-this.tileSize.h:this.tileSize.h;var g=e*-h;var m=(n)?b.pop():b.shift();for(var j=0,l=f.length;je){var f=this.grid.pop();for(var b=0,a=f.length;bc){for(var b=0,a=this.grid.length;b=0&&E<=1&&C>=0&&C<=1){if(!s){f=true}else{var h=a.x1+(E*o);var g=a.y1+(E*w);f=new OpenLayers.Geometry.Point(h,g)}}}if(z){var r;if(f){if(s){var n=[a,H];var A,h,g;outer:for(var v=0;v<2;++v){A=n[v];for(var u=1;u<3;++u){h=A["x"+u];g=A["y"+u];r=Math.sqrt(Math.pow(h-f.x,2)+Math.pow(g-f.y,2));if(r=1){g=a;e=f}else{g=b+h*m;e=i+h*l}}return{distance:Math.sqrt(Math.pow(g-c,2)+Math.pow(e-j,2)),x:g,y:e}};OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,serverResolutions:null,zoomOffset:0,initialize:function(d,c,b){var a=[];a.push(d,c,{},b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a)},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.TMS(this.name,this.url,this.getOptions())}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},getURL:function(d){d=this.adjustBounds(d);var c=this.map.getResolution();var a=Math.round((d.left-this.tileOrigin.lon)/(c*this.tileSize.w));var g=Math.round((d.bottom-this.tileOrigin.lat)/(c*this.tileSize.h));var f=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,c):this.map.getZoom()+this.zoomOffset;var e=this.serviceVersion+"/"+this.layername+"/"+f+"/"+a+"/"+g+"."+this.type;var b=this.url;if(b instanceof Array){b=this.selectUrl(e,b)}return b+e},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},setMap:function(a){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom)}},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.Grid,{DEFAULT_PARAMS:{service:"WMS",version:"1.1.1",request:"GetMap",styles:"",exceptions:"application/vnd.ogc.se_inimage",format:"image/jpeg"},reproject:false,isBaseLayer:true,encodeBBOX:false,noMagic:false,yx:{"EPSG:4326":true},initialize:function(d,c,e,b){var a=[];e=OpenLayers.Util.upperCaseObject(e);if(parseFloat(e.VERSION)>=1.3&&!e.EXCEPTIONS){e.EXCEPTIONS="INIMAGE"}a.push(d,c,e,b);OpenLayers.Layer.Grid.prototype.initialize.apply(this,a);OpenLayers.Util.applyDefaults(this.params,OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS));if(!this.noMagic&&this.params.TRANSPARENT&&this.params.TRANSPARENT.toString().toLowerCase()=="true"){if((b==null)||(!b.isBaseLayer)){this.isBaseLayer=false}if(this.params.FORMAT=="image/jpeg"){this.params.FORMAT=OpenLayers.Util.alphaHack()?"image/gif":"image/png"}}},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments)},clone:function(a){if(a==null){a=new OpenLayers.Layer.WMS(this.name,this.url,this.params,this.getOptions())}a=OpenLayers.Layer.Grid.prototype.clone.apply(this,[a]);return a},reverseAxisOrder:function(){return(parseFloat(this.params.VERSION)>=1.3&&!!this.yx[this.map.getProjectionObject().getCode()])},getURL:function(c){c=this.adjustBounds(c);var d=this.getImageSize();var e={};var b=this.reverseAxisOrder();e.BBOX=this.encodeBBOX?c.toBBOX(null,b):c.toArray(b);e.WIDTH=d.w;e.HEIGHT=d.h;var a=this.getFullRequestString(e);return a},addTile:function(b,a){return new OpenLayers.Tile.Image(this,a,b,null,this.tileSize)},mergeNewParams:function(c){var b=OpenLayers.Util.upperCaseObject(c);var a=[b];return OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,a)},getFullRequestString:function(d,b){var a=this.map.getProjection();var c=(a=="none")?null:a;if(parseFloat(this.params.VERSION)>=1.3){this.params.CRS=c}else{this.params.SRS=c}return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,arguments)},CLASS_NAME:"OpenLayers.Layer.WMS"});OpenLayers.Geometry.Collection=OpenLayers.Class(OpenLayers.Geometry,{components:null,componentTypes:null,initialize:function(a){OpenLayers.Geometry.prototype.initialize.apply(this,arguments);this.components=[];if(a!=null){this.addComponents(a)}},destroy:function(){this.components.length=0;this.components=null;OpenLayers.Geometry.prototype.destroy.apply(this,arguments)},clone:function(){var geometry=eval("new "+this.CLASS_NAME+"()");for(var i=0,len=this.components.length;i0){this.setBounds(this.components[0].getBounds());for(var b=1,a=this.components.length;b-1)){if(a!=null&&(a=0;--a){this.removeComponent(b[a])}},removeComponent:function(a){OpenLayers.Util.removeItem(this.components,a);this.clearBounds()},getLength:function(){var c=0;for(var b=0,a=this.components.length;b0)?e:h;c.push(f)}l=b.length;if(d===0){for(var k=0;k1)){for(var b=1,a=this.components.length;b1)){var h,g;for(var d=1,a=e.components.length;d2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments)}},intersects:function(m){var c=false;var l=m.CLASS_NAME;if(l=="OpenLayers.Geometry.LineString"||l=="OpenLayers.Geometry.LinearRing"||l=="OpenLayers.Geometry.Point"){var p=this.getSortedSegments();var n;if(l=="OpenLayers.Geometry.Point"){n=[{x1:m.x,y1:m.y,x2:m.x,y2:m.y}]}else{n=m.getSortedSegments()}var s,g,e,a,r,q,d,b;outer:for(var h=0,k=p.length;he){break}if(q.x2Math.max(a,r)){continue}if(Math.max(d,b)0){var p=r.x10){a.unshift(r,1);Array.prototype.splice.apply(c,a);r+=a.length-2}if(d){for(var q=0,u=h.points.length;q0&&s.length>0){s.push(f.clone());m.push(new OpenLayers.Geometry.LineString(s))}}else{n=x.splitWith(this,b)}if(c&&c.length>1){e=true}else{c=[]}if(m&&m.length>1){l=true}else{m=[]}if(e||l){if(d){n=[m,c]}else{n=c}}return n},splitWith:function(b,a){return b.split(this,a)},getVertices:function(a){var b;if(a===true){b=[this.components[0],this.components[this.components.length-1]]}else{if(a===false){b=this.components.slice(1,this.components.length-1)}else{b=this.components.slice()}}return b},distanceTo:function(h,g){var k=!(g&&g.edge===false);var B=k&&g&&g.details;var q,e={};var t=Number.POSITIVE_INFINITY;if(h instanceof OpenLayers.Geometry.Point){var r=this.getSortedSegments();var p=h.x;var o=h.y;var z;for(var v=0,w=r.length;vp&&((o>z.y1&&oz.y2))){break}}}if(B){e={distance:e.distance,x0:e.x,y0:e.y,x1:p,y1:o}}else{e=e.distance}}else{if(h instanceof OpenLayers.Geometry.LineString){var d=this.getSortedSegments();var c=h.getSortedSegments();var b,a,n,A,f;var m=c.length;var l={point:true};outer:for(var v=0,w=d.length;v4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var b=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[b])}},move:function(b,d){for(var c=0,a=this.components.length;c2)){var h=0;var g=0;for(var e=0;e2)){var f=0;for(var e=0,d=this.components.length;e2){var h,g;for(var e=0;e=q&&k<=o)||q>=o&&(k<=q&&k>=o)){h=-1;break}}continue}e=s(r(j,q,d,o,b),l);if(e==k){if(d=d&&j<=b)||d>b&&(j<=d&&j>=b)){h=-1;break}}if(e<=k){continue}if(q!=o&&(eMath.max(q,o))){continue}if(d=d&&jb&&(j=b)){++h}}var p=(h==-1)?1:!!(h&1);return p},intersects:function(d){var b=false;if(d.CLASS_NAME=="OpenLayers.Geometry.Point"){b=this.containsPoint(d)}else{if(d.CLASS_NAME=="OpenLayers.Geometry.LineString"){b=d.intersects(this)}else{if(d.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){b=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[d])}else{for(var c=0,a=d.components.length;c<\/script>");for(var c=0;c<\/script>")}}})();(function(){var c={};var b=function(i,h,g,e,f){if(!d(i,h,g)){throw"Method "+g+" of object "+h+" is not supported by API "+i+". Are you missing a script tag?"}return c[i][h][g].apply(e,f)};var d=function(g,f,e){if(typeof(c[g])=="undefined"){throw"API "+g+" not loaded. Are you missing a script tag?"}if(typeof(c[g][f])=="undefined"){throw"Object definition "+f+" in API "+g+" not loaded. Are you missing a script tag?"}return typeof(c[g][f][e])=="function"};var a=window.mxn={register:function(f,e){if(!c.hasOwnProperty(f)){c[f]={}}a.util.merge(c[f],e)},addProxyMethods:function(g,k,f){for(var e=0;e0){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;i0){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(latlon_max){lon_max=lon}if(lonlat_max){lat_max=lat}if(latlon_max){lon_max=lon}if(lon0){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)lon_max){lon_max=(lon+lonConv)}if((lon-lonConv)=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"+item.title+"

"+item.description+"

";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;ff[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;mthis.markers[m].getAttribute(field)){min=this.markers[m].getAttribute(field)}if(!max||maxthis.polylines[p].getAttribute(field)){min=this.polylines[p].getAttribute(field)}if(!max||max=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=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=[];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=[];for(var i=0;i=e){return null}else{d=((d%e)+e)%e;var i=k+"/"+d+"/"+l+"."+this.type;var f=this.url;if(f instanceof Array){f=this.selectUrl(i,f)}return f+i}},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(h){var g=this.map.getResolution();var d=Math.round((h.left-this.maxExtent.left)/(g*this.tileSize.w));var l=Math.round((this.maxExtent.top-h.top)/(g*this.tileSize.h));var k=this.map.getZoom();var e=Math.pow(2,k);if(l<0||l>=e){return null}else{d=((d%e)+e)%e;var i=k+"/"+d+"/"+l+"."+this.type;var f=this.url;if(f instanceof Array){f=this.selectUrl(i,f)}return f+i}},displayOutsideMaxExtent:true});this.maps[b].addLayer(this.layers.osmmapnik);this.maps[b].addLayer(this.layers.osm)},applyOptions:function(){},resizeTo:function(b,a){this.currentElement.style.width=b;this.currentElement.style.height=a;this.maps[this.api].updateSize()},addControls:function(a){var c=this.maps[this.api];for(var b=c.controls.length;b>1;b--){c.controls[b-1].deactivate();c.removeControl(c.controls[b-1])}if(a.zoom=="large"){c.addControl(new OpenLayers.Control.PanZoomBar())}else{if(a.zoom=="small"){c.addControl(new OpenLayers.Control.ZoomPanel());if(a.pan){c.addControl(new OpenLayers.Control.PanPanel())}}else{if(a.pan){c.addControl(new OpenLayers.Control.PanPanel())}}}if(a.overview){c.addControl(new OpenLayers.Control.OverviewMap())}if(a.map_type){c.addControl(new OpenLayers.Control.LayerSwitcher())}},addSmallControls:function(){var a=this.maps[this.api];this.addControlsArgs.pan=false;this.addControlsArgs.scale=false;this.addControlsArgs.zoom="small";a.addControl(new OpenLayers.Control.ZoomBox());a.addControl(new OpenLayers.Control.LayerSwitcher({ascending:false}))},addLargeControls:function(){var a=this.maps[this.api];a.addControl(new OpenLayers.Control.PanZoomBar());this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var a=this.maps[this.api];a.addControl(new OpenLayers.Control.LayerSwitcher({ascending:false}));this.addControlsArgs.map_type=true},setCenterAndZoom:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.setCenter(a.toProprietary(this.api),b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);if(!this.layers.markers){this.layers.markers=new OpenLayers.Layer.Markers("markers");d.addLayer(this.layers.markers)}this.layers.markers.addMarker(c);return c},removeMarker:function(a){var c=this.maps[this.api];var b=a.toProprietary(this.api);this.layers.markers.removeMarker(b);b.destroy()},removeAllMarkers:function(){var a=this.maps[this.api]},declutterMarkers:function(a){var b=this.maps[this.api]},addPolyline:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);if(!this.layers.polylines){this.layers.polylines=new OpenLayers.Layer.Vector("polylines");d.addLayer(this.layers.polylines)}b.setChild(c);this.layers.polylines.addFeatures([c]);return c},removePolyline:function(a){var c=this.maps[this.api];var b=a.toProprietary(this.api);this.layers.polylines.removeFeatures([b])},removeAllPolylines:function(){var c=[];for(var a=0,b=this.polylines.length;ad.lon){a.lon-=360}var b=new OpenLayers.Bounds();b.extend(new mxn.LatLonPoint(a.lat,a.lon).toProprietary(this.api));b.extend(new mxn.LatLonPoint(d.lat,d.lon).toProprietary(this.api));e.zoomToExtent(b)},addImageOverlay:function(c,a,e,i,f,g,d,h){var b=this.maps[this.api]},setImagePosition:function(e,b){var d=this.maps[this.api];var c;var a},addOverlay:function(a,b){var c=this.maps[this.api]},addTileLayer:function(f,a,b,d,e){var c=this.maps[this.api]},toggleTileLayer:function(b){var a=this.maps[this.api]},getPixelRatio:function(){var a=this.maps[this.api]},mousePosition:function(a){var b=this.maps[this.api]}},LatLonPoint:{toProprietary:function(){var b=this.lon*20037508.34/180;var a=Math.log(Math.tan((90+this.lat)*Math.PI/360))/(Math.PI/180);a=a*20037508.34/180;return new OpenLayers.LonLat(b,a)},fromProprietary:function(a){var c=(a.lon/20037508.34)*180;var b=(a.lat/20037508.34)*180;b=180/Math.PI*(2*Math.atan(Math.exp(b*Math.PI/180))-Math.PI/2);this.lon=c;this.lat=b}},Marker:{toProprietary:function(){var e,d,f;if(this.iconSize){e=new OpenLayers.Size(this.iconSize[0],this.iconSize[1])}else{e=new OpenLayers.Size(21,25)}if(this.iconAnchor){d=new OpenLayers.Pixel(this.iconAnchor[0],this.iconAnchor[1])}else{d=new OpenLayers.Pixel(-(e.w/2),-e.h)}if(this.iconUrl){f=new OpenLayers.Icon(this.iconUrl,e,d)}else{f=new OpenLayers.Icon("http://openlayers.org/dev/img/marker-gold.png",e,d)}var b=new OpenLayers.Marker(this.location.toProprietary("openlayers"),f);if(this.infoBubble){var a=new OpenLayers.Popup(null,this.location.toProprietary("openlayers"),new OpenLayers.Size(100,100),this.infoBubble,true);a.autoSize=true;var c=this.map;if(this.hover){b.events.register("mouseover",b,function(h){c.addPopup(a);a.show()});b.events.register("mouseout",b,function(h){a.hide();c.removePopup(a)})}else{var g=false;b.events.register("mousedown",b,function(h){if(g){a.hide();c.removePopup(a);g=false}else{c.addPopup(a);a.show();g=true}})}}if(this.hoverIconUrl){}if(this.infoDiv){}return b},openBubble:function(){},hide:function(){this.proprietary_marker.setOptions({visible:false})},show:function(){this.proprietary_marker.setOptions({visible:true})},update:function(){}},Polyline:{toProprietary:function(){var f;var d=[];var a;var c={strokeColor:this.color||"#000000",strokeOpacity:this.opacity||1,strokeWidth:this.width||1,fillColor:this.fillColor||"#000000",fillOpacity:this.getAttribute("fillOpacity")||0.2};for(var b=0,e=this.points.length;be){e=k}if(am){m=a}pt=new mxn.LatLonPoint(k,a);mkr=new mxn.Marker(pt);mkr.setIcon(c.user["profile_image_url"],[24,24]);mkr.setInfoBubble(''+c.user["screen_name"]+" "+c.html+'
'+c.created_at+"");b.addMarker(mkr)}bounds=new mxn.BoundingBox(d,l,e,m);b.setBounds(bounds)}; \ No newline at end of file diff --git a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php index 777fd9c5d3..8a730113e6 100644 --- a/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalytics/PiwikAnalyticsPlugin.php @@ -78,20 +78,28 @@ class PiwikAnalyticsPlugin extends Plugin */ function onEndShowScripts($action) { - $piwikCode1 = <<piwikroot}" : "http://{$this->piwikroot}"); -document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); -ENDOFPIWIK; - $piwikCode2 = << created in a document.write + // meant that the browser had no way to preload it, ensuring that its + // loading will be synchronous, blocking further page rendering. + // + // User-agents understand protocol-relative links, so instead of the + // URL produced in JS we can just give a universal one. Since it's + // sitting there in the DOM ready to go, the browser can preload the + // file for us and we're less likely to have to wait for it. + $piwikUrl = '//' . $this->piwikroot . 'piwik.js'; + $piwikCode = <<piwikroot}" : "http://{$this->piwikroot}"); var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$this->piwikId}); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} ENDOFPIWIK; - $action->inlineScript($piwikCode1); - $action->inlineScript($piwikCode2); + // Don't use $action->script() here; it'll try to preface the URL. + $action->element('script', array('type' => 'text/javascript', 'src' => $piwikUrl), ' '); + $action->inlineScript($piwikCode); return true; } diff --git a/plugins/TwitterBridge/twitterqueuehandler.php b/plugins/TwitterBridge/twitterqueuehandler.php index b5a624e83d..644ce17871 100644 --- a/plugins/TwitterBridge/twitterqueuehandler.php +++ b/plugins/TwitterBridge/twitterqueuehandler.php @@ -30,6 +30,7 @@ class TwitterQueueHandler extends QueueHandler function handle($notice) { - return broadcast_twitter($notice); + $ok = broadcast_twitter($notice); + return $ok || common_config('twitter', 'ignore_errors'); } }